Skip to content

Reading WADs

Lillian Skinner edited this page Mar 3, 2024 · 1 revision

Get WAD type

The get_wad_type method returns the WAD type as a string. The returned value will either be be Is for a standard WAD, or ib for a boot2 WAD.

>>> import libWiiPy
>>> from libWiiPy import wad
>>>
>>> wad_file = open("path/to/file.wad", "rb").read()
>>> wad_data = wad.WAD(wad_file)
>>>
>>> wad_data.get_wad_type()
'Is'

In this example, wad_data is the input WAD byte stream.

Get file regions

The get_<example>_region methods return the regions for a given file in a WAD, returning decimal values as (offset, size)

Getting the certificate region would be done as follows:

>>> import libWiiPy
>>> from libWiiPy import wad
>>>
>>> wad_file = open("path/to/file.wad", "rb").read()
>>> wad_data = wad.WAD(wad_file)
>>>
>>> wad_data.get_cert_region()
(64, 2560)

In this example, wad_data is the input WAD byte stream.

Method: Purpose:
get_cert_region() Get the certificate region
get_crl_region() Get the crl region
get_ticket_region() Get the content ticket region
get_tmd_region() Get the TMD (title metadata) region
get_content_region() Get the content (app data) region

Get region data

The get_<example>_data methods return the region for a given file in a WAD. The returned value is a byte stream.

Getting the TMD would be done as follows:

>>> import libWiiPy
>>> from libWiiPy import wad
>>>
>>> wad_file = open("path/to/file.wad", "rb").read()
>>> wad_data = wad.WAD(wad_file)
>>>
>>> wad_data.get_tmd_data()
b'\x00\x01\x00\x01PKb\xd8\xc9\xe4\x...

In this example, wad_data is the input WAD byte stream.

Method: Purpose:
get_cert_data() Get the certificate data
get_crl_data() Get the crl data
get_ticket_data() Get the content ticket data
get_tmd_data() Get the TMD (title metadata) data
get_content_data() Get the content (app data) data

Clone this wiki locally