Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Help with Memory Addresses (SA)


Rapper_skull
 Share

Recommended Posts

Hello, I have SA v1.0 EUR No-CD and I'm exploring memory with HxD, but I have two problems:

1) Some addresses are the same as the one I find here: http://www.gtamodding.com/index.php?title=Memory_Addresses_(SA) like money etc. but I can't understand why CPed is not the same. According to that X coordinate of the player should be at 0xB6F634 (CPed + 0x14 + 0x30) but mine is at B6FF74. Am I doing calculations wrong or there is a difference between original and No-CD? Is there a table for shifting between 1.0 and 1.01, US and EUR, original and no-cd, etc.?

2) How do I convert rotation matrix to numbers? For coordinates I use this: http://www.binaryconvert.com/convert_float.html but how can I convert the rotation matrix to sexagesimal angle?

 

Thanks in advance for your help! :)

Link to comment
Share on other sites

1)Try this:

0A96: [email protected] = actor $PLAYER_ACTOR struct // CPed
000A: [email protected] += 0x00


2)
DWORD = 2 WORDs = 4 bytes = integer
0093: [email protected] = integer [email protected] to_float

I'm not sure if the float result will be in degrees or radians but if it's in radians continue with this:

0007: [email protected] = 3.14159265358979 // pi
006B: [email protected] *= [email protected] // (float)
0017: [email protected] /= 180.0

Or go here:


Link to comment
Share on other sites

US and EU .data sections (where your CPed is) are a bit shifted.

 

For gettng an angle from a rotation matrix, this may be a good read:

https://truesculpt.googlecode.com/hg-history/38000e9dfece971460473d5788c235fbbe82f31b/Doc/rotation_matrix_to_euler.pdf

Link to comment
Share on other sites

OK I found my rotation (on the X angle I guess) at B7684C while it should be at B6FF44-B6FF6F. This is driving me crazy. Let's suppose I want to write a trainer, how can I make it compatible with all versions? Is there a shifting table?

Link to comment
Share on other sites

You could read a proper pointer from .text section, these are constant at least between US and EU versions.

Link to comment
Share on other sites

You should be able to get player's CPed pointer reliably by reading an address from 0x442E06, then reading the result again - the retrieved address is player's CPed address. Then you just add specific offsets to it and done.

Link to comment
Share on other sites

The address 0x442E06 is in memory or from the .text file in gta_sa.exe? Because all I see is CC CC CC CC.

Link to comment
Share on other sites

It's from game memory.

Link to comment
Share on other sites

When I go to offset 442E06 I see 98 CD B7 00 that reversed is address 0xB7CD98 at that address I find a value that changes every time I run the game, now is 10 CE 66 0A that reversed is 0xA66CE10. Considering this as the CPed X coordinate should be at 0xA66CE54, but all I find is 00 00 00 00. What I'm looking for is at 0xA7E3450 (the nearest one). What am I doing wrong?

Link to comment
Share on other sites

When I go to offset 442E06 I see 98 CD B7 00 that reversed is address 0xB7CD98 at that address I find a value that changes every time I run the game, now is 10 CE 66 0A that reversed is 0xA66CE10. Considering this as the CPed X coordinate should be at 0xA66CE54, but all I find is 00 00 00 00. What I'm looking for is at 0xA7E3450 (the nearest one). What am I doing wrong?

Please get IDA Pro 6.1 and then you can start analysis, you'll see what's wrong and what's right in game memory.

I can send you an IDB file of:

 

GTA San Andreas v1.0 [uS] No-CD Fixed ExeGTA San Andreas v1.01 [EURO] No-CD Fixed EXE
With some creativity you can disassemble another gta_sa.exe and find addresses you need based on known addresses from 'GTA San Andreas v1.0 [uS] No-CD Fixed Exe'.

 

0xA66CE54 - 0xA66CE10 = 0x44

 

 

00000000 CPed struc ; (sizeof=0x79C)00000000 __parent CPhysical ?...
00000000 CPhysical struc ; (sizeof=0x138)00000000 __parent CEntity ?00000044 m_vVelocity RwV3D ?00000050 m_vAngularVelocity RwV3D ?
0x44 - m_vVelocity

Finding a current XYZ position of ped may be a bit hard when making a trainer without a DLL attached to gta_sa.exe process that could call functions easily.

That's how 00A0: store_actor $PLAYER_ACTOR position_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3

command works

 

case 0xA0:CRunningScript__CollectParameters(this, 1u);v62 = CPool_CPed__getStructByHandle(CPools__ms_pPedPool, opcodeParameters[0]);v63 = v62->PedFlags.Flags1;if ( BYTE1(v63) & 1 && (v64 = v62->pVehicle) != 0 ){v65 = v64->__parent.__parent.__parent.m_pCoords;if ( v65 )v66 = &v65->matrix.pos;elsev66 = &v64->__parent.__parent.__parent.placement.pos;}else{v67 = v62->__parent.__parent.__parent.m_pCoords;if ( v67 )v66 = &v67->matrix.pos;elsev66 = &v62->__parent.__parent.__parent.placement.pos;}a2[0] = v66->x;a2[1] = v66->y;v68 = v66->z;opcodeParameters[0] = LODWORD(a2[0]);v135 = v68;opcodeParameters[1] = LODWORD(a2[1]);opcodeParameters[2] = LODWORD(v68);CRunningScript__StoreParameters(v2, 3);return 0;
Edited by fastman92
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.