FST

From WiiUBrew
Jump to navigation Jump to search

The Filesystem Table, or FST, is a file present in Wii U disk images and downloaded content that describes the folders and files contained in the title.

It seems to be based on the Wii's FST format, but an extra header/cluster section was added.

All numbers are big-endian.

The file is composed of four sections:

  • the main header
  • a number of secondary headers describing storage clusters
  • a number of file and directory entries, beginning with the root directory
  • a table of null-terminated names

Main Header

Size: 0x20 bytes

Field Size Offset Description
Magic 4 0x0 always 0x46535400 ("FST" and a null byte)
File offset factor 4 0x4 The offset of the files needs to be multipied by this. Usually 0x20, but for some titles it's 0x01.
Secondary header count 4 0x8 Number of secondary headers in the FST
Unknown 2 0xC (0x0100)
Unknown 18 0xE Null bytes

Secondary header

Each of these entries describe the position of data on disk. For downloaded content, each corresponds to one entry from the TMD.

Size: 0x20 each

Field Size Offset Description
Offset 4 0 Offset in sectors on the current partition
Size 4 4 Size in sectors
Owner Title ID 8 8 Not in all entries, some are zeros.
Group ID 4 16 Not in all entries, some are zeros.
Unknown 2 20 Varies 0x0100/0x0200.
Unknown 10 22 Zeros.

File/Directory entry

Each of these represents a file or a directory.

Size: 0x10 each

Field Size Offset Description
Type 1 0 Zero for file entries, non-zero for directory entries
Name Offset 3 1 Offset in bytes of the name of the file from the start of the nametable
Offset 4 4 Offset of the file in its storage cluster: usually in sectors. Multiply by the file offset factor from the FST header.
Size 4 8 Size of the file in bytes
Flags 2 12 0x440: data contains SHA-1 hash
Storage cluster index 2 14 an index to the list of secondary headers. Additionally, for downloaded content, same as the content ID (an index into the title metadata's list of files.)

In this case, the size corresponds to the number of entries this directory contains, and the offset field corresponds to the parent directory's offset.

Nametable

Table of null-terminated filenames.

External Links

https://code.google.com/p/cdecrypt/source/browse/trunk/main.cpp - Crediar's CDecrypt tool that can parse FSTs from downloaded content

https://github.com/CarlKenner/dolphin/blob/WiiU/Source/Core/DiscIO/FileSystemWiiU.cpp - A fork of Dolphin by CarlKenner that can read WiiU disk images.

http://blog.delroth.net/2011/06/reading-wii-discs-with-python/ - some information on the Wii's FST format