Quantcast

Jump to content

» «
Photo

GTA III Save File Documentation

190 replies to this topic
OrionSR
  • OrionSR

    Chain Game Development Team

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

#61

Posted 14 January 2015 - 12:28 PM Edited by OrionSR, 14 January 2015 - 12:41 PM.

No, I'm not really sure of anything. New editor, strange structure, IPL objects I can't read in the save yet, game I don't remember at all, and the list goes on. It would be wise to confirm and argue about everything. My strategy was to put that propose opcode line at the bottom of the screen and try to match up the numbers in the save to the activate code.

 

I'm not sure I've described the movement accurately, I'm not sure how this info applies to anything other than the ev crane. Current position was never tested. All rotations are complete guesses. Time stamp looks right though; I'm pretty sure about that one at least.

 

Later testing: What does the crane look like on a stripped main? Where is the 3rd active-like crane? How is the crane different when reactivated? What does a deactivated crane look like? What's up with the Crusher Crane and moving cranes?

 

Added: I double-checked those first few crane floats and I think my template fields match my opcode proposal. Perhaps the opcode text isn't correct.


spaceeinstein
  • spaceeinstein

    Chocolate

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

#62

Posted 14 January 2015 - 05:52 PM Edited by spaceeinstein, 14 January 2015 - 09:41 PM.

Zones block, many are unknown:
0x00 - dword - size of subblock, constant 0x2774
  0x0000 - char[4] - "ZNS\0"
  0x0004 - dword - ?
  0x0008 - dword - ?
  0x000C - dword - ?
  0x0010 - word - ?
  0x0014 - gta3.zon structures, 56 bytes each, 50 total:
    0x00 - char[8] - name
    0x08 - float[3] - x1, y1, z1
    0x14 - float[3] - x2, y2, z2
    0x20 - dword - type
    0x24 - dword - island number
    0x28 - word - ?
    0x2A - word - ?
    0x2C - dword - ?
    0x30 - dword - ?
    0x34 - dword - ?
  0x0B04 - ped/car/gang info zone structures?, 58 bytes each, 100 total
  0x21AC - word - ?
  0x21AE - word - ?
  0x21B0 - map.zon structures, 56 bytes each, 25 total:
    0x00 - char[8] - name
    0x08 - float[3] - x1, y1, z1
    0x14 - float[3] - x2, y2, z2
    0x20 - dword - type
    0x24 - dword - island number
    0x28 - word - ?
    0x2A - word - ?
    0x2C - dword - ?
    0x30 - dword - ?
    0x34 - dword - ?
  0x2728 - another structures, crime report audio?
See also GTAModding page on ZONE

thehambone
  • thehambone

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

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

#63

Posted 14 January 2015 - 10:10 PM Edited by thehambone, 14 January 2015 - 10:10 PM.

Update on the 5th vehicle immunity:
The page on GTAGaming's opcode database for opcode 02AC suggests that the 5th immunity is Melee-proof. Interestingly, you can't melee vehicles in GTA III; that feature wasn't introduced until Vice City. I'm gonna load up VC and spawn a vehicle with the 5th immunity and see if it's Melee-proof.

fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • Poland
  • Best Conversion 2016 [GTA: Underground] [Contribution]
    Contribution Award [Mods]

#64

Posted 14 January 2015 - 10:16 PM

Later the streaming files were sequenced so we could control v2 flags using v1 data files by referencing the appropriate stream.

Maybe you'll find a list of IPL files useful http://gtaforums.com...ist-of-ipl-ids/

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]

#65

Posted 14 January 2015 - 10:35 PM Edited by Seemann, 14 January 2015 - 11:14 PM.

