Files
Sylpheed/tools/re-capture/fade_quads.py
sylph-decoder 18f3c5d3dd re: verify the splash's opaque-black backdrop, and the noun amendment
sylpheed-port found the fifth member of our error family on their own side: their
"visible" test counted any element with alpha > 0, which includes palogo_eff0.
Verified from the disc rather than accepted --

  entry 10  [0] palogo_eff0.prm  1 kf  t=0  fade=0xff000000  scale=100x100  pos=(0,0)
  entry 11  same

Alpha 255 over RGB 000000: full-screen opaque black, drawn from t=0 and showing
nothing. So "any element drawn" reports these screens visible from t=0 while the
frame is black -- "visible" read as "drawn".

Worth having on its own: this verifies from the disc the premise behind
`screen render --black`, which its own help states as "what the game composites
over on a screen carrying its own background". On the splash builds that
background is DECLARED, not assumed.

METHOD gains their amendment, which is the sharpest formulation either of us
reached this week: all five instances are a failure of a NOUN, not of a number.
Extent, bounding box, duration, span, visible. The number was always correct FOR
SOMETHING; what went missing was which thing. Every other check in that file
tests whether a number is right, and not one tests whether it is a number of the
thing you think.

Also teaches fade_quads.py to address a PAK ENTRY directly (`e10`) rather than
only a build ordinal. The splashes are entries 10/11 and are not screen builds,
so no ordinal addresses them -- and writing `e10` states which index space is
meant, which is the standing lesson of build-ordinal-vs-entry.md.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wuu56cE8vJGTBtn1ppsk8v
2026-08-30 17:30:37 +00:00

74 lines
3.5 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}
# An argument may be a BUILD ordinal (mapped through BUILDS) or, prefixed with
# `e`, a raw PAK ENTRY -- the splashes are entries 10/11 and are NOT screen
# builds, so no build ordinal addresses them. Writing `e10` says which index
# space is meant, which is the whole lesson of build-ordinal-vs-entry.md.
want = sys.argv[1:] or ["2","4","5","6"]
for arg in want:
if str(arg).startswith("e"):
idx = int(str(arg)[1:]); label = f"entry {idx}"
else:
idx = BUILDS[int(arg)]; label = f"build {arg} (entry {idx})"
names, groups = parse(E[idx])
print(f"=== {label} ===")
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']})")