CodeType.cs 4.1 KB

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