1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-23 13:52:03 +00:00
Ryujinx/Ryujinx.HLE/Utilities/StructWriter.cs

26 lines
567 B
C#
Raw Normal View History

using ChocolArm64.Memory;
using System.Runtime.InteropServices;
namespace Ryujinx.HLE.Utilities
{
class StructWriter
{
2018-12-01 20:01:59 +00:00
private MemoryManager _memory;
public long Position { get; private set; }
2018-12-01 20:01:59 +00:00
public StructWriter(MemoryManager memory, long position)
{
2018-12-01 20:01:59 +00:00
this._memory = memory;
this.Position = position;
}
2018-12-01 20:01:59 +00:00
public void Write<T>(T value) where T : struct
{
2018-12-01 20:01:59 +00:00
MemoryHelper.Write(_memory, Position, value);
Position += Marshal.SizeOf<T>();
}
}
}