Extdata: Difference between revisions

Wwylele (talk | contribs)
TimmSkiller (talk | contribs)
 
(13 intermediate revisions by 7 users not shown)
Line 34: Line 34:
== Quota File ==
== Quota File ==


The inner data of <code>Quota.dat</code> is 0x48 bytes with the following format. The file seems to limit the extdata total size.
The inner data of <code>Quota.dat</code> is 0x48 bytes with the following format. The file applies limits to the file system, similar to quotas for other file systems.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 47: Line 47:
| 0x04
| 0x04
| 4
| 4
| Magic 0x30000
| Version, always 0x30000
|-
|-
| 0x08
| 0x08
| 4
| 4
| 0x1000, block size
| Block size. Always 0x1000.
|-
|-
| 0x0C
| 0x0C
| 4
| 4
| Always 126. Probably device directory capacity. See the [[#Device Directory Capacity]] more information.
| Maximum number of physical files in each physical directory. Always 126. See [[#Device Directory Capacity]] for more information.
|-
|-
| 0x10
| 0x10
| 4
| 4
| Always 0?
| padding
|-
|-
| 0x14
| 0x14
| 8
| Block count (capacity)
|-
| 0x1C
| 8
| Number of remaining blocks
|-
| 0x24
| 4
| 4
| Max number of blocks
| Current pending operation
{| class="wikitable" border="1"
! Value !! Description
|-
|-
| 0x18
| 0 || No pending operation.
| 4
|-
| Always 0?
| 1 || Physical file deletion is pending
|-
|-
| 0x1C
| 2 || Physical file resize is pending (redundant, see below note)
| 4
| Free blocks remained
|-
|-
| 0x20
| 3 || Physical subdirectory creation is pending
| 4
| Always 0?
|-
|-
| 0x24
| 4 || Physical subdirectory deletion is pending
| 4
|}
| Always 0?
|-
|-
| 0x28
| 0x28
| 4
| 8
| Equal or greater than the free blocks number?
| Number of available blocks (from offset 0x1C) at the time the above operation was queued (if any).
|-
| 0x2C
| 4
| Always 0?
|-
|-
| 0x30
| 0x30
| 4
| 8
| ID of most recently mounted Extdata image. Same as the one in [[Inner_FAT#Filesystem Header]]
| File ID that is related to the above operation info. Same as the one in [[Inner_FAT#Filesystem Header|Filesystem Header]]
|-
| 0x34
| 4
| Always 0?
|-
|-
| 0x38
| 0x38
| 4
| 8
| Always 0?
| File size of the above mentioned file. For resize, this is interpreted as the old file size.
|-
| 0x3C
| 4
| Always 0?
|-
|-
| 0x40
| 0x40
| 4
| 8
| ?
| For resize operations, the new file size to apply for the above mentioned file.
|-
|-
| 0x44
| 4
| Always 0?
|}
|}
The quota is implemented as follows:
* During initial Extdata creation with [[FS:CreateExtSaveData]], the input size limit is divided by the block size (0x1000). This becomes the block count (capacity).
* Each physical subdirectory (not to be confused with the inner virtual directories in the EXSV filesystem) counts one block towards the block quota.
** Every 126 files, a new physical subdirectory is created.
** This includes the initial physical subdirectory (00000000).
* Each physical subfile (= full DIFF container for a virtual file) counts its file size (rounded up to the quota block size) in blocks towards the block quota.
** This includes all initial physical subfiles, namely <code>icon</code> and the root EXSV filesystem file containing the [[Inner_FAT#Filesystem Header|Filesystem Header]].
** The physical subfile size is taken as the number of blocks corresponding to the physical subfile size rounded up to the block size as specified in the Quota.dat.
* Quota.dat itself is given one block.
Note: Extdata files do not support resizing after their initial creation, because each file is a separate, fixed-size DIFF container. The resize operation is therefore nonfunctional.


== Device Directory Capacity ==
== Device Directory Capacity ==
Line 272: Line 275:
|  
|  
|-
|-
| ?
| 00000516
| 00000517
| 00000517
| 00000518
| 00000518
Line 376: Line 379:
|-
|-
| ?
| ?
| ?
| 00001132
| 00001131
| 00001131
| Fantasy Life
| Fantasy Life
Line 388: Line 391:
|-
|-
| ?
| ?
| ?
| 000012c8
| 000012ca
| 000012ca
| Mario vs. Donkey Kong: Tipping Stars
| Mario vs. Donkey Kong: Tipping Stars
Line 435: Line 438:
|  
|  
|-
|-
| ?
| 000016C6
| ?
| ?
| 00001678
| 00001678
Line 448: Line 451:
|-
|-
| ?
| ?
| ?
| 0000198e
| 0000198f
| 0000198f
| Animal Crossing: New Leaf - Welcome amiibo
| Animal Crossing: New Leaf - Welcome amiibo
Line 459: Line 462:
|  
|  
|-
|-
| ?
| 00001a2c
| ?
| ?
| 00001a2e
| 00001a2e
Line 546: Line 549:
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 ===
== 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