wiithon.builder.source module
The contract a partition must fulfil to be written by the builder
- class wiithon.builder.source.PartitionSource[source]
Bases:
ABCDescribes where the content of one partition comes from
WiiDiscBuildernever reads a disc or a directory itself. It asks aPartitionSourcefor each piece it needs, in the order below, and writes what it gets backTwo implementations ship with the library:
CopyPartitionSourcereads from an existing ISODirectoryPartitionSourcereads from a directory tree
Implement this class to build a partition from anywhere else
Note
The builder calls the getters in this order:
get_partition_type(),get_ticket(),get_tmd(),get_certificates(),get_fst(),get_encrypted_header(),get_bi2(),get_apploader(),get_dol(), thenget_file_data()once per fileSee also
Patching a Wii ISO for the common cases that do not need a custom source
- abstractmethod get_partition_type()[source]
Return the type of the partition
- Return type:
- Returns:
A
WiiPartTypevalue
- abstractmethod get_tmd()[source]
Return the title metadata
- Return type:
- Returns:
The TMD. The builder rewrites its H3 hash, its data size and its signature padding before writing it, so the content hashes it carries do not need to be correct
- abstractmethod get_certificates()[source]
Return the certificate chain of the partition
- Return type:
- Returns:
The certificates, written back to back in the order given. Retail discs carries three
- abstractmethod get_encrypted_header()[source]
Return the disc header stored at offset 0 of the partition data
This is the internal header, also known as
boot.bin, not the unencrypted one at the start of the disc. The builder overwrites its DOL and FST offsets once it knows where those landed- Return type:
- Returns:
The header to place at the beginning of the partition data
- abstractmethod get_bi2()[source]
Return the BI2
- Return type:
- Returns:
The raw block, written at its fixed offset
- abstractmethod get_apploader()[source]
Return the apploader, the code that boots the game
- Return type:
- Returns:
The complete apploader, its own header included
- abstractmethod get_fst()[source]
Return the file system table of the partition
The tree drives everything that follows: the builder walks it to know which files to ask for, and rewrites the offset and length of each node once the data is placed
- Return type:
- Returns:
The tree of directories and files
- abstractmethod get_ticket()[source]
Return the ticket of the partition
The builder takes the title key from it to encrypt every block of partition data, so this is the first thing it needs
- Return type:
- Returns:
The ticket, written at offset 0 of the partition
- abstractmethod get_file_data(path)[source]
Return the content of one file
Called once per file found in the FST, in the order the builder writes them