Quantcast

Jump to content

» «
Photo

GTA III Save File Documentation

190 replies to this topic
thehambone
  • thehambone

    Don't remind me of home Or I might notice where I am

  • Members
  • Joined: 27 Dec 2013
  • United-States

#1

Posted 02 January 2015 - 05:05 AM Edited by thehambone, 19 January 2015 - 06:25 AM.

GTA III Save File Documentation

Contributors

thehambone

spaceeinstein

OrionSR

Seemann

Silent

Hey guys,

I noticed that there is no documentation on GTA III's save file structure. I've decided to partake in a little project and attempt to document the file structure myself. I intend to make a savegame editor after a good portion of the file structure has been documented.

If you'd like to help me out with documentation, leave a comment or let me know in a PM! :)

EDIT January 11, 2015:
I am no longer maintaining this post for up-to-date information. Please refer to the GTAModding article for the most up-to-date documentation.


Below is the original document, if you're curious.
Spoiler
  • spaceeinstein, OrionSR, Blackbird88 and 4 others like this

Silent
  • Silent

    Chief Vision™ Alterer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [Modding] 2016
    Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#2

Posted 02 January 2015 - 02:20 PM

From a brief browse around the III mobile code:

Block 2 - Peds pool
Block 3 - Garages
Block 4 - Vehicles pool
Block 5 - Objects pool
Block 6 - Path find
Block 7 - Cranes
Block 8 - Pickups
Block 9 - Phone info
Block 10 - Restarts
Block 11 - Radar
Block 12 - [The] Zones
Block 13 - Gangs
Block 14 - [The] Car Generators
Block 15 - Particle objects
Block 16 - Audio script objects
Block 17 - Player info
Block 18 - Stats
Block 19 - Streaming
Block 20 - Ped types

Seemann
  • Seemann

    Ruhe

  • GTA Mods Staff
  • Joined: 03 Sep 2004
  • Russia
  • Best Tool 2016 [OpenIV]
    Best Tool 2013 [Sanny Builder]
    Contribution Award [Mods]
    Helpfulness Awards [Mods]

#3

Posted 02 January 2015 - 05:47 PM

There is much better place for such documentation:

http://www.gtamodding.com/

 

I could help if you have any questions


thehambone
  • thehambone

    Don't remind me of home Or I might notice where I am

  • Members
  • Joined: 27 Dec 2013
  • United-States

#4

Posted 03 January 2015 - 06:56 PM Edited by thehambone, 03 January 2015 - 06:56 PM.

From a brief browse around the III mobile code:
 
*snip*

Awesome, thanks Silent! If you don't mind me asking, how did you find out this information? By decompiling the mobile app? I did some browsing through GTA III's class and function names here and found that the block names that you listed match up with some of the class names. However, there was no information as to how the save file is arranged.
 

There is much better place for such documentation:
http://www.gtamodding.com/
 
I could help if you have any questions

Thanks Seemann! I plan on making a page on GTAModding soon. I wanted to get my findings out on the forums first.

Silent
  • Silent

    Chief Vision™ Alterer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [Modding] 2016
    Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#5

Posted 03 January 2015 - 09:50 PM

Awesome, thanks Silent! If you don't mind me asking, how did you find out this information? By decompiling the mobile app? I did some browsing through GTA III's class and function names here and found that the block names that you listed match up with some of the class names. However, there was no information as to how the save file is arranged.


Yeah, each block data was prepared by a separate function from a separate class. And since we know function names, you could guess the block names that way.
  • thehambone likes this

spaceeinstein
  • spaceeinstein

    Chocolate

  • GTA Mods Staff
  • Joined: 17 Jul 2003
  • Hong-Kong
  • Major Contribution Award [Mods]
    Helpfulness Awards [Mods]

#6

Posted 04 January 2015 - 04:53 AM Edited by spaceeinstein, 05 January 2015 - 10:07 PM.

Sorry if my documentation can be a bit confusing. There are a lot of similarities to VC and I am copying how I structured VC's. My offsets do not include the size of the block so they are off by 4 or 8 bytes from you. I will keep this post updated whenever I can.
Block 0
0x3Ewordsystem time: Millisecond
0x40dwordunknown
0x44dwordcurrent island
0x48float[3]camera coordinates (x,y,z)
0x54dwordlength (ms) of in-game minute (1000=normal)
0x58dwordunknown, based on game clock
0x5Cbytegame hour
0x60bytegame minute
Block 2: Garage
0x00dwordsize of subblock, constant 0x156C
0x04-start of another set of offset below
0x00dwordnumber of garages
0x04bytefree bombs
0x08bytefree respray
0x18dwordPortland IE status (it is a bitstring)
0x1CdwordShoreside IE status
0x20dwordunused IE status
0x2840 bytes[18]40 bytes each, 18 total, garage car structures (see below)
0x2F8140 bytes[?]140 bytes each, garage structures (see below)
Garage car structure
0x00dwordmodel ID
0x04float[3]x,y,z position
Garage structure
0x1Cfloatx1 coordinate of a garage
0x20floatx2 coordinate of a garage

Like in VC, data for IE garages are bitstrings. There are 16 cars to export in the Portland and Shoreside garages. Delivering a Mule would change the bitstring to 0000001000000000 (tenth bit to 1). Delivering a Blista would change that to 0000001100000000 (ninth bit to 1). Check out GTAModding's documentation for the car's position in the bitstring.
  • thehambone likes this

thehambone
  • thehambone

    Don't remind me of home Or I might notice where I am

  • Members
  • Joined: 27 Dec 2013
  • United-States

#7

Posted 04 January 2015 - 08:12 AM Edited by thehambone, 04 January 2015 - 08:16 AM.

Awesome, thanks Silent! If you don't mind me asking, how did you find out this information? By decompiling the mobile app? I did some browsing through GTA III's class and function names here and found that the block names that you listed match up with some of the class names. However, there was no information as to how the save file is arranged.


Yeah, each block data was prepared by a separate function from a separate class. And since we know function names, you could guess the block names that way.

That's cool, I should really learn how to do that; I'd love to browse through GTA's source.
 

