From 079c7f91098ed84aebc58157280c09e53e3c7c02 Mon Sep 17 00:00:00 2001 From: NinjaCheetah <58050615+NinjaCheetah@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:52:24 -0400 Subject: [PATCH] Automatically fakesign WAD when using add/remove/set --- .gitignore | 2 ++ modules/title/wad.py | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/.gitignore b/.gitignore index 52c8dfb..9aa8e55 100644 --- a/.gitignore +++ b/.gitignore @@ -179,6 +179,8 @@ remakewad.pl content.map uid.sys SYSCONF +setting.txt +ciosmaps.xml # Also awful macOS files *._* diff --git a/modules/title/wad.py b/modules/title/wad.py index be35d6a..61f2698 100644 --- a/modules/title/wad.py +++ b/modules/title/wad.py @@ -66,6 +66,9 @@ def handle_wad_add(args): # Call add_content to add our new content with the set parameters. title.add_content(content_data, target_cid, target_type) + # Auto fakesign because we've edited the title. + title.fakesign() + out_file = open(output_path, 'wb') out_file.write(title.dump_wad()) out_file.close() @@ -180,6 +183,8 @@ def handle_wad_remove(args): if args.index not in valid_indices: raise ValueError("The provided content index could not be found in this title!") title.content.remove_content_by_index(args.index) + # Auto fakesign because we've edited the title. + title.fakesign() out_file = open(output_path, 'wb') out_file.write(title.dump_wad()) out_file.close() @@ -196,6 +201,8 @@ def handle_wad_remove(args): if target_cid not in valid_ids: raise ValueError("The provided Content ID could not be found in this title!") title.content.remove_content_by_cid(target_cid) + # Auto fakesign because we've edited the title. + title.fakesign() out_file = open(output_path, 'wb') out_file.write(title.dump_wad()) out_file.close() @@ -245,6 +252,8 @@ def handle_wad_set(args): title.set_content(content_data, args.index, content_type=target_type) else: title.set_content(content_data, args.index) + # Auto fakesign because we've edited the title. + title.fakesign() open(output_path, "wb").write(title.dump_wad()) print(f"Replaced content at content index {args.index}!") @@ -264,6 +273,8 @@ def handle_wad_set(args): title.set_content(content_data, target_index, content_type=target_type) else: title.set_content(content_data, target_index) + # Auto fakesign because we've edited the title. + title.fakesign() open(output_path, "wb").write(title.dump_wad()) print(f"Replaced content with Content ID \"{target_cid:08X}\"!")