You are on page 1of 4

Programming for CheatDevice

--------------------------Cheats can be added to CheatDevice by creating text files in the


/cheats/vcs directory on the memory card. The language is a simplified
interpreted subset of C.
Commands: (case sensitive)
#cheat Cheat Title
#off
// comments
setchar(startaddress, intvalue, ...);
sethex(startaddress, hexintvalue, ...;
setshort(startaddress, intvalue, ...);
setint(startaddress, intvalue, ...);
setfloat(startaddress, floatvalue, ...);
teleport(x, y, z);
off();
Formats for numeric constants:
decimal:
hex:
binary:
float:
character:

123
0xABCF0 or 0xabcf0
0b00100101101
1.23
'a', 'b', 'c', '\n'

Special pointer constants:


pplayer:
pcar:
pobj:

Pointer to player object.


Pointer to player's car object. Any command that uses this
only executes when the player is in a car.
Pointer to player object if on foot, or player's car object
if in a vehicle.

Some examples:
// any comments, such as author credits
#cheat Teleport: Top of Tall Building
teleport(95, -1509, 216.98);
#cheat Hud On
setchar(0x08b59b0a, 1); // address not ported to VCS yet
#cheat Hud Off
setchar(0x08b59b0a, 0); // address not ported to VCS yet
#cheat Max Money
setint(0x08bde55c, 99999999);
setint(0x08bde55c, 99999999);
Functions with "..." can write any number of values starting at the given
address, so Max Money could also be written as:
#cheat Max Money
setint(0x08bde55c, 99999999, 99999999);
#cheat No Money

setint(0x08bde55c, 0, 0);
#cheat Time is 9:30am
setchar(0x08bb3b40, 9, 30);
The #off section is used to set a value back to its normal setting and is
executed a single time when a cheat is turned off. For example:
// by vettefan
#cheat Invisible Toni
setchar(pplayer + 0x19A, 0xE2); // address not ported to VCS yet
#off
setchar(pplayer + 0x19A, 0x02);
// by chrislawrance
#cheat Lock Camera
setchar(pplayer + 0x560, 1); // address not ported to VCS yet
#off
setchar(pplayer + 0x560, 0);
Integer values can be treated as signed or unsigned. All of the following
commands set the same value:
setchar(0x08bde55c, 255);
setchar(0x08bde55c, -1);
setchar(0x08bde55c, 0xff);
setchar(0x08bde55c, 0xFF);
setchar(0x08bde55c, 0b11111111);
sethex(0x08bde55c, ff);
sethex is just a version of setchar that assumes all values are hex so you
can leave off the 0x.
Cheat Maker automatically performs region conversion behind the scenes
so users of the UK version see the same addresses as the US version and
addresses entered are automatically converted to the correct region.
There is no need to give different versions of cheats for UK and US
versions of the game.
CheatDevice 2.0 Advanced Features
--------------------------------The language has been extended to include much of the C syntax. Most
operators and some of the main keywords are supported. Although loops are
supported, be careful with them, as they make it very easy to slow down
the game too much.
Keywords:
if else for while break continue true false { }
Operators:
, = += -= *= /= %= /= %= &= ^= |= <<= >>= ?: || &&
| ^ & == != < > <= >= << >> + - * / % & ! ~ ++ -- ( )
Stdlib functions:
abs, fabs, sqrt, sin, cos, tan, rand,

memcpy, memmove, memset, memcmp,


strcpy, strncpy, strcat, strncat,
strcmp, strncmp, strchr, strrchr, strlen
New functions:
getchar(address);
getshort(address);
getint(address);
getfloat(address);
min(value, ...);
max(value, ...);
sgn(value);
int(value);
Button variables:
buttons
press
pressslow
pressmed
pressfast
xstick
ystick

the current button state


the button state once when first pressed, otherwise 0
button press with slow auto-repeat
button press with medium auto-repeat
button press with fast auto-repeat
the position of the analog stick from -1.0 to 1.0
the position of the analog stick from -1.0 to 1.0

Button mask constants:


CTRL_SELECT
CTRL_START
CTRL_UP
CTRL_RIGHT
CTRL_DOWN
CTRL_LEFT

CTRL_LTRIGGER
CTRL_RTRIGGER
CTRL_TRIANGLE
CTRL_CIRCLE
CTRL_CROSS
CTRL_SQUARE

CTRL_HOME
CTRL_VOLUP
CTRL_VOLDOWN
CTRL_SCREEN
CTRL_NOTE

To keep it simple, there are no user defined functions, no *dereference


or &reference, and variables are not strongly typed. All variables have
global scope within their cheat section.
New variables are automatically declared and created by the "=" operator.
If you need to declare a variable without assigning to it, declare it as
static i.e. "static varname;" and its initial value will be zero.
Examples:
setint(pcar + 0x123, getint(pcar + 0x123) + 1);
p1 = 0x08901234;
setchar(p1, getchar(p1)
setchar(p1, getchar(p1)
setchar(p1, getchar(p1)
setchar(p1, getchar(p1)
setchar(p1, getchar(p1)

+
&
^
|
|

1); // increment
0xFE); // clear a bit
0x02); // flip a bit
0x08); // set a bit
0b00001000); // set a bit could also be done this wa

y
static fInit;
if (!fInit)
{
fInit = true;
// do something just once
}

#cheat Rocket Boost 4


if (buttons & CTRL_CROSS)
{
boost = 4.0;
thrust = boost * 0.00333;
// velocity =
setfloat(pcar
thrust);
setfloat(pcar
thrust);
setfloat(pcar
thrust);

velocity + forward vector * thrust


+ 0x0140, getfloat(pcar + 0x0140) + getfloat(pcar + 0x0010) *
+ 0x0144, getfloat(pcar + 0x0144) + getfloat(pcar + 0x0014) *
+ 0x0148, getfloat(pcar + 0x0148) + getfloat(pcar + 0x0018) *

// rotational control
setfloat(pcar + 0x0078, -0.03 * xstick);
}

You might also like