Applying the port's physical-story rule to my own number. '1 697 fallback fires return a visible pose' was published as if it were a defect count; it is not, since an element that genuinely ends visible should rest visible. The first correction split the 1 697 by whether the element's LAST keyframe is visible: 347 correct, 1 350 transient peaks. Plausible, arithmetic fine, and WRONG -- 12 278 of 13 991 elements (87.8 %) end at alpha 0 because a screen's exit ramp drives everything to zero, so the split carries almost no information. The 1 350 is not published. What survives needs no such split: the fallback runs only when no two adjacent poses are equal, i.e. only when no pose is held, so every pose it can return is un-held by construction -- and 1 457 of the 2 305 times it returns the element's MAXIMUM alpha, the brightest un-held pose. I ran that control only because the port had just been bitten by the same exit ramp, its census calling ptmsg -- the main menu's permanent footer -- 'a 2-unit flash'. Without its message the 1 350 would have shipped. METHOD gains the sharpened form: the physical-story test catches confident FALSE claims, not just nulls. A wrong number usually still has a story, just an absurd one. Plus the tell that its fix was right -- re-keyed on the screen's span, the false positives fell out on their own, and a definition that stops needing hand-maintained exceptions is usually the correct one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wuu56cE8vJGTBtn1ppsk8v
69 lines
3.8 KiB
Rust
69 lines
3.8 KiB
Rust
//! Does "1 697 fallback fires return a visible pose" survive being said out loud?
|
|
//!
|
|
//! `rest-fallback-census.txt` reports that of 2 305 elements where the dwell
|
|
//! fallback decides, 1 697 rest at `alpha > 0`. It was written as if that number
|
|
//! were the defect. **It is only a defect where the element is a transient.** An
|
|
//! element that genuinely ends visible and stays visible SHOULD rest visible, and
|
|
//! the fallback happening to be the path that got there is not an error.
|
|
//!
|
|
//! The port agent hit the mirror image of this: it counted a screen's own exit
|
|
//! ramp as the end of an element's visibility, so `ptmsg` — the main menu's
|
|
//! permanent footer — came out as "a 2-unit flash". The story collapsed when
|
|
//! said aloud. This asks the same question of my number.
|
|
//!
|
|
//! Split the 1 697 by what the element's LAST keyframe does:
|
|
//! * last alpha > 0 -> the element ends visible; resting visible is right
|
|
//! * last alpha == 0 -> it fades out; a visible rest is a transient's peak
|
|
//!
|
|
//! cargo run -p sylpheed-formats --example rest_fallback_audit
|
|
use sylpheed_formats::{pak::PakArchive, ui_layout};
|
|
use std::path::PathBuf;
|
|
|
|
fn main() {
|
|
let root = PathBuf::from(std::env::var("SYLPHEED_DISC").expect("SYLPHEED_DISC"));
|
|
let mut paks: Vec<PathBuf> = std::fs::read_dir(root.join("dat")).expect("dat/")
|
|
.filter_map(|e| e.ok().map(|e| e.path()))
|
|
.filter(|p| p.extension().is_some_and(|x| x == "pak")).collect();
|
|
paks.sort();
|
|
let (mut fires, mut vis, mut ends_visible, mut ends_zero, mut at_peak) = (0, 0, 0, 0, 0);
|
|
// ⚠️ The port agent's exit-ramp finding applies to THIS split too: if a
|
|
// screen's exit ramp drives every element to a=0, then "last keyframe a=0"
|
|
// says nothing about the element being a transient. Measure it on ALL
|
|
// elements before using it on the 1 697.
|
|
let (mut all_el, mut all_end_zero) = (0usize, 0usize);
|
|
for pak in &paks {
|
|
let Ok(ar) = PakArchive::open(pak) else { continue };
|
|
for e in ar.entries() {
|
|
let Ok(by) = ar.read(e) else { continue };
|
|
let Some(b) = ui_layout::parse_build(&by) else { continue };
|
|
for el in &b.elements {
|
|
if el.keyframes.len() < 2 { continue }
|
|
all_el += 1;
|
|
if (el.keyframes.last().unwrap().fade >> 24) & 0xff == 0 { all_end_zero += 1 }
|
|
if el.keyframes.windows(2).any(|w| w[0].x == w[1].x && w[0].y == w[1].y
|
|
&& w[0].scale_x == w[1].scale_x && w[0].scale_y == w[1].scale_y
|
|
&& w[0].fade == w[1].fade) { continue }
|
|
fires += 1;
|
|
let Some(r) = el.rest() else { continue };
|
|
let a = (r.fade >> 24) & 0xff;
|
|
if a == 0 { continue }
|
|
vis += 1;
|
|
let last = (el.keyframes.last().unwrap().fade >> 24) & 0xff;
|
|
if last > 0 { ends_visible += 1 } else { ends_zero += 1 }
|
|
let peak = el.keyframes.iter().map(|k| (k.fade >> 24) & 0xff).max().unwrap_or(0);
|
|
if a == peak { at_peak += 1 }
|
|
}
|
|
}
|
|
}
|
|
println!("fallback fires {fires}");
|
|
println!(" of those, rest alpha > 0 {vis}");
|
|
println!(" element's LAST keyframe alpha > 0 {ends_visible} <- ends visible; resting visible is CORRECT");
|
|
println!(" element's LAST keyframe alpha = 0 {ends_zero} <- fades out; a visible rest is a transient's peak");
|
|
println!(" rest alpha == the element's MAX {at_peak}");
|
|
println!("\nCONTROL on the split itself — is 'ends at a=0' near-universal?");
|
|
println!(" all elements with >= 2 keyframes {all_el}");
|
|
println!(" of those, last keyframe alpha = 0 {all_end_zero} ({:.1} %)",
|
|
100.0 * all_end_zero as f64 / all_el as f64);
|
|
println!("\n--- END (if this line is missing, the run did not finish) ---");
|
|
}
|