From GTAModding
Jump to: navigation, search
For CLEO for GTA III and Vice City prior to v2.0.0.0, use opcode 05E3.

GTA III Vice City San Andreas (with CLEO)

Calls a method
0AA6: call_method [int1] struct [int2] num_params [int3] pop [int4] ( [any] ... )
Memory address
Number of parameters
Size to pop
Any values to push (optional)

This CLEO opcode calls a method (also known as a non-static member function in C++) located at the memory address. These functions use the thiscall calling convention. When they are called, a "this" pointer referencing the object's structure is passed to the function. The number of parameters determines the number of arguments to pass onto the call stack. The size to pop depends if the caller or callee cleans the call stack. If the callee cleans the stack (which generally happens for the thiscall calling convention), the size to pop should be 0. The order to pass the arguments is reversed from the function's parameter order.

For example, a method call in C++ in Vice City can look like this:

TheCamera.CCamera::CamShake(1.0, 10.0, 20.0, 30.0);

TheCamera is the structure for the game's camera object located at 0x7E4688. CCamera::CamShake is a member function located at 0x46FF21 with four parameters all accepting floating-point values: intensity, x-coordinate, y-coordinate, and z-coordinate. To call this function using this opcode in Vice City, it should look like this:

0AA6: call_method 0x46FF21 struct 0x7E4688 num_params 4 pop 0 z 30.0 y 20.0 x 10.0 intensity 1.0


See 0136#For Vice City, 0ADC#Example


call, method, member, function