1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-10 14:11:45 +00:00
Ryujinx/Ryujinx.Memory/WritableRegion.cs

30 lines
639 B
C#
Raw Normal View History

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