CodeType.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. namespace Ryujinx.HLE.HOS.Tamper
  2. {
  3. /// <summary>
  4. /// The opcodes specified for the Atmosphere Cheat VM.
  5. /// </summary>
  6. enum CodeType
  7. {
  8. /// <summary>
  9. /// Code type 0 allows writing a static value to a memory address.
  10. /// </summary>
  11. StoreConstantToAddress = 0x0,
  12. /// <summary>
  13. /// Code type 1 performs a comparison of the contents of memory to a static value.
  14. /// If the condition is not met, all instructions until the appropriate conditional block terminator
  15. /// are skipped.
  16. /// </summary>
  17. BeginMemoryConditionalBlock = 0x1,
  18. /// <summary>
  19. /// Code type 2 marks the end of a conditional block (started by Code Type 1 or Code Type 8).
  20. /// </summary>
  21. EndConditionalBlock = 0x2,
  22. /// <summary>
  23. /// Code type 3 allows for iterating in a loop a fixed number of times.
  24. /// </summary>
  25. StartEndLoop = 0x3,
  26. /// <summary>
  27. /// Code type 4 allows setting a register to a constant value.
  28. /// </summary>
  29. LoadRegisterWithContant = 0x4,
  30. /// <summary>
  31. /// Code type 5 allows loading a value from memory into a register, either using a fixed address or by
  32. /// dereferencing the destination register.
  33. /// </summary>
  34. LoadRegisterWithMemory = 0x5,
  35. /// <summary>
  36. /// Code type 6 allows writing a fixed value to a memory address specified by a register.
  37. /// </summary>
  38. StoreConstantToMemory = 0x6,
  39. /// <summary>
  40. /// Code type 7 allows performing arithmetic on registers. However, it has been deprecated by Code
  41. /// type 9, and is only kept for backwards compatibility.
  42. /// </summary>
  43. LegacyArithmetic = 0x7,
  44. /// <summary>
  45. /// Code type 8 enters or skips a conditional block based on whether a key combination is pressed.
  46. /// </summary>
  47. BeginKeypressConditionalBlock = 0x8,
  48. /// <summary>
  49. /// Code type 9 allows performing arithmetic on registers.
  50. /// </summary>
  51. Arithmetic = 0x9,
  52. /// <summary>
  53. /// Code type 10 allows writing a register to memory.
  54. /// </summary>
  55. StoreRegisterToMemory = 0xA,
  56. /// <summary>
  57. /// Code type 0xC0 performs a comparison of the contents of a register and another value.
  58. /// This code support multiple operand types, see below. If the condition is not met,
  59. /// all instructions until the appropriate conditional block terminator are skipped.
  60. /// </summary>
  61. BeginRegisterConditionalBlock = 0xC0,
  62. /// <summary>
  63. /// Code type 0xC1 performs saving or restoring of registers.
  64. /// NOTE: Registers are saved and restored to a different set of registers than the ones used
  65. /// for the other opcodes (Save Registers).
  66. /// </summary>
  67. SaveOrRestoreRegister = 0xC1,
  68. /// <summary>
  69. /// Code type 0xC2 performs saving or restoring of multiple registers using a bitmask.
  70. /// NOTE: Registers are saved and restored to a different set of registers than the ones used
  71. /// for the other opcodes (Save Registers).
  72. /// </summary>
  73. SaveOrRestoreRegisterWithMask = 0xC2,
  74. /// <summary>
  75. /// Code type 0xC3 reads or writes a static register with a given register.
  76. /// NOTE: Registers are saved and restored to a different set of registers than the ones used
  77. /// for the other opcodes (Static Registers).
  78. /// </summary>
  79. ReadOrWriteStaticRegister = 0xC3,
  80. /// <summary>
  81. /// Code type 0xFF0 pauses the current process.
  82. /// </summary>
  83. PauseProcess = 0xFF0,
  84. /// <summary>
  85. /// Code type 0xFF1 resumes the current process.
  86. /// </summary>
  87. ResumeProcess = 0xFF1,
  88. /// <summary>
  89. /// Code type 0xFFF writes a debug log.
  90. /// </summary>
  91. DebugLog = 0xFFF
  92. }
  93. }