screen-transitions.md carried a 14-unit "black hold" that the page itself flagged as arithmetic rather than measurement. Measured it against the running game; the guess was wrong, and finding the instrument to measure it turned up a second, larger error in the same page. 1. fade_quads.py was STALE. It read each pose's time from blk+36 -- the next record's time word -- the association the keyframe record-layout fix retired in the crate. sylpheed-cli was rebuilt at the time; the Python helper was never swept with it. Signature: it cannot time a group's last pose, so it printed a trailing `t=-`. Fixed, controlled against the rebuilt `screen info` ([0 12 70 80] for build 5's pteff00.prm). 2. Through it, the page labelled the quad's CLEAR-hold as its fade-in and published 0.87 s / 0.97 s / 4.08 s for a ramp that is 0.20 s / 0.20 s / 0.27 s. A port pacing its menu fade-in off that would run it 5x too slow. 3. The measurement. fade_decompose.sh boots to the main menu, arms the UI draw capture there, then presses (B), so one 260-frame window holds the whole screen change. The fade quad is identified rather than guessed: a .prm carries no tex[base=] and paints last, so it is the last full-screen untextured quad of a frame. Control first -- the quad's ramp is decoded at 10 units = 5 frames, and measures 4 submitted-frame steps with one unlogged frame in the span. Result: content elements begin fading at frame 34; the black quad first appears at 40 and is opaque by 43; the menu's last frame is 45; frame 46 has 6 draws against 12. So the ~14 extra units are the content's own fade-outs OVERLAPPING the quad's ramp, not a hold after it, and the inter-screen black is one frame. Refutation attempted: sylpheed-port's entries 13/14 twins. Re-derived off the disc -- 3.06 / 4.33 / 47.91, identical to two decimals. Recorded as confirming their addressing and arithmetic, NOT as independent support: same renderer, same disc, which is their own rule. Reach: one transition, one run; the frame axis has gaps (232 headers over frames 3..260), so every span is +-1 frame. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wuu56cE8vJGTBtn1ppsk8v
66 lines
3.0 KiB
Python
Executable File
66 lines
3.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Dump every `.prm` primitive's keyframe group (alpha + time) for a UI build.
|
|
|
|
The screen-transition fade lives here -- see docs/re/screen-transitions.md.
|
|
Usage: PAK=<pak> fade_quads.py [build...] (default: GP_TITLE, builds 2 4 5 6)"""
|
|
import struct, sys, glob, os, zlib
|
|
# The monorepo migration left this pointing at /work/Syplheed-Reborn, a path
|
|
# that no longer exists -- so the command screen-transitions.md cites as its
|
|
# evidence could not be re-run. Resolve beside this file instead.
|
|
_SD = os.path.dirname(os.path.abspath(__file__))
|
|
sys.path.insert(0, _SD)
|
|
src = open(os.path.join(_SD, "regn_decode.py")).read()
|
|
exec(src.split("# ── POF0")[0])
|
|
|
|
DECL_AT, DECL_ENTRY, KF = 0x20, 60, 40
|
|
def be32(b,o): return struct.unpack_from(">I", b, o)[0]
|
|
|
|
def parse(bundle):
|
|
n = be32(bundle, 0x14)
|
|
names=[]
|
|
for i in range(n):
|
|
o = DECL_AT + i*DECL_ENTRY
|
|
names.append(bundle[o:o+28].split(b"\0")[0].decode("ascii","replace"))
|
|
groups={}
|
|
pos = DECL_AT + n*DECL_ENTRY
|
|
for _ in range(n):
|
|
if pos+8 > len(bundle): break
|
|
idx = be32(bundle,pos); frames = be32(bundle,pos+4)
|
|
if idx>=n or frames==0 or frames>4096: break
|
|
first = pos+12; end = first + frames*KF - 4
|
|
g=[]
|
|
for k in range(frames):
|
|
blk = first + k*KF
|
|
if blk+36 > len(bundle) or blk+36 > end: break
|
|
g.append(dict(fade=be32(bundle,blk), sx=be32(bundle,blk+16), sy=be32(bundle,blk+20),
|
|
x=struct.unpack_from(">i",bundle,blk+28)[0], y=struct.unpack_from(">i",bundle,blk+32)[0],
|
|
# A POSE'S TIME PRECEDES IT (ui-keyframe-record-layout.md).
|
|
# This read `blk+36` -- the NEXT record's time word --
|
|
# which shifted every time by one slot and left the
|
|
# last pose untimed. That stale association is what
|
|
# made screen-transitions.md print a 0.87-4.08 s
|
|
# fade-in and an untimed fade-out. Corrected 2026-08-30.
|
|
t=be32(bundle,blk-4)))
|
|
groups[idx]=g; pos=end
|
|
return names, groups
|
|
|
|
# ...and the default pak pointed at /work/sylph_extract, which the disc mount
|
|
# replaced. $SYLPHEED_DISC is what run-canary and sylpheed-cli both use.
|
|
pak = os.environ.get("PAK") or os.path.join(
|
|
os.environ.get("SYLPHEED_DISC", "/disc"), "dat", "GP_TITLE.pak")
|
|
E = pak_entries(pak)
|
|
E = [b for h,b in E]
|
|
# build index -> pak entry index, from `screen list`: 0..9 then 12, 15
|
|
BUILDS = {0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,10:12,11:15}
|
|
want = [int(a) for a in sys.argv[1:]] or [2,4,5,6]
|
|
for b in want:
|
|
names, groups = parse(E[BUILDS[b]])
|
|
print(f"=== build {b} ===")
|
|
for i,nm in enumerate(names):
|
|
if not nm.endswith(".prm"): continue
|
|
g = groups.get(i, [])
|
|
print(f" [{i}] {nm} {len(g)} kf")
|
|
for k in g:
|
|
a=(k['fade']>>24)&0xff
|
|
print(f" t={str(k['t']):>5} fade=0x{k['fade']:08x} (alpha {a:3d}) scale={k['sx']}x{k['sy']} pos=({k['x']},{k['y']})")
|