wiithon.disc.partition module
Access to the contents of a decrypted disc partition
Instances of WiiPartitionInfo are produced by
wiithon.disc.reader.WiiIsoReader.open_partition(). They are not meant to be
built directly
- class wiithon.disc.partition.WiiPartitionInfo(header, tmd, certificates, internal_header, fst, crypto, partition_offset)[source]
Bases:
objectA decrypted partition and everything it contains
All reads go through a
CryptPartReader, which decrypts blocks on demand. Nothing is held in memory beyond the file system table, so reading a large file costs a disc read, not a full partition decryption- Parameters:
header (
WiiPartitionHeader)tmd (
TMD)certificates (
List[Certificate])internal_header (
DiscHeader)fst (
FST)crypto (
CryptPartReader)partition_offset (
int)
- header: WiiPartitionHeader
Partition header, holding the ticket and the offsets to the TMD, certificates, H3 table and data
- certificates: List[Certificate]
The partition certificate chain
- internal_header: DiscHeader
Disc header found at offset
0x000of the decrypted data, also known asboot.bin. This is where the DOL and FST offsets live
- crypto: CryptPartReader
Decrypting reader used for every access to partition data
- read_file(path)[source]
Read a file from the partition
- Parameters:
path (
str) – Path inside the partition, using/as separator, for example"StageData/HeavensDoorGalaxy.arc"- Return type:
- Returns:
The decrypted file contents
- Raises:
FstFileNotFoundError – If no node matches
pathFstIsADirectoryError – If
pathresolves to a directory
- read_apploader()[source]
Read the apploader, the code that boots the game
The apploader header declares two payload sizes. Both are read along with the header itself
- Return type:
- Returns:
The complete apploader, header included
- read_dol()[source]
Read and parse the main executable
The DOL has no explicit size on disc, so it is computed as the furthest end of any text or data section declared in its header
- read_bi2()[source]
Read
bi2.bin, the disc configuration block that follows the header- Return type:
- Returns:
The raw block, read at its fixed offset and size
- list_files(node=None, prefix='')[source]
List every file in the partition, recursively
Directories are traversed but not listed. Only files appear in the result
- Parameters:
- Return type:
- Returns:
Full paths, using
/as separator
Note
nodeandprefixdrive the recursion and are not meant to be passed by callers. On a large disc the whole list is built in memory, so prefercallback_all_files()when you only need to walk it
- callback_all_files(callback, node=None)[source]
Walk every file in the partition and invoke a callback on each
Directories are traversed but never passed to the callback
- Parameters:
- Return type:
Note
The callback receives the node, not the full path. If you need paths, use
list_files()