Line 18:
Line 18:
The authoritative source of information about the Wii's metadata layout is [http://git.infradead.org/users/segher/wii.git?a=blob;f=zestig.c Segher's zestig.c], but here is an attempt to describe that in English.
The authoritative source of information about the Wii's metadata layout is [http://git.infradead.org/users/segher/wii.git?a=blob;f=zestig.c Segher's zestig.c], but here is an attempt to describe that in English.
−
Each metadata "superblock" starts with the 4 magic bytes "SFFS", followed by a 4-byte "generation number" and another 4-byte number (always 0x10?). When accessing the FS, IOS will choose the superblock with the highest generation number and use it; whenever it modifies the filesystem in any way, it will increment the generation number by 1 and write out an entirely new superblock in the next slot (in round-robin order). This allows the history of the filesystem to be seen.
+
Each metadata "superblock" starts with the 4 magic bytes "SFFS" (probably short for Secure FAT FileSystem), followed by a 4-byte "generation number" and another 4-byte number (always 0x10?). When accessing the FS, IOS will choose the superblock with the highest generation number and use it; whenever it modifies the filesystem in any way, it will increment the generation number by 1 and write out an entirely new superblock in the next slot (in round-robin order). This allows the history of the filesystem to be seen.
The next 0x10000 bytes (bytes 0xc:0x1000c within the superblock) are 0x8000 2-byte cluster numbers, and comprise the FAT. The FAT is followed by the FST — the tree structure containing the directory hierarchy and (plaintext!) filenames.
The next 0x10000 bytes (bytes 0xc:0x1000c within the superblock) are 0x8000 2-byte cluster numbers, and comprise the FAT. The FAT is followed by the FST — the tree structure containing the directory hierarchy and (plaintext!) filenames.