mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-23 15:02:02 +00:00
25 lines
567 B
C#
25 lines
567 B
C#
using ChocolArm64.Memory;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Ryujinx.HLE.Utilities
|
|
{
|
|
class StructWriter
|
|
{
|
|
private MemoryManager _memory;
|
|
|
|
public long Position { get; private set; }
|
|
|
|
public StructWriter(MemoryManager memory, long position)
|
|
{
|
|
this._memory = memory;
|
|
this.Position = position;
|
|
}
|
|
|
|
public void Write<T>(T value) where T : struct
|
|
{
|
|
MemoryHelper.Write(_memory, Position, value);
|
|
|
|
Position += Marshal.SizeOf<T>();
|
|
}
|
|
}
|
|
}
|