Sorry if my documentation can be a bit confusing. There are a lot of similarities to VC and I am copying how I structured VC's. My offsets do not include the size of the block so they are off by 4 or 8 bytes from you. I will keep this post updated whenever I can.
*snip*

Sweet, thanks man! I confirmed your findings and updated the OP.
I'm actually thinking of dividing each block into "header" and "data" sections -- the header being the size(s) of the block and (if available) the block ID string, the data being, well, the data. That way our offsets should match up.

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#8

Posted 04 January 2015 - 11:24 PM Edited by OrionSR, 05 January 2015 - 01:28 AM.

I am way out of my comfort zone (SA Saves) and only have this game on PS2 where the saves are hard to work with, but perhaps I can be of some help anyway. Please forgive the rather random attacks on the data. Please verify reports; I usually can't do it myself.

 

GTASnP describes the saves available at GTA III Mission Save Files as "III (PC/Android/iOS)". Are they directly compatible between systems? I will be using these saves as a common source of reference unless someone has a well documented or easy to download set. The documentation provided in this topic appears to match this format.

 

GTA III saves for PS2 are a little different.

Filesize (on disk): 204,800 bytes

Does not include 0x40 bytes for save name and system time

(Data at PS2 offset 0x04 appears to match PC offset 0x44)

Save name and time is part of the file system.

Save names have a slot number and a space followed by the mission name.

Mission names includes single quote at the beginning.

Mission names includes single quote at end*

*Long names on PC saves have 3 periods and no end quote.

No file extention.

(Only peeked at one so far.)

 

Can color controls (~r~) be used in III save names like they can in SA?

 

File sizes are usually consistent, but limited experiments with SA suggest that the game doesn't really care if the save is a little too long or too short, within some limits I don't remember.

 

Corrected

Block 1: Misc
0x60	dword	game hour
0x64	word	game minute
0x66    word    (usually 0x4170)
0x68    dword   pad number?

These variables appear to serve a dual purpose. Clues: First save has what looks like float values in 0x60, 0x64 and 0x68. Later saves appear to be game hour dword, game minute word, garbage word left over from the top of the float which is usually but not always 0x4170 (which suggests that floats might get written to these variables as the game progresses) and the unknown dword at 0x64 (usually 0).

 

Offsets should be from start of block data. Max Criminal Points is a reasoned guess. I'm not sure how consistent the player string is.

Block 2: Ped Pool
0x05FE 	dword 	max wanted level
0x0602 	dword 	max criminal points
0x0606  char[8] "player" 00 00

Does anyone have a generic drag-n-drop checksum-32 tool for GTA saves that will fix the last 4 bytes regardless of filesize?

 

Where can I find GTAIII mission scripts for PC?


Silent
  • Silent

    Chief Vision™ Alterer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [Modding] 2016
    Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#9

Posted 04 January 2015 - 11:36 PM Edited by Silent, 04 January 2015 - 11:40 PM.

Does anyone have a generic drag-n-drop checksum-32 tool for GTA saves that will fix the last 4 bytes regardless of filesize?


I always recalculate it in HxD as it has an option to calculate a checksum of an entire file. Just remove the checksum, run it, and write the output.


Also, while we're at it, I should probably add a note on how VC Steam saves are different...


EDIT:

I KNEW sannybuilder website will have those scripts...
http://public.sannyb...s/MAIN-GTA3.rar

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#10

Posted 05 January 2015 - 12:03 AM Edited by OrionSR, 05 January 2015 - 01:42 AM.

Thanks for the scripts. It will help to know what data I'm looking for.

 

HxD is my standard method for fixing checksums on saves that don't match SA-PC conventions. But for SA saves I've got a tool by pdescobar that I can simply drop saves on to fix things for me. I work with a lot of saves so it gets quite a bit of use, but I never got permission to distribute it freely; PD had a strong sense of responsibility for his tools, hence the error checking that keeps it from working on newer saves.  I've seen other checksum tools but never one generic enough to simply checksum everything except the last 4 bytes to the last dword in the file, regardless of size or content.

 

Added:

 

Another reasoned guess for global and weather timers based on the order found in SA saves. Values appear to be a bit larger than what appear to be other game timers. Weather tends to go crazy when not in sync with the global timer. Lowering the global timer will force game scripts to wait longer before starting (test with a few minutes). Also, recently used cargens may not spawn, recently used police triggers may not spawn, and dropped pickups may linger on the map; maybe, I haven't examined these structures too closely.

Block 1: Misc
0x5C    dword   weather timer
0x6C	dword	global timer

thehambone
  • thehambone

    Don't remind me of home Or I might notice where I am

  • Members
  • Joined: 27 Dec 2013
  • United-States

#11

Posted 05 January 2015 - 01:59 AM Edited by thehambone, 05 January 2015 - 02:22 AM.

I am way out of my comfort zone (SA Saves) and only have this game on PS2 where the saves are hard to work with, but perhaps I can be of some help anyway. Please forgive the rather random attacks on the data. Please verify reports; I usually can't do it myself.
 
GTASnP describes the saves available at GTA III Mission Save Files as "III (PC/Android/iOS)". Are they directly compatible between systems? I will be using these saves as a common source of reference unless someone has a well documented or easy to download set. The documentation provided in this topic appears to match this format.
 
GTA III saves for PS2 are a little different.

Filesize (on disk): 204,800 bytes

Does not include 0x40 bytes for save name and system time

(Data at PS2 offset 0x04 appears to match PC offset 0x44)

Save name and time is part of the file system.

Save names have a slot number and a space followed by the mission name.

Mission names includes single quote at the beginning.

Mission names includes single quote at end*

*Long names on PC saves have 3 periods and no end quote.

No file extention.

(Only peeked at one so far.)

 
Can color controls (~r~) be used in III save names like they can in SA?
 
File sizes are usually consistent, but limited experiments with SA suggest that the game doesn't really care if the save is a little too long or too short, within some limits I don't remember.

Thanks for the info, OrionSR! Do you have any PS2 gamesaves that I can have a look at? I don't have a modded PS2 (yet), so I can't extract them from my memory card. I downloaded the Android version of III today took a breif look at a save file. Android gamesaves appear to match PC gamesaves from what I could see.
As it turns out, color controls are allowed in the gamesave title. I haven't tried using any other controls yet.
 

Corrected

Block 1: Misc
0x60	dword	game hour
0x64	word	game minute
0x66    word    (usually 0x4170)
0x68    dword   pad number?
These variables appear to serve a dual purpose. Clues: First save has what looks like float values in 0x60, 0x64 and 0x68. Later saves appear to be game hour dword, game minute word, garbage word left over from the top of the float which is usually but not always 0x4170 (which suggests that floats might get written to these variables as the game progresses) and the unknown dword at 0x64 (usually 0).

I dunno, these values have me stumped. I thought the game hour was a dword at first. Then I tried changing the values at offsets 0x61, 0x62, and 0x63 and found that the game's hour did not change; it only changed when the value at 0x60 was modified, which led me to believe the hour was just a byte. Same with the minutes. I also haven't seen the float behavior you're describing. I'm mostly working with gamesaves that only have the first mission done.
 

HxD is my standard method for fixing checksums on saves that don't match SA-PC conventions. But for SA saves I've got a tool by pdescobar that I can simply drop saves on to fix things for me. I work with a lot of saves so it gets quite a bit of use, but I never got permission to distribute it freely; PD had a strong sense of responsibility for his tools, hence the error checking that keeps it from working on newer saves.  I've seen other checksum tools but never one generic enough to simply checksum everything except the last 4 bytes to the last dword in the file, regardless of size or content.

I've been using a little command-line tool that I wrote in C to calculate the checksums for me. If you want, I can whip up a little drag-and-drop app in the next day or so that'll calculate and append checksum to any GTA save file. It'll be in Java though because right now I only know how to write GUI apps in Java. :sui:

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#12

Posted 05 January 2015 - 07:24 AM Edited by OrionSR, 05 January 2015 - 02:59 PM.

PS2 Save Converter - also check out PS2 save builder, PSV Exporter and GTA III Garage Editor.

 

Rather than go through the hassle of setting up my PS2s and transferring saves to USB using AR-Max I just downloaded a couple of saves from GameFAQs. The tools linked above should be able to handle most of the common PS2 save archive formats. Extract just the saves. You won't need the icons or anything. You should recognize them by name and size.

 

I understand your confusion about those game time dwords. Very strange stuff going on there with those floats. I concluded the size of those values based on what appears to be written. The old float data was completely overwritten in 0x60 and 0x68, but only 2 bytes were overwritten for 0x64. In this case I think the game is reading and writing dwords or words to a byte in memory. So only in memory it would be documented as a byte. Um... If I try to hide data in the upper bytes I suspect it will be overwritten by the clock. I'm not sure of the best definition. I'm just highlighting the arguments.

 

The float values were seen in this save, the first in topic the linked above. 'LUIGI'S GIRLS'

00000060 0E 3B 1A 41 1F B8 5B 41 00 00 5E 3E

Coordinates? 9.639418, 13.73245, 0.2167969

 

Added:

 

Multiple data sets of Misc section across full game (sort of):

