Extdata: Difference between revisions
→Tools: old extdata_tool is a dead link; Add new tools |
→SD Extdata: Add Swapnote JPN ExtdataID |
||
(13 intermediate revisions by 7 users not shown) | |||
Line 29: | Line 29: | ||
* Device file with <code>SubDirID = SubFileID = 00000000</code> doesn't exist. Other ID combinations can exists. | * Device file with <code>SubDirID = SubFileID = 00000000</code> doesn't exist. Other ID combinations can exists. | ||
* Device file with <code>SubDirID = 00000000</code> and <code>SubFileID = 00000001</code> is the VSXE metadata file and must exist. | * Device file with <code>SubDirID = 00000000</code> and <code>SubFileID = 00000001</code> is the VSXE metadata file and must exist. | ||
* Other files, besides <code>Quota.dat</code> and <code>00000000/00000001</code>, are normal sub files, are these device files one-to-one correspond to virtual files. | * Other files, besides <code>Quota.dat</code> and <code>00000000/00000001</code>, are normal sub files, are these device files one-to-one correspond to virtual files. They contain raw virtual file data in the DIFF inner content. | ||
* <code>SubDirID = 00000000</code> is usually the only one device directory that can be seen. See [[#Device Directory Capacity]] for more information. | * <code>SubDirID = 00000000</code> is usually the only one device directory that can be seen. See [[#Device Directory Capacity]] for more information. | ||
== Quota File == | == Quota File == | ||
The inner data of <code>Quota.dat</code> is 0x48 bytes with the following format. The | The inner data of <code>Quota.dat</code> is 0x48 bytes with the following format. The file seems to limit the extdata total size. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 51: | Line 51: | ||
| 0x08 | | 0x08 | ||
| 4 | | 4 | ||
| 0x1000, block size | | 0x1000, block size | ||
|- | |- | ||
| 0x0C | | 0x0C | ||
Line 57: | Line 57: | ||
| Always 126. Probably device directory capacity. See the [[#Device Directory Capacity]] more information. | | Always 126. Probably device directory capacity. See the [[#Device Directory Capacity]] more information. | ||
|- | |- | ||
| | | 0x10 | ||
| 4 | | 4 | ||
| | | Always 0? | ||
|- | |- | ||
| | | 0x14 | ||
| 4 | | 4 | ||
| | | Max number of blocks | ||
|- | |- | ||
| 0x18 | | 0x18 | ||
| 4 | | 4 | ||
| | | Always 0? | ||
|- | |- | ||
| 0x1C | | 0x1C | ||
| 4 | | 4 | ||
| | | Free blocks remained | ||
|- | |- | ||
| 0x20 | | 0x20 | ||
| | | 4 | ||
| | | Always 0? | ||
|- | |||
| 0x24 | |||
| 4 | |||
| Always 0? | |||
|- | |- | ||
| 0x28 | | 0x28 | ||
| 4 | | 4 | ||
| | | Free blocks remained + (blocks occupied by the recently mounted file, specified by the ID below (0 if recently deleted)) | ||
|- | |- | ||
| 0x2C | | 0x2C | ||
| 4 | | 4 | ||
| | | Always 0? | ||
|- | |- | ||
| 0x30 | | 0x30 | ||
| 4 | | 4 | ||
| | | ID of most recently mounted file. Same as the one in [[Inner_FAT#Filesystem Header]] | ||
|- | |- | ||
| 0x34 | | 0x34 | ||
| 4 | | 4 | ||
| | | Always 0? | ||
|- | |- | ||
| 0x38 | | 0x38 | ||
| 4 | | 4 | ||
| | | Always 0? | ||
|- | |- | ||
| | | 0x3C | ||
| 4 | | 4 | ||
| | | Always 0? | ||
|- | |- | ||
| | | 0x40 | ||
| 4 | | 4 | ||
| | | Size in bytes of most recently mounted file (device file size). 0 if recently deleted | ||
|- | |- | ||
| | | 0x44 | ||
| 4 | | 4 | ||
| | | Always 0? | ||
|} | |} | ||
== Device Directory Capacity == | |||
A device directory in an extdata (a <code><SubDirID></code> directory) seems to have a maximum number of device files it can contain. For SD extdata, this maximum number seems to be hard-coded as 126. For NAND extdata, the number is probably indicated by a field in Quota.dat, which is, again, always 126 as observed. 3DS FS tries to put all device files in the device directory <code>00000000</code> if possible, and only when more than 126 files needed to add, a second device directory <code>00000001</code> and so on are created. However, few extdata have such amount of files to store, so the behavior lacks of use cases to confirm. | |||
The number 126 is probably from some kind of other capacity of 128 with <code>"."</code> and <code>".."</code> entries reserved. It is theorized that this is to keep a FAT directory table, with 0x20 bytes for each entry, in one 0x1000 cluster. The motivation is unclear. | |||
== VSXE Filesystem == | |||
This is one variant of the [[Inner FAT|FAT filesystem]]. Please refer to its page for the description of the filesystem. In general, device file <code>00000000/00000001</code> contains the metadata of the filesystem, while other device files (except for the Quota file) contains normal sub-files | |||
This | |||
Each non-dummy file entry corresponds to a device file. The path to the device file is generated by the following computation: | Each non-dummy file entry corresponds to a device file. The path to the device file is generated by the following computation: | ||
Line 303: | Line 140: | ||
char extdata_path[...]; // ".../extdata/<ExtdataID-High>/<ExtdataId-Low>" | char extdata_path[...]; // ".../extdata/<ExtdataID-High>/<ExtdataId-Low>" | ||
char device_path[...]; // output path | char device_path[...]; // output path | ||
sprintf(device_path, "%s/%08x/%08x", extdata_path, SubDirID, SubFileID); | |||
</pre> | </pre> | ||
When mounting extdata, the unique identifier is used to match the ID stored in subfile's [[DISA and DIFF#DIFF header|DIFF header]]. If the ID doesn't match, mounting will fail. | When mounting extdata, the unique identifier is used to match the ID stored in subfile's [[DISA and DIFF#DIFF header|DIFF header]]. If the ID doesn't match, mounting will fail. | ||
Line 435: | Line 272: | ||
| | | | ||
|- | |- | ||
| | | 00000516 | ||
| 00000517 | | 00000517 | ||
| 00000518 | | 00000518 | ||
Line 539: | Line 376: | ||
|- | |- | ||
| ? | | ? | ||
| | | 00001132 | ||
| 00001131 | | 00001131 | ||
| Fantasy Life | | Fantasy Life | ||
Line 551: | Line 388: | ||
|- | |- | ||
| ? | | ? | ||
| | | 000012c8 | ||
| 000012ca | | 000012ca | ||
| Mario vs. Donkey Kong: Tipping Stars | | Mario vs. Donkey Kong: Tipping Stars | ||
Line 598: | Line 435: | ||
| | | | ||
|- | |- | ||
| | | 000016C6 | ||
| ? | | ? | ||
| 00001678 | | 00001678 | ||
Line 611: | Line 448: | ||
|- | |- | ||
| ? | | ? | ||
| | | 0000198e | ||
| 0000198f | | 0000198f | ||
| Animal Crossing: New Leaf - Welcome amiibo | | Animal Crossing: New Leaf - Welcome amiibo | ||
Line 622: | Line 459: | ||
| | | | ||
|- | |- | ||
| | | 00001a2c | ||
| ? | | ? | ||
| 00001a2e | | 00001a2e | ||
Line 709: | Line 546: | ||
Empty space is filled with 0xC-long sequences of 00 00 ... 07 | Empty space is filled with 0xC-long sequences of 00 00 ... 07 | ||
== Tools == | |||
* [https://github.com/wwylele/3ds-save-tool 3ds-save-tool] - Extract/verifies extdata | * [https://github.com/wwylele/3ds-save-tool 3ds-save-tool] - Extract/verifies extdata |