wiithon.disc.structs.tmd_content module

One content entry of a Title Metadata block

A TMD ends with a list of these, one per content the title is made of. This module exposes TMDContent, which is read and written by TMD and is not meant to be built alone

On a disc the list holds a single entry, index 0, that stands for the whole encrypted partition data

Layout, 0x24 bytes:

Offset  Size    Field
0x00    0x04    Content ID
0x04    0x02    Index
0x06    0x02    Type (0x0001: Normal, 0x4001: DLC, 0x8001: Shared)
0x08    0x08    Size
0x10    0x14    SHA-1 hash

References

https://wiibrew.org/wiki/Title_metadata

class wiithon.disc.structs.tmd_content.TMDContent[source]

Bases: object

A single content descriptor of a TMD

The Wii uses this to know the size of a content and to check it against its hash before booting it

Note

Nothing is validated at read time.

id: int

Unique content identifier

index: int

Position of the content list

content_type: int

Content type. 0x0001 for normal, 0x4001 for DLC and 0x8001 for shared

size: int

Content size in bytes

hash: bytes

SHA1 of the content

classmethod read(stream)[source]

Read and parse a content entry from a binary stream

Parameters:

stream (BinaryIO) – Binary IO stream

Return type:

TMDContent

Returns:

The parsed entry

write(stream)[source]

Write the content entry to a binary stream at the current position

Parameters:

stream (BinaryIO) – Binary IO stream

Return type:

None

Note

size and hash are written as they are, nothing is recomputed. When building a disc they are patched afterwards on the serialised TMD by fakesign_tmd()