Difference between revisions of "Memory Addresses (GTA4)"

From GTAMods Wiki
Jump to navigation Jump to search
(adding Vehicle pool variable)
 
(24 intermediate revisions by 7 users not shown)
Line 4: Line 4:
  
 
A list of [[Wikipedia:Data_structure|Structures]] that occur in GTA IV's memory.
 
A list of [[Wikipedia:Data_structure|Structures]] that occur in GTA IV's memory.
 +
 +
===VECTOR===
 +
 +
<source lang="cpp">struct VECTOR
 +
{
 +
float x; // 0x0 | 0
 +
float y; // 0x4 | 4
 +
float z; // 0x8 | 8
 +
float unk;
 +
};</source>
 +
 +
===CVector===
 +
 +
<source lang="cpp">struct CVector
 +
{
 +
VECTOR bodyHeading; // 0x0 | 0
 +
VECTOR visionHeading; // 0x10 | 16
 +
VECTOR unkVector; // 0x20 | 32
 +
VECTOR position; // 0x30 | 48
 +
};</source>
 +
===CVehicle===
 +
{| class="wikitable"
 +
|+ CVehicle Globals
 +
|-
 +
!ms_pPool [DWORD]
 +
!Address
 +
!Notes
 +
|-
 +
!IV 1.0.7.0
 +
|  ||
 +
|-
 +
!IV 1.0.8.0
 +
| 0x01252CD0  ||
 +
|-
 +
! IV 1.0.4.0
 +
| 0x01619240 ||
 +
|-
 +
!EFLC 1.1.2.0
 +
| 0x015C17B0 ||
 +
|-
 +
!EFLC 1.1.3.0
 +
| ||
 +
|}
 +
===CVehicleInfo===
 +
The CVehicleInfo class holds all relevant vehicle parameters, as listed in the [[Handling.dat]] file. In essence the CVehicleInfo class is a representation of the data in the [[Handling.dat]] file.
 +
 +
The array of CVehicleInfo's is located at GTAIV.exe+11E3BF0 (1.0.7.0). (Note: unverified. The location might change between start-ups.). The order of elements in the array is exactly the same as in the [[Handling.dat]] file.
 +
 +
Note: not all parameters have been reversed!
 +
 +
<source lang="cpp">
 +
class CVehicleInfo //Size=0x0110(272)
 +
{
 +
public:
 +
char sIdentifier[16]; //0x0000 
 +
float fMass; //0x0010 
 +
float centreOfMassX; //0x0020 
 +
float centreOfMassY; //0x0024 
 +
float centreOfMassZ; //0x0028 
 +
__int32 nPercentSubmerged; //0x0030 
 +
float m_fDriveInertia; //0x003C 
 +
__int16 m_nDriveGears; //0x0040 
 +
float m_fDriveForce; //0x0044 
 +
float m_fBrakeForce; //0x0074 
 +
float m_fTractionCurveMax; //0x008C 
 +
float m_fTractionCurveMin; //0x0094 
 +
float m_fSuspensionForce; //0x00B4 
 +
float m_fSuspensionCompDamp; //0x00B8 
 +
float m_fSuspensionReboundDamp; //0x00BC 
 +
float m_fSuspensionUpperLimit; //0x00C0 
 +
float m_fSuspensionLowerLimit; //0x00C4 
 +
float m_fSuspensionRaise; //0x00C8 
 +
float m_fCollisionDamageMult; //0x00D4 
 +
float m_fWeaponDamageMult; //0x00D8 
 +
float m_fDeformationDamageMult; //0x00DC 
 +
float m_fEngineDamageMult; //0x00E0 
 +
float m_fSeatOffsetDist; //0x00E4 
 +
__int32 m_nMonetaryValue; //0x00E8 
 +
DWORD mFlags; //0x00EC 
 +
}
 +
</source>
 +
 +
===CPed===
 +
<source lang="cpp">
 +
class CPed //Size = 0xE6C(3692) WIP
 +
{
 +
CPhysical _CPhysicalParent //0x0 528 Bytes
 +
bool      m_bDead          //0x210
 +
bool      m_bInjured      //0x211
 +
bool      m_bFatallyInjured//0x212
 +
...
 +
bool      m_bIsDrunk      //0x780
 +
}
 +
