Line 223: |
Line 223: |
| == Directory Entry Table == | | == Directory Entry Table == |
| | | |
− | The directory entry table is an array of the entry type shown below. It describes the directory hierarchy of the file system. There are two variants of the directory entry type. | + | The directory entry table is an array of the entry type shown below. It describes the directory hierarchy of the file system. There are two variants of the directory entry type, and a dummy entry type. |
| | | |
| === Savegame/Extdata Variant=== | | === Savegame/Extdata Variant=== |
Line 317: |
Line 317: |
| | | |
| The 0-th entry of the array is always a dummy entry, which functions as the head of the dummy entry linked list. The 1-st entry of the array is always the root. Therefore maximum entry count is two more than maximum directory count. Dummy entries are left there when deleting directories, and reserved for future use. | | The 0-th entry of the array is always a dummy entry, which functions as the head of the dummy entry linked list. The 1-st entry of the array is always the root. Therefore maximum entry count is two more than maximum directory count. Dummy entries are left there when deleting directories, and reserved for future use. |
| + | |
| + | == File Entry Table == |
| + | |
| + | The file entry table is an array of the entry type shown below. It contains information for each file. There are three variants of the file entry type, and a dummy entry type. |
| + | |
| + | === Savegame Variant === |
| + | {| class="wikitable" border="1" |
| + | ! Offset |
| + | ! Length |
| + | ! Description |
| + | |- |
| + | | 0x00 |
| + | | 4 |
| + | | Parent directory index in directory entry table |
| + | |- |
| + | | 0x04 |
| + | | 16 |
| + | | ASCII file name |
| + | |- |
| + | | 0x14 |
| + | | 4 |
| + | | Next sibling file index. 0 if this is the last one |
| + | |- |
| + | | 0x18 |
| + | | 4 |
| + | | Padding |
| + | |- |
| + | | 0x1C |
| + | | 4 |
| + | | First block index in data region. 0x80000000 if the file is just created and has no data. |
| + | |- |
| + | | 0x20 |
| + | | 8 |
| + | | File Size |
| + | |- |
| + | | 0x28 |
| + | | 4 |
| + | | Padding? |
| + | |- |
| + | | 0x2C |
| + | | 4 |
| + | | Index of the next file in the same hash table bucket. 0 if this is the last one |
| + | |} |
| + | |
| + | === Extdata Variant === |
| + | {| class="wikitable" border="1" |
| + | ! Offset |
| + | ! Length |
| + | ! Description |
| + | |- |
| + | | 0x00 |
| + | | 4 |
| + | | Parent directory index in directory entry table |
| + | |- |
| + | | 0x04 |
| + | | 16 |
| + | | ASCII file name |
| + | |- |
| + | | 0x14 |
| + | | 4 |
| + | | Next sibling file index. 0 if this is the last one |
| + | |- |
| + | | 0x18 |
| + | | 4 |
| + | | Padding |
| + | |- |
| + | | 0x1C |
| + | | 4 |
| + | | Always 0x80000000 |
| + | |- |
| + | | 0x20 |
| + | | 8 |
| + | | Unique identifier |
| + | |- |
| + | | 0x28 |
| + | | 4 |
| + | | Padding? |
| + | |- |
| + | | 0x2C |
| + | | 4 |
| + | | Index of the next file in the same hash table bucket. 0 if this is the last one |
| + | |} |
| + | |
| + | === Title database Variant === |
| + | |
| + | {| class="wikitable" border="1" |
| + | ! Offset |
| + | ! Length |
| + | ! Description |
| + | |- |
| + | | 0x00 |
| + | | 4 |
| + | | Parent directory index in directory entry table |
| + | |- |
| + | | 0x04 |
| + | | 8 |
| + | | Title ID |
| + | |- |
| + | | 0x0C |
| + | | 4 |
| + | | Next sibling file index. 0 if this is the last one |
| + | |- |
| + | | 0x10 |
| + | | 4 |
| + | | Padding |
| + | |- |
| + | | 0x14 |
| + | | 4 |
| + | | First block index in data region. |
| + | |- |
| + | | 0x18 |
| + | | 8 |
| + | | File size |
| + | |- |
| + | | 0x20 |
| + | | 8 |
| + | | Padding? |
| + | |- |
| + | | 0x28 |
| + | | 4 |
| + | | Index of the next file in the same hash table bucket. 0 if this is the last one |
| + | |} |
| + | |
| + | === Dummy Entry === |
| + | Like directory entry table, file entry table also has some dummy entries: |
| + | |
| + | {| class="wikitable" border="1" |
| + | ! Offset |
| + | ! Length |
| + | ! Description |
| + | |- |
| + | | 0x00 |
| + | | 4 |
| + | | Current total entry count |
| + | |- |
| + | | 0x04 |
| + | | 4 |
| + | | Maximum entry count = maximum file count + 1 |
| + | |- |
| + | | 0x08 |
| + | | 36/32 |
| + | | Padding / All zero |
| + | |- |
| + | | 0x2C/0x28 |
| + | | 4 |
| + | | Index of the next dummy entry. 0 if this is the last one |
| + | |} |
| + | |
| + | The 0-th entry of the array is always a dummy entry, which functions as the head of the dummy entry linked list. Therefore maximum entry count is one more than maximum file count. Dummy entries are left there when deleting files, and reserved for future use. |
| | | |
| == File Allocation Table == | | == File Allocation Table == |