Skip to content

Commit

Permalink
Fixed sync-to-pmdsky-debug inserting in wrong place
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonymousRandomPerson committed Oct 19, 2024
1 parent fbd9e66 commit 6564a51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion asm/overlay_31_02382FBC.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6564a51

Please sign in to comment.