diff --git a/.gitignore b/.gitignore index 2a807b4..31c80af 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ 1_extracted/* 3_patched/* 4_builds/* +wip_* # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/tools/pythonlib/Tales_Exe.py b/tools/pythonlib/Tales_Exe.py index e55a762..edebd88 100644 --- a/tools/pythonlib/Tales_Exe.py +++ b/tools/pythonlib/Tales_Exe.py @@ -215,6 +215,7 @@ def getTalesInstance(args, game_name): if args.file_type == "Menu": #tales_instance.unpack_menu_files() tales_instance.extract_all_menu(keep_translations=True) + tales_instance.extract_menu_bg() elif args.file_type == "Iso": tales_instance.extract_Iso(args.iso.resolve()) @@ -231,6 +232,7 @@ def getTalesInstance(args, game_name): tales_instance.extract_Iso(args.iso.resolve()) tales_instance.decompress_arm9() tales_instance.decompress_overlays() + tales_instance.extract_menu_bg() tales_instance.extract_all_menu(keep_translations=True) tales_instance.extract_all_skits(args.replace) tales_instance.extract_all_story(args.replace) \ No newline at end of file diff --git a/tools/pythonlib/ToolsTOH.py b/tools/pythonlib/ToolsTOH.py index 682cdc1..03dda6e 100644 --- a/tools/pythonlib/ToolsTOH.py +++ b/tools/pythonlib/ToolsTOH.py @@ -665,6 +665,16 @@ def get_node_bytes(self, entry_node, pad=False) -> bytes: return bytes_entry + def extract_menu_bg(self): + file_name = 'MENU_BG' + base_path = self.paths['extracted_files'] / 'data' / 'menu' + fps4 = Fps4(detail_path=self.paths['original_files'] / f'data/menu/{file_name}.dat', + header_path=self.paths['original_files'] / f'data/menu/{file_name}.b') + + (base_path / file_name).mkdir(parents=True, exist_ok=True) + fps4.extract_files(destination_path= base_path / file_name, copy_path=self.paths['temp_files'] / 'menu', + decompressed=False) + def extract_all_skits(self, keep_translations=False): type = 'skit' base_path = self.paths['extracted_files'] / self.file_dict[type] diff --git a/tools/pythonlib/formats/fps4.py b/tools/pythonlib/formats/fps4.py index 6a8e0bb..59b4d48 100644 --- a/tools/pythonlib/formats/fps4.py +++ b/tools/pythonlib/formats/fps4.py @@ -130,10 +130,14 @@ def extract_files(self, destination_path:Path, copy_path:Path, decompressed=Fals shutil.copy(destination_path / file.name, copy_path / file.name) #Decompress using LZ10 or LZ11 - if decompressed: + if file.c_type == "LZ10": args = [Path.cwd() / 'tools/pythonlib/utils/lzss', '-d', destination_path / file.name] subprocess.run(args, stdout = subprocess.DEVNULL) + elif file.c_type == "LZ11": + args = [Path.cwd() / 'tools/pythonlib/utils/lzx', '-d', destination_path / file.name] + subprocess.run(args, stdout=subprocess.DEVNULL) + with open(destination_path / file.name, 'rb') as f: head = f.read(4)