In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "FST"

From WiiUBrew
Jump to navigation Jump to search
m (table classed for readability)
(Add info on file flags from Crediar's Cdecrypt source)
Line 1: Line 1:
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 image or file.
+
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.
 
It seems to be based on the Wii's FST format, but an extra header/cluster section was added.
Line 20: Line 20:
 
! Field !! Size !! Offset !! Description
 
! Field !! Size !! Offset !! Description
 
|-
 
|-
|Magic || 4 || 0 || always "FST" and a null byte
+
|Magic || 4 || 0 || always 0x46535400 ("FST" and a null byte)
 
|-
 
|-
 
|Secondary header size || 4 || 4 || (not sure)
 
|Secondary header size || 4 || 4 || (not sure)
Line 45: Line 45:
 
|Name Offset || 4 || 0 || Offset in bytes of the name of the file from the start of the nametable
 
|Name Offset || 4 || 0 || Offset in bytes of the name of the file from the start of the nametable
 
|-
 
|-
|Offset || 4 || 4 || Offset in sectors of the file in its storage cluster (multiply by 32 for byte offset)
+
|Offset || 4 || 4 || Offset of the file in its storage cluster: usually in sectors (multiply by 32 for byte offset); may be in bytes if the 0x4 bit in flags is set
 
|-
 
|-
 
|Size || 4 || 8 || Size of the file in bytes
 
|Size || 4 || 8 || Size of the file in bytes
 
|-
 
|-
| Storage cluster index || 4 || 12 || this field & 0xff is an index to the list of secondary headers
+
| Flags || 2 || 12 || 0x4: offset is in bytes, not sectors; 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.)
 
|}
 
|}
  
If the top bits of the name offset is set (&0xff000000), then this entry is a directory
+
If the top bits of the name offset is set (&0xff000000), then this entry is a directory.
  
In this case, the size corresponds to the number of entries this directory contains.
+
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 ==
 
== Nametable ==
Line 61: Line 63:
  
 
== External Links ==
 
== 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.
 
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
 
http://blog.delroth.net/2011/06/reading-wii-discs-with-python/ - some information on the Wii's FST format

Revision as of 21:07, 21 June 2015

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 0 always 0x46535400 ("FST" and a null byte)
Secondary header size 4 4 (not sure)
Secondary header count 4 8 Number of secondary headers in the FST

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

File/Directory entry

Each of these represents a file or a directory.

Size: 0x10 each

Field Size Offset Description
Name Offset 4 0 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 32 for byte offset); may be in bytes if the 0x4 bit in flags is set
Size 4 8 Size of the file in bytes
Flags 2 12 0x4: offset is in bytes, not sectors; 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.)

If the top bits of the name offset is set (&0xff000000), then this entry is a directory.

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