'Offset              00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
'Description'        Block Size- Save Title------------------------------------------------------------------------------------------------------------------------------------- Year- Month DayWk DayMo Hour- Min-- Sec-- mSec- Always----- Island----- CameraX---- CameraY---- CameraZ---- InGameMin-- WeatherTim- GameHour--- GameMinute- FloatDword0 GlobalTim-- Always1.0a- Empty1----- Empty2----- UnDword1--- Always1.0b- Always1.0c- Always1.0d- FloatDword1 FloatDword2 UnFloat1--- UnFloat2---
'Luigi_s Girls'      C0 65 00 00 27 00 4C 00 55 00 49 00 47 00 49 00 27 00 53 00 20 00 47 00 49 00 52 00 4C 00 53 00 27 00 00 00 02 00 00 00 01 01 90 7C 00 FC FD 7F 90 00 00 00 D9 07 02 00 01 00 17 00 0E 00 08 00 35 00 C8 03 01 14 03 00 01 00 00 00 00 20 5D 44 00 A8 98 C3 00 00 58 41 E8 03 00 00 68 90 06 00 0E 3B 1A 41 1F B8 5B 41 00 00 5E 3E 68 90 06 00 00 00 80 3F 00 00 00 00 00 00 00 00 E8 2A 00 00 00 00 80 3F 00 00 80 3F 00 00 80 3F 00 00 B8 BE 00 00 5B 41 FF FF 77 40 45 44 04 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 40 00 00 00 40
'The Getaway'        D0 66 00 00 27 00 54 00 48 00 45 00 20 00 47 00 45 00 54 00 41 00 57 00 41 00 59 00 27 00 00 00 0C 00 00 00 02 00 00 00 01 01 90 7C 00 FC FD 7F 90 00 00 00 D9 07 02 00 01 00 17 00 0F 00 03 00 19 00 5D 00 01 14 03 00 01 00 00 00 00 20 5D 44 00 A8 98 C3 00 00 58 41 E8 03 00 00 B0 CB 1E 00 04 00 00 00 34 00 70 41 00 00 00 00 B0 CB 1E 00 00 00 80 3F 00 00 00 00 00 00 00 00 E7 C0 00 00 00 00 80 3F 00 00 80 3F 00 00 80 3F 00 00 00 00 00 00 00 00 FF FF 23 3D DF DD 5D 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1D 00 00 00 00 00 00 40 00 00 00 40
'Salvator_s Calle..' 48 66 00 00 27 00 53 00 41 00 4C 00 56 00 41 00 54 00 4F 00 52 00 45 00 27 00 53 00 20 00 43 00 41 00 4C 00 4C 00 45 00 2E 00 2E 00 2E 00 00 00 4D 00 00 00 D9 07 02 00 01 00 17 00 0F 00 19 00 2B 00 19 01 01 14 03 00 01 00 00 00 00 20 5D 44 00 A8 98 C3 00 00 58 41 E8 03 00 00 C6 A8 2D 00 0F 00 00 00 01 00 70 41 00 00 00 00 C6 A8 2D 00 00 00 80 3F 00 00 00 00 00 00 00 00 FA 1C 01 00 00 00 80 3F 00 00 80 3F 00 00 80 3F 02 00 00 00 01 00 00 00 FF FF 23 3D 89 88 88 3C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E 00 00 00 00 00 00 40 00 00 00 40
'Kingdom Come'       D0 66 00 00 27 00 4B 00 49 00 4E 00 47 00 44 00 4F 00 4D 00 20 00 43 00 4F 00 4D 00 45 00 27 00 00 00 00 00 02 00 00 00 01 01 90 7C 00 FC FD 7F 90 00 00 00 D9 07 02 00 01 00 17 00 11 00 31 00 2A 00 42 02 01 14 03 00 02 00 00 00 00 00 C5 42 00 00 EC C3 00 80 9E 41 E8 03 00 00 C3 11 4A 00 03 00 00 00 36 00 70 41 00 00 00 00 C3 11 4A 00 00 00 80 3F 00 00 00 00 00 00 00 00 44 DB 01 00 00 00 80 3F 00 00 80 3F 00 00 80 3F 00 00 00 00 00 00 00 00 FF FF 23 3D 67 66 66 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 00 00 00 00 00 40 00 00 00 40
'Plaster Blaster'    48 66 00 00 27 00 50 00 4C 00 41 00 53 00 54 00 45 00 52 00 20 00 42 00 4C 00 41 00 53 00 54 00 45 00 52 00 27 00 00 00 01 01 90 7C 00 FC FD 7F 90 00 00 00 D9 07 02 00 03 00 19 00 14 00 14 00 36 00 00 00 01 14 03 00 02 00 00 00 00 00 C5 42 00 00 EC C3 00 80 9E 41 E8 03 00 00 73 9F 5B 00 0A 00 00 00 3B 00 70 41 00 00 00 00 73 9F 5B 00 00 00 80 3F 00 00 00 00 00 00 00 00 DF 47 02 00 00 00 80 3F 00 00 80 3F 00 00 80 3F 01 00 00 00 01 00 00 00 FF FF 23 3D BD BB 7B 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1F 00 00 00 00 00 00 40 00 00 00 40
'S.A.M.'             48 66 00 00 27 00 53 00 2E 00 41 00 2E 00 4D 00 2E 00 27 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 00 00 02 00 00 00 01 01 90 7C 00 EC FD 7F 90 00 00 00 D9 07 02 00 04 00 1A 00 12 00 3A 00 28 00 6D 00 01 14 03 00 03 00 00 00 00 88 29 C4 00 00 CE C0 00 80 C3 41 E8 03 00 00 9C 72 7A 00 02 00 00 00 1D 00 70 41 00 00 00 00 9C 72 7A 00 00 00 80 3F 00 00 00 00 00 00 00 00 87 07 03 00 00 00 80 3F 00 00 80 3F 00 00 80 3F 00 00 00 00 00 00 00 00 FF FF 23 3D 78 77 F7 3E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 40 00 00 00 40
PS2 'Gripped!'       54 7D 00 00                                                                                                                                                                                                 01 14 03 00 01 00 00 00 00 20 5D 44 00 A8 98 C3 00 00 58 41 E8 03 00 00 AD D0 ED 02 0C 00 00 00 08 00 00 00 00 00 00 00 AD D0 ED 02 00 00 80 3F 00 00 00 00 00 00 00 00 2E 9F 57 00 00 00 80 3F 00 00 80 3F 00 00 80 3F 01 00 00 00 02 00 00 00 FF FF 00 00 89 88 08 3E 7F 00 00 00 5E 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 03 00 00 00 00 01 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 00 00 24 00 00 00 0F 00 00 00 07 00 00 00 09 00 00 00 D1 07 00 00 2D 00 00 00 00 00 00 40 00 00 00 40
PS2 'Offset          00 01 02 03                                                                                                                                                                                                 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3

Speculation mode is enabled:

 

0x44 - "Always" is surprisingly close to the size of all data.

0x70 - Always1.0a  might be game speed. Currently 1.0.

0x7C - UnDword1 is approximately equal to the global timer divided by 40.

0x94 and 0x98 - I was trying to force UnFloat1 and UnFloat2 to be the current camera and vehicle views but... maybe not floats. Bit flags?

 

Added some more:

Car Generator Structure:
0x18   byte   flags ? (force spawn, player owned?)
0x1C   byte   minimum delay
0x1E   byte   maximum delay (10000 is standard)
0x20   dword  time stamp
0x2C through 0x47 mystery data(28 bytes)* 
*This data appears to be consistent between models but no obvious connection to handling.cfg observed.
SA version: 
014B: $PARKED_RHINO = init_car_generator #RHINO color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 2435.302 -1671.848 12.8007 angle 90.0
flags: bit 2=force spawn, bit 8=player owned

If you change the model of a cargen in the save will the mystery data change to match the new model? Does the remodeled cargen have any unusual properties?

 

Apparently the min and max delays don't work in SA so I'm not sure how to test them.

 

Player owned means that the player won't get a wanted level when entering a vehicle for the first time. I suspect it's not included in III.

Gang Block Data:
Gang Records [9] (2 unused)
Record Structure [4 dwords]
0x00   dword   Gang Car (-1 for unused) 0236:
0x04   dword   always(?) 0xFF (gang car 2?)
0x08   dword   primary weapon 0237:
0x0C   dword   secondary weapon 0237:

You will be missing out on important clues if you only test on new saves. There are frequently differences in saves that are created fresh after starting the game and saves restarted after loading a previous save. I remember hearing something about a Purple Nines (?) glitch that, iirc, was related to saved game clock (?) information carrying over in a save.

 

