GameData

From Luma's Workshop
Revision as of 18:47, 13 August 2025 by VTXG (talk | contribs) (Created page with "{{WIP}} In Super Mario Galaxy, save data is stored on the Wii's NAND, inside the file <code>GameData.bin</code>. == SMG1 == The file starts with a 16-byte long header. {| class="wikitable" !Offset !Size !Name !Description |- |0x0 |4 |Checksum |A checksum of the file's contents. |- |0x4 |4 |Version |Always 2. |- |0x8 |4 |Save Entry Count |The number of save entries inside this file. In SMG1, this value is 19. |- |0xC |4 |File Size |The size of this file, in bytes. |} Thi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This page is in progress and may contain incomplete information or editor's notes.

In Super Mario Galaxy, save data is stored on the Wii's NAND, inside the file GameData.bin.

SMG1

The file starts with a 16-byte long header.

Offset Size Name Description
0x0 4 Checksum A checksum of the file's contents.
0x4 4 Version Always 2.
0x8 4 Save Entry Count The number of save entries inside this file. In SMG1, this value is 19.
0xC 4 File Size The size of this file, in bytes.

This is followed up by a list of entry headers, each one with this structure:

Offset Size Name Description
0x0 12 Name The name of this entry.
0xC 4 Offset The offset to this entry's data.

In SMG1, the following entries can be found:

Name Description
mario1 - mario6 Mario save data.
luigi1 - luigi6 Luigi save data.
config1 - config6 Config save data shared between mario and luigi data.
sysconf Game save data shared across all save entries.

mario/luigi Data

The data starts with a Binary Chunk Holder Header with the following values:

Name Value Notes
Unknown 1
Chunk Count 6

GameDataPlayerStatus Section

This section stores information about the story progress, the star bit count, and the life count.
This section starts with a Binary Chunk Header with the following values:

Name Value Notes
Signature PLAY
Hash 0x27C90F Unknown hash.
Size 19

The actual data is structured as follows:

Offset Size Name Description
0x0 1 Story Progress The story progress value. Corresponds to the progressvalue of Unlabeled Table 1.
0x1 4 Star Bit Count The number of star bits owned.
0x5 2 Life Remaining The player's life count.

NOTE: The Life Remaining value is not used to set the mario's life count, but is instead used for 1-Up mail calculation. (This needs more research)

GameEventFlagStorage Section

This section stores game event flags. A complete list of events can be found in the Progress Checks page.
This section starts with a Binary Chunk Header with the following values:

Name Value Notes
Signature FLG1
Hash 0x65020442 Hash code of the string "2bytes/flag"
Size 126

This section's data is made up of multiple 2-byte numbers:

Offset Bit Count Name Description
0 1 Value If this flag is enabled or not.
1 15 Hash A shortened hash code of the flag's name.

StarPieceAlmsStorage Section

This section stores information about hungry lumas.
This section starts with a Binary Chunk Header with the following values:

Name Value Notes
Signature PCE1
Hash 0xF5DE1DC0 Hash code of the string "StarPieceAlmsStorage" multiplied by 32.
Size 44

The data is an array of 16 2-byte values, each one corresponding to the amount of star bits fed to hungry lumas.
TicoFat and TicoGalaxy use their Obj_arg7 to indicate what index they get/set their star bit count from, although TicoGalaxy uses Obj_arg7 + 8 for the index.
Due to TicoFat and TicoGalaxy having 7 occurrences each, this means that the values at index 7 and 15 go unused.
Furthermore, due to theTicoFat in StarEggRoadZone having an Obj_arg7 of -1, index 0 also goes unused.

SpinDriverPathStorage Section

This section stores information about launch star paths.
This section starts with a Binary Chunk Header with the following values:

Name Value Notes
Signature SPN1
Hash 0x12345679 Unknown hash.
Size 998

Todo.

GameEventValueStorage Section

This section stores game event values. A complete list of events can be found in the Progress Checks page.
This section starts with a Binary Chunk Header with the following values:

Name Value Notes
Signature VLE1
Hash 0x564C4531 The string "VLE1".
Size 112

This section's data is made up of key-value pairs:

Offset Size Name Description
0x0 2 Hash The hash of the event's name.
0x1 2 Value The value of this event.

GameDataAllGalaxyStorage Section

This section stores galaxy information, such as the collected power stars.
This section starts with a Binary Chunk Header with the following values:

Name Value Notes
Signature GALA
Hash 0xBF0640EE Unknown hash.
Size 874

This section uses the Binary Data Content system to write its data.
This section starts with a galaxy count:

Offset Size Name Description
0x0 2 Galaxy Count The number of galaxies. In SMG1, this value is 42.

Followed by a Binary Data Content header:

Name Value Notes
Attribute Count 4
Data Size 20

The Binary Data Content contains the following attributes:

Offset Size Name Description
0x0 2 mGalaxyName The name of the galaxy.
0x2 1 mPowerStarFlag The power star collection flags. Each bit corresponds to a power star.
0x3 1 mFirstPlayFlag Todo.
0x4 16 mMaxCoinNum Todo.

SMG2

Todo.

Binary Chunk System

To write save entry data, a system was created to read, write, and manage writing sub-sections of the data.

Binary Chunk Holder Header

A 4-byte header used throughout all save entries.

Offset Size Name Description
0x0 1 Unknown Always 1.
0x1 1 Chunk Count The number of chunks in the data.
0x2 2 Padding

Binary Chunk Header

A 12-byte header used for identifying the sub-sections of data.

Offset Size Name Description
0x0 4 Signature A 4-byte long ASCII string
0x4 4 Hash An additional identifier for the chunk.
0x8 4 Size The size of this chunk, in bytes, from the start of this header.

NOTE: The Hash value is not always a hash code, as some chunks simply use 1 as the value.

Binary Data Content

The save file's dynamic data serialization system. The data starts with a 8-byte long header.

Offset Size Name Description
0x0 2 Attribute Count The number of attributes in the data structure.
0x2 2 Data Size The size of the data structure.

This is followed by multiple attribute headers.

Offset Size Name Description
0x0 2 Hash The hash of the attribute's name.
0x2 2 Offset The offset from the start of the data structure.

As for the data, its structure is dinamically created by the attributes. Furthermore, multiple data structures can be written to the data buffer.

Tools

  • TKSaveEditor - A currently WIP tool by VTXG.