Update ActionReplayCodeTypes.txt (#71)

Update ActionReplayCodeTypes.txt

Co-authored-by: Journey <timtag1190@gmail.com>
pull/72/head
Raphael Emberger 2019-04-11 13:07:53 +00:00 committed by Journey
parent ae158ed76e
commit 141a743767
1 changed files with 106 additions and 60 deletions

View File

@ -1,11 +1,10 @@
############################### ###############################
# Action Replay # # Action Replay #
# Code Types supported by # # Code Types supported by #
# CTRPluginFramework # # CTRPluginFramework #
# v0.5.0 #
############################### ###############################
Those codes are all supported by CTRPF Beta 0.4.1 and higher (check in Tools).
============== ==============
INFO INFO
============== ==============
@ -19,10 +18,20 @@ persistent = register's value is kept between code execution
not persistent = register's value is set to default value when the code starts 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. Default value of offset (#1 and #2), data (#1 and #2) and storage (#1 and #2) registers is zero.
Default mode of all the registers is integer mode.
The active offset and data register is set to #1 when the code starts. 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. When a register index (#1 or #2) is not precised in the description, the active register is used.
====================
Shared Memory Page
====================
CTRPF creates an empty memory page at 0x01E81000 which allows you to
store and share values between your codes.
All of your codes have access to this memory range : 0x01E81000 - 0x01E82000
The way you use it is entirely up to you.
============== ==============
CODE TYPES CODE TYPES
============== ==============
@ -47,35 +56,73 @@ Conditional 16bit codes:
9XXXXXXX ZZZZYYYY Equal To (YYYY == [XXXXXXX + offset] & ~ZZZZ) 9XXXXXXX ZZZZYYYY Equal To (YYYY == [XXXXXXX + offset] & ~ZZZZ)
AXXXXXXX ZZZZYYYY Not Equal To (YYYY != [XXXXXXX + offset] & ~ZZZZ) AXXXXXXX ZZZZYYYY Not Equal To (YYYY != [XXXXXXX + offset] & ~ZZZZ)
Conditional mode:
-----------------------
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)
DFFFFFFF 00000003 - Conditional codes: active storage register is compared to YYYY (immediate value)
DFFFFFFF 00000004 - Conditional codes: active data register is compared to active storage register
Offset Codes: Offset Codes:
-------------- --------------
BXXXXXXX 00000000 offset = *(XXXXXXX + offset) BXXXXXXX 00000000 offset = *(XXXXXXX + offset)
D3000000 XXXXXXXX offset#1 = XXXXXXXX D3000000 XXXXXXXX offset#1 = XXXXXXXX
D3000001 XXXXXXXX - offset#2 = XXXXXXXX D3000001 XXXXXXXX - offset#2 = XXXXXXXX
DC000000 XXXXXXXX Adds an value to the current offset DC000000 XXXXXXXX Adds a value to the current offset
Loop Codes: 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 C0000000 YYYYYYYY Execute next block YYYYYYYY times (immediate value)
D0000000 00000000 Terminator code C1000000 00000000 Execute next block as many times as the value stored in data#1
D0000000 00000001 Exit from a loop, isn't a terminator code anymore, it doesn't end blocks C2000000 00000000 Execute next block as many times as the value stored in data#2
D1000000 00000000 Loop execute D1000000 00000000 Loop execute
D2000000 00000000 - Full terminator: end all conditional blocks, clear active offset and active data register D0000000 00000001 - Stops a loop execution directly (jump to next block) - Doesn't ends blocks
D2000000 00000001 - Exit from code directly, isn't a terminator code anymore, it doesn't end block or clear register
Terminators:
-------------
D0000000 00000000 Ends a conditional block
D2000000 00000000 - Ends all block / Execute loops
D2000000 00000001 - Ends the code execution (ignore all blocks / next instructions). Doesn't ends blocks, so it can be conditional
Data Register Codes: Data Register Codes:
--------------------- ---------------------
D4000000 XXXXXXXX Adds XXXXXXXX to the data register D4000000 XXXXXXXX Adds XXXXXXXX to the active data register
D4000001 XXXXXXXX data#1 = data#1 + data#2 + XXXXXXXX D4000001 XXXXXXXX data#1 = data#1 + data#2 + XXXXXXXX
D4000002 XXXXXXXX - data#2 = data#2 + data#1 + XXXXXXXX D4000002 XXXXXXXX - data#2 = data#2 + data#1 + XXXXXXXX
D5000000 XXXXXXXX data#1 = XXXXXXXX
D5000001 XXXXXXXX - data#2 = XXXXXXXX D5000000 XXXXXXXX data = XXXXXXXX
D5000001 XXXXXXXX - data#1 = XXXXXXXX
D5000002 XXXXXXXX - data#2 = XXXXXXXX
D6000000 XXXXXXXX (32bit) [XXXXXXXX+offset] = data ; offset += 4 D6000000 XXXXXXXX (32bit) [XXXXXXXX+offset] = data ; offset += 4
D6000001 XXXXXXXX (32bit) [XXXXXXXX+offset] = data#1 ; offset += 4
D6000002 XXXXXXXX (32bit) [XXXXXXXX+offset] = data#2 ; offset += 4
D7000000 XXXXXXXX (16bit) [XXXXXXXX+offset] = data & 0xffff ; offset += 2 D7000000 XXXXXXXX (16bit) [XXXXXXXX+offset] = data & 0xffff ; offset += 2
D7000001 XXXXXXXX (16bit) [XXXXXXXX+offset] = data#1 & 0xffff ; offset += 2
D7000002 XXXXXXXX (16bit) [XXXXXXXX+offset] = data#2 & 0xffff ; offset += 2
D8000000 XXXXXXXX (8bit) [XXXXXXXX+offset] = data & 0xff ; offset++ D8000000 XXXXXXXX (8bit) [XXXXXXXX+offset] = data & 0xff ; offset++
D8000001 XXXXXXXX (8bit) [XXXXXXXX+offset] = data#1 & 0xff ; offset++
D8000002 XXXXXXXX (8bit) [XXXXXXXX+offset] = data#2 & 0xff ; offset++
D9000000 XXXXXXXX (32bit) sets data to [XXXXXXXX+offset] D9000000 XXXXXXXX (32bit) sets data to [XXXXXXXX+offset]
D9000001 XXXXXXXX (32bit) sets data#1 to [XXXXXXXX+offset]
D9000002 XXXXXXXX (32bit) sets data#2 to [XXXXXXXX+offset]
DA000000 XXXXXXXX (16bit) sets data to [XXXXXXXX+offset] & 0xFFFF DA000000 XXXXXXXX (16bit) sets data to [XXXXXXXX+offset] & 0xFFFF
DA000001 XXXXXXXX (16bit) sets data#1 to [XXXXXXXX+offset] & 0xFFFF
DA000002 XXXXXXXX (16bit) sets data#2 to [XXXXXXXX+offset] & 0xFFFF
DB000000 XXXXXXXX (8bit) sets data to [XXXXXXXX+offset] & 0xFF DB000000 XXXXXXXX (8bit) sets data to [XXXXXXXX+offset] & 0xFF
DB000001 XXXXXXXX (8bit) sets data#1 to [XXXXXXXX+offset] & 0xFF
DB000002 XXXXXXXX (8bit) sets data#2 to [XXXXXXXX+offset] & 0xFF
Patch Code:
--------------
EXXXXXXX YYYYYYYY - Copy Y bytes (Z) to [XXXXXXX + offset]
ZZZZZZZZ ZZZZZZZZ
Input Codes: Input Codes:
---------------- ----------------
@ -83,26 +130,21 @@ DD000000 XXXXXXXX if KEYPAD has value XXXXXXXX execute next block (see SPECI
DE000000 AAAABBBB - if touchpos X is between AAAA >= X >= BBBB execute next block 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 DE000001 AAAABBBB - if touchpos Y is between AAAA >= Y >= BBBB execute next block
Floating point mode:
-----------------------
DFFFFFFE 00000000 - Set active data register as integer, no conversion
DFFFFFFE 00000001 - Set active data register as float, no conversion
DFFFFFFE 00000010 - Set active data register as integer, convert from float value encoding to integer
DFFFFFFE 00000011 - Set active data register as float, convert from integer value encoding to float
Registers operations: Registers operations:
----------------------- -----------------------
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
DF00XXXX YYYYZZZZ - Operations:
-------------------------------
DF000000 00000000 - Set offset register #1 as active (default) DF000000 00000000 - Set offset register #1 as active (default)
DF000000 00000001 - Set offset register #2 as active DF000000 00000001 - Set offset register #2 as active
DF000001 00000000 - Set data register #1 as active (default) DF000001 00000000 - Set data register #1 as active (default)
DF000001 00000001 - Set data register #2 as active DF000001 00000001 - Set data register #2 as active
DF000002 00000000 - Set storage register #1 as active (default)
DF000002 00000001 - Set storage register #2 as active
DF000000 00010000 - Copy offset #1 to offset #2 DF000000 00010000 - Copy offset #1 to offset #2
DF000000 00010001 - Copy offset #2 to offset #1 DF000000 00010001 - Copy offset #2 to offset #1
@ -118,9 +160,11 @@ DF000001 00020001 - Copy data #2 to offset #2
DF000002 00020000 - Copy data #1 to storage #1 DF000002 00020000 - Copy data #1 to storage #1
DF000002 00020001 - Copy data #2 to storage #2 DF000002 00020001 - Copy data #2 to storage #2
Arithmetic Codes: Arithmetic operations:
--------------- -----------------------
F0000001 0000000X - Toggle float mode for F1, F2, F3, F4, F5 (X: 0 to disable, 1 to enable) F0000001 00000000 - Disable float mode for F1, F2, F3 codes
F0000001 00000001 - Enable float mode for F1, F2, F3 codes
F1XXXXXX YYYYYYYY - *(XXXXXX + offset) += YYYYYYYY F1XXXXXX YYYYYYYY - *(XXXXXX + offset) += YYYYYYYY
F2XXXXXX YYYYYYYY - *(XXXXXX + offset) *= YYYYYYYY F2XXXXXX YYYYYYYY - *(XXXXXX + offset) *= YYYYYYYY
F3XXXXXX YYYYYYYY - *(XXXXXX + offset) /= YYYYYYYY F3XXXXXX YYYYYYYY - *(XXXXXX + offset) /= YYYYYYYY
@ -133,35 +177,44 @@ F9000000 00000000 - NOT - data = ~data
FA000000 YYYYYYYY - Left shift - data <<= YYYYYYYY FA000000 YYYYYYYY - Left shift - data <<= YYYYYYYY
FB000000 YYYYYYYY - Right shift - data >>= YYYYYYYY FB000000 YYYYYYYY - Right shift - data >>= YYYYYYYY
Patch Code: Data copy:
-------------- ---------------------
EXXXXXXX YYYYYYYY - Copy Y bytes (Z) to [XXXXXXX + offset]
ZZZZZZZZ ZZZZZZZZ
Copy Code:
--------------
FC000000 YYYYYYYY - Copy YYYYYYYY bytes from [offset#2] to [offset#1] FC000000 YYYYYYYY - Copy YYYYYYYY bytes from [offset#2] to [offset#1]
Hook Code: Data search:
-------------- ---------------------
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:
--------------
FE00XXXX YYYYYYYY - Search pattern (Z) from offset to offset + Y, XXXX is pattern size (in bytes) 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 ZZZZZZZZ ZZZZZZZZ Next block of code is executed if the pattern is found and offset is updated with the address
Generator Code: Random generator:
----------------- ---------------------
FFXXXXXX YYYYYYYY - data = random number between XXXXXX and YYYYYYYY FFXXXXXX YYYYYYYY - data = random number between XXXXXX and YYYYYYYY
Custom ASM routines:
---------------------
F0F00000 ZZZZZZZZ - ZZZZZZZZ code size in bytes - XXXXXXXX ASM instructions (ARM32)
XXXXXXXX XXXXXXXX - Execute asm instructions embedded in the AR code
# Thread ctx on code entry
---------------------
# r0:
# r1:
# r2:
# r3:
# r4: offset#1 ptr
# r5: offset#2 ptr
# r6: data#1 ptr
# r7: data#2 ptr
# r8: storage#1 ptr
# r9: storage#2 ptr
# r10: shared memory page ptr
# r11:
# r12:
# sp: a stack of 0x1000 bytes available
# lr: address to return to to exit the code
All the registers (including VFP) are backed/restored so they can be used freely.
=================== ===================
SPECIAL KEYPAD CODE SPECIAL KEYPAD CODE
=================== ===================
@ -177,6 +230,8 @@ SPECIAL KEYPAD CODE
0x200 L 0x200 L
0x400 X 0x400 X
0x800 Y 0x800 Y
0x1000 Debug
0x2000 Not-Folded
0x4000 ZL (N3DS Only) 0x4000 ZL (N3DS Only)
0x8000 ZR (N3DS Only) 0x8000 ZR (N3DS Only)
0x100000 Touchpad (any position) 0x100000 Touchpad (any position)
@ -188,12 +243,3 @@ SPECIAL KEYPAD CODE
0x20000000 CPad-Left 0x20000000 CPad-Left
0x40000000 CPad-Up 0x40000000 CPad-Up
0x80000000 CPad-Down 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