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>
17 lines
919 B
Python
17 lines
919 B
Python
# Usage: read_value.py exe VA -> int32 / float / double / string at a virtual address (for DAT_xxxxxxxx constants)
|
|
import struct, sys
|
|
data = open(sys.argv[1], 'rb').read()
|
|
va = int(sys.argv[2], 16)
|
|
pe = struct.unpack_from('<I', data, 0x3c)[0]
|
|
optsz = struct.unpack_from('<H', data, pe + 20)[0]
|
|
rva = va - struct.unpack_from('<I', data, pe + 52)[0]
|
|
for i in range(struct.unpack_from('<H', data, pe + 6)[0]):
|
|
sva, rsz, raw = struct.unpack_from('<III', data, pe + 24 + optsz + 40 * i + 12)
|
|
if sva <= rva < sva + rsz:
|
|
o = raw + rva - sva
|
|
b = data[o:o + 8]
|
|
s = data[o:data.index(b'\0', o)][:60]
|
|
print('int32 %d uint32 0x%08x float %r double %r str %r' % (struct.unpack('<i', b[:4])[0], struct.unpack('<I', b[:4])[0], struct.unpack('<f', b[:4])[0], struct.unpack('<d', b)[0], s))
|
|
break
|
|
else: print('not in a file-backed section (uninitialised .data/.bss: runtime value)')
|