Ghidra 12.2 project and full dump of isaac-ng.exe v1.9.7.17, query scripts, notes indexed by entity, anm2/rooms reimplementations, and db/ (names + fields) that build.sh re-applies. Fixes awk numeric address comparison in find.sh/decompile.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
1.1 KiB
Python
21 lines
1.1 KiB
Python
# Regenerates the "Entity notes" table in notes/README.md from the "## " headings of notes/**/*.md.
|
|
# A heading is indexed when it names an address (6-8 hex digits). Usage: notes_index.py notesdir
|
|
import glob, os, re, sys
|
|
d = sys.argv[1]
|
|
rows = []
|
|
for p in sorted(glob.glob(f'{d}/*/*.md')):
|
|
if '/_tools/' in p: continue
|
|
for line in open(p):
|
|
if not line.startswith('## '): continue
|
|
addrs = re.findall(r'\b(?:0x)?(00[4-9a][0-9a-f]{5}|[4-9a][0-9a-f]{5})\b', line)
|
|
if not addrs: continue
|
|
h = line[3:].strip().replace('|', '/')
|
|
name = re.split(r'[:(—@]| - ', h)[0].strip(' .')
|
|
rows.append(f"| {name} | {' '.join('0x' + a.lstrip('0') for a in dict.fromkeys(addrs))} | {h} | [{os.path.relpath(p, d)}]({os.path.relpath(p, d)}) |")
|
|
readme = f'{d}/README.md'
|
|
s = open(readme).read()
|
|
a, b = s.index('<!-- index -->') + len('<!-- index -->'), s.index('<!-- /index -->')
|
|
table = '\n| entity | address | heading (what the note covers, status) | file |\n|---|---|---|---|\n' + '\n'.join(sorted(rows, key=str.lower)) + '\n'
|
|
open(readme, 'w').write(s[:a] + table + s[b:])
|
|
print(f'notes_index: {len(rows)} rows')
|