From 5baf2de67c9308ea88d3e9d7b950dd959b071e98 Mon Sep 17 00:00:00 2001 From: Mc-muffin <8714476+Mc-muffin@users.noreply.github.com> Date: Mon, 22 May 2023 12:53:52 -0500 Subject: [PATCH] New Story insert code --- pythonlib/games/ToolsTOR.py | 52 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/pythonlib/games/ToolsTOR.py b/pythonlib/games/ToolsTOR.py index 6b5963f..3ca1ccb 100644 --- a/pythonlib/games/ToolsTOR.py +++ b/pythonlib/games/ToolsTOR.py @@ -512,25 +512,19 @@ class ToolsTOR(ToolsTales): return bytes_entry - def get_New_Theirsce(self, theirsce, scpk_file_name, destination): + def get_new_theirsce(self, theirsce: Theirsce, xml: Path) -> Theirsce: #To store the new text_offset and pointers to update new_text_offsets = dict() - - #Grab strings_offset for pointers - theirsce.read(12) - strings_offset = struct.unpack(" bytes: #Open the original SCPK with open( self.dat_archive_extract + "SCPK/" + scpk_file_name, 'r+b') as scpk: @@ -601,7 +590,7 @@ class ToolsTOR(ToolsTales): # f.write(data_uncompressed) #Update THEIRSCE uncompressed file - theirsce = self.get_New_Theirsce(io.BytesIO(data_uncompressed), scpk_file_name, self.story_XML_new) + theirsce = self.get_new_theirsce(io.BytesIO(data_uncompressed), scpk_file_name, self.story_XML_new) theirsce.seek(0) @@ -648,7 +637,7 @@ class ToolsTOR(ToolsTales): pak2_obj = pak2lib.get_data(pak2_data) #Generate the new Theirsce based on the XML and replace the original one - theirsce_io = self.get_New_Theirsce(io.BytesIO(pak2_obj.chunks.theirsce), os.path.basename(pak2_file_path).split(".")[0], self.skit_XML_new) + theirsce_io = self.get_new_theirsce(io.BytesIO(pak2_obj.chunks.theirsce), os.path.basename(pak2_file_path).split(".")[0], self.skit_XML_new) theirsce_io.seek(0) new_data = theirsce_io.read() pak2_obj.chunks.theirsce = new_data @@ -830,13 +819,24 @@ class ToolsTOR(ToolsTales): output_elf.write(struct.pack("