Savegames: Difference between revisions
Moosehunter (talk | contribs) No edit summary |
Moosehunter (talk | contribs) Core file system |
||
Line 702: | Line 702: | ||
|} | |} | ||
=== | === Save File Table === | ||
The save file table is similar to the RomFS file table, except the save file table uses linked lists instead of dictionaries. | |||
The table contains a list of directory entries and a list of file entries. Their respective types are:<br /> | |||
'''SaveFsList<SaveFileTableEntry<SaveDirectoryInfo>>'''<br /> | |||
'''SaveFsList<SaveFileTableEntry<SaveFileInfo>>''' | |||
==== Save File Table Entry ==== | |||
SaveFileTableEntry<class T> | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 716: | Line 722: | ||
| 0x00 | | 0x00 | ||
| 4 | | 4 | ||
| | | Next entry index. A value of 0 indicates the end of the list. | ||
|- | |- | ||
| 0x04 | | 0x04 | ||
| | | sizeof(T) | ||
| | | Value of type T. | ||
|- | |||
|} | |||
==== Save File Info ==== | |||
Holds the information of a single file. | |||
{| class="wikitable" | |||
|- | |- | ||
! Start | |||
! Length | |||
! Description | |||
|- | |- | ||
| | | 0x00 | ||
| 4 | | 4 | ||
| | | Starting block index. | ||
|- | |- | ||
| | | 0x04 | ||
| 8 | | 8 | ||
| | | File length in bytes. | ||
|- | |- | ||
| | | 0x0C | ||
| 8 | | 8 | ||
| | | Reserved. | ||
|- | |||
|} | |||
==== Save Directory Info ==== | |||
Holds the information of a single directory. | |||
{| class="wikitable" | |||
|- | |||
! Start | |||
! Length | |||
! Description | |||
|- | |||
| 0x00 | |||
| 4 | |||
| First child directory index. 0 if none. | |||
|- | |- | ||
| | | 0x04 | ||
| 4 | | 4 | ||
| | | First child file index. 0 if none. | ||
|- | |||
| 0x08 | |||
| 0xC | |||
| Reserved. | |||
|- | |- | ||
|} | |} | ||
=== | === Save FS List === | ||
SaveFsList<class T> | |||
This is a linked list that is used internally by '''Save File Table''' as a key-value store. Integer/string pairs are used as keys. The list is represented as a single array so that it can be easily stored and read from a file. Entry indexes 0 and 1 are reserved. | |||
Index 0 is the start of a list containing all free entries. When an item in the list is removed, the entry it was using is added to this list for future reuse. | |||
Index 1 is the start of a list containing all currently used entries. | |||
The first 8 bytes of the list are used as follows. Indexes 0 and 1 are included in these counts. | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 757: | Line 798: | ||
| 0x00 | | 0x00 | ||
| 4 | | 4 | ||
| | | The size of the list. Freed entries that have not been reused are included in the count. | ||
|- | |- | ||
| 0x04 | | 0x04 | ||
| | | 4 | ||
| | | The current capacity of the list based on the number of bytes allocated. | ||
|- | |||
|} | |||
==== Save FS List Key ==== | |||
{| class="wikitable" | |||
|- | |||
! Start | |||
! Length | |||
! Description | |||
|- | |- | ||
| | | 0x00 | ||
| 4 | | 4 | ||
| | | 32-bit integer. | ||
|- | |- | ||
| | | 0x04 | ||
| | | 0x40 | ||
| | | 0x40-byte string. | ||
|- | |||
|} | |||
==== Save FS List Entry ==== | |||
{| class="wikitable" | |||
|- | |||
! Start | |||
! Length | |||
! Description | |||
|- | |- | ||
| | | 0x00 | ||
| | | 0x44 | ||
| | | Key. | ||
|- | |- | ||
| | | 0x44 | ||
| | | sizeof(T) | ||
| | | Value. | ||
|- | |- | ||
| | | 0x44 + sizeof(T) | ||
| 4 | | 4 | ||
| Next | | Next entry node index. A value of 0 indicates the end of the list. | ||
|- | |- | ||
|} | |} |