Nothing here changes what a tool computes; it changes where tools look. - tools/re-capture: 33 censuses globbed /work/sylph_extract, a path that has existed nowhere since /work became a clone, so they matched nothing and printed empty results. They now resolve the disc through a new disc.py from $SYLPHEED_DISC and exit loudly without it (the #44 fix, generalised). Nine scripts that imported siblings from the retired Reborn checkout or an old session scratchpad now import from their own directory. unitgroup.py only needs the variable when --pak is not given. - sylpheed-xex: the loader only ever uses the XEX2 retail key. The dead devkit key and a doc comment claiming a devkit fallback that does not exist are gone; Project Sylpheed is a retail XEX2, so no XEX1 key either. - sylpheed-viewer: real_font_rasterizes looked for /tmp/sylph_extract and so always skipped. It reads $SYLPHEED_DISC now, and passes against the disc. - Comments and docs that named xenia-rs, the Reborn repository or /work/*.pe as places to look now name sylpheed.db, Canary's ppc_context.h and the flat .pe; docs/re/README.md no longer says the native Canary build does not run. Historical records keep their original paths: findings that were measured against /work/xenia-rs/sylpheed.db still say so. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
58 lines
2.3 KiB
Python
58 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""The unit datasheet's own schema, as shipped on the disc.
|
|
|
|
Each GP_MAIN_GAME_*.pak carries 15 IDXD records whose field VALUES are Japanese
|
|
type names rather than data -- Shift-JIS, and the only non-ASCII strings on the
|
|
whole disc. Records whose name ends '_???' (and 'NS_*') are wildcards standing
|
|
for the numbered family, e.g. Turret_??? for Turret_000..Turret_00N.
|
|
|
|
Where a field's type is an enumeration the schema holds an EXAMPLE value
|
|
instead of a type name ('Yes' for a boolean, 'Vessel' for Generic.Type).
|
|
|
|
Regenerates docs/re/data/datasheet-schema.txt.
|
|
"""
|
|
import glob, os, sys
|
|
from disc import disc_root
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
from unit_substructures import pak_entries
|
|
import unitgroup as U
|
|
|
|
# the six type names, held as latin-1 (how unitgroup.py hands strings back)
|
|
TYPES = {
|
|
'\x95\xb6\x8e\x9a\x97\xf1': 'STRING',
|
|
'NS_"\x95\xb6\x8e\x9a\x97\xf1"': 'NS_STRING',
|
|
'\x90\xae\x90\x94': 'INT',
|
|
'\x90\xae\x90\x94\x92l': 'INT_VALUE',
|
|
'\x95\x82\x93\xae\x8f\xac\x90\x94\x92l': 'FLOAT',
|
|
'\x95\x82\x93\xae\x8f\xac\x90\x94\x92l[0\x81`1]': 'FLOAT[0..1]',
|
|
}
|
|
|
|
def main():
|
|
pak = sorted(glob.glob(disc_root() + '/**/GP_MAIN_GAME_D.pak', recursive=True))
|
|
if not pak:
|
|
print('disc not mounted; nothing to do'); return
|
|
out = {}
|
|
for h, b in pak_entries(pak[0]):
|
|
if b[:4] != b'IDXD':
|
|
continue
|
|
try:
|
|
recs = U.parse(b)
|
|
except Exception:
|
|
continue
|
|
for r in recs:
|
|
if any(v in TYPES for t, f, v in r['fields']):
|
|
out[r['squadron']] = r['fields']
|
|
print('the unit datasheet schema shipped in GP_MAIN_GAME_*.pak')
|
|
print('%d schema records; identical in all six paks (x6 = one user)' % len(out))
|
|
print()
|
|
for name in sorted(out):
|
|
fields = out[name]
|
|
typed = sum(1 for t, f, v in fields if v in TYPES)
|
|
print('=== %s (%d fields, %d typed) ===' % (name, len(fields), typed))
|
|
for t, f, v in sorted(fields, key=lambda x: (x[1] or '')):
|
|
print(' %-28s %s' % (f, TYPES.get(v, 'example: ' + repr(v))))
|
|
print()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|