Jump to content

Save game file format?


Elodran

Recommended Posts

  • 1 month later...

I took some time to look at the FogGene's findings and to make my own observations on XCOM savegame format.

 

As I predicted, save format is quite similar to upk format. The main difference is that all the objects and names in savefile are stored directly as strings while in upk they are stored as name/object table indexes.

 

Objects are saved as a sequence of lzo packed chunks. Each chunk starts with usual "magic" - C1 83 2A 9E. After unpacking it reveals a structure, described by FogGene on me3explorer forum.

 

I want to make several corrections to his description, though.

 

Uncompressed save data starts with the list of names. First 4 bytes hold the number of string objects in the list (N), but the actual number of objects is N/2. I'll explain why.

 

Each object saved in that list has the following structure:

(string) Name (int) Numeric (string) PackageName (int) Numeric
This structure follows the same convention as name reference, used in upk: Name + Numeric define a unique instance name. The only difference is that Name is referenced with 4-byte index in upk and is saved as a string in savefile.

 

So, for each name in savefile name list, data format follows this pattern:

4 bytes integer - length of object name
null-terminated string - object name
4 bytes integer - numeric
4 bytes integer - length of package name
null-terminated string - package name
4 bytes integer - numeric
Numeric is decoded the same way as for upk: if numeric == 0, nothing is added to the name; if numeric > 0, numeric-1 is added to the name. Examples (URB_Bar):

WorldInfo_6:URB_Bar
StaticMeshActor_35:URB_Bar
StaticMeshActor_11:URB_Bar
StaticMeshActor_13:URB_Bar
LightmassImportanceVolume_0:URB_Bar
XComFloorVolume_7:URB_Bar
XComFloorVolume_11:URB_Bar
XComFloorVolume_12:URB_Bar
WordInfo_X is an instance of an object in the World, so I don't know why FogGene decided to nest all the other objects under WordInfo in his tool.

 

For whatever reason this list of names is repeated three times in the savefile: two times from the start and another one time later.

 

List of names is immediately followed by the saved properties for each of the object. Again, data format is essentially the same as DefaultPropertiesList format in upk with the difference that all the names are saved directly as strings.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...