</source>
 +
===CWeaponInfo===
 +
See [[List_of_Weapons_(GTA4)]] for the arrays referred to in the struct.
 +
 +
Array of CWeaponInfo's can be found at GTAIV.exe+0x1540A20 (1.0.7.0) and GTAIV.exe+0x124A600 (1.0.8.0).
 +
<source lang="cpp">
 +
CWeaponInfo g_weaponInfos[60];
 +
</source>
 +
 +
NOTE: work in progress
 +
 +
<source lang="cpp">class CWeaponInfo // size: 0x110 (1.0.7.0)
 +
{
 +
int weapontype;
 +
 +
int slot;
 +
 +
int firetype;
 +
 +
int damagetype;
 +
 +
int group;
 +
 +
float targetrange;
 +
 +
float weaponrange;
 +
 +
int stattype;
 +
 +
struct {
 +
unsigned int bCanaim : 1;
 +
unsigned int bCanaimwitharm : 1;
 +
unsigned int bCanfreeaim : 1;
 +
unsigned int bFirstperson : 1;
 +
unsigned int bKeepcamerabehind : 1;
 +
unsigned int bGun : 1;
 +
unsigned int bThrown : 1;
 +
unsigned int bHeavy : 1;
 +
unsigned int bSilenced : 1;
 +
unsigned int bMeleeclub : 1;
 +
unsigned int bMeleeblade : 1;
 +
unsigned int bArmourpenetrating : 1;
 +
unsigned int b2handed : 1;
 +
unsigned int bTreatas2handedincover : 1;
 +
unsigned int bAnimreload : 1;
 +
unsigned int bAnimcrouchfire : 1;
 +
unsigned int bCreatevisibleordnance : 1;
 +
unsigned int bExplosionbasedonimpact : 1;
 +
unsigned int bAddsmokeonexplosion : 1;
 +
unsigned int bInstantkillinmp : 1;
 +
unsigned int bHigherbreakforce : 1;
 +
unsigned int bCanbeusedasdriveby : 1;
 +
unsigned int bHeavyweaponusesrifleanims : 1;
 +
unsigned int bMissioncanforcedrivebyuse : 1;
 +
unsigned int bDontrumblewhendoingdriveby : 1;
 +
}              weaponflags;
 +
 +
int modelhash; // 0x24
 +
 +
int animation; // 0x28
 +
float firerate; // 0x2C
 +
float blindfirerate; // 0x30
 +
float accuracy; // 0x34
 +
float accuracyfps; // 0x38
 +
int unk2_0; // 0x3C
 +
float offset_x; // 0x40
 +
float offset_y; // 0x44
 +
float offset_z; // 0x48
 +
int unk3_0; // 0x4C
 +
float crouchoffset_x; // 0x50
 +
float crouchoffset_y; // 0x54
 +
float crouchoffset_z; // 0x58
 +
int unk4_0; // 0x5C
 +
int unk5_0; // 0x60
 +
float reticule_standing; // 0x64
 +
float reticule_ducked; // 0x68
 +
float reticule_scale; // 0x6C
 +
int rumble_duration; // 0x70
 +
float rumble_intensity; // 0x74
 +
int pickupregentime; // 0x78
 +
int unk7_FFFFFFFF; // 0x7C
 +
short pickupammoonstreet; // 0x80
 +
short damage; // 0x82
 +
short damagefps; // 0x84
 +
short clipsize; // 0x86
 +
int maxammo; // 0x88
 +
int timebetweenshots; // 0x8C
 +
float physicsforce; // 0x90
 +
int reloadtime_normal; // 0x94
 +
int reloadtime_fast; // 0x98
 +
int reloadtime_crouch; // 0x9C
 +
int projectiletype; // 0xA0
 +
int projectilefusetime; // 0xA4
 +
int projectiletocreate; // 0xA8
 +
int projectilexplosiontype; // 0xAC
 +
float projectileoffsetx; // 0xB0
 +
float projectileoffsety; // 0xB4
 +
float projectileoffsetz; // 0xB8
 +
int unk13_0; // 0xBC
 +
float projectilerotoffsetx; // 0xC0
 +
float projectilerotoffsety; // 0xC4
 +
float projectilerotoffsetz; // 0xC8
 +
int unk17_0; // 0xCC
 +
float projectilephysicsexplodeimpactthreshold; // 0xD0
 +
float projectilephysicsexplodeimpactwithvehiclethreshold; // 0xD4
 +
float projectilephysicsvehiclevelocity; // 0xD8
 +
int meleeanim; // 0xDC
 +
int unk19_FFFFFFFF; // 0xE0
 +
int muzzlefx; // 0xE4
 +
int shellfx; // 0xE8
 +
int projectiletrailfx; // 0xEC
 +
float networkplayermod; // 0xF0
 +
float networkpedmod; // 0xF4
 +
float aimingaccuracytime; // 0xF8
 +
int aimingpellets; // 0xFC
 +
int shotsfired; // 0x100
 +
int unk21_0; // 0x104
 +
int unk22_0; // 0x108
 +
int unk23_0; // 0x10C
 +
};</source>
  
 
==Classes==
 
