0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-24 02:45:50 +00:00
ryujinx-fork/Ryujinx.Memory/WritableRegion.cs

30 lines
635 B
C#
Raw Normal View History

using System;
namespace Ryujinx.Memory
{
public sealed class WritableRegion : IDisposable
{
private readonly IVirtualMemoryManager _mm;
private readonly ulong _va;
private bool NeedsWriteback => _mm != null;
public Memory<byte> Memory { get; }
public WritableRegion(IVirtualMemoryManager mm, ulong va, Memory<byte> memory)
{
_mm = mm;
_va = va;
Memory = memory;
}
public void Dispose()
{
if (NeedsWriteback)
{
_mm.Write(_va, Memory.Span);
}
}
}
}