added block 12
        struct
        {
            DWORD   size;
            struct
            {
                CHAR    sig[4] <comment="ZNS">;
                DWORD   size;
                struct
                {
                    typedef struct
                    {
                        CHAR    m_szName[8];
                        RwV3D   m_vCoordA;
                        RwV3D   m_vCoordB;
                        enum<DWORD>{}   m_eZoneType <comment="0, 1, 2 or 3 for MapZone">;
                        ISLAND  m_eCurrentIsland;
                        WORD    m_wZoneInfoIdNight;
                        WORD    m_wZoneInfoIdDay;
                        INT32   unknown <comment="neighbour/inner/outer? zone index">;
                        INT32   unknown <comment="neighbour/inner/outer? zone index">;
                        INT32   unknown <comment="neighbour/inner/outer? zone index">;
                    } Zone;

                    DWORD   m_dwCurrentZoneIndex;
                    ISLAND  m_eCurrentIsland;
                    WORD    m_dwLastSearchZoneIndex <comment="index of last search invoked by a script">;
                    BYTE    align[2];
                    Zone    m_aZone[50] <comment="from gta3.zon">;
                    struct
                    {
                        WORD    m_waDensity[29];
                    } m_aZoneInfo[100] <comment="day/night pairs for each Zone">;
                    WORD    m_wZoneCount;
                    WORD    m_wZoneInfoCount;
                    Zone    m_aMapZone[25] <comment="from map.zon">;
                    struct
                    {
                        INT16    m_wZoneId;
                    } m_aAudioZone[36];
                    WORD    m_wMapZoneCount;
                    WORD    m_wAudioZoneCount;
                } data;
            } data;
        } block <name="Zones">;
what do that zone types mean? 0, 1, 2 (for gta3.zon), 3 (for map.zon)?

OrionSR
  • OrionSR

    Chain Game Development Team

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

#66

Posted 15 January 2015 - 12:06 AM Edited by OrionSR, 15 January 2015 - 12:27 AM.

 

Later the streaming files were sequenced so we could control v2 flags using v1 data files by referencing the appropriate stream.

Maybe you'll find a list of IPL files useful http://gtaforums.com...ist-of-ipl-ids/

 

Interesting, our index is yours +3. I don't know how to account for the difference. It's been a long time since I conducted this investigation and I've lost access to many of the notes. You will need to be more specific about "IPL IDs from unmodded GTA SA" as the sequence is different in unmodded v1 and unmodded v2. If both lists were available then it would be possible to control any flag of the other version. I have reference for the few flags I need to control.

 

Special Notes: I use this strategy all the time in the Chain Game saves - dozens or rounds without few issues. We use hybrid-IPL configurations (best I can do for standard scripts) since we have players with both versions, and take turns on who gets the barriers that round. Extra flags appear to cause no issues. Enabling v2 flags using v1 streams works as expected. Disabling streams other than the 5 standard objects for your version can leave strange lingering soft spot issues that persist in the save and/or memory in ways I have never be able to identify. I always restart the game after using this trick. It seems to help.

 

I need to look, but based on SE's questions I think the III and VC streams might be completely different in the save. I was never able to identify the changes to what I thought was IPL information in memory that are reflected in the simple flags in the save. I would like to be able to enable and disable streams in SA by index so I'm hoping the III and VC structures are more complete, closer to how things work in memory.

 

"File size must be 201820 BYTEs" - this should eventually be confirmed for III. SA will always write consistent file sizes but is willing, within reason, to verify the checksum integrity of saves that aren't the right size and has no problem loading them - until I got carried away but I don't remember the details.  Most SA save tool will reject saves that aren't the right size. SASE on the other hand can read many structures in SA Mobile v1.06 saves. Individual blocks break down due to things like more locals and an extra word in the object structure, but compatible blocks much later in the save continue to parse without issue.

 

I don't really need this, but I'm curious. I don't know the proper terms here but I'll forge ahead and let you guys correct me: How can I enumerate the bit flags to appear in-line in an expandable structure? I know this won't work, because I tried first and then looked up the data types, but something like:

    BIT Fire_01;
    BIT Ambulance_02;
    BIT Enforcer_04;
    BIT FBICar_08;
    BIT Rhino_10;
    BIT Barracks_20;
    BIT Police_40;
    BIT align;

I would like to encourage that the block documentation be renumbered to match the index of blocks in 010. This has been bothering me for a while but I finally have a valid argument.

 

Melee Damage: Interesting, How can we demonstrate the immunity in-game? Players will want to know or they won't care. How can we know for sure without an in-game observation?

 

Who is out of the loop if we abandon structure offsets for purely 010 reports of the save structure until we get things mapped out a little better? If the offsets should be required then I'll work up a spreadsheet function to calculate the offsets based on the data type. If I keep doing things by hand errors are bound to creep in.

 

I plan to start using the template as the standard for what is complete, but I'm not sure how long I can ignore the wiki. The plan of converting a template to wiki is starting to seem like a practical idea. I had a buddy that was great with this stuff; I think he used grep. If we could decide on a keyword format he could easily convert a raw report into formatted output, so I never learned the trick.

 

