Archived
1
0
Fork 0
forked from Mirror/Ryujinx
This repository has been archived on 2024-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
jinx/Ryujinx.HLE/Utilities/StructWriter.cs

32 lines
692 B
C#
Raw Normal View History

using Ryujinx.Cpu;
using Ryujinx.Memory;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.Utilities
{
class StructWriter
{
private IVirtualMemoryManager _memory;
public ulong Position { get; private set; }
public StructWriter(IVirtualMemoryManager memory, ulong position)
{
_memory = memory;
Position = position;
}
public void Write<T>(T value) where T : struct
{
MemoryHelper.Write(_memory, Position, value);
Position += (ulong)Marshal.SizeOf<T>();
}
public void SkipBytes(ulong count)
{
Position += count;
}
}
}