Homebrew.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using ChocolArm64.Memory;
  2. namespace Ryujinx.Core.OsHle
  3. {
  4. static class Homebrew
  5. {
  6. //http://switchbrew.org/index.php?title=Homebrew_ABI
  7. public static void WriteHbAbiData(AMemory Memory, long Position, int MainThreadHandle)
  8. {
  9. Memory.Manager.Map(Position, AMemoryMgr.PageSize, (int)MemoryType.Normal, AMemoryPerm.RW);
  10. //MainThreadHandle
  11. WriteConfigEntry(Memory, ref Position, 1, 0, MainThreadHandle);
  12. //NextLoadPath
  13. WriteConfigEntry(Memory, ref Position, 2, 0, Position + 0x200, Position + 0x400);
  14. //AppletType
  15. WriteConfigEntry(Memory, ref Position, 7);
  16. //EndOfList
  17. WriteConfigEntry(Memory, ref Position, 0);
  18. }
  19. private static void WriteConfigEntry(
  20. AMemory Memory,
  21. ref long Position,
  22. int Key,
  23. int Flags = 0,
  24. long Value0 = 0,
  25. long Value1 = 0)
  26. {
  27. Memory.WriteInt32(Position + 0x00, Key);
  28. Memory.WriteInt32(Position + 0x04, Flags);
  29. Memory.WriteInt64(Position + 0x08, Value0);
  30. Memory.WriteInt64(Position + 0x10, Value1);
  31. Position += 0x18;
  32. }
  33. }
  34. }