Anyway, my next step is to gather everything that's been roughed and isn't included in the template into one spot and then start hacking away at converting them to 010. I wouldn't be offended if Seemann followed up to prevent me from mangling his preferred labeling format.

 

Ooh, Objects might be the only draft left. Nice work Seemann. Did I botch that one up too badly?


thehambone
  • thehambone

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

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

#67

Posted 15 January 2015 - 02:22 AM Edited by thehambone, 15 January 2015 - 03:48 AM.

The template looks great! I've been meaning to update the GTAModding page but I've been getting sidetracked. I guess I could do that now. I'm going to follow what space did on VC's save file page and indent the tables.

It seems like the game does care about whether or not the file is 201820 bytes. I tried adding and removing 4 bytes from the end of the file (before the checksum) and updating the block size and checksum accordingly and the game showed a "Slot is corrupted" message. Perhaps Seemann can look in the executable for a definite confirmation.

More updates on 5th vehicle immunity
After some testing on VC, I've concluded that the 5th vehicle immunity is NOT Melee-proof. It took 60 hits with a hammer to make a car catch fire, whether the car had the elusive 5th immunity or not. It seems that, in VC at least, setting the collision-proof immunity on a car makes it melee-proof (technically, melee impacts are collisions). GTAG's opcode database probably only reflects SA's parameters for this particular opcode.
What could this immunity be? I've tried checking pop-proof tires (which is only possible from VC onwards), tip-proof, and heavy. It doesn't seem to be any of these. At this point, I would start to think the immunity is unused, but that wouldn't explain why so many cars have it:
securica,  1 1 0 0 1, Van Heist 
stretch,   1 1 1 1 1, Salvatores Called A Meeting
trash,     1 1 0 0 1, Blow Fish
cheetah,   1 1 1 0 1, Turismo
cheetah,   1 1 1 0 1, Turismo 
cheetah,   1 1 1 0 1, Turismo
rhino,     1 0 0 0 0, Arms Shortage
barracks,  1 0 0 0 0, Arms Shortage
bobcat,    1 1 1 0 1, Evidence Dash
patriot,   1 0 0 0 0, Marked Man
securica,  0 0 1 0 0, Escort Service
"Chopper", 1 1 1 1 1, The Exchange

OrionSR
  • OrionSR

    Chain Game Development Team

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

#68

Posted 15 January 2015 - 03:06 AM Edited by OrionSR, 15 January 2015 - 03:07 AM.

Legend:

AP (All Proof) - BP/DP/EP/FP
BP (Bullet Proof)
DP (Damage Proof)
EP (Explosion Proof)
FP (Fire Proof)
MP (Melle Proof)
WP (Water Proof)
TP (Tip Proof)
PP (Pop Proof)
UH (Unique Handling)
H (Heavy)
EC/UC (Exclusive Color/Unique Color)
PC (Permanent Color)
Unique (Refers to a one time only Vehicle)

A lot of these Properties only can be saved in LCS/VCS, though...

