CTRPF-AR-CHEAT-CODES/ActionReplayCodeTypes.txt

200 lines
7.6 KiB
Plaintext
Raw Normal View History

###############################
2018-01-04 19:59:21 +00:00
# Action Replay #
# Code Types supported by #
# CTRPluginFramework #
###############################
Those codes are all supported by CTRPF Beta 0.4.1 and higher (check in Tools).
2018-01-04 19:59:21 +00:00
==============
INFO
==============
You have access to:
- 2 offset registers (not persistent)
- 2 data registers (not persistent)
- 2 storage registers (persistent)
persistent = register's value is kept between code execution
not persistent = register's value is set to default value when the code starts
Default value of offset (#1 and #2), data (#1 and #2) and storage (#1 and #2) registers is zero.
The active offset and data register is set to #1 when the code starts.
When a register index (#1 or #2) is not precised in the description, the active register is used.
==============
CODE TYPES
==============
Memory Writes:
---------------
0XXXXXXX YYYYYYYY 32bit write to [XXXXXXX + offset]
1XXXXXXX 0000YYYY 16bit write to [XXXXXXX + offset]
2XXXXXXX 000000YY 8bit write to [XXXXXXX + offset]
Conditional 32bit codes:
-------------------------
3XXXXXXX YYYYYYYY Greater Than (YYYYYYYY > [XXXXXXX + offset])
4XXXXXXX YYYYYYYY Less Than (YYYYYYYY < [XXXXXXX + offset])
5XXXXXXX YYYYYYYY Equal To (YYYYYYYY == [XXXXXXX + offset])
6XXXXXXX YYYYYYYY Not Equal To (YYYYYYYY != [XXXXXXX + offset])
Conditional 16bit codes:
-------------------------
7XXXXXXX ZZZZYYYY Greater Than (YYYY > [XXXXXXX + offset] & ~ZZZZ)
8XXXXXXX ZZZZYYYY Less Than (YYYY < [XXXXXXX + offset] & ~ZZZZ)
9XXXXXXX ZZZZYYYY Equal To (YYYY == [XXXXXXX + offset] & ~ZZZZ)
AXXXXXXX ZZZZYYYY Not Equal To (YYYY != [XXXXXXX + offset] & ~ZZZZ)
Offset Codes:
--------------
BXXXXXXX 00000000 offset = *(XXXXXXX + offset)
D3000000 XXXXXXXX offset#1 = XXXXXXXX
D3000001 XXXXXXXX - offset#2 = XXXXXXXX
2018-01-04 19:59:21 +00:00
DC000000 XXXXXXXX Adds an value to the current offset
Loop Codes:
------------
CX000000 YYYYYYYY Sets the repeat value to: YYYYYYYY (immediate value) if X == 0, data #1 if X == 1 or data #2 if X == 2
D0000000 00000000 Terminator code
2018-04-11 18:34:50 +00:00
D0000000 00000001 Exit from a loop, isn't a terminator code anymore, it doesn't end blocks
D1000000 00000000 Loop execute
D2000000 00000000 - Full terminator: end all conditional blocks, clear active offset and active data register
D2000000 00000001 - Exit from code directly, isn't a terminator code anymore, it doesn't end block or clear register
2018-01-04 19:59:21 +00:00
Data Register Codes:
---------------------
D4000000 XXXXXXXX Adds XXXXXXXX to the data register
2018-01-11 00:57:43 +00:00
D4000001 XXXXXXXX data#1 = data#1 + data#2 + XXXXXXXX
D4000002 XXXXXXXX - data#2 = data#2 + data#1 + XXXXXXXX
D5000000 XXXXXXXX data#1 = XXXXXXXX
D5000001 XXXXXXXX - data#2 = XXXXXXXX
2018-01-04 19:59:21 +00:00
D6000000 XXXXXXXX (32bit) [XXXXXXXX+offset] = data ; offset += 4
D7000000 XXXXXXXX (16bit) [XXXXXXXX+offset] = data & 0xffff ; offset += 2
D8000000 XXXXXXXX (8bit) [XXXXXXXX+offset] = data & 0xff ; offset++
D9000000 XXXXXXXX (32bit) sets data to [XXXXXXXX+offset]
DA000000 XXXXXXXX (16bit) sets data to [XXXXXXXX+offset] & 0xFFFF
DB000000 XXXXXXXX (8bit) sets data to [XXXXXXXX+offset] & 0xFF
Input Codes:
----------------
DD000000 XXXXXXXX if KEYPAD has value XXXXXXXX execute next block (see SPECIAL KEY CODE for values)
2018-01-11 00:57:43 +00:00
DE000000 AAAABBBB - if touchpos X is between AAAA >= X >= BBBB execute next block
DE000001 AAAABBBB - if touchpos Y is between AAAA >= Y >= BBBB execute next block
2018-01-04 19:59:21 +00:00
Registers operations:
-----------------------
2018-01-11 00:57:43 +00:00
DFFFFFFF 00000000 - Conditional codes: value of address is compared to YYYY (immediate value)
DFFFFFFF 00000001 - Conditional codes: value of address is compared to active data register
DFFFFFFF 00000002 - Conditional codes: active data register is compared to YYYY (immediate value)
DFFFFFFE 000000YX - Set the active data register vfp state
Y:
- 0: no conversion
- 1: convert from integer to float if X == 1, from float to integer if X == 0
X:
- 0: Disable the vfp state
- 1: Enable the vfp state
2018-01-04 19:59:21 +00:00
DF00XXXX YYYYZZZZ - Operations:
-------------------------------
DF000000 00000000 - Set offset register #1 as active (default)
DF000000 00000001 - Set offset register #2 as active
DF000001 00000000 - Set data register #1 as active (default)
DF000001 00000001 - Set data register #2 as active
DF000000 00010000 - Copy offset #1 to offset #2
DF000000 00010001 - Copy offset #2 to offset #1
DF000001 00010000 - Copy data #1 to data #2
DF000001 00010001 - Copy data #2 to data #1
DF000002 00010000 - Copy storage #1 to data #1
DF000002 00010001 - Copy storage #2 to data #2
DF000000 00020000 - Copy offset #1 to data #1
DF000000 00020001 - Copy offset #2 to data #2
DF000001 00020000 - Copy data #1 to offset #1
DF000001 00020001 - Copy data #2 to offset #2
DF000002 00020000 - Copy data #1 to storage #1
DF000002 00020001 - Copy data #2 to storage #2
Arithmetic Codes:
2018-01-04 19:59:21 +00:00
---------------
2018-04-11 18:34:50 +00:00
F0000001 0000000X - Toggle float mode for F1, F2, F3, F4, F5 (X: 0 to disable, 1 to enable)
2018-01-04 19:59:21 +00:00
F1XXXXXX YYYYYYYY - *(XXXXXX + offset) += YYYYYYYY
F2XXXXXX YYYYYYYY - *(XXXXXX + offset) *= YYYYYYYY
F3XXXXXX YYYYYYYY - *(XXXXXX + offset) /= YYYYYYYY
F4000000 YYYYYYYY - MUL - data *= YYYYYYYY
F5000000 YYYYYYYY - DIV - data /= YYYYYYYY
F6000000 YYYYYYYY - AND - data &= YYYYYYYY
F7000000 YYYYYYYY - OR - data |= YYYYYYYY
F8000000 YYYYYYYY - XOR - data ^= YYYYYYYY
F9000000 00000000 - NOT - data = ~data
FA000000 YYYYYYYY - Left shift - data <<= YYYYYYYY
FB000000 YYYYYYYY - Right shift - data >>= YYYYYYYY
2018-01-11 00:57:43 +00:00
Patch Code:
--------------
EXXXXXXX YYYYYYYY - Copy Y bytes (Z) to [XXXXXXX + offset]
ZZZZZZZZ ZZZZZZZZ
Copy Code:
--------------
2018-01-04 19:59:21 +00:00
FC000000 YYYYYYYY - Copy YYYYYYYY bytes from [offset#2] to [offset#1]
Hook Code:
--------------
FD0000WX YYYYYYYY - Create a hook at offset to custom code (ZZZZ), YYY is code size in bytes
ZZZZZZZZ ZZZZZZZZ
W - Manual Return (don't allow the assisted bx lr), set 1 to enable (default: 0)
X - Don't Execute Overwritten Instruction Before custom code, set 1 to enable (default: 0)
See more informations below
FD100000 YYYYYYYY - Disable a hook at address YYYYYYYY if exists
Search Code:
--------------
2018-01-11 00:57:43 +00:00
FE00XXXX YYYYYYYY - Search pattern (Z) from offset to offset + Y, XXXX is pattern size (in bytes)
ZZZZZZZZ ZZZZZZZZ Next block of code is executed if the pattern is found and offset is updated with the address
Generator Code:
-----------------
FFXXXXXX YYYYYYYY - data = random number between XXXXXX and YYYYYYYY
2018-01-04 19:59:21 +00:00
===================
SPECIAL KEYPAD CODE
===================
0x1 A
0x2 B
0x4 Select
0x8 Start
0x10 Right
0x20 Left
0x40 Up
0x80 Down
0x100 R
0x200 L
0x400 X
0x800 Y
0x4000 ZL (N3DS Only)
0x8000 ZR (N3DS Only)
0x100000 Touchpad (any position)
0x1000000 CStick-Right (N3DS Only)
0x2000000 CStick-Left (N3DS Only)
0x4000000 CStick-Up (N3DS Only)
0x8000000 CStick-Down (N3DS Only)
0x10000000 CPad-Right
0x20000000 CPad-Left
0x40000000 CPad-Up
2018-01-11 00:57:43 +00:00
0x80000000 CPad-Down
Note about the hook system:
----------------------------
- A hook can only be created if the target address isn't already hooked
- All hooks created by a code will be disabled when the code is disabled in the menu (or edited using the builtin code editor)
- With default parameters (and except for instructions which are PC dependent), the overwritten instruction is executed before executing the custom code (ZZZZ)
- A maximum of 90 enabled hooks is available in same time
- No need for a code cave, the code will be placed into CTRPF's memory (so you can do really long code)
- Without Manual Return bit enabled, LR is changed before jumping to the custom code, so you can return to the hook manager which will restore LR before returning to the game