libWiiPy.archive package#
Submodules#
libWiiPy.archive.ash module#
- libWiiPy.archive.ash.decompress_ash(ash_data: bytes, sym_tree_bits: int = 9, dist_tree_bits: int = 11) bytes #
Decompresses the data of an ASH file and returns the decompressed data.
With the default parameters, this function can decompress ASH files found in the files of the Wii Menu and Animal Crossing: City Folk. Some ASH files, notably the ones found in the WiiWare title My Pokémon Ranch, require setting dist_tree_bits to 15 instead for a successful decompression. If an ASH file is failing to decompress with the default options, trying a dist_tree_bits value of 15 will likely fix it. No other leaf sizes are known to exist, however they might be out there.
- Parameters:
ash_data (bytes) – The data for the ASH file to decompress.
sym_tree_bits (int, option) – Number of bits for each leaf in the symbol tree. Defaults to 9.
dist_tree_bits (int, option) – Number of bits for each leaf in the distance tree. Defaults to 11.
libWiiPy.archive.u8 module#
- class libWiiPy.archive.u8.U8Archive#
Bases:
object
- dump() bytes #
Dumps the U8Archive object into the raw data of a U8 archive.
- Returns:
The full U8 archive as bytes.
- Return type:
bytes
- load(u8_data: bytes) None #
Loads raw U8 data into a new U8 object. This allows for extracting the file and updating its contents.
- Parameters:
u8_data (bytes) – The data for the U8 file to load.
- libWiiPy.archive.u8.extract_u8(u8_data, output_folder) None #
Extracts the provided U8 archive file data into the provided output folder path. Note that the folder must not already exist to ensure that the output can correctly represent the file structure of the original U8 archive.
- Parameters:
u8_data (bytes) – The data for the U8 file to extract.
output_folder (str) – The path to a new folder to extract the archive to.
- libWiiPy.archive.u8.pack_u8(input_path, generate_imet=False, imet_titles: List[str] = None) bytes #
Packs the provided file or folder into a new U8 archive, and returns the raw file data for it.
- Parameters:
input_path – The path to the input file or folder.
generate_imet (bool, optional) – Whether an IMET header should be generated for this U8 archive or not. IMET headers are only used for channel banners (00000000.app). Defaults to False.
imet_titles (List[str], optional) – A list of the channel title in different languages for the IMET header. If only one item is provided, that item will be used for all entries in the header. Defaults to None, and is only used when generate_imet is True.
- Returns:
u8_archive – The data for the packed U8 archive.
- Return type:
bytes