Save Files: Difference between revisions
→Folder Structure: Clarify location of save file content definitions |
mNo edit summary |
||
| (8 intermediate revisions by 3 users not shown) | |||
| Line 29: | Line 29: | ||
===Options=== | ===Options=== | ||
<code>option.sav</code> contains the settings set in the options menu (inverted camera, stick sensitivity etc.). The exact data stored here corresponds to the game flags defined in <code>Pack/Bootup.pack/GameData/savedataformat.ssarc/saveformat_*.bgsvdata</code>, where the <code>file_list</code> array's zero-index dictionary contains the <code>file_name</code> "option.sav" | <code>option.sav</code> contains the settings set in the options menu (inverted camera, stick sensitivity etc.). The exact data stored here corresponds to the game flags defined in <code>Pack/Bootup.pack//GameData/savedataformat.ssarc///saveformat_*.bgsvdata</code>, where the <code>file_list</code> array's zero-index dictionary contains the <code>file_name</code> "option.sav" | ||
===Album=== | ===Album=== | ||
| Line 40: | Line 40: | ||
Each save state contains 3 files: | Each save state contains 3 files: | ||
* caption.jpg A screenshot taken at the time of saving. | * caption.jpg A screenshot taken at the time of saving. | ||
* caption.sav Contains a small amount of data for each save that is displayed in the save select screen (e.g. time and location). The exact data stored here corresponds to the game flags defined in <code>Pack/Bootup.pack/GameData/savedataformat.ssarc/saveformat_*.bgsvdata</code>, where the <code>file_list</code> array's zero-index dictionary contains the <code>file_name</code> "caption.sav" | * caption.sav Contains a small amount of data for each save that is displayed in the save select screen (e.g. time and location). The exact data stored here corresponds to the game flags defined in <code>Pack/Bootup.pack//GameData/savedataformat.ssarc///saveformat_*.bgsvdata</code>, where the <code>file_list</code> array's zero-index dictionary contains the <code>file_name</code> "caption.sav" | ||
* game_data.sav The data for each save state. The exact data stored here corresponds to the game flags defined in <code>Pack/Bootup.pack/GameData/savedataformat.ssarc/saveformat_*.bgsvdata</code>, where the <code>file_list</code> array's zero-index dictionary contains the <code>file_name</code> "game_data.sav" | * game_data.sav The data for each save state. The exact data stored here corresponds to the game flags defined in <code>Pack/Bootup.pack//GameData/savedataformat.ssarc///saveformat_*.bgsvdata</code>, where the <code>file_list</code> array's zero-index dictionary contains the <code>file_name</code> "game_data.sav" | ||
==.sav Folder Format== | ==.sav Folder Format== | ||
All data in these files is stored as little endian on Switch and as big endian | All data in these files is stored as little endian on Switch and as big endian on Wii U. | ||
A save file (with the exception of files in the tracker folder) starts with the following header: | A save file (with the exception of files in the tracker folder) starts with the following header: | ||
| Line 94: | Line 94: | ||
!Offset !! Size !! Description | !Offset !! Size !! Description | ||
|- | |- | ||
| 0x00 || 4 || '''id''': ID of the data being stored, crc32 of the internal key | | 0x00 || 4 || '''id''': ID of the data being stored, crc32 hash of the internal key | ||
|- | |- | ||
|0x04 || 4 || '''value''' | |0x04 || 4 || '''value''' | ||
|} | |} | ||
The first four bytes in each 8 byte chunk are the ID. The ID is the '''crc32 hash of the internal key'''; the internal key being the <code>dataName</code> given to the value - defined in the <code>.bgsvdata</code> files. For example the <code>dataName</code> for rupees is <code>CurrentRupee</code>, making the ID <code>588553208</code> (s32) - represented by these four bytes <code>0x23149bf8</code> in the raw file. The s32 data for this particular value is stored in the next four bytes of the chunk. | |||
In <code>Pack/Bootup.pack//GameData/savedataformat.ssarc///saveformat_*.bgsvdata</code>, the game stores a mapping for each ID to the corresponding entry name. This name is then further defined in one of the files in <code>Pack/Bootup.pack//GameData/gamedata.ssarc//*</code>, depending on its data type. | |||
Strings are stored with the maximum possible number of characters (e.g. 256 characters for strings defined in string256_data_0.bgdata) and are broken up into 4-byte parts. These are then stored in sequential chunks with the ID repeating for each chunk. | |||
For arrays, the data is also stored in sequential chunks, each with an identical ID. | |||
Inventory items are stored in <code>PorchItem</code> with a maximum of 420 internal string identifiers, e.g. <code>Weapon_Sword_023 | Horse names (<code>Horse_UserName</code>), for example, will take up (6 names × 16 chunks per name =) 96 chunks with the ID <code>0x7b74e117</code> in the save file. Since horse names are stored as <code>string64_array_data</code>, that's 64 UTF-8 bytes per name. The <code>Horse_UserName</code> array has a maximum size of '''six''' <code>string64</code> names. The array will always occupy (6 names × 16 chunks per name x 4 bytes per chunk =) 384 bytes of string data, alongside 384 bytes of IDs (one 4-byte ID before every 4-byte data chunk), making the entire array '''768 bytes'''. | ||
''Note: even if the horse name has 64 characters in the save file, the name may be truncated when displayed on UI elements.'' | |||
Data types for '''value''' include: | |||
<ul> | |||
<li>bool</li> | |||
<li>s32 (int32)</li> | |||
<li>f32 (float32)</li> | |||
<li>string32 (string)</li> | |||
<li>string64</li> | |||
<li>string256</li> | |||
<li>vector2f</li> | |||
<li>vector3f</li> | |||
<li>vector4f</li> | |||
</ul> | |||
and respective arrays: | |||
<ul> | |||
<li>bool_array</li> | |||
<li>s32_array</li> | |||
<li>f32_array</li> | |||
<li>string64_array</li> | |||
<li>string256_array</li> | |||
<li>vector2f_array</li> | |||
<li>vector3f_array</li> | |||
</ul> | |||
Value types are read as, and therefore must correspond to, the type defined in the<code>Pack/Bootup.pack//GameData/gamedata.ssarc/*</code> in the key of the main byml dictionary where the id is found. In the vanilla game, this often corresponds to the name of the file, itself, but this relationship is not strict. It therefore also may not be the case for files added by mods. | |||
Types defined in <code>Pack/Bootup.pack//GameData/gamedata.ssarc/*</code> that do not follow this rule are: | |||
<ul> | |||
<li>In <code>revival_bool_data_*.bgdata</code> the key is bool_data</li> | |||
<li>In <code>revival_s32_data_0.bgdata</code> the key is s32_data</li> | |||
<li>In <code>string32_data_0.bgdata</code> the key is string_data</li> | |||
</ul> | |||
Inventory items are stored in <code>PorchItem</code> with a maximum of 420 internal string identifiers, e.g. <code>Weapon_Sword_023</code>. Associated arrays of <code>PorchEquip</code>: boolean and <code>PorchItem_Value1</code>: int32 store if the item is equipped and its current durability * 100 or item count. Swords, Bows and Shields also store their modifier key in <code>PorchSword_FlagSp</code>: uint32 and modifier value <code>PorchSword_ValueSp</code>: int32. Similar Flag and Value exist for the Bows and Shields. <code>FlagSp</code> modifiers can take any or all of the following values. | |||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ | ||
| Line 140: | Line 179: | ||
|0x80000000 | |0x80000000 | ||
|} | |} | ||
Associated data with Cooked Items are held in <code>CookEffect0 | Associated data with Cooked Items are held in <code>CookEffect0</code>: vector2f, <code>CookEffect1</code>: vector2f, and <code>StaminaRecover</code>: vector2f arrays. Values within these arrays are | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ | ||
| Line 171: | Line 210: | ||
|EffectLevel | |EffectLevel | ||
|} | |} | ||
<references /> | Weather data with [[WorldMgr#Weather types|type data]] are found in <code>climateWeather</code> : int32_array, <code>climateWeather2</code>: int32_array and <code>climateWeather3</code> : int32_array. These values contain the weather for the next three in-game days. Arrays are 20 values in length map directly to climate values of each [[Map area]]. Each int32 value contains 6 packed [[WorldMgr#Weather types|WorldMgr]] weather types that each are 4 bits long (nibble, 0x0-0xF). These weather types identify are for each 4 hour long period during the day.<references /> | ||
[[Category:File_formats]] | [[Category:File_formats]] | ||