These are not available in official dmnt, do not use these code to ensure wide compatibility. Using these extension will make cheat not compatible with system that did not have my dmnt fork installed.
- M: Memory region to write to (4 = non). On official release this will default to Main NSO
On official release 5T0R2SAA AAAAAAAA
and 5TMR3SAA AAAAAAAA
will be same as 5T0R10AA AAAAAAAA
setting bit mask 0x08000000 will have no effect. Cheat code will be active when button is held on official release
Floating point maths are not supported on official release, result will be 0.
The following provides documentation of the instruction format for the virtual machine used to manage cheat codes.
Typically, instruction type is encoded in the upper nybble of the first instruction u32.
Code type 0x0 allows writing a static value to a memory address.
0TMR00AA AAAAAAAA VVVVVVVV (VVVVVVVV)
- T: Width of memory write (1, 2, 4, or 8 bytes).
- M: Memory region to write to (0 = Main NSO, 1 = Heap, 2 = Alias, 3 = Aslr, 4 = non).
- R: Register to use as an offset from memory region base.
- A: Immediate offset to use from memory region base.
- V: Value to write.
Code type 0x1 performs a comparison of the contents of memory to a static value.
If the condition is not met, all instructions until the appropriate End or Else conditional block terminator are skipped.
1TMC00AA AAAAAAAA VVVVVVVV (VVVVVVVV)
- T: Width of memory write (1, 2, 4, or 8 bytes).
- M: Memory region to write to (0 = Main NSO, 1 = Heap, 2 = Alias, 3 = Aslr).
- C: Condition to use, see below.
- A: Immediate offset to use from memory region base.
- V: Value to compare to.
- 1: >
- 2: >=
- 3: <
- 4: <=
- 5: ==
- 6: !=
Code type 0x2 marks the end of a conditional block (started by Code Type 0x1 or Code Type 0x8).
When an Else is executed, all instructions until the appropriate End conditional block terminator are skipped.
2X000000
- X: End type (0 = End, 1 = Else).
Code type 0x3 allows for iterating in a loop a fixed number of times.
300R0000 VVVVVVVV
- R: Register to use as loop counter.
- V: Number of iterations to loop.
310R0000
- R: Register to use as loop counter.
Code type 0x4 allows setting a register to a constant value.
400R0000 VVVVVVVV VVVVVVVV
- R: Register to use.
- V: Value to load.
Code type 0x5 allows loading a value from memory into a register, either using a fixed address or by dereferencing the destination register.
5TMR00AA AAAAAAAA
- T: Width of memory read (1, 2, 4, or 8 bytes).
- M: Memory region to write to (0 = Main NSO, 1 = Heap, 2 = Alias, 3 = Aslr).
- R: Register to load value into.
- A: Immediate offset to use from memory region base.
5T0R10AA AAAAAAAA
- T: Width of memory read (1, 2, 4, or 8 bytes).
- R: Register to load value into. (This register is also used as the base memory address).
- A: Immediate offset to use from register R.
5T0R2SAA AAAAAAAA
- T: Width of memory read (1, 2, 4, or 8 bytes).
- R: Register to load value into.
- S: Register to use as the base memory address.
- A: Immediate offset to use from register R.
5TMR3SAA AAAAAAAA
- T: Width of memory read (1, 2, 4, or 8 bytes).
- M: Memory region to write to (0 = Main NSO, 1 = Heap, 2 = Alias, 3 = Aslr).
- R: Register to load value into.
- S: Register to use as offset register.
- A: Immediate offset to use from memory region base.
Code type 0x6 allows writing a fixed value to a memory address specified by a register.
6T0RIor0 VVVVVVVV VVVVVVVV
- T: Width of memory write (1, 2, 4, or 8 bytes).
- R: Register used as base memory address.
- I: Increment register flag (0 = do not increment R, 1 = increment R by T).
- o: Offset register enable flag (0 = do not add r to address, 1 = add r to address).
- r: Register used as offset when o is 1.
- V: Value to write to memory.
Code type 0x7 allows performing arithmetic on registers.
However, it has been deprecated by Code type 0x9, and is only kept for backwards compatibility.
7T0RC000 VVVVVVVV
- T: Width of arithmetic operation (1, 2, 4, or 8 bytes).
- R: Register to apply arithmetic to.
- C: Arithmetic operation to apply, see below.
- V: Value to use for arithmetic operation.
- 0: Addition
- 1: Subtraction
- 2: Multiplication
- 3: Left Shift
- 4: Right Shift
Code type 0x8 enters or skips a conditional block based on whether a key combination is pressed.
8kkkkkkk
- k: Keypad mask to check against, see below.
Note that for multiple button combinations, the bitmasks should be ORd together.
Note: This is the direct output of hidKeysDown()
.
- 0000001: A
- 0000002: B
- 0000004: X
- 0000008: Y
- 0000010: Left Stick Pressed
- 0000020: Right Stick Pressed
- 0000040: L
- 0000080: R
- 0000100: ZL
- 0000200: ZR
- 0000400: Plus
- 0000800: Minus
- 0001000: Left
- 0002000: Up
- 0004000: Right
- 0008000: Down
- 0010000: Left Stick Left
- 0020000: Left Stick Up
- 0040000: Left Stick Right
- 0080000: Left Stick Down
- 0100000: Right Stick Left
- 0200000: Right Stick Up
- 0400000: Right Stick Right
- 0800000: Right Stick Down
- 1000000: SL
- 2000000: SR
- 8000000: when this is set button only activate code once per keydown, need to be release before the code will run again
Code type 0x9 allows performing arithmetic on registers.
9TCRS0s0
- T: Width of arithmetic operation (1, 2, 4, or 8 bytes).
- C: Arithmetic operation to apply, see below.
- R: Register to store result in.
- S: Register to use as left-hand operand.
- s: Register to use as right-hand operand.
9TCRS100 VVVVVVVV (VVVVVVVV)
- T: Width of arithmetic operation (1, 2, 4, or 8 bytes).
- C: Arithmetic operation to apply, see below.
- R: Register to store result in.
- S: Register to use as left-hand operand.
- V: Value to use as right-hand operand.
- 0: Addition
- 1: Subtraction
- 2: Multiplication
- 3: Left Shift
- 4: Right Shift
- 5: Logical And
- 6: Logical Or
- 7: Logical Not (discards right-hand operand)
- 8: Logical Xor
- 9: None/Move (discards right-hand operand)
- 10: Float Addition, Width force to 4 bytes
- 11: Float Multiplication, Width force to 4 bytes
- 12: Double Addition, Width force to 8 bytes
- 13: Double Multiplication, Width force to 8 bytes
Code type 0xA allows writing a register to memory.
ATSRIOxa (aaaaaaaa)
- T: Width of memory write (1, 2, 4, or 8 bytes).
- S: Register to write to memory.
- R: Register to use as base address.
- I: Increment register flag (0 = do not increment R, 1 = increment R by T).
- O: Offset type, see below.
- x: Register used as offset when O is 1, Memory type when O is 3, 4 or 5.
- a: Value used as offset when O is 2, 4 or 5.
- 0: No Offset
- 1: Use Offset Register
- 2: Use Fixed Offset
- 3: Memory Region + Base Register
- 4: Memory Region + Relative Address (ignore address register)
- 5: Memory Region + Relative Address + Offset Register
Code Type 0xB is currently reserved for future use.
Code Types 0xC-0xF signal to the VM to treat the upper two nybbles of the first dword as instruction type, instead of just the upper nybble.
This reserves an additional 64 opcodes for future use.
Code type 0xC0 performs a comparison of the contents of a register and another value. This code support multiple operand types, see below.
If the condition is not met, all instructions until the appropriate conditional block terminator are skipped.
C0TcSX##
C0TcS0Ma aaaaaaaa
C0TcS1Mr
C0TcS2Ra aaaaaaaa
C0TcS3Rr
C0TcS400 VVVVVVVV (VVVVVVVV)
C0TcS5X0
- T: Width of memory write (1, 2, 4, or 8 bytes).
- c: Condition to use, see below.
- S: Source Register.
- X: Operand Type, see below.
- M: Memory Type (operand types 0 and 1).
- R: Address Register (operand types 2 and 3).
- a: Relative Address (operand types 0 and 2).
- r: Offset Register (operand types 1 and 3).
- X: Other Register (operand type 5).
- V: Value to compare to (operand type 4).
- 0: Memory Base + Relative Offset
- 1: Memory Base + Offset Register
- 2: Register + Relative Offset
- 3: Register + Offset Register
- 4: Static Value
- 5: Other Register
- 1: >
- 2: >=
- 3: <
- 4: <=
- 5: ==
- 6: !=
Code type 0xC1 performs saving or restoring of registers.
C10D0Sx0
- D: Destination index.
- S: Source index.
- x: Operand Type, see below.
- 0: Restore register
- 1: Save register
- 2: Clear saved value
- 3: Clear register
Code type 0xC2 performs saving or restoring of multiple registers using a bitmask.
C2x0XXXX
- x: Operand Type, see below.
- X: 16-bit bitmask, bit i == save or restore register i.
- 0: Restore register
- 1: Save register
- 2: Clear saved value
- 3: Clear register
Code type 0xC3 reads or writes a static register with a given register.
C3000XXx
- XX: Static register index, 0x00 to 0x7F for reading or 0x80 to 0xFF for writing.
- x: Register index.
Code Type 0xF0 signals to the VM to treat the upper three nybbles of the first dword as instruction type, instead of just the upper nybble.
This reserves an additional 16 opcodes for future use.
Code type 0xFF0 pauses the current process.
FF0?????
Code type 0xFF1 resumes the current process.
FF1?????
Code type 0xFFF writes a debug log to the SD card under the folder /atmosphere/cheat_vm_logs/
.
FFFTIX##
FFFTI0Ma aaaaaaaa
FFFTI1Mr
FFFTI2Ra aaaaaaaa
FFFTI3Rr
FFFTI4X0
- T: Width of memory write (1, 2, 4, or 8 bytes).
- I: Log id.
- X: Operand Type, see below.
- M: Memory Type (operand types 0 and 1).
- R: Address Register (operand types 2 and 3).
- a: Relative Address (operand types 0 and 2).
- r: Offset Register (operand types 1 and 3).
- X: Value Register (operand type 4).
- 0: Memory Base + Relative Offset
- 1: Memory Base + Offset Register
- 2: Register + Relative Offset
- 3: Register + Offset Register
- 4: Register Value