Militia provided these definitions suggesting only the BP FP EP CP (I argued about using DP, won't use it myself) properties are savable in III. The collectors offer no clues. My thoughts for what is not on the list might be bullet proof glass or armored gas caps. To be clear, is PP the 5th immunity in VC?

 

Thanks for the file size update. I tend to trust direct observation more than than anything else.


thehambone
  • thehambone

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

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

#69

Posted 15 January 2015 - 03:47 AM Edited by thehambone, 15 January 2015 - 03:50 AM.

My previous post was a bit unclear.
Tires don't pop in III; that feature was introduced in VC. Same goes for glass -- windshields don't shatter with gunfire in III and people can't be shot through the windshield in III. Gas caps were introduced in SA.

I was unable to determine what the 5th immunity was in VC either, though I didn't test extensively. It wasn't pop-proof, though.

spaceeinstein
  • spaceeinstein

    Chocolate

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

#70

Posted 15 January 2015 - 06:08 AM Edited by spaceeinstein, 15 January 2015 - 06:10 AM.

I think the documentation of the fifth proof was implied from the character's equivalent (opcode 02AB). Melee-proof works on characters. Does the fifth proof of vehicles as documented work in SA? Based on my wild guess, it could be related to the water. Here are a few interesting uses from Vice City:
Supply & Demand's Squalo (part 1): 1 1 1 0 0
Supply & Demand's Squalo (part 2): 0 1 1 1 0
The Driver's Sabre Turbo:          1 1 1 0 1

OrionSR
  • OrionSR

    Chain Game Development Team

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

#71

Posted 15 January 2015 - 06:40 AM Edited by OrionSR, 15 January 2015 - 10:03 AM.

Streaming Models

 

I'm sorry. As soon as I looked at the data in the streaming block I knew I made a mistake. I finally found the post fastman92 sent me with the original block names - the streaming block is called models in the SA docs.

 

The models block in SA remains a mystery. They look like flags. I suspect the strange soft spot issues mentioned in my IPL rant is related to this block, mostly because I've looked everywhere else, nothing else remains. All experiments with manipulating the model data has failed to produce any observable result, and re-saving results in normal looking data. hmvartak reported that the flags change as the player moves about the map but no pattern to the changes could be detected.

 

Added: My current hypothesis is that there might be a correspondence by byte or bit with every object in IDE or IPL. An additional observation is that there is a lot more model data in the PS2 saves, and PS2 saves have a lot more streaming IPL files.

 

More: Comparing block size of normal saves with the block size of full map or stripped map mods might provide useful clues. When I converted a save created on PC to run on PS2 I just pasted PC data over a template PS2 save and left the model data untouched. Everything seemed to work as expected. Seems useless but that, finally, I think, is the summary of all of my experiments with models in SA saves.

 

Off-topic again: How can I enable and disable SA IPL streams by index? The goal is to dump sets of artificially streamed cargens using unused stream IDs. Also, how can I determine the stream ID for a set of coordinates so I can let artificially streamed cargens discard with the rest of the stream?

 

And an old challenge has been gnawing at me recently. When I first started trying to edit saves for the Chain Game I had a long discussion with pdescobar trying to convince me that I'd be much better off learning to code. He was right of course, but the nail in the coffin for hex editing was the challenge of launching threads. Now I'm wondering if I can finally control all elements of a save using only an editor. The thread structures aren't my forte; do you think it's technically possible to copy an active thread from one save to another?


thehambone
  • thehambone

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

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

#72

Posted 15 January 2015 - 07:50 PM

I added garages to the GTAModding article. Something came across my mind when I was doing that: how should we document structures thar can appear a variable number of times in a particular block? Like garages, for instance. There are 27 defined in an unmodded save, which is dictated by the "garages_count" value at another offset in the block. When documenting, should we write "Garage[27]" or "Garage[garages_count]"? Should we call the data after the defined garages "align" or call it extra space for more garages?

Another thing crossed my mind: are there differences in gamesaves (slight or not) created by different versions of the .exe? I know San Andreas has an .exe version signature at the start of the gamesave, III does not. From my experience, VC gamesaves created with .exe version 1.0 are not compatible with the Steam .exe.
This can be something we test at the end.

OrionSR
  • OrionSR

    Chain Game Development Team

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

#73

Posted 15 January 2015 - 10:37 PM Edited by OrionSR, 15 January 2015 - 11:46 PM.

Good question. I suggest trying different strategies in different sections to see what looks best. When in doubt, try to mirror the structure of the template as closely as possible. Ideally, readers will see a direct correspondence between the two documents - like it got converted by a processor.

 

This is how I chose to document something similar in the crane structure - for consideration, not yet a recommendation.

0x00    dword    block size
    0x00    dword    sub-block size
        0x00    dword    active cranes[6]
        0x04    dword    ev crane flags
        0x08    crane records[8] 128 bytes
            0x00  dword    m_dwStaticIndex
...

In this example,

active cranes[6] in suppose to imply 6 crane records with data in a standard save. Something like [standard=6] might be more descriptive.

crane records[8] is suppose to indicate a fixed set of 8 records. Something like [limit=8] might be used to describe a variable to be adjusted by a limits adjuster config file.

 

Garage[garages_count] is exactly how I'd handle a structure that varied by count. (Assuming were all happy with the labels.)

 

Version Differences:

 

Assume huge structural changes in saves created on different consoles. My current plan is to document a standard PC structure and support version differences with modified templates and notes. Immediate plans for III is to determine an identifier for PC and mobile saves so Samutz can clarify the labels on SnP. We should consider active support for mobile saves; it's current, players are active, and there's an application for what we learn.

 

In San Andreas PC the specific engine version makes almost no difference. If a "pure" v2 player downgrades just the engine only the file ID will change. The player can continue to use his v2 saves or switch to v1 scripts and play those old saves from when the game was new. The player might notice a few odd quirks in his v1 saves though. Barriers that should be on early saves are missing. There are giant blue hell holes at the crack factory and palace. That's because the v1 saves still have IPL flags based on GTA3.IMG v1, a huge file that's not easy to downgrade. Those three layers are the primary factors in SA saves - engine, script, and IPL.

 

I think it's safe to ignore IPL for III. There's no need to clarify now.

 

The SA v1 and v2 saves are almost the same. If Rockstar had fiddled with structures or globals it wouldn't be so easy to convert the saves. The size of main is a little different, but everything else that gets saved seems to be identical (or crash!), so tweak a few offsets to account for the size of main and everything works as expected (there's probably a bit more to it, but not much). Size of main has proved to be a key identifier for script versions. SnP is using this to detect v1 and v2 script versions, and I think he even added identifiers for All-In-One and TTDISA saves, maybe others.

 

