mirror of
https://github.com/pret/pmd-sky.git
synced 2026-03-21 17:25:15 -05:00
Added documented symbol counter
This commit is contained in:
parent
74757132e6
commit
4cdeec3ccf
|
|
@ -711,7 +711,7 @@
|
|||
.public _022A8994
|
||||
.public _022A92B4_JP
|
||||
.public _022A92B8_JP
|
||||
.public _022A92C4_JP
|
||||
.public _022A92C4
|
||||
.public _022A9A5C
|
||||
.public _022AA35C
|
||||
.public _022AAC64
|
||||
|
|
|
|||
|
|
@ -33112,7 +33112,7 @@ sub_02025AD8: ; 0x02025AD8
|
|||
mov r2, #1
|
||||
bl LoadFileFromRom
|
||||
ldr r1, [sp]
|
||||
ldr r0, _02025B3C ; =_022A92C4_JP
|
||||
ldr r0, _02025B3C ; =_022A92C4
|
||||
bl HandleSir0Translation
|
||||
ldr r1, _02025B40 ; =_0209AC18
|
||||
add r0, sp, #0
|
||||
|
|
@ -33184,7 +33184,7 @@ sub_02025AD8: ; 0x02025AD8
|
|||
_02025B6C: .word _0209B548_JP
|
||||
_02025B34: .word _022A7A54
|
||||
_02025B38: .word _0209AC04
|
||||
_02025B3C: .word _022A92C4_JP
|
||||
_02025B3C: .word _022A92C4
|
||||
_02025B40: .word _0209AC18
|
||||
_02025B44: .word _020AFD04
|
||||
_02025B48: .word _022A92B4_JP
|
||||
|
|
|
|||
|
|
@ -58984,8 +58984,8 @@ _022A92B8_JP:
|
|||
.global _022A7A54
|
||||
_022A7A54:
|
||||
.space 0x4
|
||||
.global _022A92C4_JP
|
||||
_022A92C4_JP:
|
||||
.global _022A92C4
|
||||
_022A92C4:
|
||||
.space 0x4
|
||||
#if defined(EUROPE)
|
||||
.global _022A7A64
|
||||
|
|
|
|||
59
tools/sync_pmdsky_debug/count_documented_symbols.py
Normal file
59
tools/sync_pmdsky_debug/count_documented_symbols.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import re
|
||||
from typing import Dict
|
||||
from xmap_reader import read_xmap_symbols
|
||||
|
||||
UNDOCUMENTED_SYMBOL_MATCHER = re.compile(r'_[0-9A-F]{8}$')
|
||||
|
||||
xmap_symbols = read_xmap_symbols()
|
||||
|
||||
def get_fraction_and_percent(documented_count, total_count):
|
||||
return f'{documented_count}/{total_count} ({documented_count / total_count:.4%})'
|
||||
|
||||
class SymbolCount:
|
||||
num_documented_data_symbols: int = 0
|
||||
total_data_symbols: int = 0
|
||||
num_documented_symbols: int = 0
|
||||
total_symbols: int = 0
|
||||
|
||||
def print_counts(self):
|
||||
if self.total_data_symbols != self.total_symbols:
|
||||
print(f'Total: {get_fraction_and_percent(self.num_documented_symbols, self.total_symbols)}')
|
||||
print(f'Functions: {get_fraction_and_percent(self.num_documented_symbols - self.num_documented_data_symbols, self.total_symbols - self.total_data_symbols)}')
|
||||
print(f'Data: {get_fraction_and_percent(self.num_documented_data_symbols, self.total_data_symbols)}')
|
||||
print()
|
||||
|
||||
symbol_counts: Dict[str, SymbolCount] = {}
|
||||
for overlay, symbols in xmap_symbols['us'].items():
|
||||
if overlay == 'ram':
|
||||
continue
|
||||
|
||||
symbol_count = SymbolCount()
|
||||
symbol_counts[overlay] = symbol_count
|
||||
|
||||
symbol_count.total_symbols = len(symbols)
|
||||
|
||||
for symbol in symbols.values():
|
||||
if not UNDOCUMENTED_SYMBOL_MATCHER.search(symbol.name) and 'UNKNOWN' not in symbol.name:
|
||||
symbol_count.num_documented_symbols += 1
|
||||
if symbol.is_data:
|
||||
symbol_count.num_documented_data_symbols += 1
|
||||
if symbol.is_data:
|
||||
symbol_count.total_data_symbols += 1
|
||||
|
||||
if symbol_count.total_symbols > 0:
|
||||
if overlay == 'main':
|
||||
overlay = 'ARM9'
|
||||
elif overlay == 'arm7':
|
||||
overlay = 'ARM7'
|
||||
else:
|
||||
overlay = f'Overlay {overlay}'
|
||||
print(overlay)
|
||||
symbol_count.print_counts()
|
||||
|
||||
all_symbol_count = SymbolCount()
|
||||
all_symbol_count.num_documented_data_symbols = sum([count.num_documented_data_symbols for count in symbol_counts.values()])
|
||||
all_symbol_count.num_documented_symbols = sum([count.num_documented_symbols for count in symbol_counts.values()])
|
||||
all_symbol_count.total_data_symbols = sum([count.total_data_symbols for count in symbol_counts.values()])
|
||||
all_symbol_count.total_symbols = sum([count.total_symbols for count in symbol_counts.values()])
|
||||
|
||||
all_symbol_count.print_counts()
|
||||
Loading…
Reference in New Issue
Block a user