Save Files: Difference between revisions

Tderop (talk | contribs)
Added some information about dataName and CurrentRupee. Specified dataName for horse names (Horse_UserName) and corrected to say 64 bytes instead of 64 characters.
Tderop (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 99: Line 99:
|}
|}


The first four bytes 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.
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.
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.q. 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.
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. The horse names (<code>Horse_UserName</code>), for example, will take up 96 chunks - with the ID <code>0x7b74e117</code> in the save file. 6 names with 16 chunks = 64 bytes for each name.
For arrays, the data is also stored in sequential chunks, each with an identical ID.  


Data types for value include:
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>
<ul>