Small fix to better show sections in Menu file

This commit is contained in:
FistingUranus
2022-08-05 18:05:00 -04:00
committed by fortiersteven
parent 3a29f52278
commit 5b18683575
2 changed files with 8 additions and 7 deletions

View File

@@ -540,7 +540,7 @@ class ToolsTOR(ToolsTales):
print("Writing file %05d/%05d..." % (current - dummies, len(file_list)))
#Use the new SLPS updated and update the pointers for the SCPK
with open("../Data/{}/Menu/New/SLPS_254.50".format(self.repo), "r+b") as output_elf:
with open("../Data/{}/Menu/New/SLPS_254.50".format(self.repo_name), "r+b") as output_elf:
output_elf.seek(self.POINTERS_BEGIN)
for i in range(len(sectors) - 1):

View File

@@ -625,6 +625,7 @@ class ToolsTales:
sections_start = [ section['Text_Start'] for section in file_node['Sections'] if section['Text_Start'] > 0 ]
sections_end = [ section['Text_End'] for section in file_node['Sections'] if section['Text_Start'] > 0 ]
sections = [ section for section in file_node['Sections'] if section['Text_Start'] > 0 ]
base_offset = file_node['Base_Offset']
new_file_path = file_node['File_Extract']
@@ -634,8 +635,8 @@ class ToolsTales:
with open(new_file_path, "r+b") as menu_file:
menu_file.seek(sections_start[section_id])
section_max = max( sections_end )
menu_file.seek( int(sections[section_id]["Text_Start"]) )
section_max = max( [int(ele['Text_End']) for ele in sections] )
for entry_node in root.iter("Entry"):
@@ -659,16 +660,16 @@ class ToolsTales:
new_offset = menu_file.tell() + nb_bytes
pos=0
if new_offset < sections_end[section_id]:
if new_offset < int(sections[section_id]['Text_End']):
pos = menu_file.tell()
else:
section_id = section_id+1
if (section_id < len( sections_start )):
#print("Going at : {} ({})".format( sections_start[section_id] , hex( sections_start[section_id] )))
menu_file.seek( sections_start[section_id] )
if (section_id < len( sections )):
print("Going at : {} ({})".format( sections[section_id]['Section'], hex( int(sections[section_id]['Text_Start']) )))
menu_file.seek( int(sections[section_id]['Text_Start']) )
pos = menu_file.tell()
else:
break;