Savegames: Difference between revisions
Moosehunter (talk | contribs) No edit summary |
Moosehunter (talk | contribs) No edit summary |
||
Line 82: | Line 82: | ||
The final CMAC key used for this is generated using GenerateAesKek with a kek source and the device key, along with and LoadAesKey and a set key seed. | The final CMAC key used for this is generated using GenerateAesKek with a kek source and the device key, along with and LoadAesKey and a set key seed. | ||
=== DISF === | |||
This section contains information about the structure of the save file. | This section contains information about the structure of the save file. | ||
Line 265: | Line 265: | ||
|} | |} | ||
=== | === Duplex header === | ||
* Block sizes are stored as powers of 2 | |||
* Block sizes are | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 286: | Line 285: | ||
| 0x08 | | 0x08 | ||
| 8 | | 8 | ||
| | | Master bitmap offset | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
| 8 | | 8 | ||
| | | Master bitmap size | ||
|- | |- | ||
| 0x18 | | 0x18 | ||
| 4 | | 4 | ||
| | | Master bitmap block size power | ||
|- | |- | ||
| 0x1C | | 0x1C | ||
| 8 | | 8 | ||
| | | Level 1 offset | ||
|- | |- | ||
| 0x24 | | 0x24 | ||
| 8 | | 8 | ||
| | | Level 1 size | ||
|- | |- | ||
| 0x2C | | 0x2C | ||
| 4 | | 4 | ||
| | | Level 1 block size power | ||
|- | |- | ||
| 0x30 | | 0x30 | ||
| 8 | | 8 | ||
| | | Level 2 offset | ||
|- | |- | ||
| 0x38 | | 0x38 | ||
| 8 | | 8 | ||
| | | Level 2 size | ||
|- | |- | ||
| 0x40 | | 0x40 | ||
| 4 | | 4 | ||
| | | Level 2 block size power | ||
|- | |- | ||
|} | |} | ||
=== | === Integrity verification header === | ||
* | * Offsets for levels 1-3 come from the metadata remap storage | ||
* Offsets for level 4 comes from the main data remap storage | |||
* This is the same header used in NCA files | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 341: | Line 342: | ||
|- | |- | ||
| 0x08 | | 0x08 | ||
| 4 | | 4 | ||
| | | Master hash size | ||
|- | |- | ||
| | | 0xC | ||
| 4 | | 4 | ||
| | | Number of levels (Unused in save files) | ||
|- | |- | ||
| | | 0x10 | ||
| | | 0x18*6 | ||
| Level | | Level information for up to 6 levels | ||
|- | |- | ||
| | | 0xA0 | ||
| | | 32 | ||
| | | Salt seed | ||
|- | |- | ||
| | |} | ||
==== Level information ==== | |||
* 0x18 bytes long | |||
* Block sizes are stored as powers of 2 | |||
{| class="wikitable" | |||
|- | |- | ||
! Start | |||
! Length | |||
! Description | |||
|- | |- | ||
| | | 0x00 | ||
| 8 | | 8 | ||
| | | Offset | ||
|- | |- | ||
| | | 0x08 | ||
| 8 | | 8 | ||
| | | Size | ||
|- | |- | ||
| | | 0x10 | ||
| 4 | | 4 | ||
| | | Block size power | ||
|- | |- | ||
| | | 0x14 | ||
| 4 | | 4 | ||
| Reserved | | Reserved | ||
|- | |- | ||
|} | |} | ||
==== | === Journal header === | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 434: | Line 402: | ||
| 0x04 | | 0x04 | ||
| 4 | | 4 | ||
| Magic Number (0x10000) | | Magic Number (0x10000 or less) | ||
|- | |- | ||
| 0x08 | | 0x08 | ||
| 8 | | 8 | ||
| | | Total size (Incl. journal) | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
| 8 | | 8 | ||
| | | Journal size | ||
|- | |- | ||
| 0x18 | | 0x18 | ||
| 8 | | 8 | ||
| | | Block size | ||
|- | |- | ||
| 0x20 | | 0x20 | ||
| 4 | | 4 | ||
| Unknown | | Unknown (Must be 0 or 1) | ||
|- | |- | ||
| 0x24 | | 0x24 | ||
| 4 | | 4 | ||
| | | Main data block count | ||
|- | |- | ||
| 0x28 | | 0x28 | ||
| 8 | | 8 | ||
| | | Journal block count | ||
|- | |- | ||
| | | 0x200 | ||
| | | | ||
| | | End | ||
|- | |- | ||
|} | |} | ||
=== | === Save FS header === | ||
* | * Structure is different than 3DS. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 486: | Line 454: | ||
| 0x08 | | 0x08 | ||
| 8 | | 8 | ||
| | | Number of blocks. Does not change if save file is resized. | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
| 8 | | 8 | ||
| | | Block Size | ||
|- | |||
| | |||
| | |||
| The below fields are read separately from the above fields | |||
|- | |- | ||
| 0x18 | | 0x18 | ||
| 8 | | 8 | ||
| | | Block size | ||
|- | |- | ||
| 0x20 | | 0x20 | ||
| 8 | | 8 | ||
| | | FAT offset | ||
|- | |||
| 0x28 | |||
| 4 | |||
| FAT entry count | |||
|- | |||
| 0x2C | |||
| 4 | |||
| Padding | |||
|- | |||
| 0x30 | |||
| 8 | |||
| Data offset | |||
|- | |||
| 0x38 | |||
| 4 | |||
| Data block count | |||
|- | |||
| 0x3C | |||
| 4 | |||
| Padding | |||
|- | |||
| 0x40 | |||
| 8 | |||
| Directory table block index | |||
|- | |||
| 0x48 | |||
| 8 | |||
| File table block index | |||
|- | |- | ||
|} | |} | ||
=== RMAP === | |||
* There are generally two RMAP blocks in sequence. | * There are generally two RMAP blocks in sequence. |