PC to PS2 conversion: The structural differences are minor and easy to manage with a template to supply missing data and manual editing. The key trick to getting everything to work was using PS2 scripts on the PC engine to make the data to be copied to the PS2 save. There doesn't seem to be any practical application for this strategy. PS2 players don't download or edit saves due to the technical changes of moving saves between PS2 and PC. Nobody does this anymore, almost nobody ever did. SA Mobile saves have huge structural differences (more locals), so no hope of running mobile scripts on PC. And it's not needed, they've got cleo too.

 

Thanks for your support on the wiki. I appreciate your frustration with labels. For me the process is: better labels -> better understanding -> better labels, etc. I plan to defer to Seemann for a consistent though cryptic labeling system unless I think we've got something wrong, then I'll make up something that sounds like it fits and let Seemann cryptify it how he may. In the end I hope the cryptic labels can be converted fairly directly into clear comments. I recommend concentrating on the comments - try it, see what works. I figure the labels need to be more consistent; like keywords in a script.

 

Is it possible to add columns to the contents? Probably not but a new table would serve the same purpose. I'm looking for a way to track block progress by forum (I want to round out template drafts there), the template (I'm hoping Seemann will fix my drafts and make updates while I'm learning), and wiki (I'm not sure why I'm squeamish about the wiki).

 

And FYI, I'm a bit distracted and may not get back to serious hex editing for a few days, but I'm still with you. Don't feel bad about following your leads, you are picking up valuable skills quickly, but anything you can do to help organize the information would be appreciated.

 

Added: Would the wiki tables read better if headers were only used at the start of each block? After all, if the reader can't figure out the implied headers by context they aren't going to make sense of what follows.


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]

#74

Posted 15 January 2015 - 11:17 PM

Hey guys, thank you all for your hard work! I read every comment very carefully, but have not much time to handle them quick. I believe after all we could reveal some of the long-term mysteries for Vice City and San Andreas too, so keep it up!

OrionSR
  • OrionSR

    Chain Game Development Team

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

#75

Posted 17 January 2015 - 07:30 AM

The Save File Companion III

 

I started a companion topic in the player's forum so I have a place to ask game-play questions. My questions about cranes were cluttering their special vehicle topic. An interesting question from the collectors: How does the crusher crane make vehicles collision proof when no car immunity code is used? The videos show the player pulling a passenger out of the seat just as the crane starts to lift. The vehicle drops and they drive away with the immune car.


spaceeinstein
  • spaceeinstein

    Chocolate

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

#76

Posted 17 January 2015 - 02:23 PM Edited by spaceeinstein, 17 January 2015 - 02:38 PM.

what do that zone types mean? 0, 1, 2 (for gta3.zon), 3 (for map.zon)?

I've only tested on VC so far so I'm assuming III behaves the same way. If zones overlap each other, type 2 takes precedence over type 1 and type 1 takes precedence over type 0. Types 0, 1, 2 are for zone text and zone info stuff. Type 3 is for loading the island that you're in. Zone types are independent of the file name. So if a type 1 was defined in map.zon, the zone will be treated as the rest of the type 0, 1, 2, and a type 3 in gta3.zon will be treated as a type 3. In the save file, all types 0, 1, 2 are clumped with each other into one section and all type 3 is clumped into the other section. They're based on zone types rather than file names so maybe more accurate names are needed for those sections. I've swapped navig.zon and map.zon (new game required) and the save structure stayed similar.

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

#77

Posted 18 January 2015 - 11:11 AM Edited by Silent, 18 January 2015 - 11:24 AM.

You know what's the problem with including block size in the block structure?

On gtamodding, block size is included as a structure so you get things like
0x0034	word	SYSTEMTIME wYear
but in the EXE, offsets do not include block size
 
