mirror of
https://github.com/pret/pmd-sky.git
synced 2026-09-06 18:45:03 -05:00
Synced from pmdsky-debug
This commit is contained in:
@@ -19,6 +19,7 @@ LANGUAGE_KEYS_XMAP_TO_PMDSKY_DEBUG = {value: key for key, value in LANGUAGE_KEYS
|
||||
# Symbols with duplicate addresses that should be ignored.
|
||||
SYMBOL_BLACKLIST = set([
|
||||
'GAME_STATE_VALUES',
|
||||
'MEMORY_ALLOCATION_TABLE'
|
||||
])
|
||||
|
||||
"""
|
||||
|
||||
@@ -101,6 +101,12 @@ NONMATCHING_SYMBOLS_ARM7 = {
|
||||
|
||||
WRAM_OFFSET = 0x1477E18
|
||||
|
||||
ITCM_RAM_START_ADDRESSES = {
|
||||
'NA': 0x20B3380,
|
||||
'EU': 0x20B3CC0,
|
||||
'JP': 0x20B4BE0
|
||||
}
|
||||
|
||||
@dataclass
|
||||
class SymbolDetails:
|
||||
name: str
|
||||
|
||||
@@ -7,7 +7,7 @@ from ruamel.yaml.comments import CommentedMap
|
||||
from ruamel.yaml.scalarint import HexCapsInt
|
||||
|
||||
from pmdsky_debug_reader import LANGUAGE_KEYS_XMAP_TO_PMDSKY_DEBUG, SYMBOLS_FOLDER, get_pmdsky_debug_location, read_pmdsky_debug_symbols
|
||||
from symbol_details import NONMATCHING_SYMBOLS_ARM7, NONMATCHING_SYMBOLS_ARM9, WRAM_OFFSET, SymbolDetails
|
||||
from symbol_details import ITCM_RAM_START_ADDRESSES, NONMATCHING_SYMBOLS_ARM7, NONMATCHING_SYMBOLS_ARM9, WRAM_OFFSET, SymbolDetails
|
||||
from xmap_reader import HEADER_FOLDER, read_xmap_symbols
|
||||
from yaml_writer import YamlManager, yaml
|
||||
|
||||
@@ -202,9 +202,14 @@ def sync_xmap_symbol(address: int, symbol: SymbolDetails, language: str, section
|
||||
symbol_entry_addresses.sort()
|
||||
return
|
||||
else:
|
||||
symbol_entry_language_addresses[language_key] = HexCapsInt(hex_address)
|
||||
if reorder_languages:
|
||||
symbol_entry_language_addresses.move_to_end(language_key, last=False)
|
||||
if section_name == 'ITCM':
|
||||
# ITCM needs to be handled specially to add both ROM and RAM addresses.
|
||||
symbol_entry_language_addresses[language_key] = HexCapsInt(ITCM_RAM_START_ADDRESSES[language_key] + (hex_address - 0x1FF8000))
|
||||
symbol_entry_language_addresses[f'{language_key}-ITCM'] = hex_address
|
||||
else:
|
||||
symbol_entry_language_addresses[language_key] = HexCapsInt(hex_address)
|
||||
if reorder_languages:
|
||||
symbol_entry_language_addresses.move_to_end(language_key, last=False)
|
||||
|
||||
if wram_address is not None:
|
||||
symbol_entry_language_addresses[language_key + '-WRAM'] = HexCapsInt(wram_address)
|
||||
|
||||
@@ -70,9 +70,9 @@ def read_xmap_symbols_for_language(language: str) -> Dict[str, Dict[int, SymbolD
|
||||
if current_section is not None and is_ram:
|
||||
current_section = 'ram'
|
||||
if current_section is not None and current_section not in xmap_symbols:
|
||||
xmap_symbols[current_section]: Dict[str, int] = {}
|
||||
xmap_symbols[current_section] = {}
|
||||
|
||||
elif current_section is not None and line.startswith(' ') and ('.text' in line or '.data' in line or '.bss' in line) and len(line) > 28 and line[28] not in NON_FUNCTION_SYMBOLS:
|
||||
elif current_section is not None and line.startswith(' ') and ('.text' in line or '.data' in line or '.bss' in line or '.itcm' in line) and len(line) > 28 and line[28] not in NON_FUNCTION_SYMBOLS:
|
||||
symbol_split = line[28:-1].split('\t')
|
||||
symbol_name = symbol_split[0]
|
||||
symbol_address = int(line[2:10], 16)
|
||||
|
||||
Reference in New Issue
Block a user