You've already forked PythonLib
mirror of
https://github.com/lifebottle/PythonLib.git
synced 2026-02-13 15:25:50 -08:00
Updating extract_Story_Pointer to receive bytecode parameter
This commit is contained in:
@@ -34,6 +34,9 @@ class ToolsTOPX(ToolsTales):
|
||||
self.all_original = '../Data/{}/Disc/Original/PSP_GAME/USRDIR/all.dat'.format(self.repo_name)
|
||||
self.all_new = '../Data/{}/Disc/New/PSP_GAME/USRDIR/all.dat'.format(self.repo_name) #File is all.dat
|
||||
|
||||
self.story_struct_byte_code = b'\x18\x00\x0C\x04'
|
||||
self.story_string_byte_code = b'\x00\x00\x82\x02'
|
||||
|
||||
self.make_dirs()
|
||||
#############################
|
||||
#
|
||||
@@ -142,7 +145,10 @@ class ToolsTOPX(ToolsTales):
|
||||
#File size
|
||||
fsize = tss.getbuffer().nbytes
|
||||
tss.seek(pointer_block, 0) #Go the the start of the pointer section
|
||||
pointers_offset, texts_offset = self.extract_Story_Pointers(tss, strings_offset, fsize)
|
||||
|
||||
|
||||
#Struct
|
||||
pointers_offset, texts_offset = self.extract_Story_Pointers(tss, strings_offset, fsize, self.story_string_byte_code)
|
||||
|
||||
text_list = [self.bytes_to_text(tss, ele)[0] for ele in texts_offset]
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ class ToolsTOR(ToolsTales):
|
||||
#File size
|
||||
fsize = theirsce.getbuffer().nbytes
|
||||
theirsce.seek(pointer_block, 0) #Go the the start of the pointer section
|
||||
pointers_offset, texts_offset = self.extract_Story_Pointers(theirsce, strings_offset, fsize)
|
||||
pointers_offset, texts_offset = self.extract_Story_Pointers(theirsce, strings_offset, fsize, self.story_byte_code)
|
||||
|
||||
text_list = [self.bytes_to_text(theirsce, ele)[0] for ele in texts_offset]
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ class ToolsTales:
|
||||
HW.pack_into(out, cmds, c)
|
||||
return bytes(out)
|
||||
|
||||
def extract_Story_Pointers(self, theirsce, strings_offset, fsize):
|
||||
def extract_Story_Pointers(self, theirsce, strings_offset, fsize, bytecode):
|
||||
|
||||
|
||||
pointers_offset = []
|
||||
@@ -250,7 +250,7 @@ class ToolsTales:
|
||||
previous_addr = 0
|
||||
while theirsce.tell() < strings_offset:
|
||||
b = theirsce.read(1)
|
||||
if b == self.story_byte_code:
|
||||
if b == bytecode:
|
||||
addr = struct.unpack("<H", theirsce.read(2))[0]
|
||||
|
||||
current_pos = theirsce.tell()
|
||||
|
||||
Reference in New Issue
Block a user