*(_DWORD *)&byte_715C28[48] = *(_DWORD *)&SystemTime;
so everything is 4b off.


EDIT:
Edited a gtamodding page with as much Block 0 documentation as I could figure out.

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]

#78

Posted 18 January 2015 - 11:59 AM Edited by Seemann, 18 January 2015 - 12:00 PM.

That's why I stopped to move the information in the GTAModding article while we are unsure how to properly describe it. The Garages section has the correct layout though.

Silent, yesterday I've updated the template with Misc values using the GTA 3 Mobile binary. I wasn't sure on the fields you named as compilation date and time. On what platforms they are actually used?

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

#79

Posted 18 January 2015 - 12:54 PM

On what platforms they are actually used?


No clue, probably not used in release at all.

OrionSR
  • OrionSR

    Chain Game Development Team

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

#80

Posted 18 January 2015 - 08:03 PM Edited by OrionSR, 18 January 2015 - 08:07 PM.

You know what's the problem with including block size in the block structure?

On gtamodding, block size is included as a structure so you get things like (...) but in the EXE, offsets do not include block size (...) so everything is 4b off.

I think everyone is in agreement on breaking sizes out of the contents of blocks and sub-blocks. Keeping the wiki up to date is a sticking point on the project. IMO, you should just make the wiki work the way it should - the way we really want it in the end rather than an opinion on what looks nice. The wiki structure should reflect the 010 template. The 010 template should be considered the master document for structure. Once the structure is mapped in 010 the offsets become irrelevant - it's all based on field size. What was critical information before is now something I need to update for others.

 

Is there a sizeless logical container structure for fields hidden in the exe? My current concept wants to put all fields in boxes, an array with one record. This would complicate the offsets but using the misc block as an example: File ID is a record with one field and is used in later games. System Info is a record not used in PS2. Misc is a consistent record in all version but fields may vary. I work with saves from all versions. What I'm looking for is: How can I enable and disable whole field structures without recalculating all the offsets?


thehambone
  • thehambone

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

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

#81

Posted 18 January 2015 - 10:02 PM Edited by thehambone, 18 January 2015 - 10:03 PM.

I've added Block 13: Car Generators to the wiki page. I'm still not sure if I should be using C data types or generics like WORD, DWORD, and BYTE though. I'm slowly working my way through the blocks and adding all known data to the wiki.

Seemann, your template looks fantastic! However I want to correct you on something. In the garages block, you imply that the StoredCars struct is arranged in the following way:
# Each line represents a StoredCar
 Garage   | Slot
==========+======
          | 1
          | 2
 Portland | 3
          | 4
          | 5
          | 6
----------+------
          | 1
          | 2
 Staunton | 3
          | 4
          | 5
          | 6
----------+------
          | 1
          | 2
Shoreside | 3
          | 4
          | 5
          | 6
This is not the case. I've found that its arranged like this:
# Each line represents a StoredCar
 Garage   | Slot
==========+======
 Portland |
 Staunton | 1
Shoreside |
----------+------
 Portland |
 Staunton | 2
Shoreside |
----------+------
 Portland |
 Staunton | 3
Shoreside |
----------+------
# ...and so on for a total of 18 slots
Offtopic:
Forgive me for sounding line a noob, but what methods are you guys using to decompile the mobile app? I've tried decompiling the .apk using apktool and I'm able to get some of the Java code used to launch the game and a few .so libraries. Are you guys decompiling the .so libraries as well? Or are you using an entirely different method?

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]

#82

Posted 18 January 2015 - 10:42 PM Edited by Seemann, 19 January 2015 - 12:57 AM.

Is there a sizeless logical container structure for fields hidden in the exe? My current concept wants to put all fields in boxes, an array with one record. This would complicate the offsets but using the misc block as an example: File ID is a record with one field and is used in later games. System Info is a record not used in PS2. Misc is a consistent record in all version but fields may vary. I work with saves from all versions. What I'm looking for is: How can I enable and disable whole field structures without recalculating all the offsets?

Sorry, I can't seem to understand your point correctly. Let's see: a save file consists of 'block's and there are 20 different blocks in. Each block has some size defined by a DWORD value directly before it. Also each block has different internal structure depending on how the exe dumps the information. This structure (a set of fields) could also vary on different game platforms (PC, PS2, Mobile), but still there is a size value before, so reading it you always know how much bytes you should skip to proceed to the next block. So basically each block has the following structure:
typedef struct block {
    DWORD   size;
    byte    data[size];
};
the way data is arranged depends on the position of the block: the first block (misc) has one structure, the second one another and so forth. To find a particular field you must read blocks one by one, reach that one containing the required field, check out what platform this save file is made for, and skip needed number of bytes using the appropriate block description. It seems that there is no other way to do that.
Is it your original intention?
 

