mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Updated get_symbol.py to use dkr.map
This commit is contained in:
@@ -3,27 +3,32 @@ import re
|
||||
|
||||
from file_util import FileUtil
|
||||
|
||||
SYMBOLS_TEXT_FILENAME = 'undefined_syms.txt'
|
||||
SYMBOLS_TEXT_FILENAME = 'build/us_1.0/dkr.map'
|
||||
|
||||
symbol_define_regex = r'([_0-9A-Za-z]*)\s*=\s*([_0-9A-Za-z]*)\s*;'
|
||||
symbol_define_regex = r'\s*(0x[0-9a-f]{16})\s*([_0-9A-Za-z]*)'
|
||||
|
||||
def main():
|
||||
FileUtil.set_working_dir_to_project_base()
|
||||
if len(sys.argv) != 2:
|
||||
show_help()
|
||||
return
|
||||
print_symbol(int(sys.argv[1], 16))
|
||||
|
||||
def print_symbol(ramAddress):
|
||||
lines = FileUtil.get_text_from_file(SYMBOLS_TEXT_FILENAME).split('\n')
|
||||
try:
|
||||
lines = FileUtil.get_text_from_file(SYMBOLS_TEXT_FILENAME).split('\n')
|
||||
except:
|
||||
print('Couldn\'t open file ' + SYMBOLS_TEXT_FILENAME)
|
||||
return
|
||||
foundSymbol = False
|
||||
for line in lines:
|
||||
matches = re.match(symbol_define_regex, line)
|
||||
if matches is None:
|
||||
continue
|
||||
address = int(matches[2], 16)
|
||||
address = int(matches[1], 16)
|
||||
if address == ramAddress:
|
||||
symbol = matches[1]
|
||||
print(matches[2] + ' = ' + matches[1])
|
||||
symbol = matches[2]
|
||||
print('0x%08X = %s' % (address, symbol))
|
||||
foundSymbol = True
|
||||
break
|
||||
if not foundSymbol:
|
||||
|
||||
Reference in New Issue
Block a user