wiithon.disc.reader module
Read-only access to a Wii disc image
This module exposes WiiIsoReader, the entry point for inspecting an ISO
without modifying it. To modify one, see wiithon.disc.patcher
- class wiithon.disc.reader.WiiIsoReader(path)[source]
Bases:
objectRead-only view of a Wii disc image
Opening a reader parses the unencrypted disc header and the partition table immediately, then validates the Wii magic word. Partitions themselves are read lazily, only when
open_partition()is calledThe reader holds an open file handle for its whole lifetime. Use it as a context manager so the handle is released even when an error occurs
Example
>>> with WiiIsoReader("game.iso") as reader: ... partition = reader.open_partition(reader.get_data_partition()) ... data = partition.read_file("opening.bnr")
- Parameters:
path (
str)
- disc_header: DiscHeader
Unencrypted disc header, read from offset
0x000.
- partitions: List[WiiPartitionEntry]
Every entry of the partition table, in disc order
- get_data_partition()[source]
Return the DATA partition entry, which holds the game itself
- Return type:
- Returns:
The first DATA entry found, or
Noneif the disc has none
- get_update_partition()[source]
Return the UPDATE partition entry, which holds a system update
- Return type:
- Returns:
The first UPDATE entry found, or
None. An update partition is optional and many discs do not carry one
- get_partitions()[source]
Return every partition entry listed in the partition table
- Return type:
- Returns:
The entries in disc order, including types Wiithon cannot open yet such as CHANNEL
- read_region()[source]
Read the raw region bytes from the disc
- Return type:
- Returns:
The region block, read at its fixed offset
Note
This seeks the underlying file handle. The value is already cached in
regionat construction, so you rarely need to call this
- read_magic_word()[source]
Read the Wii magic word from its fixed offset
- Return type:
- Returns:
The 32-bit word stored at offset
0x4FFFC. A valid Wii disc yields0xC3F81A8E.
Note
This seeks the underlying file handle. The value is already validated and cached in
magic_wordat construction
- open_partition(entry)[source]
Decrypt a partition and load its file system table
This reads the partition header, the TMD and the certificate chain, then sets up AES decryption using the title key from the ticket. It finally reads the internal disc header and the FST from the decrypted data
- Parameters:
entry (
WiiPartitionEntry) – Partition table entry, obtained fromget_data_partition(),get_update_partition()orget_partitions()- Return type:
- Returns:
A
WiiPartitionInfogiving access to the files inside the partition
Warning
CHANNEL partitions are not supported yet
Note
The certificate chain is assumed to hold exactly three certificates, which covers every retail disc seen so far