With that in mind, can you provide me with access to a 110% save (everything plus sandboxing, or as close as you've got), a restart save created after loading that save, and a super-clean fresh start save. Try to do as little as possible or establish a protocol to keep things pretty much the same. I frequently use trainers to warp and cleo to save.

  • thehambone likes this

spaceeinstein
  • spaceeinstein

    Chocolate

  • GTA Mods Staff
  • Joined: 17 Jul 2003
  • Hong-Kong
  • Major Contribution Award [Mods]
    Helpfulness Awards [Mods]

#13

Posted 05 January 2015 - 05:36 PM Edited by spaceeinstein, 05 January 2015 - 06:08 PM.

Thanks for the insight, Orion. I hadn't thought of the trailing unknown bytes as just junk. Is it appropriate to name them "align" like in the SA documentation? If that's the case, the free bomb and free respray from my prior post has to be changed to byte because they are stored as a byte.

For the garage block:
......free respray
0x18dwordPortland IE status
0x1CdwordShoreside IE status
0x20dwordunused IE status

Like in VC, it is a bitstring. There are 16 cars to export in the Portland and Shoreside garages. Delivering a Mule would change the bitstring to 0000001000000000 (tenth bit to 1). Delivering a Blista would change that to 0000001100000000 (ninth bit to 1). Check out GTAModding's documentation for the car's position in the bitstring.

Dividing into header and data sounds like a good idea. If it helps, I am working on a visual representation of VC's save structure here.

thehambone
  • thehambone

    Don't remind me of home Or I might notice where I am

  • Members
  • Joined: 27 Dec 2013
  • United-States

#14

Posted 05 January 2015 - 07:59 PM Edited by thehambone, 05 January 2015 - 10:02 PM.

You guys are great! I mapped out the garage car structures last night and I'll be posting those findings soon.
 

If you change the model of a cargen in the save will the mystery data change to match the new model? Does the remodeled cargen have any unusual properties?

Apparently the min and max delays don't work in SA so I'm not sure how to test them.

From what I can tell, the "mystery data" is static data. I stuck a car gen outside of the Staunton safehouse to test this. I copied the car gen for Joey's BF Injection (the second to last one defined in the save file) and changed the coords accordingly. The car spawned normally. I drove it around the lot, then saved the game. The "mystery data" remained the same. Then I changed the model to the Borgnine. When I loaded up the game, I saw no odd visual changes and the car handled normally. I saved the game again and saw that the "mystery data" still did not change. I want to do further testing to see if cars that have multiple model variants are affected by this data.

A few questions:
-Are the min/max delays like the min/max amount of time before the car can spawn again?
-(Not related to car gens) How does the global timer work? Millis elapsed from an epoch (like Unix time)?
 

With that in mind, can you provide me with access to a 110% save (everything plus sandboxing, or as close as you've got), a restart save created after loading that save, and a super-clean fresh start save. Try to do as little as possible or establish a protocol to keep things pretty much the same. I frequently use trainers to warp and cleo to save.

I can attempt to make a fully completed gamesave, though I don't know how long it'll take me since I don't have any completed games on my system. I'd rather make one myself and not download one from SnP or GameFAQs. Also, what do you mean by "everything plus sandboxing"? Forgive me for being somewhat of a noob lol.
 

the free bomb and free respray from my prior post has to be changed to byte because they are stored as a byte.

I don't know, I still think those are dwords. I've found that any nonzero value will allow free bombs/resprays, even if that value is 0x10000000, 0xFFFFFFFF, etc. (i.e. a dword value). This isn't the case for the game clock, though. Only changing the value at offset 0x60 reflected a change in the game's clock (hours). The other 3 bytes (0x61, 0x62, and 0x63) seemed to have no effect.
 

Dividing into header and data sounds like a good idea. If it helps, I am working on a visual representation of VC's save structure here.

The more I think about it, the more treating the "Miscellaneous" section of Block 0/1 (however you want to call it) as a header makes sense to me. If you notice, each block is arranged into the following structure:
Size of block
Size of block again
(data)

I think the header is meant to go between the two block sizes. Most blocks don't have a proper header, so all you see are two block sizes back to back. Block 0/1 does have a proper header, however, so it is arranged like the following:
Size of block
"Miscellaneous" data (header)
Size of block again
(script data)

So, rather than calling the "SCR" block a sub-block of block 0/1, I think the "SCR" block IS block 0/1 and the "miscellaneous" is just block 0/1's header. Does that make sense?

spaceeinstein
  • spaceeinstein

    Chocolate

  • GTA Mods Staff
  • Joined: 17 Jul 2003
  • Hong-Kong
  • Major Contribution Award [Mods]
    Helpfulness Awards [Mods]

#15

Posted 05 January 2015 - 09:09 PM Edited by spaceeinstein, 05 January 2015 - 10:08 PM.

That's great insight, treating the miscellaneous as a header and the script as the primary block. I'll restructure the VC documentation and see how that goes.

Here are some more for the garages.
......continue from prior, see first post for complete table
0x2840 bytes[18]40 bytes each, 18 total, garage car structures (see prior)
0x2F8140 bytes[?]140 bytes each, garage structures (see below)
0x1Cfloatx1 coordinate of a garage
0x20floatx2 coordinate of a garage

The first structure is the crusher crane area, which I did not expect. The second is the Portland save garage.

Note that I've edited my posts a bunch of times. You can reread my posts if you like, or check out my first post in the topic for the complete table.

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#16

Posted 05 January 2015 - 09:53 PM

Please consider omitting report data from quotes unless it is critical to the discussion. There's a reasonable good change I'll need to correct or update the reports.

 

Please consider maintaining absolute offsets along with relative offsets for as long as the data points remain fixed, or to the start of the global variable space.

 

The PS2 save structure suggests that System Information and Misc might be considered independent structures within your larger block and sub-block organization. My thought is that structures do not have the block size descriptions included with blocks and sub-blocks (I'm still fuzzy on the details). Structures may have one or more records with independent fields. So by definition, a block cannot contain a single field; it must be documented as a field of a record of the structure of the block. Consider how you might want to organize things in an editor; you don't want to come back to redo the documentation once you get into coding. Again, I'm bringing up things to think about rather than arguing for a particular approach.

 

No, don't make a complete save. A complete record of saves with known properties would helpful but that's a long term project. Save it until you have more specific questions to answer. What I want is a restart save created from an old save that is as dirty as possible to compare with a fresh save for carry over data. What I was describing as a 110% save is 100% completion plus anything else that could be done.

 

Global timer is milliseconds. Timers might be timestamps (now) or wake timers (then). More clarification is needed but I'm out of time.

 

I have no additional information on min and max delay.

 

I still wrestle with how to document align bytes properly. I'll try to fill in more on that after work. For now it sound like hambone has a good argument. The important thing is to focus on how things work in the save, which might be different than how the game handles things in memory. What gets read or overwritten? Does data persist in the save or get dropped along the way? Where does the apparently random data found in some align bytes come from anyway?

 

Thanks for answering my questions but you don't need to stop what you are working on. Most of the time I'm just trying to complete the documentation without running any tests of my own. I figure you'll get to it as part of vetting the information for the topic. What are your current goals? I don't want to be stepping on your toes. I'm mostly trying to grab the low hanging fruit while feeling my way around these new saves.

 

Is the gargen pool in III a fixed size or do you need to change the size of the save to add a new one? Are you using Cleo to run your tests? What trainers and tools do you have available?


Silent
  • Silent

    Chief Vision™ Alterer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [Modding] 2016
    Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#17

Posted 05 January 2015 - 10:40 PM

Eh, just skip information about the alignment, assume it's assumed :p

So documenting things like
0x00 - byte - foo
0x01 - byte - bar
0x04 - dword - foobar
should be perfectly reasonable imo. Throwing THER IS ALIGN info on users only clutters the docs.

Seemann
  • Seemann

    Ruhe

  • GTA Mods Staff
  • Joined: 03 Sep 2004
  • Russia
  • Best Tool 2016 [OpenIV]
    Best Tool 2013 [Sanny Builder]
    Contribution Award [Mods]
    Helpfulness Awards [Mods]

#18

Posted 05 January 2015 - 11:54 PM Edited by Seemann, 05 January 2015 - 11:56 PM.

Eh, just skip information about the alignment, assume it's assumed :p

So documenting things like

0x00 - byte - foo
0x01 - byte - bar
0x04 - dword - foobar
should be perfectly reasonable imo. Throwing THER IS ALIGN info on users only clutters the docs.

 

It works when the format is fully documented. Otherwise it may lead to a proposal that a missed chunk of code is unknown. Personally I would stick to the SA Saves documentation format.


Silent
  • Silent

    Chief Vision™ Alterer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [Modding] 2016
    Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#19

Posted 05 January 2015 - 11:58 PM

Then stick to naming those unknown. But then, knowing what's alignment and what's unknown data requires looking into the binaries.

thehambone
  • thehambone

    Don't remind me of home Or I might notice where I am

  • Members
  • Joined: 27 Dec 2013
  • United-States

#20

Posted 06 January 2015 - 12:19 AM Edited by thehambone, 06 January 2015 - 07:37 AM.

No, don't make a complete save. A complete record of saves with known properties would helpful but that's a long term project. Save it until you have more specific questions to answer. What I want is a restart save created from an old save that is as dirty as possible to compare with a fresh save for carry over data. What I was describing as a 110% save is 100% completion plus anything else that could be done.

Alright, I can get those files to you in a little bit then.
 

Is the gargen pool in III a fixed size or do you need to change the size of the save to add a new one? Are you using Cleo to run your tests? What trainers and tools do you have available?

Well there are 149 defined car gens by default. The game leaves room for 11 more at the end of the car gen block buffer. Cars like the Borgnine and BF Injection that get activated at a later time in the game are defined from the start, they are just set to not spawn. If you add a car gen, you must increment the value at block offset 0x14 (number of car gens to load), otherwise your new car won't appear.

I'm not using CLEO or trainers to run my tests. The only CLEO script I have loaded is one that displays the player coordinates at the bottom of the screen. But other than that, my game is pretty much vanilla.
I actually have limited CLEO scripting knowledge, though I intend to improve that as my research on this progresses (I'm rather new to GTA modding if you can't already tell). I understand how CLEO works (opcodes and whatnot), I'm just not good with the syntax yet.


Thanks for all the info, tips, and pointers, guys! :^:

EDIT: Updated Garage block. Added garage and garage car structures.
Is there a limit to how many tables can be in a single post? The last few sections of my OP are rendering tables incorrectly. I might just have to put all of the info into code blocks.

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#21

Posted 06 January 2015 - 01:20 PM

Most of the Align descriptions in the SA save wiki went through a progression. I don't think many of them got full Align status until our exe diver made a definitive call. May I suggest:

 

Unknown - most common description

unknown (align?) - clues suggest alignment to the nearest whole dword

Unknown (align) - we've argued about it and are pretty sure it's alignment

Unknown (Align) - additional clues support alignment (signature bytes)

Align - determined by examination of the executable files

 

I thought I found signature bytes in the GTAIII saves but now I've lost them. These bytes are found in suspected alignment data a tend to persist in a save strand, but are usually different on different game plays. IIRC, signature bytes also match each other within the file. I imagine them to be what leaks through from the background on which the data in memory was laid.

 

The bomb type information suggests that GTA III supports bomb types introduced in VC and SA.

 

I suspect your Cleo skills are good enough for the strategies I'd like to suggest. See if the showsavescreen script included with Sanny Builder will work for on III. I have found this to be an essential tool for save hacking. FYI, Cleo is more than a handy testing tool, it is my primary strategy for editing saves. What I can't do with standard commands I write directly to memory and save.

 

Force Spawn at CarGen record offset 0x18: Does it work? What is the data?

 

Adapt the showsavescreen mod to have a different trigger key and, instead of saving, create (014B) and display (014C) 2 cargens where they will be clearly seen when loading a save. One creation line for a vehicle should have a 1 between the color bytes and alarm. If this works as expected the car with the force spawn flag will spawn when loading but the other will not until you leave and return. The value in the save may not be the same value in the creation line. Try using local variable [email protected] to create and display one and then the other, and if that doesn't work go ahead and reuse the Joey global. You'll lose the handle to his car but that won't matter on a throwaway test save.

 

If you haven't already, decompile your main.scm and use the standard lines for reference on the data in the saves.

0219: $PORTLAND_HIDEOUT_GARAGE = create_garage 16 from 891.25 -311.0624 7.6875 898.375 -315.4999 12.6875 

I'm not sure if it helps here. In SA the save data was much different from the input. All sorts of points got calculated from the original data set, and strange rotations I could never figure out how to manipulate manually. Since I can't run tests directly, reading the scripts is my primary strategy for identifying data in the save.


Seemann
  • Seemann

    Ruhe

  • GTA Mods Staff
  • Joined: 03 Sep 2004
  • Russia
  • Best Tool 2016 [OpenIV]
    Best Tool 2013 [Sanny Builder]
    Contribution Award [Mods]
    Helpfulness Awards [Mods]

#22

Posted 06 January 2015 - 02:07 PM Edited by Seemann, 21 March 2015 - 10:27 PM.

I've started digging into the gta3 binary and so far documented the first block including 'the scripts' subblock. From my experience using 010 editor with its templates feature is the best choice when exploring a new format, so I'm dumping the save structure into a .bt template.
6usTSvHs.png
 
You may find the template there:
https://github.com/x...ats/gta3save.bt
 
Contributions are welcome.
 
I will also make (if no one do it before me) an article on GTAModding.com soon.
Here we go: http://www.gtamoddin...i/Saves_(GTA_3)
  • Silent likes this

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#23

Posted 07 January 2015 - 02:52 AM Edited by OrionSR, 07 January 2015 - 02:56 AM.

Wouldn't it be cool...

 

Wouldn't it be cool if a 010 template could be converted directly into the save documentation? A conversion tool would be cool but probably not worth the effort to produce a single document, but it would still be cool if the documentation had such a precise structure.

 

 I intend to make a savegame editor after a good portion of the file structure has been documented.

Wouldn't it be cool if your editor could read 010 templates so it could be automatically updated as new information is discovered? This would reinforce the need to have the language in the docs match the language in the templates, and hopefully the programming language used to create the editor as well.

 

Wouldn't it be cool if an All-In-One [sic] GTA III Era save editor could handle any save, from any version, from any OS, with any mod of III, VC, SA, LCS and VCS if a user was to create the proper template? My thought is, let's get everybody as a potential user base.

 

Wouldn't it be cool if the editor had a hex programmer's mode that could create and modify 010 templates, run macro scripts, and compare saves using filters?

 

Wouldn't it be cool if our editor had a full reader and editing mode like SASE but could actually manipulate all available data?

 

Wouldn't it be cool if my editor had a user friendly plugin mode that presents complicated tasks in a sensible interface similar to the SA Savegame Editor 3.0? Wouldn't it be cool if the plugins could be supplemented or replaced by 3rd party developers?

 

You are probably thinking this is all too much, and you are probably right, but I'm trying to think big in order to build a solid foundation. We can scale things back considerably for the task at hand but I'd like to keep my options open for a full featured SA editor.


thehambone
  • thehambone

    Don't remind me of home Or I might notice where I am

  • Members
  • Joined: 27 Dec 2013
  • United-States

#24

Posted 07 January 2015 - 05:56 AM

I checked out 010 Editor and it's really nice. I like the template feature.

Some pretty good (and big) ideas, Orion! I was actually thinking of adding an "advanced" mode in my editor that would allow the user to edit the raw hex data on a per-block basis. I like your ideas of plugins and scripts and whatnot (I just hope my programming skills are up to par with such advanced features as these). Also, original my plan was to create VC and SA editors once my III editor was finished. I like your idea of making an all-in-one editor.

I'd say for now though, lets focus on getting a good part of this thing documented, then we can discuss how to go about programming. Definitely keep those ideas in mind though!

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#25

Posted 07 January 2015 - 10:36 PM Edited by OrionSR, 08 January 2015 - 01:31 PM.

Updated: Mostly experimenting with formatting and language, but also lost confidence in the fade in description.

 

The Fade-In bytes are a guess based on the SA documentation.

Search 28 01 00 00 24 01 00 00

Block 10: Restart Points
Offset     Type       Description
0x0000     dword      offset to end of block/size of block (constant 0x128)
0x0004     block data[]

          Block 10 Block Data
          Offset   Type       Description
0x0008    0x00     string     "RST" 00
0x000C    0x04     dword      offset to end of block/size of data structure (constant 0x124)
0x0010    0x08     data structure[]

              Block 10 Data Structure
              Offset   Type       Description
0x0010        0x00     wasted records[8]
0x0090        0x80     busted records[8]
0x0110        0x100    byte       unknown (wasted restarts/island)?
0x0112        0x102    byte       unknown (busted restarts/island)?
0x0114        0x104    dword      unknown
0x0118        0x108    override records[1]
0x0128        0x118    byte       unknown (fade in/island/overrides) (1)?
0x0129        0x119    byte       unknown (fade in/island/overrides) (1)?
0x012A        0x11A    byte[2]    unknown(align)?

                  Block 10 Restart Records[4 floats] (all)
                  Offset   Type       Description
                  0x00     float[3]   x,y,z coordinates
                  0x0C     float      z angle degrees

The format "RST" 00 is used to denote the null string terminator using the same format used in Sanny.

//SA Mobile snippet
hex
"gMobileMenu" 00
end

Data from main.scm for reference.  Recommend cleo testing to isolate values not observed in normal saves.

Where is the override flag? Is the critical override flag different?

03C6:   current_island == 1 
016C: restart_if_wasted at 1144.25 -596.875 13.875 90.0 
016D: restart_if_busted at 1143.875 -675.1875 -100.0 90.0 

03C6:   current_island == 2 
016C: restart_if_wasted at 183.5 -17.75 16.1875 180.0 
016D: restart_if_busted at 340.25 -1123.375 25.0 180.0 

03C6:   current_island == 3 
016C: restart_if_wasted at -1253.0 -138.1875 57.75 90.0 
016D: restart_if_busted at -1259.5 -44.5 57.75 90.0 

016E: override_restart at 811.875 -939.9375 35.75 180.0 
016E: override_restart at 883.5 -308.1875 7.5625 90.0 (values seen in save)

0255: set_critical_mission_restart_at 811.875 -939.9375 35.75 angle 180.0
0255: set_critical_mission_restart_at 883.5 -308.1875 7.5625 angle 90.0 

01F6: cancel_override_restart 
01F6: cancel_override_restart 

0111: set_wasted_busted_check_to 1
0112:   wasted_or_busted
0117:   player $PLAYER_CHAR wasted

SA: byte Game state (wasted/busted/on a rampage etc.)
  • thehambone likes this

Seemann
  • Seemann

    Ruhe

  • GTA Mods Staff
  • Joined: 03 Sep 2004
  • Russia
  • Best Tool 2016 [OpenIV]
    Best Tool 2013 [Sanny Builder]
    Contribution Award [Mods]
    Helpfulness Awards [Mods]

#26

Posted 07 January 2015 - 11:07 PM Edited by Seemann, 07 January 2015 - 11:09 PM.

I've extracted the third block (Garages) structure into the 010 template. Most of the fields are unknown/unnamed.

 

The actual data size of this block is 5244, which is 244 bytes less than its hardcoded value (5484), so the rest of the block is just a padding. This padding contains no random garbage bytes but repeats a part of the previous data (of the block1, as the block2 is much smaller). This repeating starts from the offset 5244 of the block1, which is the place for the global variable $1260 (0xCC + 0x1260*4 = 0x147C = 5244).

 

So, 244 bytes in the end of the garages block contains global variables values from $1260 to $1321.

  • thehambone likes this

thehambone
  • thehambone

    Don't remind me of home Or I might notice where I am

  • Members
  • Joined: 27 Dec 2013
  • United-States

#27

Posted 08 January 2015 - 06:30 AM Edited by thehambone, 22 March 2015 - 01:13 AM.

Force Spawn at CarGen record offset 0x18: Does it work? What is the data?

Alright, so I did what you suggested and assigned two cargens to two different key mappings, one with the force spawn flag set and one without it set. I initiated the cargens by pressing the assigned keys and then saved the game (using the savescreen script). I then re-loaded the game and saw that both cars had spawned. I reloaded the game a few times and still both cars spawned. The only time they didn't spawn was when I exited the game completely, relaunched, then reloaded the save, but the cars were present in each subsequent reload.
I examined the save file and saw that the byte at car gen record offset 0x18 for one of the car gens was set to '1' as expected. So maybe the game recognizes that force spawn is set, but ignores it? What do you think?
 
I'm going to re-do my OP in the next day or so and completely do away with the tables. I'll add the code snippets you guys posted when I do this. I'm also going to try to update the GTAModding page soon as well (so Seemann isn't doing all the work ;)).
 
Lastly, if it is of use to anyone, I created a drag-and-drop checksum calculator that works with any III-era save file. GTAGarage is currently giving me login issues, so I can't upload the tool there yet, but I have uploaded it to other mod hosting sites and will post a link when it has been approved by one of the sites (I think I'm allowed to do that, right?).

