Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (85,209 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. 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

    2. Red Dead Redemption

    3. 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. Forum Support

    2. Site Suggestions

thehambone

GTA III Save File Documentation

Recommended Posts

thehambone

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.

Introduction
Changelog

January 06, 2015 1:34am CST

-Added garage car structure to Garage block.
-Added garage structure to Garage block.


January 04, 2015 1:44am CST

-Added titles to all blocks (thanks Silent!)
-Added "current island" and a few unknown bytes to Miscellaneous block.
-Started mapping out Garage block and garage car structures.


January 02, 2015 1:03am CST

-Organization
-Added colors


January 01, 2015 11:05pm CST

-Initial post

 


Conventions used in this document

-All numbers NOT preceded by '0x' are assumed to be base-10 (decimal) values.
-'(?)' indicates an untested or unknown value.
-Red indicates sections that need to be documented.
-Orange indicates sections that are partially documented.
-Green indicates sections that are well documented.



The Save File (PC Version)
General Info

-Save files are ALWAYS 0x3145C (201820) bytes long.
-Byte order is little endian. For example, the number 3452 is represented as as 0x7C 0x0D.
-File is divided into 22 blocks, followed by a 4-byte checksum (more info on the checksum below).


File Structure

Block 1: Miscellaneous and Scripts

Miscellaneous
[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block
[/td]
0x0004
word[24]
Gamesave title
-Null-terminated string.
-Each char is a 16-bit word.
-Game fills rest of buffer with garbage values.
-When viewed in-game, title may overlap timestamp if text is too long.
0x0034
word
Timestamp
Year
0x0036
word
Timestamp
Month
0x0038
word
Timestamp
Day of week. Sunday is 0, Saturday is 6.
0x003A
word
Timestamp
Day of month
0x003C
word
Timestamp
Hour
0x003E
word
Timestamp
Minute
0x0040
word
Timestamp
Second
0x0042
word
Timestamp
Millisecond
0x0044
dword
(?)

0x0048
dword
Current island
1=Portland, 2=Staunton Island, 3=Shoreside Vale.
A value out of range will cause the game to crash upon loading the gamesave.
0x004C
float[3]
Camera coordinates (x, y, z)

0x0058
dword
Length of 1 in-game minute
Value is in milliseconds.
Default value is 1000.
0x005C
dword
(?)
Based on game clock.
0x0060
byte
Game clock
Hours. Values above 23 will cause undefined behavior with the game's timecycle.
0x0061
byte
(?)
Seems to always be 0x00.
0x0062
byte
(?)
Seems to always be 0x00.
0x0063
byte
(?)
Seems to always be 0x00.
0x0064
byte
Game clock
Minutes.
0x0065
byte
(?)
Seems to always be 0x00.
0x0066
word
(?)
Seems to always be 0x4170.
...



0x00C0
-
Start of sub-block A
[/table]

Sub-Block A: The Scripts

[table]

Offset
Data Type
Description
Additional Notes

0x0000
dword
Size of sub-block

0x0004
string
"SCR\0"
Script block identifier.
0x0008
dword
Size of sub-block
0x08 bytes less than previous size.
0x000C
-
Start of sub-block data
(undocumented)[/table]

 



Block 2: Ped Pool

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 3: Garages

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
dword
Number of garages
Value is 27 in an unmodifed game.
0x000C
dword
Free bombs
0 = false, anything greater than 0 = true.
0x0010
dword
Free resprays
(see above)
...



0x0030
[18]
Start of garage car structures
(Garage car structure defined below)
0x300
[27]
Start of garage structures
(Garagr structure defined below)[/table]

Garage Car Structure
Garage car structures are always 0x28 bytes in length.
[table]Offset
Data Type
Description
Additional Notes
0x0000
dword
Vehicle ID
IDs are defined in data/default.ide. Undefined value will cause game to crash when garage is opened.
0x0004
float[3]
Vehicle coordinates (x, y, z)

0x0010
float[3]
Vector rotation

0x001C
dword
Vehicle immunities
Bitstring: 0 = no immunities, 1 = bulletproof, 2 = fireproof, 4 = explosion proof, 8 = damage proof, 16 = (?)
0x0020
byte
Primary color ID
IDs are defined in data/carcols.dat. Color defaults to black if ID is undefined.
0x0021
byte
Secondary color ID
(see above)
0x0022
byte
Radio station ID
0 = Head Radio, 1 = Double Cleff FM, 2 = Jah Radio, 3 = Rise FM, 4 = Lips 106, 5 = Game FM,
6 = MSX FM, 7 = Flashback 95.6, 8 = Chatterbox 109, 9 = User track player (if user tracks loaded, random otherwise), 10 = Police radio, 11 = Radio off
Does not apply to vehicles without a radio.
0x0023
byte
Model variation 1
Undefined value will cause game to crash when garage is opened. (where are these defined?)
0x0024
byte
Model variation 2
(see above)
0x0025
byte
Bomb type ID
0 = no bomb, 1 = timer bomb, 2 = ignition bomb, 3 = remote bomb, 4 = timer bomb (armed), 5 = ignition bomb (armed)
0x0026
word
(?)
[/table]

Garage Structure
Garage structures are always 0x8C bytes in length.
[table]Offset
Data Type
Description
Additional Notes
0x0000
byte
Garage type ID

...



0x001C
float[6]
Garage position
X1, X2, Y1, Y2, Z1, Z2.
0x0034
float
Door open starting distance
Z coordinate. How far the door is open when it is first loaded into view.
0x0038
float
Door open distance
Z coordinate. How far the door can open.
0x003C
float
(?)
Seems to be an X coordinate.
0x0040
float
(?)
Seems to be a Y coordinate.
0x0044
float
(?)
Seems to be an X coordinate.
0x0048
float
(?)
Seems to be a Y coordinate.
0x004C
float
Door 1 position
Z coordinate.
0x0050
float
Door 2 position
Z coordinate.
...


[/table]



Block 4: Vehicle Pool

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 5: Object Pool

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 6: Path Find

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 7: Cranes

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 8: Pickups

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 9: Phone Info

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 10: Restart Points

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
string
"RST\0"
Block identifier.
0x000C
dword
Size of block
0x08 bytes less than previous size.
0x0010
-
Start of block data
(undocumented)[/table]



Block 11: Radar

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
string
"RDR\0"
Block identifier.
0x000C
dword
Size of block
0x08 bytes less than previous size.
0x0010
-
Start of block data
(undocumented)[/table]



Block 12: The Zones

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
string
"ZNS\0"
Block identifier.
0x000C
dword
Size of block
0x08 bytes less than previous size.
0x0010
-
Start of block data
(undocumented)[/table]



Block 13: Gangs

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
string
"GNG\0"
Block identifier.
0x000C
dword
Size of block
0x08 bytes less than previous size.
0x0010
-
Start of block data
(undocumented)[/table]



Block 14: The Car Generators

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
string
"CGN\0"
Block identifier.
0x000C
dword
Size of block
0x08 bytes less than previous size.
0x0010
-
Start of car generator header
(Header defined below)
(variable)
dword
Size of block

(variable)
[149]
Start of car generators
(Car generator structure defined below)[/table]

Header
[table]Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of header
Seems to always be 0x0C.
0x0004
dword
Number of car generators
Number of generators to load.
0x0008
dword
(?)

0x000C
dword
(?)
Seems to always be 0x00.[/table]

Gar Generator Structure
Car generators are always 0x48 bytes in length.
[table]Offset
Data Type
Description
Additional Notes
0x0000
dword
Vehicle ID
IDs are defined in data/default.ide. Game will crash upon loading save file if value is undefined.
0x0004
float[3]
Coordinates (x, y, z)

0x00010
float
Orientation
0 is north, 180 is south.
0x0014
word
Primary color ID
IDs defined in data/carcols.dat. If value is not defined, game defaults to black.
0x0016
word
Secondary color ID
(see above)
0x0018
byte
(?)

0x0019
byte
Alarm
Chance the car will have an alarm (percentage).
0x001A
byte
Locked
Chance car will be locked (percentage).
0x001B
byte
(?)
Seems to always be 0x00. (align?)
0x001C
word
(?)
Seems to always be 0x0000.
0x001E
word
(?)
Seems to always be 0x2710.
0x0020
dword
(?)

0x0024
dword
(?)
Seems to always be 0xFFFFFFFF.
0x0028
word
Vehicle can spawn
0xFFFF = true, 0x0000 = false. Not sure if there can be a range of values.
0x002A
word
(?)
Seems to always be 0x0000.
0x002C
dword
(?)

0x0030
dword
(?)

0x0034
dword
(?)

0x0038
dword
(?)

0x003C
dword
(?)

0x0040
dword
(?)

0x0044
dword
(?)
[/table]



Block 15: Particle Objects

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 16: Audio Script Objects

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
string
"AUD\0"
Block identifier.
0x000C
dword
Size of block
0x08 bytes less than previous size.
0x0010
-
Start of block data
(undocumented)[/table]



Block 17: Player Info

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 18: Stats

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 19: Streaming

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 20: Ped Types

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
string
"PTP\0"
Block identifier.
0x000C
dword
Size of block
0x08 bytes less than previous size.
0x0010
-
Start of block data
(undocumented)[/table]



Block 21: Padding 1 (?)

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Block 22: Padding 2 (?)

Not sure why this table won't render correctly...

[table]

Offset
Data Type
Description
Additional Notes
0x0000
dword
Size of block

[td]0x0004
dword
Size of block
0x04 bytes less than previous size.
0x0008
-
Start of block data
(undocumented)[/table]



Checksum

The last 4 bytes of the save file is its checksum. Any time the file is edited, the checksum must be updated. Otherwise, the game will show a "Slot is corrupted" message where the gamesave title would usually be. The checksum is simply the sum of all preceding (0x31458) bytes.

 

 

Edited by thehambone

Share this post


Link to post
Share on other sites
Silent

From a brief browse around the III mobile code:

 

 

Block 2 - Peds poolBlock 3 - GaragesBlock 4 - Vehicles poolBlock 5 - Objects poolBlock 6 - Path findBlock 7 - CranesBlock 8 - PickupsBlock 9 - Phone infoBlock 10 - RestartsBlock 11 - RadarBlock 12 - [The] ZonesBlock 13 - GangsBlock 14 - [The] Car GeneratorsBlock 15 - Particle objectsBlock 16 - Audio script objectsBlock 17 - Player infoBlock 18 - StatsBlock 19 - StreamingBlock 20 - Ped types

Share this post


Link to post
Share on other sites
Seemann

There is much better place for such documentation:

http://www.gtamodding.com/

 

I could help if you have any questions

Share this post


Link to post
Share on other sites
thehambone

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. Edited by thehambone

Share this post


Link to post
Share on other sites
Silent

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.

Share this post


Link to post
Share on other sites
spaceeinstein

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[table]

0x3E word system time: Millisecond 0x40 dword unknown 0x44 dword current island 0x48 float[3] camera coordinates (x,y,z) 0x54 dword length (ms) of in-game minute (1000=normal) 0x58 dword unknown, based on game clock 0x5C byte game hour 0x60 byte game minute [/table]Block 2: Garage[table] 0x00 dword size of subblock, constant 0x156C 0x04 - start of another set of offset below [/table][table] 0x00 dword number of garages 0x04 byte free bombs 0x08 byte free respray 0x18 dword Portland IE status (it is a bitstring) 0x1C dword Shoreside IE status 0x20 dword unused IE status 0x28 40 bytes[18] 40 bytes each, 18 total, garage car structures (see below) 0x2F8 140 bytes[?] 140 bytes each, garage structures (see below) [/table]Garage car structure[table] 0x00 dword model ID 0x04 float[3] x,y,z position [/table]Garage structure[table] 0x1C float x1 coordinate of a garage 0x20 float x2 coordinate of a garage [/table]

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.

Edited by spaceeinstein

Share this post


Link to post
Share on other sites
thehambone

 

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.

Edited by thehambone

Share this post


Link to post
Share on other sites
OrionSR

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: Misc0x60	dword	game hour0x64	word	game minute0x66    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 Pool0x05FE 	dword 	max wanted level0x0602 	dword 	max criminal points0x0606  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?

Edited by OrionSR

Share this post


Link to post
Share on other sites
Silent

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.sannybuilder.com/GTA_original_files/MAIN-GTA3.rar

Edited by Silent

Share this post


Link to post
Share on other sites
OrionSR

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: Misc0x5C    dword   weather timer0x6C	dword	global timer
Edited by OrionSR

Share this post


Link to post
Share on other sites
thehambone

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: Misc0x60	dword	game hour0x64	word	game minute0x66    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: Edited by thehambone

Share this post


Link to post
Share on other sites
OrionSR

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 40PS2 '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 40PS2 '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 delay0x1E   byte   maximum delay (10000 is standard)0x20   dword  time stamp0x2C 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.0flags: 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.

Edited by OrionSR

Share this post


Link to post
Share on other sites
spaceeinstein

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:

[table]

 

... ... free respray

 

0x18 dword Portland IE status

 

0x1C dword Shoreside IE status

 

0x20 dword unused IE status

[/table]

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.

Edited by spaceeinstein

Share this post


Link to post
Share on other sites
thehambone

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:

[table]

Size of blockSize of block again(data)[/table]

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:

[table]

Size of block"Miscellaneous" data (header)Size of block again(script data)[/table]

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?

Edited by thehambone

Share this post


Link to post
Share on other sites
spaceeinstein

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.

[table]

... ... continue from prior, see first post for complete table 0x28 40 bytes[18] 40 bytes each, 18 total, garage car structures (see prior) 0x2F8 140 bytes[?] 140 bytes each, garage structures (see below) [/table][table] 0x1C float x1 coordinate of a garage 0x20 float x2 coordinate of a garage [/table]

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.

Edited by spaceeinstein

Share this post


Link to post
Share on other sites
OrionSR

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?

Share this post


Link to post
Share on other sites
Silent

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

 

So documenting things like

 

0x00 - byte - foo0x01 - byte - bar0x04 - dword - foobar
should be perfectly reasonable imo. Throwing THER IS ALIGN info on users only clutters the docs.

Share this post


Link to post
Share on other sites
Seemann

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

 

So documenting things like

0x00 - byte - foo0x01 - byte - bar0x04 - 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.

Edited by Seemann

Share this post


Link to post
Share on other sites
Silent

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

Share this post


Link to post
Share on other sites
thehambone

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.

Edited by thehambone

Share this post


Link to post
Share on other sites
OrionSR

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.

Share this post


Link to post
Share on other sites
Seemann

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/x87/gta/blob/master/formats/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.gtamodding.com/wiki/Saves_(GTA_3)

Edited by Seemann

Share this post


Link to post
Share on other sites
OrionSR

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.

Edited by OrionSR

Share this post


Link to post
Share on other sites
thehambone

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!

Share this post


Link to post
Share on other sites
OrionSR

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 00Block 10: Restart PointsOffset     Type       Description0x0000     dword      offset to end of block/size of block (constant 0x128)0x0004     block data[]          Block 10 Block Data          Offset   Type       Description0x0008    0x00     string     "RST" 000x000C    0x04     dword      offset to end of block/size of data structure (constant 0x124)0x0010    0x08     data structure[]              Block 10 Data Structure              Offset   Type       Description0x0010        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      unknown0x0118        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 snippethex"gMobileMenu" 00end

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.00255: 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 10112:   wasted_or_busted0117:   player $PLAYER_CHAR wastedSA: byte Game state (wasted/busted/on a rampage etc.)
Edited by OrionSR

Share this post


Link to post
Share on other sites
Seemann

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.

Edited by Seemann

Share this post


Link to post
Share on other sites
thehambone

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.

Edited by thehambone

Share this post


Link to post
Share on other sites
OrionSR

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?

 

{$CLEO .cs}//ShowSaveScreen.txt0000:wait 10while true  wait 0  if    0AB0:   key_pressed 0x73 // F4  then    03D8: show_save_screen // when pressed  :Wait    wait 0    if      0AB0:   key_pressed 0x73 // F4    then      jump @Wait    end//    03D8: show_save_screen // when released  endend

 

 

 

Pickup Records

Search: 18 25 00 00 14 25 00 00Pickup Records[limit 339] 28 bytes0x00    byte        type (see http://www.gtamodding.com/index.php?title=0213#GTA_III)0x01    byte        picked up =10x02    word        ammo, money value0x04    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
Edited by OrionSR

Share this post


Link to post
Share on other sites
Seemann

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?

Share this post


Link to post
Share on other sites
Silent

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.

Share this post


Link to post
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

×

Important Information

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