MemReader.cs 812 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using ChocolArm64.Memory;
  2. namespace Ryujinx.Core.OsHle.Utilities
  3. {
  4. class MemReader
  5. {
  6. private AMemory Memory;
  7. public long Position { get; private set; }
  8. public MemReader(AMemory Memory, long Position)
  9. {
  10. this.Memory = Memory;
  11. this.Position = Position;
  12. }
  13. public byte ReadByte()
  14. {
  15. byte Value = Memory.ReadByte(Position);
  16. Position++;
  17. return Value;
  18. }
  19. public int ReadInt32()
  20. {
  21. int Value = Memory.ReadInt32(Position);
  22. Position += 4;
  23. return Value;
  24. }
  25. public long ReadInt64()
  26. {
  27. long Value = Memory.ReadInt64(Position);
  28. Position += 8;
  29. return Value;
  30. }
  31. }
  32. }