Skip to content

Commit

Permalink
update Menu_Bg
Browse files Browse the repository at this point in the history
  • Loading branch information
fortiersteven committed Oct 15, 2024
1 parent db63797 commit b9ecd22
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
1_extracted/*
3_patched/*
4_builds/*
wip_*

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
2 changes: 2 additions & 0 deletions tools/pythonlib/Tales_Exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
10 changes: 10 additions & 0 deletions tools/pythonlib/ToolsTOH.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 5 additions & 1 deletion tools/pythonlib/formats/fps4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit b9ecd22

Please sign in to comment.