Fixed error message incorrectly being printed when downloading to a WAD

This commit is contained in:
Campbell 2024-07-20 17:48:00 -04:00
parent 7c4906f0db
commit 125ba4ea69
Signed by: NinjaCheetah
GPG Key ID: B547958AF96ED344
2 changed files with 16 additions and 15 deletions

View File

@ -106,20 +106,21 @@ def handle_nus_title(args):
title.content.content_list = content_list title.content.content_list = content_list
# Try to decrypt the contents for this title if a ticket was available. # Try to decrypt the contents for this title if a ticket was available.
if can_decrypt is True and output_dir is not None: if output_dir is not None:
for content in range(len(title.tmd.content_records)): if can_decrypt is True:
print(" - Decrypting content " + str(content + 1) + " of " + str(len(title.tmd.content_records)) + for content in range(len(title.tmd.content_records)):
" (Content ID: " + str(title.tmd.content_records[content].content_id) + ")...") print(" - Decrypting content " + str(content + 1) + " of " + str(len(title.tmd.content_records)) +
dec_content = title.get_content_by_index(content) " (Content ID: " + str(title.tmd.content_records[content].content_id) + ")...")
content_file_name = hex(title.tmd.content_records[content].content_id)[2:] dec_content = title.get_content_by_index(content)
while len(content_file_name) < 8: content_file_name = hex(title.tmd.content_records[content].content_id)[2:]
content_file_name = "0" + content_file_name while len(content_file_name) < 8:
content_file_name = content_file_name + ".app" content_file_name = "0" + content_file_name
dec_content_out = open(output_dir.joinpath(content_file_name), "wb") content_file_name = content_file_name + ".app"
dec_content_out.write(dec_content) dec_content_out = open(output_dir.joinpath(content_file_name), "wb")
dec_content_out.close() dec_content_out.write(dec_content)
else: dec_content_out.close()
print("Title has no Ticket, so content will not be decrypted!") else:
print("Title has no Ticket, so content will not be decrypted!")
# If --wad was passed, pack a WAD and output that. # If --wad was passed, pack a WAD and output that.
if wad_file is not None: if wad_file is not None:

View File

@ -14,7 +14,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="WiiPy is a simple command line tool to manage file formats used by the Wii.") description="WiiPy is a simple command line tool to manage file formats used by the Wii.")
parser.add_argument("--version", action="version", parser.add_argument("--version", action="version",
version=f"WiiPy v1.2.0, based on libWiiPy v{version('libWiiPy')} (from branch \'main\')") version=f"WiiPy v1.2.1, based on libWiiPy v{version('libWiiPy')} (from branch \'main\')")
subparsers = parser.add_subparsers(dest="subcommand", required=True) subparsers = parser.add_subparsers(dest="subcommand", required=True)
# Argument parser for the WAD subcommand. # Argument parser for the WAD subcommand.