From 0f7c40a88f7d114f79baaed078f074c8e3506f6f Mon Sep 17 00:00:00 2001 From: NinjaCheetah <58050615+NinjaCheetah@users.noreply.github.com> Date: Tue, 5 Mar 2024 22:18:15 -0500 Subject: [PATCH] Update WAD extraction code to name .apps correctly and work with current libWiiPy main --- modules/wad.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/wad.py b/modules/wad.py index 42465a6..55c1617 100644 --- a/modules/wad.py +++ b/modules/wad.py @@ -3,7 +3,7 @@ import os import pathlib -import struct +import binascii from libWiiPy import wad, tmd, ticket, content @@ -23,24 +23,29 @@ def extract_wad_to_folder(in_file_input: str, out_folder_input: str): title_key = ticket_data.get_title_key() - cert_name = tmd_data.get_title_id() + ".cert" + cert_name = tmd_data.title_id + ".cert" cert_out = open(os.path.join(out_folder, cert_name), "wb") cert_out.write(wad_data.get_cert_data()) cert_out.close() - tmd_name = tmd_data.get_title_id() + ".tmd" + tmd_name = tmd_data.title_id + ".tmd" tmd_out = open(os.path.join(out_folder, tmd_name), "wb") tmd_out.write(wad_data.get_tmd_data()) tmd_out.close() - ticket_name = tmd_data.get_title_id() + ".tik" + ticket_name = tmd_data.title_id + ".tik" ticket_out = open(os.path.join(out_folder, ticket_name), "wb") ticket_out.write(wad_data.get_ticket_data()) ticket_out.close() - for content_file in range(0, tmd_data.get_num_contents()): + meta_name = tmd_data.title_id + ".footer" + meta_out = open(os.path.join(out_folder, meta_name), "wb") + meta_out.write(wad_data.get_meta_data()) + meta_out.close() + + for content_file in range(0, tmd_data.num_contents): content_file_name = "000000" - content_file_name += str(hex(content_file)) + ".app" + content_file_name += str(binascii.hexlify(content_file.to_bytes()).decode()) + ".app" content_out = open(os.path.join(out_folder, content_file_name), "wb") content_out.write(content_data.get_content(content_file, title_key)) content_out.close()