Fixed sync-to-pmdsky-debug inserting in wrong place

This commit is contained in:
AnonymousRandomPerson 2024-10-19 00:03:35 -04:00
parent fbd9e668a5
commit 6564a51336
2 changed files with 4 additions and 4 deletions

View File

@ -8926,7 +8926,7 @@ DUNGEON_MAIN_MENU_ITEMS:
.byte 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF
.global DUNGEON_MENU_SWITCH_STR1
DUNGEON_MENU_SWITCH_STR1:
.byte 0x5B, 0x64, 0x75, 0x6E, 0x67, 0x65, 0x6F, 0x6E, 0x3A, 0x30, 0x5D, 0x00
.string "[dungeon:0]"
.global OVERLAY31_UNKNOWN_STRING_IDS
OVERLAY31_UNKNOWN_STRING_IDS:
.hword 0x8C7 + OV31_DATA_OFFSET

View File

@ -157,13 +157,13 @@ def sync_xmap_symbol(address: int, symbol: SymbolDetails, language: str, section
# Keep track of the symbol directly before the target symbol.
# This will be used as an anchor when appending to the header file.
symbol_header_line = find_symbol_in_header(symbol_entry['name'], symbol.is_data, header_contents)
if symbol_header_line is not None:
if symbol_header_line is not None and insert_index is None:
target_header_line = symbol_header_line
if language_key in symbol_entry['address']:
current_symbol_address: int | List[int] = symbol_entry['address'][language_key]
if isinstance(current_symbol_address, list):
current_symbol_address = current_symbol_address[0]
if current_symbol_address > address and insert_index is not None:
if current_symbol_address > address and insert_index is None:
insert_index = i
if not matching_symbol_entry:
matching_symbol_entry = {
@ -273,7 +273,7 @@ def sync_xmap_symbol(address: int, symbol: SymbolDetails, language: str, section
else:
symbol_header = f'void {base_symbol_name}(void);\n'
header_contents[target_header_line - 1] += symbol_header
header_contents[target_header_line] += symbol_header
with open(header_path, 'w') as header_file:
header_file.writelines(header_contents)