From 7ec521ab9dfb408fcd55daebdeef3e4a1399f919 Mon Sep 17 00:00:00 2001 From: Mc-muffin <8714476+Mc-muffin@users.noreply.github.com> Date: Tue, 8 Aug 2023 00:46:47 -0500 Subject: [PATCH] Add basic ASM patching --- pythonlib/games/ToolsTOR.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pythonlib/games/ToolsTOR.py b/pythonlib/games/ToolsTOR.py index 644cacb..f741890 100644 --- a/pythonlib/games/ToolsTOR.py +++ b/pythonlib/games/ToolsTOR.py @@ -21,7 +21,7 @@ from pythonlib.formats.theirsce import Theirsce from pythonlib.formats.theirsce_instructions import (AluOperation, InstructionType, TheirsceBaseInstruction) from .ToolsTales import ToolsTales - +import subprocess @dataclass class LineEntry: @@ -54,6 +54,7 @@ class ToolsTOR(ToolsTales): self.paths: dict[str, Path] = {k: base_path / v for k, v in jsonRaw["paths"].items()} self.main_exe_name = jsonRaw["main_exe_name"] + self.asm_file = jsonRaw["asm_file"] # super().__init__("TOR", str(self.paths["encoding_table"]), "Tales-Of-Rebirth") @@ -747,6 +748,18 @@ class ToolsTOR(ToolsTales): f.write_uint16_at(_l, val_lo) + def patch_binaries(self): + subprocess.run( + [ + str(self.paths["tools"] / "asm" / "armips.exe"), + str(self.paths["tools"] / "asm" / self.asm_file), + "-strequ", + "__SLPS_PATH__", + str(self.paths["temp_files"] / self.main_exe_name), + ] + ) + + def create_Node_XML(self, root, list_informations, section) -> None: strings_node = etree.SubElement(root, 'Strings') etree.SubElement(strings_node, 'Section').text = section