mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-11-28 03:40:50 +01:00
30 lines
618 B
C#
30 lines
618 B
C#
|
using System;
|
|||
|
|
|||
|
namespace Ryujinx.Cpu
|
|||
|
{
|
|||
|
public sealed class WritableRegion : IDisposable
|
|||
|
{
|
|||
|
private readonly MemoryManager _mm;
|
|||
|
private readonly ulong _va;
|
|||
|
|
|||
|
private bool NeedsWriteback => _mm != null;
|
|||
|
|
|||
|
public Memory<byte> Memory { get; }
|
|||
|
|
|||
|
internal WritableRegion(MemoryManager mm, ulong va, Memory<byte> memory)
|
|||
|
{
|
|||
|
_mm = mm;
|
|||
|
_va = va;
|
|||
|
Memory = memory;
|
|||
|
}
|
|||
|
|
|||
|
public void Dispose()
|
|||
|
{
|
|||
|
if (NeedsWriteback)
|
|||
|
{
|
|||
|
_mm.Write(_va, Memory.Span);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|