mirror of
https://github.com/NinjaCheetah/WiiPy.git
synced 2025-04-26 21:31:02 -04:00
Update WAD extraction code to name .apps correctly and work with current libWiiPy main
This commit is contained in:
parent
a6f660f627
commit
0f7c40a88f
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import struct
|
import binascii
|
||||||
from libWiiPy import wad, tmd, ticket, content
|
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()
|
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 = open(os.path.join(out_folder, cert_name), "wb")
|
||||||
cert_out.write(wad_data.get_cert_data())
|
cert_out.write(wad_data.get_cert_data())
|
||||||
cert_out.close()
|
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 = open(os.path.join(out_folder, tmd_name), "wb")
|
||||||
tmd_out.write(wad_data.get_tmd_data())
|
tmd_out.write(wad_data.get_tmd_data())
|
||||||
tmd_out.close()
|
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 = open(os.path.join(out_folder, ticket_name), "wb")
|
||||||
ticket_out.write(wad_data.get_ticket_data())
|
ticket_out.write(wad_data.get_ticket_data())
|
||||||
ticket_out.close()
|
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 = "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 = open(os.path.join(out_folder, content_file_name), "wb")
|
||||||
content_out.write(content_data.get_content(content_file, title_key))
|
content_out.write(content_data.get_content(content_file, title_key))
|
||||||
content_out.close()
|
content_out.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user