0AA6

From GTAMods Wiki
Revision as of 00:12, 9 February 2017 by Spaceeinstein (talk | contribs) (Created page with "{{This|For CLEO for GTA III and Vice City prior to v2.0.0.0, use opcode 05E3.}} {{OpCode | games = {{Icon|t}} (with CLEO) | description = Calls a method | syntax1...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to 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)


Description
Calls a method
Syntax
0AA6: call_method [int1] struct [int2] num_params [int3] pop [int4] ( [any] ... )
Parameter
[int1]
Memory address
[int2]
Structure
[int3]
Number of parameters
[int4]
Size to pop
[any]
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

Example

See 0136#For Vice City, 0ADC#Example

Keywords

call, method, member, function