This branch predates CI on `main`. `cargo fmt --all` only; no behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
50 lines
1.8 KiB
Rust
50 lines
1.8 KiB
Rust
//! Which `GP_TITLE` elements does the resting-pose dwell fallback decide, and does
|
|
//! it hand back a visible pose? The disc-wide census says 5 fires / 4 visible here.
|
|
//! cargo run -p sylpheed-formats --example rest_fallback_title
|
|
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");
|
|
for (i, e) in ar.entries().iter().enumerate() {
|
|
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;
|
|
}
|
|
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;
|
|
}
|
|
let Some(r) = el.rest() else { continue };
|
|
let a = (r.fade >> 24) & 0xff;
|
|
let ks: Vec<String> = el
|
|
.keyframes
|
|
.iter()
|
|
.map(|k| {
|
|
format!(
|
|
"{}:a{}",
|
|
k.time.map(|v| v.to_string()).unwrap_or("-".into()),
|
|
(k.fade >> 24) & 0xff
|
|
)
|
|
})
|
|
.collect();
|
|
println!(
|
|
"entry {i:2} {:24} rest a={a:3} t={:?} [{}]{}",
|
|
el.name,
|
|
r.time,
|
|
ks.join(" "),
|
|
if a > 0 { " <== VISIBLE" } else { "" }
|
|
);
|
|
}
|
|
}
|
|
}
|