Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

pdescobar

[SA] Memory access via stat opcodes

Recommended Posts

PLPynton

Stat 64412 PROCEDURAL OBJECT GENERATION TABLE DEFINITION 64422:18x4b per cell

 

example breakdown (full) of object 000 (sjmcacti2 by the means of original game):

 

Stat 64422 PROCEDURAL_OBJECT -000 SURFACE TYPE

Stat 64423 PROCEDURAL_OBJECT -000 OBJECT NAME

Stat 64424 PROCEDURAL_OBJECT -000 AVERAGE SPACING

Stat 64425 PROCEDURAL_OBJECT -000 DENSITY [x/sqm]

Stat 64426 PROCEDURAL_OBJECT -000 MINIMUM DISTANCE [x^2]

Stat 64427 PROCEDURAL_OBJECT -000 MINIMUM ROTATION [RAD]

Stat 64428 PROCEDURAL_OBJECT -000 MAXIMUM ROTATION [RAD]

Stat 64429 PROCEDURAL_OBJECT -000 MINIMUM SCALE XY

Stat 64430 PROCEDURAL_OBJECT -000 MAXIMUM SCALE XY

Stat 64431 PROCEDURAL_OBJECT -000 MINIMUM SCALE Z

Stat 64432 PROCEDURAL_OBJECT -000 MAXIMUM SCALE Z

Stat 64433 PROCEDURAL_OBJECT -000 MINIMUM Z OFFSET

Stat 64434 PROCEDURAL_OBJECT -000 MAXIMUM Z OFFSET

Stat 64435 PROCEDURAL_OBJECT -000 b1=ALIGN

Stat 64436 PROCEDURAL_OBJECT -000 USE GRID [sq base in m]

Stat 64437 PROCEDURAL_OBJECT -000 UNUSED

Stat 64438 PROCEDURAL_OBJECT -000 UNUSED

Stat 64439 PROCEDURAL_OBJECT -000 UNUSED

end

 

here is last object for our stat range:

 

Stat 65520 PROCEDURAL_OBJECT -060 SURFACE TYPE

 

and under that virtual stat is last object used in game and there is a memory space for few more:

Stat 66144 PROCEDURAL_OBJECT -093 SURFACE TYPE

Edited by PLPynton

Share this post


Link to post
Share on other sites
Seemann

As the way of using stats to gain memory access is seriously limited, I'd like to suggest alternate way.

That's pretty clear and simple method which is based on SA arrays.

 

The original idea was told by Y_Less there, so all credits goes to him.

The main thing is that the array indexes can contain 32-bit integer values that gives us an access to ANY in-game address in ranges 0x00000000..0xFFFFFFFF.

 

There is an example how to increment player's money by $150 via arrays (bit useless because of 0109, but very easy to see that it works)

 

(SB example):

 

[email protected] = 0xB7CE50 // memory address to readgosub @MemoryRead // get current money to [email protected]@ += [email protected] = 0xB7CE50gosub @MemoryWrite // set new money value from [email protected]// --------------------:MemoryWrite [email protected] -= 0xA49960 [email protected] /= 4 // now [email protected] contains the value which after array's parsing will point to the memory address that we specified 008A: &0([email protected],1i) = [email protected]:MemoryRead [email protected] -= 0xA49960 [email protected] /= 4 008B: [email protected] = &0([email protected],1i)return

 

 

in SAMB this method will work too but small changes are necessary.

 

P.S. However, there are still one limit. Not every memory address could be re-written by this, because of Access Violation Error. So, the using of Xieon's patch remains the best solution so far.

 

 

Share this post


Link to post
Share on other sites
ceedj

Does anyone have a working copy of this .rar they can send me? The one from the top post comes up as corrupted.

 

EDIT: Whoops, just realized I posted this in the worng topic. Sorry guys; I'm referring to Xieon's patch. Thanks.

Share this post


Link to post
Share on other sites
Bigun

 

Whoops, just realized I posted this in the worng topic. Sorry guys; I'm referring to Xieon's patch. Thanks.

 

No problem, it isn't really off-topic here. And maybe it's better than bumping that topic for that.

 

 

Does anyone have a working copy of this .rar they can send me? The one from the top post comes up as corrupted.

 

Actually, it works for me. When you click that link, you need to click on "/mempatch.rar". Actually, right-click and choose "Save Target As" etc (using Firefox, when I initially just clicked the link it opened the rar in FF showing the text biggrin.gif).

 

Also, Xieon's patch and INI code converter are included in the latest SB download. turn.gif

Share this post


Link to post
Share on other sites
Seemann

 

Does anyone have a working copy of this .rar they can send me? The one from the top post comes up as corrupted.

 

That's the link

Share this post


Link to post
Share on other sites
Seemann

I realized that the way of changing memory I described above (through the arrays) is working only when you change memory value with 32-bit value (dword). But if you need change the only byte (or word) and use this way it also rewrites the neighbour bytes.

 

Though, to change the byte in game memory you need

 

1. Read memory address (you get DWORD value)

2. Change ITS byte(-s) using set_bit, clear_bit opcodes; so you will change only specified bytes

3. Rewrite the whole address with the new value

 

The main thing is that we do not change any bytes except those needed to be changed.

 

 

// [email protected] -address// [email protected] -new value// [email protected] -length (in bytes)//--write specified number of bytes into memory:MemoryWrite    0085: [email protected] = [email protected] [email protected] /= 4 [email protected] *= 4           // memory address 0062: [email protected] -= [email protected]    // offset (0, 1, 2, 3)  :_GetInitValue      // if you specify mem offset in [email protected], you're able to gosub here gosub @MemoryRead // get initial value [email protected] *= 8 // bytes -> bits [email protected] *= 8 dec([email protected]) for [email protected] = 0 to [email protected]   if     08B6: test [email protected] bit [email protected]    then     08BF: set [email protected] bit [email protected]    // 1   else     08C5: clear [email protected] bit [email protected]  // 0   end    inc([email protected]) // next memory bit end     008A: &0([email protected],1i) = [email protected]  // write new value return//--write 32-bit value into memory-----------:MemoryWrite32bit [email protected] -= 0xA49960 [email protected] /= 4 008A: &0([email protected],1i) = [email protected]   return//--read 32-bit value from memory-----------:MemoryRead [email protected] -= 0xA49960 [email protected] /= 4 008B: [email protected] = &0([email protected],1i)return//-------------------------------------------

 

 

So, example of using that. It shows how to remove annoying text box saying "To stop Carl..." when the player first time stealing a car:

 

 

[email protected] = 0xC0BC15 //  [email protected] = 1        //  [email protected] = 1        //  LENGTH (Byte)gosub @MemoryWrite....

 

 

Share this post


Link to post
Share on other sites
Demarest
I tried doing that in VC once. Even though I was only changing the one byte, I was crashing the game. I'm assuming that's because I was also trying to write to read-only bytes? Not sure, but not once was I able to get it to work confused.gif

Share this post


Link to post
Share on other sites
random_download
I tried doing that in VC once. Even though I was only changing the one byte, I was crashing the game. I'm assuming that's because I was also trying to write to read-only bytes? Not sure, but not once was I able to get it to work confused.gif

I think writing to read-only values would just mean that they don't get written to (ie. nothing happens). The game would crash however if you write to an address that doesn't exist.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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