EDIT: Here's the link to my checksum calculator.
  • OrionSR likes this

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#28

Posted 08 January 2015 - 12:11 PM Edited by OrionSR, 08 January 2015 - 02:03 PM.

Force Spawn: I think the cars are more than happy to spawn on PC. Perhaps this test should be ran on PS2 where vehicles are less likely to spawn as expected. Keep an eye out for a stubborn cargen we can try the flag on. Is it a flag or the value set? You could re-test with values of 2 and 3 to see what comes through in the save. In SA a value of 1 (anything odd, iirc) was 02 in the save; it was setting a bit flag. The other bit flag in SA is player owned. You could test entering a car for the first time in plain view of a cop and see if a wanted level is applied. No hurry on tracking down a single field while there's so much large scale stuff to tackle. Unless you want to; I'm counting on you for in-game testing, So if you are having fun then knock yourself out. I remember being quite baffled by these flags when I first started editing SA saves. It was really fun to finally figure out what they did.
 

Yes, I'd like the checksum tool, but no hurry. I'm not currently editing any saves and trying to run them so I'm good. Thank you. This will help me a lot.

 

Comments on timers. We were never terribly specific in the SA documentation. Maybe something like:

timer - automatically increments (global timer, local timers)

time stamp - copy of global timer when set (cargen)

