This branch predates CI on `main`. `cargo fmt --all` only; no behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
50 lines
2.1 KiB
Rust
50 lines
2.1 KiB
Rust
//! The sweep leaves' RAW keyframes, so a segment rate can be checked not assumed.
|
|
//!
|
|
//! `sylpheed-port` reports `pteff03` as +4.0000 px/unit over t 0..150 and +4.0000
|
|
//! again over 150..540 -- perfectly linear -- against `pteff03a` at -4.0667 then
|
|
//! -4.0625. That asymmetry is what makes their "inversion" observation sharp: my
|
|
//! linearity gate fails on the leaf whose source is exactly straight. It is their
|
|
//! number from their export, so it is worth deriving independently.
|
|
//!
|
|
//! cargo run -p sylpheed-formats --example ptloop_leaf_keyframes
|
|
use std::path::PathBuf;
|
|
use sylpheed_formats::{pak::PakArchive, ui_layout};
|
|
|
|
fn main() {
|
|
let root = PathBuf::from(std::env::var("SYLPHEED_DISC").expect("SYLPHEED_DISC"));
|
|
let ar = PakArchive::open(root.join("dat/GP_TITLE.pak")).expect("GP_TITLE.pak");
|
|
let by = ar.read(&ar.entries()[4]).expect("entry 4");
|
|
let b = ui_layout::parse_build(&by).expect("parse");
|
|
for parent in ["ptloop01", "ptloop02"] {
|
|
let Some(el) = b.elements.iter().find(|e| e.name.starts_with(parent)) else {
|
|
continue;
|
|
};
|
|
let Some(&(off, size)) = b.records.get(&el.name) else {
|
|
continue;
|
|
};
|
|
let Some(lb) = ui_layout::parse_build(&by[off..off + size]) else {
|
|
continue;
|
|
};
|
|
for le in &lb.elements {
|
|
println!("\n== {} -> leaf {}", el.name, le.name);
|
|
let ks: Vec<_> = le.keyframes.iter().collect();
|
|
for w in ks.windows(2) {
|
|
let (a, c) = (w[0], w[1]);
|
|
match (a.time, c.time) {
|
|
(Some(t0), Some(t1)) if t1 > t0 => println!(
|
|
" t {t0:>4} -> {t1:<4} x {:>6} -> {:<6} = {:+.4} px/unit",
|
|
a.x,
|
|
c.x,
|
|
(c.x - a.x) as f64 / (t1 - t0) as f64
|
|
),
|
|
_ => println!(
|
|
" t {:?} -> {:?} x {} -> {} (no rate)",
|
|
a.time, c.time, a.x, c.x
|
|
),
|
|
}
|
|
}
|
|
}
|
|
}
|
|
println!("--- END ---");
|
|
}
|