==Classes==
Line 9: Line 222:
 
A list of [[Wikipedia:Class_(computer_science)|Classes]] that occur in GTA IV's memory.
 
A list of [[Wikipedia:Class_(computer_science)|Classes]] that occur in GTA IV's memory.
  
scrThread:
+
===scrThread===
  
 
<source lang="cpp">class scrThread
 
<source lang="cpp">class scrThread
Line 58: Line 271:
  
 
A list of [[Wikipedia:Function_(computer_science)|Functions]] that occur in GTA IV's memory.
 
A list of [[Wikipedia:Function_(computer_science)|Functions]] that occur in GTA IV's memory.
 +
 +
<source lang="cpp">/* 0x4581C0 */ unsigned int __cdecl CRC32(char* text,unsigned int mask); // 1.0.2.0</source>
 +
 +
===Virtual Tables===
 +
* 0x00D69844 CPed VTable 1.0.7.0
  
 
==Variables==
 
==Variables==
Line 63: Line 281:
 
A list of [[Wikipedia:Variables#Computer_programming|Variables]] that occur in GTA IV's memory.
 
A list of [[Wikipedia:Variables#Computer_programming|Variables]] that occur in GTA IV's memory.
  
<b>0xF56BC4</b> BYTE AESEncryptionKey[32] (1.0.2.0)
+
<source lang="cpp">/* 0xF56BC4 */ BYTE AESEncryptionKey[32]; // 1.0.2.0
 +
/* 0x15AD8B4 */ DWORD* globalVariablesPool; // 1.0.2.0</source>
  
 
{{stub}}
 
{{stub}}
  
 
==External Links==
 
==External Links==
* {{GTAF|378631}} - Documenting GTAIV memory addresses
+
* {{GTAF|378631|Documenting GTAIV memory addresses}}
* {{GTAF|393804}} - IV Limits
+
* {{GTAF|393804|IV Limits}}
  
 
[[Category:Memory Addresses]][[Category:GTA 4]]
 
[[Category:Memory Addresses]][[Category:GTA 4]]

Latest revision as of 13:29, 1 February 2019

GTA4 for PC Memory Addresses

Structures

A list of Structures that occur in GTA IV's memory.

VECTOR

struct VECTOR
{
	float	x;	// 0x0 | 0
	float	y;	// 0x4 | 4
	float	z;	// 0x8 | 8
	float	unk;
};

CVector

struct CVector
{
	VECTOR	bodyHeading;		// 0x0 | 0
	VECTOR	visionHeading;		// 0x10 | 16
	VECTOR	unkVector;			// 0x20 | 32
	VECTOR	position;			// 0x30 | 48
};

CVehicle

CVehicle Globals
ms_pPool [DWORD] Address Notes
IV 1.0.7.0
IV 1.0.8.0 0x01252CD0
IV 1.0.4.0 0x01619240
EFLC 1.1.2.0 0x015C17B0
EFLC 1.1.3.0

CVehicleInfo

The CVehicleInfo class holds all relevant vehicle parameters, as listed in the Handling.dat file. In essence the CVehicleInfo class is a representation of the data in the Handling.dat file.

The array of CVehicleInfo's is located at GTAIV.exe+11E3BF0 (1.0.7.0). (Note: unverified. The location might change between start-ups.). The order of elements in the array is exactly the same as in the Handling.dat file.

Note: not all parameters have been reversed!

class CVehicleInfo //Size=0x0110(272)
{
public:
	char sIdentifier[16]; //0x0000  
	float fMass; //0x0010  
	float centreOfMassX; //0x0020  
	float centreOfMassY; //0x0024  
	float centreOfMassZ; //0x0028  
	__int32 nPercentSubmerged; //0x0030  
	float m_fDriveInertia; //0x003C  
	__int16 m_nDriveGears; //0x0040  
	float m_fDriveForce; //0x0044   
	float m_fBrakeForce; //0x0074   
	float m_fTractionCurveMax; //0x008C   
	float m_fTractionCurveMin; //0x0094   
	float m_fSuspensionForce; //0x00B4  
	float m_fSuspensionCompDamp; //0x00B8  
	float m_fSuspensionReboundDamp; //0x00BC  
	float m_fSuspensionUpperLimit; //0x00C0  
	float m_fSuspensionLowerLimit; //0x00C4  
	float m_fSuspensionRaise; //0x00C8  
	float m_fCollisionDamageMult; //0x00D4  
	float m_fWeaponDamageMult; //0x00D8  
	float m_fDeformationDamageMult; //0x00DC  
	float m_fEngineDamageMult; //0x00E0  
	float m_fSeatOffsetDist; //0x00E4  
	__int32 m_nMonetaryValue; //0x00E8  
	DWORD mFlags; //0x00EC  
}

CPed

class CPed //Size = 0xE6C(3692) WIP
{
	CPhysical _CPhysicalParent //0x0 528 Bytes
	bool      m_bDead          //0x210
	bool      m_bInjured       //0x211
	bool      m_bFatallyInjured//0x212
	...
	bool      m_bIsDrunk       //0x780
}

CWeaponInfo

See List_of_Weapons_(GTA4) for the arrays referred to in the struct.

Array of CWeaponInfo's can be found at GTAIV.exe+0x1540A20 (1.0.7.0) and GTAIV.exe+0x124A600 (1.0.8.0).

CWeaponInfo g_weaponInfos[60];

NOTE: work in progress

class CWeaponInfo // size: 0x110 (1.0.7.0)
{
	int weapontype;

	int slot;

	int firetype;

	int damagetype;

	int group;

	float targetrange;

	float weaponrange;

	int stattype;

	struct {
		unsigned int bCanaim : 1;
		unsigned int bCanaimwitharm : 1;
		unsigned int bCanfreeaim : 1;
		unsigned int bFirstperson : 1;
		unsigned int bKeepcamerabehind : 1;
		unsigned int bGun : 1;
		unsigned int bThrown : 1;
		unsigned int bHeavy : 1;
		unsigned int bSilenced : 1;
		unsigned int bMeleeclub : 1;
		unsigned int bMeleeblade : 1;
		unsigned int bArmourpenetrating : 1;
		unsigned int b2handed : 1;
		unsigned int bTreatas2handedincover : 1;
		unsigned int bAnimreload : 1;
		unsigned int bAnimcrouchfire : 1;
		unsigned int bCreatevisibleordnance : 1;
		unsigned int bExplosionbasedonimpact : 1;
		unsigned int bAddsmokeonexplosion : 1;
		unsigned int bInstantkillinmp : 1;
		unsigned int bHigherbreakforce : 1;
		unsigned int bCanbeusedasdriveby : 1;
		unsigned int bHeavyweaponusesrifleanims : 1;
		unsigned int bMissioncanforcedrivebyuse : 1;
		unsigned int bDontrumblewhendoingdriveby : 1;
	}              weaponflags;

	int modelhash; // 0x24

	int animation; // 0x28
	float firerate; // 0x2C
	float blindfirerate; // 0x30
	float accuracy; // 0x34
	float accuracyfps; // 0x38
	int unk2_0; // 0x3C
	float offset_x; // 0x40
	float offset_y; // 0x44
	float offset_z; // 0x48
	int unk3_0; // 0x4C
	float crouchoffset_x; // 0x50
	float crouchoffset_y; // 0x54
	float crouchoffset_z; // 0x58
	int unk4_0; // 0x5C
	int unk5_0; // 0x60
	float reticule_standing; // 0x64
	float reticule_ducked; // 0x68
	float reticule_scale; // 0x6C
	int rumble_duration; // 0x70
	float rumble_intensity; // 0x74
	int pickupregentime; // 0x78
	int unk7_FFFFFFFF; // 0x7C
	short pickupammoonstreet; // 0x80
	short damage; // 0x82
	short damagefps; // 0x84
	short clipsize; // 0x86
	int maxammo; // 0x88
	int timebetweenshots; // 0x8C
	float physicsforce; // 0x90
	int reloadtime_normal; // 0x94
	int reloadtime_fast; // 0x98
	int reloadtime_crouch; // 0x9C
	int projectiletype; // 0xA0
	int projectilefusetime; // 0xA4
	int projectiletocreate; // 0xA8
	int projectilexplosiontype; // 0xAC
	float projectileoffsetx; // 0xB0
	float projectileoffsety; // 0xB4
	float projectileoffsetz; // 0xB8
	int unk13_0; // 0xBC
	float projectilerotoffsetx; // 0xC0
	float projectilerotoffsety; // 0xC4
	float projectilerotoffsetz; // 0xC8
	int unk17_0; // 0xCC
	float projectilephysicsexplodeimpactthreshold; // 0xD0
	float projectilephysicsexplodeimpactwithvehiclethreshold; // 0xD4
	float projectilephysicsvehiclevelocity; // 0xD8
	int meleeanim; // 0xDC
	int unk19_FFFFFFFF; // 0xE0
	int muzzlefx; // 0xE4
	int shellfx; // 0xE8
	int projectiletrailfx; // 0xEC
	float networkplayermod; // 0xF0
	float networkpedmod; // 0xF4
	float aimingaccuracytime; // 0xF8
	int aimingpellets; // 0xFC
	int shotsfired; // 0x100
	int unk21_0; // 0x104
	int unk22_0; // 0x108
	int unk23_0; // 0x10C
};

Classes

A list of Classes that occur in GTA IV's memory.

scrThread

class scrThread
{
public:
	virtual ~scrThread();
	virtual int reset(int i1,int i2,int i3);
	virtual int run(int i1);
	virtual int loop(int i1);
	virtual int closeDown();

	DWORD	threadId;
	DWORD	scriptHash;
	DWORD	state;
	DWORD	IP;
	DWORD	currentFrame;
	DWORD	SP;
	DWORD	timerA;
	DWORD	timerB;
	DWORD	timerC;
	float	waitTime;
	BYTE	zPadding1[28];
	DWORD	exIP;
	DWORD	exFrameSP;
	BYTE	zPadding2[4];
	void*	stack;
	BYTE	zPadding3[4];
	void*	XLiveBuffer;
	BYTE	zPadding4[8];
	char*	exitMessage;
	char	programName[54];
	BYTE	zPadding5[14];
	bool	saveScript;
	bool	playerControlOnInMissionCleanup;
	bool	clearHelpInMissionCleanup;
	BYTE	zPadding6[1];
	bool	allowNonMinigameTextMessages;
	BYTE	zPadding7[1];
	bool	errorInScript;
	bool	canBePaused;
	BYTE	zPadding8[3];
	bool	canRemoveBlipsCreatedByAnyScript;
	BYTE	zPadding9[7];
	DWORD	flags;
};

Functions

A list of Functions that occur in GTA IV's memory.

/* 0x4581C0 */ unsigned int __cdecl CRC32(char* text,unsigned int mask); // 1.0.2.0

Virtual Tables

  • 0x00D69844 CPed VTable 1.0.7.0

Variables

A list of Variables that occur in GTA IV's memory.

/* 0xF56BC4 */ BYTE AESEncryptionKey[32]; // 1.0.2.0
/* 0x15AD8B4 */ DWORD* globalVariablesPool; // 1.0.2.0

External Links