Seemann, your template looks fantastic! However I want to correct you on something. In the garages block, you imply that the StoredCars struct is arranged in the following way:
(...) This is not the case. I've found that its arranged like this:(...)

In other words this is an array of 18 elements arranged like this:
0: portland slot 0
1: staunton slot 0
2: shoreside slot 0
3: portland slot 1
4: staunton slot 1
5: shoreside slot 1
...
15: portland slot 6
16: staunton slot 6
17: shoreside slot 6
Right?
 

Forgive me for sounding line a noob, but what methods are you guys using to decompile the mobile app? I've tried decompiling the .apk using apktool and I'm able to get some of the Java code used to launch the game and a few .so libraries. Are you guys decompiling the .so libraries as well? Or are you using an entirely different method?

.so libraries are decompilable with IDA.

OrionSR
  • OrionSR

    Chain Game Development Team

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

#83

Posted 19 January 2015 - 02:19 AM Edited by OrionSR, 19 January 2015 - 12:44 PM.

Nice work on the store garage structure. This is exactly the sort of thing I'm hoping you'll find with your in-game testing. Well done. These sorts of things are not mistakes though. The best available information was documented accurately. It's only a mistake if it passes quality control. Keep an eye out for opcodes that don't quite match descriptions. Sometimes you find that enable = 1 turns it off, it should really be disable = 1, or even toggle = 1 and the parameter is ignored. Or maybe they fixed the default descriptions to match mobile so there won't be so many surprises.

 

I'm pretty sure the SA save structure is like thehambone's description in the save and Seemann's description in memory.

 

Hypothesis (a hunch): All fields are part of an array. (An array may only include 1 record.)

 

Clues in exe: a variable naming structure such as sysytem.savename, system.wYear, system.wMonth, etc. then a distinct change to time.gamemin, time.weathertimer time.gamehour, etc. I think this breaks things down a little more than I'm really expecting though. ID, System, MIsc, and maybe some odd stuff in the unknown stuff at the end seem like the broader groupings within the block 0 header, records with fields of similar information. Other clues would be separate subroutines that write system info and misc data, or a nesting structure in the code.

 

My hunch is suggested by the c0de words in the SA mobile saves - extra words with a value of 0xC0DE. My hypothesis is that these words written at the start of each write command. The IPL byte flags are written de c0 00 de c0 01 de c0 00, but pickups are writed c0de+pickup record0, c0de+pickup record1, etc. - which totally shot my previous hypothesis that structures like pickups and markers is a dump of the whole pool at once. I don't yet have enough information to predict where all of the c0de words appear.

 

The application is that I would like to work with groups of fields in an editor and I'm looking for an inherent structure to organize the information. For example, save compare but ignore all system info, stats, and crane info with one check box for each group. Or making it easier to convert a PC template/wiki to PS2 without the system info - the offsets for the misc record wouldn't need to be adjusted as much. And I'm looking for clues to solve the c0de word riddle.

 

The offsets and values were mocked,

0x0000    dword    block size
    0x0000 systeminfo[1] 40? bytes
        0x0000 wchar_t[24]    save name 
        0x0034 	word 	SYSTEMTIME wYear
        0x0036 	word 	SYSTEMTIME wMonth
        0x0038 	word 	SYSTEMTIME wDayOfWeek
        (...)
    0x0060 misc[1] 220? bytes
        0x0000 	dword 	unknown
        0x0004 	enum 	current island (1=Portland; 2=Staunton; 3=Shoreside Vale)
        0x0008 	float[3] 	camera coordinates (x,y,z)
        (...)
    0x00C0    dword    sub-block size
    0x00C4    sub-block (threads)

Little Boxes: This analogy holds up better than I expected.

Save, Block Size, Block, Header, Sub-block size, Sub-block, Sub-header, Data Pool, Record, Array, Field, Checksum
Ferry, Truck License, Semi-truck, Tractor, Trailer License, Trailer, Tool Rack, Cargo Hold, Box, Box Stack, Thing, Displacement

