SAVW (File Format): Difference between revisions
>Aruki (Making this because we just figured out what the logbook categories are and I'd rather save it now than forget and have to go digging through logs to find it later.) |
>Aruki No edit summary |
||
(24 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
The '''SAVW format''' | The '''SAVW format''' describes save data in the Metroid Prime series and Donkey Kong Country Returns. It allows any data used by the game's script data that needs to be preserved between play sessions to be saved and retrieved from the save file without the executable having to know anything about it. This is used for, for instance, saving whether a particular MemoryRelay has been activated, or whether a specific layer has been toggled on. | ||
__TOC__ | __TOC__ | ||
== Format == | == Format == | ||
The format is basically just a series of arrays. The structure remains more or less the same across every game, just with arrays being added or removed. The main difference between formats is that starting in Metroid Prime 3, the engine stores references to saved variables through a combination of a 128-bit state ID and an instance ID instead of implicitly associating them via instance IDs alone. The state ID is mirrored in another file (usually on the object via a property). | |||
{| class="wikitable" | |||
! Type | |||
! Count | |||
! Name | |||
! Notes | |||
! MP1 | |||
! MP2 | |||
! MP3 | |||
! DKCR | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Magic''' | |||
| Always <code>0xC001D00D</code>. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Version''' | |||
| [[#Version|See below]] for a list of possible version numbers. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Area Count''' | |||
| Number of areas contained in this world. Always 1 in DKCR. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Cinematic Skip Count''' | |||
| Count of skippable cinematics. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| [[#Saved State Descriptor|Saved State Descriptor]] | |||
| ''Cinematic Skip Count'' | |||
| '''Cinematic Skip Array''' | |||
| Array describing all skippable cinematics in the world. Points to Cinematic Skip SpecialFunctions (MP1) or cameras with cinematic skip enabled (MP2+). | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Memory Relay Count''' | |||
| Count of Memory Relay instances. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| [[#Saved State Descriptor|Saved State Descriptor]] | |||
| ''Memory Relay Count'' | |||
| '''Memory Relay Array''' | |||
| Array describing all Memory Relays in the world. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Layer Toggle Count''' | |||
| Count of layers that can be toggled on/off from this world. | |||
| {{check}} | |||
| {{check}} | |||
| {{nocheck}} | |||
| {{nocheck}} | |||
|- | |||
| [[#Layer Toggle|Layer Toggle]] | |||
| ''Layer Toggle Count'' | |||
| '''Layer Toggle Array''' | |||
| Array specifying every layer toggleable from this world (referenced by a ScriptLayerController). The layers specified can be in other worlds. | |||
| {{check}} | |||
| {{check}} | |||
| {{nocheck}} | |||
| {{nocheck}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Door Count''' | |||
| Count of DoorArea/Door instances. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{nocheck}} | |||
|- | |||
| [[#Saved State Descriptor|Saved State Descriptor]] | |||
| ''Door Count'' | |||
| '''Door Array''' | |||
| Array describing all DoorArea/Door instances in the world. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{nocheck}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Scannable Object Count''' | |||
| Count of scannable objects in the next array. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{nocheck}} | |||
|- | |||
| [[#Scannable Object|Scannable Object]] | |||
| ''Scannable Object Count'' | |||
| '''Scannable Object Array''' | |||
| Array describing every scannable object in this world. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{nocheck}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''System State Env Var Count''' | |||
| Count of system state env vars modified from this world. | |||
| {{nocheck}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| [[#Environment Variable|Environment Variable]] | |||
| ''System State Env Var Count'' | |||
| '''System State Env Var Array''' | |||
| Array of env vars affecting the entire system. | |||
| {{nocheck}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Game State Env Var Count''' | |||
| Count of game state env vars modified from this world. | |||
| {{nocheck}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| [[#Environment Variable|Environment Variable]] | |||
| ''Game State Env Var Count'' | |||
| '''Game State Env Var Array''' | |||
| Array of env vars affecting only this save slot. | |||
| {{nocheck}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Unmappable Object Count''' | |||
| Count of unmappable objects in the world. | |||
| {{nocheck}} | |||
| {{check}} | |||
| {{check}} | |||
| {{nocheck}} | |||
|- | |||
| [[#Saved State Descriptor|Saved State Descriptor]] | |||
| ''Unmappable Object Count'' | |||
| '''Unmappable Object Array''' | |||
| Array describing every instance that can be removed from the map. Primarily Translator Door Location SpecialFunctions in MP2 and Pickups in MP3. | |||
| {{nocheck}} | |||
| {{check}} | |||
| {{check}} | |||
| {{nocheck}} | |||
|- | |||
| u32 | |||
| 1 | |||
| '''Puzzle Piece Count''' | |||
| Count of Puzzle Piece Pickups in this world. (This value also controls the level puzzle piece count that displays on the HUD ingame.) | |||
| {{nocheck}} | |||
| {{nocheck}} | |||
| {{nocheck}} | |||
| {{check}} | |||
|- | |||
| [[#Saved State Descriptor|Saved State Descriptor]] | |||
| ''Puzzle Piece Count'' | |||
| '''Puzzle Piece Array''' | |||
| Array describing all Puzzle Piece Pickups. | |||
| {{nocheck}} | |||
| {{nocheck}} | |||
| {{nocheck}} | |||
| {{check}} | |||
|- | |||
| colspan=8 {{unknown|End of file}} | |||
|} | |||
=== Version === | |||
Each revision of the SAVW format has a unique version number, which corresponds to the following games: | |||
{| class="wikitable" | |||
! Version | |||
! Game | |||
|- | |||
| 0x3 | |||
| Metroid Prime | |||
|- | |||
| 0x5 | |||
| Metroid Prime 2: Echoes | |||
|- | |||
| 0x6 | |||
| Metroid Prime 3: Corruption | |||
|- | |||
| 0x8 | |||
| Donkey Kong Country Returns | |||
|} | |||
=== Saved State Descriptor === | |||
In Metroid Prime 1 and 2, saved state values were referenced only via the instance ID of the object that the state is for. In Prime 3 and DKCR, a 128-bit [[GUID]] was introduced that handles references to save file data, and is stored in the file in conjunction with the instance IDs. | |||
{| class="wikitable" | |||
! Type | |||
! Name | |||
! Notes | |||
! MP1 | |||
! MP2 | |||
! MP3 | |||
! DKCR | |||
|- | |||
| [[GUID]] | |||
| '''GUID''' | |||
| ID of this saved state. | |||
| {{nocheck}} | |||
| {{nocheck}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| u32 | |||
| '''Instance ID''' | |||
| Instance ID of the object that uses this saved state. | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
| {{check}} | |||
|- | |||
| colspan=7 {{unknown|End of descriptor}} | |||
|} | |||
=== Layer Toggle === | |||
{| class="wikitable" | |||
! Type | |||
! Name | |||
! Notes | |||
|- | |||
| u32 | |||
| '''Area ID''' | |||
| Internal area ID (not the MREA ID). | |||
|- | |||
| u32 | |||
| '''Layer Index''' | |||
| Index of the layer that can be toggled. | |||
|- | |||
| colspan=3 {{unknown|End of layer}} | |||
|} | |||
=== Scannable Object === | |||
{| class="wikitable" | |||
! Type | |||
! Name | |||
! Notes | |||
|- | |||
| Asset ID | |||
| '''SCAN Asset ID''' | |||
| Asset ID of a [[SCAN (Metroid Prime)|SCAN]] file. | |||
|- | |||
| u32 | |||
| '''Logbook Category''' | |||
| Enum describing which logbook category this scan is part of. Always 0 in MP2 and MP3. See below for possible values for MP1. | |||
|- | |||
| colspan=3 {{unknown|End of scan}} | |||
|} | |||
Possible logbook category values (MP1 only): | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 12: | Line 305: | ||
|- | |- | ||
| 0 | | 0 | ||
| | | Non-Logbook | ||
|- | |- | ||
| 1 | | 1 | ||
Line 21: | Line 314: | ||
|- | |- | ||
| 3 | | 3 | ||
| | | Creatures | ||
|- | |- | ||
| 4 | | 4 | ||
| Research | | Research | ||
|- | |||
| 5 | |||
| Artifacts | |||
|} | |||
=== Environment Variable === | |||
{| class="wikitable" | |||
! Type | |||
! Name | |||
! Notes | |||
|- | |||
| string | |||
| '''Variable Name''' | |||
| Name of the environment variable as a zero-terminated string. | |||
|- | |||
| u32 | |||
| {{unknown|Unknown}} | |||
| Always 0? | |||
|- | |||
| u32 | |||
| {{unknown|Unknown}} | |||
| Always 1? | |||
|- | |||
| u32 | |||
| {{unknown|Unknown}} | |||
| Always 0? | |||
|- | |||
| colspan=3 {{unknown|End of environment variable}} | |||
|} | |} | ||
[[Category:File Formats]] | |||
[[Category:Metroid Prime]] | |||
[[Category:Metroid Prime 2 Demo]] | |||
[[Category:Metroid Prime 2: Echoes]] | |||
[[Category:Metroid Prime 3 Prototype]] | |||
[[Category:Metroid Prime 3: Corruption]] | |||
[[Category:Donkey Kong Country Returns]] |
Latest revision as of 07:18, 5 February 2019
The SAVW format describes save data in the Metroid Prime series and Donkey Kong Country Returns. It allows any data used by the game's script data that needs to be preserved between play sessions to be saved and retrieved from the save file without the executable having to know anything about it. This is used for, for instance, saving whether a particular MemoryRelay has been activated, or whether a specific layer has been toggled on.
Format
The format is basically just a series of arrays. The structure remains more or less the same across every game, just with arrays being added or removed. The main difference between formats is that starting in Metroid Prime 3, the engine stores references to saved variables through a combination of a 128-bit state ID and an instance ID instead of implicitly associating them via instance IDs alone. The state ID is mirrored in another file (usually on the object via a property).
Type | Count | Name | Notes | MP1 | MP2 | MP3 | DKCR |
---|---|---|---|---|---|---|---|
u32 | 1 | Magic | Always 0xC001D00D .
|
✔ | ✔ | ✔ | ✔ |
u32 | 1 | Version | See below for a list of possible version numbers. | ✔ | ✔ | ✔ | ✔ |
u32 | 1 | Area Count | Number of areas contained in this world. Always 1 in DKCR. | ✔ | ✔ | ✔ | ✔ |
u32 | 1 | Cinematic Skip Count | Count of skippable cinematics. | ✔ | ✔ | ✔ | ✔ |
Saved State Descriptor | Cinematic Skip Count | Cinematic Skip Array | Array describing all skippable cinematics in the world. Points to Cinematic Skip SpecialFunctions (MP1) or cameras with cinematic skip enabled (MP2+). | ✔ | ✔ | ✔ | ✔ |
u32 | 1 | Memory Relay Count | Count of Memory Relay instances. | ✔ | ✔ | ✔ | ✔ |
Saved State Descriptor | Memory Relay Count | Memory Relay Array | Array describing all Memory Relays in the world. | ✔ | ✔ | ✔ | ✔ |
u32 | 1 | Layer Toggle Count | Count of layers that can be toggled on/off from this world. | ✔ | ✔ | ✖ | ✖ |
Layer Toggle | Layer Toggle Count | Layer Toggle Array | Array specifying every layer toggleable from this world (referenced by a ScriptLayerController). The layers specified can be in other worlds. | ✔ | ✔ | ✖ | ✖ |
u32 | 1 | Door Count | Count of DoorArea/Door instances. | ✔ | ✔ | ✔ | ✖ |
Saved State Descriptor | Door Count | Door Array | Array describing all DoorArea/Door instances in the world. | ✔ | ✔ | ✔ | ✖ |
u32 | 1 | Scannable Object Count | Count of scannable objects in the next array. | ✔ | ✔ | ✔ | ✖ |
Scannable Object | Scannable Object Count | Scannable Object Array | Array describing every scannable object in this world. | ✔ | ✔ | ✔ | ✖ |
u32 | 1 | System State Env Var Count | Count of system state env vars modified from this world. | ✖ | ✔ | ✔ | ✔ |
Environment Variable | System State Env Var Count | System State Env Var Array | Array of env vars affecting the entire system. | ✖ | ✔ | ✔ | ✔ |
u32 | 1 | Game State Env Var Count | Count of game state env vars modified from this world. | ✖ | ✔ | ✔ | ✔ |
Environment Variable | Game State Env Var Count | Game State Env Var Array | Array of env vars affecting only this save slot. | ✖ | ✔ | ✔ | ✔ |
u32 | 1 | Unmappable Object Count | Count of unmappable objects in the world. | ✖ | ✔ | ✔ | ✖ |
Saved State Descriptor | Unmappable Object Count | Unmappable Object Array | Array describing every instance that can be removed from the map. Primarily Translator Door Location SpecialFunctions in MP2 and Pickups in MP3. | ✖ | ✔ | ✔ | ✖ |
u32 | 1 | Puzzle Piece Count | Count of Puzzle Piece Pickups in this world. (This value also controls the level puzzle piece count that displays on the HUD ingame.) | ✖ | ✖ | ✖ | ✔ |
Saved State Descriptor | Puzzle Piece Count | Puzzle Piece Array | Array describing all Puzzle Piece Pickups. | ✖ | ✖ | ✖ | ✔ |
End of file |
Version
Each revision of the SAVW format has a unique version number, which corresponds to the following games:
Version | Game |
---|---|
0x3 | Metroid Prime |
0x5 | Metroid Prime 2: Echoes |
0x6 | Metroid Prime 3: Corruption |
0x8 | Donkey Kong Country Returns |
Saved State Descriptor
In Metroid Prime 1 and 2, saved state values were referenced only via the instance ID of the object that the state is for. In Prime 3 and DKCR, a 128-bit GUID was introduced that handles references to save file data, and is stored in the file in conjunction with the instance IDs.
Type | Name | Notes | MP1 | MP2 | MP3 | DKCR |
---|---|---|---|---|---|---|
GUID | GUID | ID of this saved state. | ✖ | ✖ | ✔ | ✔ |
u32 | Instance ID | Instance ID of the object that uses this saved state. | ✔ | ✔ | ✔ | ✔ |
End of descriptor |
Layer Toggle
Type | Name | Notes |
---|---|---|
u32 | Area ID | Internal area ID (not the MREA ID). |
u32 | Layer Index | Index of the layer that can be toggled. |
End of layer |
Scannable Object
Type | Name | Notes |
---|---|---|
Asset ID | SCAN Asset ID | Asset ID of a SCAN file. |
u32 | Logbook Category | Enum describing which logbook category this scan is part of. Always 0 in MP2 and MP3. See below for possible values for MP1. |
End of scan |
Possible logbook category values (MP1 only):
ID | Category |
---|---|
0 | Non-Logbook |
1 | Space Pirate Data |
2 | Chozo Lore |
3 | Creatures |
4 | Research |
5 | Artifacts |
Environment Variable
Type | Name | Notes |
---|---|---|
string | Variable Name | Name of the environment variable as a zero-terminated string. |
u32 | Unknown | Always 0? |
u32 | Unknown | Always 1? |
u32 | Unknown | Always 0? |
End of environment variable |