Files
psxrecomp/tools/_psx_header_dump.py
T
Matthew Stanley 60801820fd cleanup: genericize hardcoded dev-machine paths in tracked docs/tools
Replace absolute F:/C: paths with repo-relative (../TombaRecomp, bios/, beetle-psx/)
or placeholders (<desktop>/<psxref>/<nesrecomp>/<psxrecomp-v4>) across accuracy docs,
WIDESCREEN/SHADOW/RECURSION_BUG/config_schema/ISSUES/README, and tools/*.py|.ps1.
Removed a personal C:\Users\Matthew\Desktop path (ISSUES.md). Left CLAUDE.md/PLAN.md
sibling-project + version-history paths intact (intentional layout documentation).
2026-07-06 11:51:36 -07:00

26 lines
994 B
Python

import struct, os, sys
p = sys.argv[1] if len(sys.argv) > 1 else '../TombaRecomp/tomba/SCUS_942.36'
with open(p, 'rb') as f:
h = f.read(0x800)
magic = h[:8]
init_pc, init_gp = struct.unpack('<II', h[0x10:0x18])
t_addr, t_size = struct.unpack('<II', h[0x18:0x20])
d_addr, d_size = struct.unpack('<II', h[0x20:0x28])
b_addr, b_size = struct.unpack('<II', h[0x28:0x30])
sp_base, sp_off = struct.unpack('<II', h[0x30:0x38])
print('magic :', magic)
print(f'init_pc : 0x{init_pc:08X}')
print(f'init_gp : 0x{init_gp:08X}')
print(f't_addr : 0x{t_addr:08X}')
print(f't_size : 0x{t_size:08X}')
print(f'd_addr : 0x{d_addr:08X} d_size: 0x{d_size:08X}')
print(f'b_addr : 0x{b_addr:08X} b_size: 0x{b_size:08X}')
print(f'sp_base : 0x{sp_base:08X} sp_off: 0x{sp_off:08X}')
print()
sz = os.path.getsize(p)
nh = p + '_no_header'
if os.path.exists(nh):
sz_nh = os.path.getsize(nh)
print(f'headered size : {sz}')
print(f'no_header size: {sz_nh} (delta = {sz - sz_nh} = 0x{sz-sz_nh:X})')