In this analogy I work for the shipping company in charge of moving your things; all of the containers are ours, that's our specialty. We don't care what your things are but could look it up on the website if we were curious. We figure that if the ship weighs the same at the origin and destination then everything made the journey. We want to put all of your things in boxes. Should we put each thing in it's own box, everything in one box, different boxes based on type, or back in the doriginal boxes?


thehambone
  • thehambone

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

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

#84

Posted 19 January 2015 - 06:24 AM Edited by thehambone, 19 January 2015 - 06:32 PM.

In other words this is an array of 18 elements arranged like this:
*snip*
Right?

Yes, that's exactly what I'm saying.
 

 

Forgive me for sounding line a noob, but what methods are you guys using to decompile the mobile app? I've tried decompiling the .apk using apktool and I'm able to get some of the Java code used to launch the game and a few .so libraries. Are you guys decompiling the .so libraries as well? Or are you using an entirely different method?

.so libraries are decompilable with IDA.

 

That's what I figured. Thanks!
 

My hunch is suggested by the c0de words in the SA mobile saves - extra words with a value of 0xC0DE. My hypothesis is that these words written at the start of each write command. The IPL byte flags are written de c0 00 de c0 01 de c0 00, but pickups are writed c0de+pickup record0, c0de+pickup record1, etc. - which totally shot my previous hypothesis that structures like pickups and markers is a dump of the whole pool at once. I don't yet have enough information to predict where all of the c0de words appear.
 
The application is that I would like to work with groups of fields in an editor and I'm looking for an inherent structure to organize the information. For example, save compare but ignore all system info, stats, and crane info with one check box for each group. Or making it easier to convert a PC template/wiki to PS2 without the system info - the offsets for the misc record wouldn't need to be adjusted as much. And I'm looking for clues to solve the c0de word riddle.

I'm not sure I understand what you mean. Can you elaborate?

EDIT: Ok, I understand what you mean with the 0xC0DE values now (it helps when you aren't reading at 1:00 AM). So are you saying that, if III uses a 0xC0DE "system" like SA does, you want to try to map out where the game executes write() commands in the save so you can further divide up the data?


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]

#85

Posted 19 January 2015 - 08:10 AM Edited by Seemann, 19 January 2015 - 08:12 AM.

Hypothesis (a hunch): All fields are part of an array. (An array may only include 1 record.)

no. only fields explicitly named as arrays are written so. all the others are written independently of each other. say, game writes a dword value, then a single byte value, then falls into a loop dumping some pool, then a dword again. it's all done with separate write commands in the saving procedure. the reading from a save file is done in the same manner.

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

#86

Posted 19 January 2015 - 05:27 PM

Though in SA plenty of save blocks are fixed structures |classes, actually) with their Extract/Construct methods.

OrionSR
  • OrionSR

    Chain Game Development Team

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

#87

Posted 25 January 2015 - 07:01 PM

The 5th immunity has gained a lot off attention in the GTA III forums. The players have bashed about their vehicles in every manner they can think of and have failed to find anything that the flag might do. Everyone agrees it is not melee proof. At this point I feel they are trying to prove the 5th immunity does nothing; an impossible task from an observational perspective - trying to prove a negative. I think our only hope of learning something more is if an expert can take a closer look at the internal workings of this flag.

  • 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]

#88

Posted 27 January 2015 - 07:58 PM

Is there any save file with a non-empty block 3 (vehicles) for me to test?

thehambone
  • thehambone

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

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

#89

Posted 27 January 2015 - 09:00 PM

Is there any save file with a non-empty block 3 (vehicles) for me to test?

This gamesave has data in block 3.

This is the only one I've come across with data in block 3. It's a 100% complete save that I downloaded a few weeks ago.
  • Seemann 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]

#90

Posted 28 January 2015 - 10:45 PM Edited by Seemann, 28 January 2015 - 10:55 PM.

Whoa, thanks for the save. I've learned a lot from this one. This file stores information about four Rhinos left in different places of the map. Some of them drowned in water or destroyed but their chassis is still present!

I've spawned a few Rhinos using a cheat code and after reloading they were still there! So, the game saves spawned cars and boats(?).

I don't know if it only valid for Rhino, or any spawned vehicle (is only Rhino cheat-spawnable?), or any script vehicle which is unique (that is, no opcode 01C3 MARK_CAR_AS_NO_LONGER_NEEDED is applied)? Need to test.


Now, every single block in a save file is described, only internal fields left. We need to move all the information into the GTAModding.com article.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users