-
Notifications
You must be signed in to change notification settings - Fork 19
Code Types
Cheat Device's engine is borrowed from ps2rd, which closely supports the code types used by CodeBreaker. This page documents each supported code type with any caveats to be aware of.
0aaaaaaa 000000vv
*(uint8_t *)a = v;
Constantly writes the 8-bit value v
to address a
.
1aaaaaaa 0000vvvv
*(uint16_t *)a = v;
Constantly writes the 16-bit value v
to address a
.
NOTE: a
must be short-aligned (a % 2 == 0
).
2aaaaaaa vvvvvvvv
*(uint32_t *)a = v
Constantly writes the 32-bit value v
to address a
.
NOTE: a
must be word-aligned (a % 4 == 0
).
This code has multiple forms:
300000vv 0aaaaaaa
*(uint8_t *)a += v;
301000vv 0aaaaaaa
*(uint8_t *)a -= v;
3020vvvv 0aaaaaaa
*(uint16_t *)a += v;
3030vvvv 0aaaaaaa
*(uint16_t *)a -= v;
30400000 0aaaaaaa
vvvvvvvv 00000000
*(uint32_t *)a += v;
30500000 0aaaaaaa
vvvvvvvv 00000000
*(uint32_t *)a -= v;
Increment or decrement the current value at address a
by value v
.
4aaaaaaa nnnnssss
vvvvvvvv iiiiiiii
uint32_t *p = a;
while(n--) {
*p = v;
p += s;
v += i;
}
Starting with address a
, this code type will write the 32-bit value v
to n
addreses. In each cycle, the address is incremented by s
*4 and the value is incremented by i
.
5sssssss nnnnnnnn
0ddddddd 00000000
while(n--) {
*d++ = *s++;
}
Copy n
bytes from source address s
to destination address d
.
6aaaaaaa 000000vv
0000nnnn p_0
p_1 p_2
........ ........
p_(n-1) p_n
6aaaaaaa 0000vvvv
0001nnnn p_0
p_1 p_2
........ ........
p_(n-1) p_n
6aaaaaaa vvvvvvvv
0002nnnn p_0
p_1 p_2
........ ........
p_(n-1) p_n
Loads the 32-bit base address from address a
, adds offset p_0
to it, and constantly writes the value v
to the final address.
Loads the 32-bit base address from address a
, adds offset p_0
to it to get an initial pointer address P_0
. Dereference P_0
and add p_1
to the result to get the next pointer address P_1
. This is done n
times until the final address P_n
is found, at which point the value v
is written to it.
NOTE: Execution of this code type will stop if a NULL pointer is encountered to prevent a crash.
7aaaaaaa 000000vv
*(uint8_t *)a |= v;
7aaaaaaa 0010vvvv
*(uint16_t *)a |= v;
7aaaaaaa 002000vv
*(uint8_t *)a &= v;
7aaaaaaa 0030vvvv
*(uint16_t *)a &= v;
7aaaaaaa 004000vv
*(uint8_t *)a ^= v;
7aaaaaaa 0050vvvv
*(uint16_t *)a ^= v;
Performs a bitwise logical operation between value v
and the value stored at address a
.
NOTE: This code type is unique to Cheat Device.
8aaaaaaa nnnnssss
000000vv 000000ii
uint8_t *p = a;
while(n--) {
*p = v;
p += s;
v += i;
}
8aaaaaaa nnnnssss
1000vvvv 0000iiii
uint16_t *p = a;
while(n--) {
*p = v;
p += s;
v += i;
}
Starting with address a
, this code type will write the value v
to n
addresses. In each cycle, the address is incremented by s
or s
*2 and the value is incremented by i
.
Caaaaaaa vvvvvvvv
if(*(uint32_t *)a == v) {
// Execute all remaining codes
}
If the 32-bit value at address a
is equal to value v
, all subsequent codes will be executed.
Daaaaaaa nnt0vvvv
uint16_t *p = a;
if (t == 0 && *p == v) { /* Execute next n lines */ }
else if (t == 1 && *p != v) { /* Execute next n lines */ }
else if (t == 2 && *p < v) { /* Execute next n lines */ }
else if (t == 3 && *p > v) { /* Execute next n lines */ }
else if (t == 4 && *p & ~v) { /* Execute next n lines */ }
else if (t == 5 && *p & v) { /* Execute next n lines */ }
else if (t == 6 && *p | ~v) { /* Execute next n lines */ }
else if (t == 7 && *p | v) { /* Execute next n lines */ }
Daaaaaaa nnt1vvvv
uint8_t *p = a;
if (t == 0 && *p == v) { /* Execute next n lines */ }
else if (t == 1 && *p != v) { /* Execute next n lines */ }
else if (t == 2 && *p < v) { /* Execute next n lines */ }
else if (t == 3 && *p > v) { /* Execute next n lines */ }
else if (t == 4 && *p & ~v) { /* Execute next n lines */ }
else if (t == 5 && *p & v) { /* Execute next n lines */ }
else if (t == 6 && *p | ~v) { /* Execute next n lines */ }
else if (t == 7 && *p | v) { /* Execute next n lines */ }
Compares the value at address a
to value v
, and executes the next n
code lines only if the test condition t
is true.
t |
Test Condition |
---|---|
0 | == |
1 | != |
2 | < |
3 | > |
4 | NAND |
5 | AND |
6 | NOR |
7 | OR |
E0nnvvvv taaaaaaa
E1nnvvvv taaaaaaa
This code-type is equivalent to the D-type and is included for backward compatibility.