Fix critical menu files bug

Overwriting the originals is kinda bad, actually
This commit is contained in:
Mc-muffin
2024-12-08 12:44:56 -05:00
parent 7e9103435b
commit 1c8323c14a
3 changed files with 30 additions and 6 deletions

View File

@@ -72,6 +72,28 @@ def get_arguments(argv=None):
help="(Optional) - Insert only changed files not yet commited",
)
sp_extract.add_argument(
"--update-battle-subs",
required=False,
dest="update_subs",
action="store_true",
help="(Deprecated)",
)
sp_extract.add_argument(
"--update-subs",
required=False,
action="store_true",
help="(Optional) - Update Battle and Fmv Subs",
)
sp_extract.add_argument(
"--single-build",
required=False,
action="store_true",
help="(Optional) - Create just a single iso instead",
)
sp_insert = sp.add_parser(
"insert",
help="Take the new texts and recreate the files",

View File

@@ -238,7 +238,7 @@ class Theirsce(FileIO):
elif size_mask == 2:
value = top << 16 | self.read_uint16()
value = value | 0xFF000000 | 0xF80000 if signed else value
else: #if size_mask == 3:
elif size_mask == 3:
value = self.read_uint32()
# to signed

View File

@@ -269,7 +269,7 @@ class ToolsTOR(ToolsTales):
# sections.append(sub.off)
# Setup three-way opcode generator
d = TheirsceBaseInstruction(); d.type = InstructionType.INVALID
d = TheirsceBaseInstruction(0); d.type = InstructionType.INVALID
a,b,c = tee(theirsce.walk_code(), 3)
next(a, d)
next(b, d); next(b, d)
@@ -863,12 +863,14 @@ class ToolsTOR(ToolsTales):
f.write(data)
else:
dest_path = out_path / file_relpath
with FileIO(file_path, "r+b") as f:
data = self.get_new_menu(entry, f, xml_folder_path)
dest_path.parent.mkdir(parents=True, exist_ok=True)
with dest_path.open("wb") as f:
with FileIO(file_path, "r+b") as f:
data = f.read()
with FileIO(dest_path, "wb") as f:
f.write(data)
f.seek(0)
self.get_new_menu(entry, f, xml_folder_path)
def pack_menu_file(self, root, pools: list[list[int]], base_offset: int, f: FileIO, monster_hack: bool) -> None: