You've already forked PythonLib
mirror of
https://github.com/lifebottle/PythonLib.git
synced 2026-02-13 15:25:50 -08:00
Truncate Theirsce files before insertion
Avoids dangling bytes that make DAT.BIN bigger
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user