From 6564a51336e0c93185637191bb5ab5dbb37eff19 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sat, 19 Oct 2024 00:03:35 -0400 Subject: [PATCH] Fixed sync-to-pmdsky-debug inserting in wrong place --- asm/overlay_31_02382FBC.s | 2 +- tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/asm/overlay_31_02382FBC.s b/asm/overlay_31_02382FBC.s index 126dfebb..5c59fc12 100644 --- a/asm/overlay_31_02382FBC.s +++ b/asm/overlay_31_02382FBC.s @@ -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 diff --git a/tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py b/tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py index 84b014bb..828573ef 100644 --- a/tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py +++ b/tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py @@ -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)