diff --git a/pythonlib/formats/FileIO.py b/pythonlib/formats/FileIO.py index c0cf891..380c0ac 100644 --- a/pythonlib/formats/FileIO.py +++ b/pythonlib/formats/FileIO.py @@ -35,6 +35,12 @@ class FileIO(object): def tell(self): return self.f.tell() + + def truncate(self, size=None): + if size is None: + self.f.truncate(self.f.tell()) + else: + self.f.truncate(size) def seek(self, pos, whence=0): self.f.seek(pos, whence) diff --git a/pythonlib/games/ToolsTOR.py b/pythonlib/games/ToolsTOR.py index f17536e..4bbab50 100644 --- a/pythonlib/games/ToolsTOR.py +++ b/pythonlib/games/ToolsTOR.py @@ -428,6 +428,7 @@ class ToolsTOR(ToolsTales): #Go at the start of the dialog #Loop on every Entry and reinsert theirsce.seek(theirsce.strings_offset + 1) + theirsce.truncate() nodes = [ele for ele in root.iter('Entry') if ele.find('Id').text != "-1"] nodes = [ele for ele in nodes if ele.find('PointerOffset').text != "-1"]