305f06eb71
* Make all title id instances unsigned * Replace address and size with ulong instead of signed types Long overdue change. Also change some logics here and there to optimize with the new memory manager. * Address Ac_K's comments * Remove uneeded cast all around * Fixes some others misalignment
31 lines
692 B
C#
31 lines
692 B
C#
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;
|
|
}
|
|
}
|
|
}
|