Boolean Values In PS2 Games

Dark Killer
This is going to be the first of many tutorials. In this tutorial I will show you how to modify boolean values in ps2 games.

What is a boolean value?

Boolean values are used to denote the result of a logical operation. A boolean value can be either true (1) or false (0).

How would I find a boolean value in PS2DIS?

Some words to look out for in labels would be:


Dissasembly Examples:

Typically theres two ways boolean values work in ps2 games. There\'s the \"straight-forward\" way (which i\'ll cover in the latter half on this tutorial) and theres the function call way. In the form of a function call there will be a store instruction to an area high in memory which holds the result of some logical operation performed elsewhere. This is where either 0x01 or 0x00 is stored according to the result of said logical operation. To find this you want to be on the lookout for a store byte instruction (syntax: sb $t, offset($s)).

Ex: The Punisher
00151034 a022b9f8 sb v0, $b9f8(at) (__0053b9f8)
00151038 3c01005f lui at, $005f
0015103c 8c22b1f8 lw v0, $b1f8(at)
00151040 1040000d beq v0, zero, $00151078
00151044 3c060045 lui a2, $0045
00151048 3c040181 lui a0, $0181
0015104c 3c050045 lui a1, $0045
00151050 24c6c4c0 addiu a2, a2, $c4c0 (\"Big_head_mode\")

the first line is storing the least significant byte (read: the last byte in the address\' data) into v0. the address its calling is 0053b9f8. lets have a look at the data on that address:

0053b9f8 00000000 nop

the least significant byte is 0x00 which would mean that the logical operation returned a boolean false. we need to change that:

Enable Big Heads (Credit: delcano)
0053b9f8 00000001

now I know you\'re probably wondering \"why didn\'t you put a \'2\' in front of the address?\"

the reason is that we only need to write 1 byte (8-bits) to the address. \'20\' would signify a 32-bit write (although in most cases it wouldnt matter since the data is all zeros anyway, its just better to use the proper 8-bit write)

now onto the \"straight-forward\" way:

sometimes a label will bring you directly to the address holding the boolean value.

Ex: Grand Theft Auto 3
0041848C 00000000 nop BombsAreFree_8CGarages

Bombs Are Free
0041848C 00000001