wake time - global timer plus time to wait (threads)

countdown - automatically decrements (next attack in SA)

 

The spoiler includes a more responsive trigger script template for showsavescreen. The default one tends to miss keystrokes or run twice. A proper save mod should probably have an on mission check but we might actually want to save during a mission and screw things up so we can take a look. Do the key press opcodes work in III?

Spoiler

 

Pickup Records

Search: 18 25 00 00 14 25 00 00

Pickup Records[limit 339] 28 bytes
0x00    byte        type (see http://www.gtamodding.com/index.php?title=0213#GTA_III)
0x01    byte        picked up =1
0x02    word        ammo, money value
0x04    word        unknown (handle, 0 if picked up)?
0x06    bytes[2]    unknown (align?)
0x08    dword       time stamp (0 if not picked up)
0x0C    word        model ID (see default.ide 0-199 and gta3.ide)
0x0E    byte        unknown (2=allocated,1=empty, various activity)
0x0F    byte        unknown (align?)
0x10    float[3]    x,y,z coordinates

Seemann
  • Seemann

    Ruhe

  • GTA Mods Staff
  • Joined: 03 Sep 2004
  • Russia
  • Best Tool 2016 [OpenIV]
    Best Tool 2013 [Sanny Builder]
    Contribution Award [Mods]
    Helpfulness Awards [Mods]

#29

Posted 08 January 2015 - 02:44 PM

OrionSR;

FYI I've just added block10 in the 010 template, based on your description with some corrections.

 

We should think of the better convention on naming nested structures, those *_info, *_data structs are frustrating me. One clear thing is that before any struct there is a DWORD value of its size. Should this value be a part of the struct itself (as I described in the GTAModding article), or be out of it, directly preceeding, which I stick to in the 010 template?


Silent
  • Silent

    Chief Vision™ Alterer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [Modding] 2016
    Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#30

Posted 08 January 2015 - 08:28 PM

Don't make it a part of the struct. Game seems to handle it independently, ie. things you could call a structure is prepared by a specific class method. Offsets and sizes are prepared by generic save functions, though.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users