StructWriter.cs 565 B

12345678910111213141516171819202122232425
  1. using ChocolArm64.Memory;
  2. using System.Runtime.InteropServices;
  3. namespace Ryujinx.HLE.Utilities
  4. {
  5. class StructWriter
  6. {
  7. private MemoryManager Memory;
  8. public long Position { get; private set; }
  9. public StructWriter(MemoryManager Memory, long Position)
  10. {
  11. this.Memory = Memory;
  12. this.Position = Position;
  13. }
  14. public void Write<T>(T Value) where T : struct
  15. {
  16. MemoryHelper.Write(Memory, Position, Value);
  17. Position += Marshal.SizeOf<T>();
  18. }
  19. }
  20. }