Files
Sylpheed/tools/re-capture/bgm_wave_census.py
sim e909c7c133 chore: retire the last dead paths and names from the consolidation
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>
2026-09-16 22:30:28 +02:00

33 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python3
"""Every BGM bank's sub-wave structure: count, bytes, PsuedoBytesPerSec, seconds.
Static, disc-only. See docs/re/structures/bgm-two-stems.md."""
import os, sys, struct
from disc import disc_root
_SD = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, _SD)
exec(open(os.path.join(_SD, "slb_segment_phase.py")).read().split("def cmd_phases")[0])
pak=Pak(disc_root() + "/dat/sound.pak")
def bps(b, riff_at):
# PsuedoBytesPerSec at RIFF+0x20 (u32 LE), SampleRate at +0x24
return struct.unpack_from("<I", b, riff_at+0x20)[0], struct.unpack_from("<I", b, riff_at+0x24)[0]
rows=[]
for n in list(range(1,60))+list(range(101,120)):
name=f"BGM_{n:03d}.slb"
i=pak.find(name)
if i is None: continue
b=pak.read(i); ws=waves(b)
ds=[]
for w in ws:
pb,sr=bps(b,w["at"])
ds.append((w["data_size"], pb, sr, w["data_size"]/pb if pb else 0))
rows.append((name,len(ws),ds))
print(f"{'bank':14s} {'waves':>5s} per-wave (bytes, bytes/s, Hz, seconds)")
same=0
for name,k,ds in rows:
txt=" | ".join(f"{d:8d} {pb:6d} {sr:5d} {sec:7.2f}s" for d,pb,sr,sec in ds)
eq = len(ds)==2 and abs(ds[0][3]-ds[1][3])<0.05
same += eq
print(f"{name:14s} {k:5d} {txt} {'EQUAL-LENGTH' if eq else ''}")
print(f"\n{len(rows)} BGM banks; {same} are exactly two waves of equal duration")