Narrows a standing unexplained pair without claiming to decode it, and states precisely why it cannot be closed in this container. Census over every UI pak on the disc -- 2859 builds, 90347 keyframes, parents and nested leaves. +4 has 12 distinct values and +8 has 11, against 157 for the decoded rotation at +12. Per sprite-instance across 14241 of them, with +12 as a control because it is known to hold a real angle: +4 takes more than two distinct values on 7 instances, +8 on 99, and +12 on 396. So +4 is in practice a two-state field whose state is 180 -- and for a screen-plane sprite a 180 degree rotation about an in-plane axis is a mirror. But they are not booleans. GP_TITLE entry 7 s ptlogo3a runs +4 = -72, -18, -4, -1 against +12 = -14, -4, -1, 0: the two decay to zero together with +4 roughly four to five times +12 at each keyframe. That is a coupled two-axis settle and the strongest support the disc offers for the three-axis reading. So the readings reconcile -- the field is an angle whose overwhelmingly common use is the 180 degree special case. The reach is the important half. All six non-zero +4/+8 keyframes in GP_TITLE are in entry 7, the Japanese title, which has no oracle capture and which MISSION scopes out as localisation beyond English. The five English screens that do have captures carry +4 = +8 = 0 on every keyframe, so they never exercise the fields. The paks that use them heavily, GP_READY_ROOM at 4686 and GP_DIALOG at 1058, are also out of scope and GP_READY_ROOM is a recorded no-go. So this is untestable against every oracle the project holds rather than merely unfinished. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsEPXWVaEpyfudtR6re1Pd
84 lines
3.9 KiB
Rust
84 lines
3.9 KiB
Rust
//! What are the keyframe block's `+4` and `+8`?
|
|
//!
|
|
//! `+12` is decoded as a screen-plane rotation in degrees. `+4` and `+8` sit
|
|
//! immediately before it and are carried but unexplained; one standing 🟡
|
|
//! reading is that the three together are rotations about three axes, "not tied
|
|
//! to an observed rotation". This censuses them across every UI pak on the disc
|
|
//! so the reading can be argued with rather than assumed.
|
|
use sylpheed_formats::{pak, ui_layout};
|
|
use std::collections::BTreeMap;
|
|
|
|
fn main() {
|
|
let dir = std::env::args().nth(1).expect("usage: <disc>/dat");
|
|
let mut paks: Vec<_> = std::fs::read_dir(&dir)
|
|
.expect("dir")
|
|
.filter_map(|e| e.ok().map(|e| e.path()))
|
|
.filter(|p| p.extension().map(|x| x == "pak").unwrap_or(false))
|
|
.collect();
|
|
paks.sort();
|
|
|
|
let mut h4: BTreeMap<i32, usize> = BTreeMap::new();
|
|
let mut h8: BTreeMap<i32, usize> = BTreeMap::new();
|
|
let mut h12: BTreeMap<i32, usize> = BTreeMap::new();
|
|
let mut both_nz: Vec<String> = Vec::new();
|
|
let (mut kfs, mut builds) = (0usize, 0usize);
|
|
|
|
for p in &paks {
|
|
let Ok(ar) = pak::PakArchive::open(p) else { continue };
|
|
let name = p.file_name().unwrap().to_string_lossy().to_string();
|
|
for (i, e) in ar.entries().to_vec().iter().enumerate() {
|
|
let Ok(bytes) = ar.read(e) else { continue };
|
|
let Some(b) = ui_layout::parse_build(&bytes) else { continue };
|
|
builds += 1;
|
|
// parents and leaves alike
|
|
let mut groups: Vec<(String, Vec<ui_layout::Keyframe>)> = b
|
|
.elements.iter().map(|el| (el.name.clone(), el.keyframes.clone())).collect();
|
|
for el in &b.elements {
|
|
if let Some(&(off, size)) = b.records.get(&el.name) {
|
|
if let Some(lb) = ui_layout::parse_build(&bytes[off..off + size]) {
|
|
for le in &lb.elements {
|
|
groups.push((format!("{}->{}", el.name, le.name), le.keyframes.clone()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (nm, ks) in groups {
|
|
for k in &ks {
|
|
kfs += 1;
|
|
*h4.entry(k.unknown_4).or_default() += 1;
|
|
*h8.entry(k.unknown_8).or_default() += 1;
|
|
*h12.entry(k.rotation_deg).or_default() += 1;
|
|
if k.unknown_4 != 0 || k.unknown_8 != 0 {
|
|
both_nz.push(format!("{name} e{i} {nm} +4={} +8={} +12={}",
|
|
k.unknown_4, k.unknown_8, k.rotation_deg));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
println!("{builds} builds, {kfs} keyframes (parents + leaves)\n");
|
|
for (nm, h) in [("+4", &h4), ("+8", &h8), ("+12 (rotation)", &h12)] {
|
|
let nz: usize = h.iter().filter(|(k, _)| **k != 0).map(|(_, v)| *v).sum();
|
|
println!("{nm}: {} distinct values, {} non-zero keyframes ({:.4}%)",
|
|
h.len(), nz, 100.0 * nz as f64 / kfs as f64);
|
|
let mut top: Vec<_> = h.iter().filter(|(k, _)| **k != 0).collect();
|
|
top.sort_by_key(|(_, v)| std::cmp::Reverse(**v));
|
|
for (k, v) in top.iter().take(6) { println!(" {k:>8} x{v}"); }
|
|
}
|
|
println!("\nkeyframes with a non-zero +4 or +8: {}", both_nz.len());
|
|
// Per-pak, so a reader can ask whether a pak they have a CAPTURE of is
|
|
// among them -- which decides whether the field is testable at all.
|
|
let mut per: BTreeMap<String, usize> = BTreeMap::new();
|
|
for l in &both_nz {
|
|
let pak = l.split_whitespace().next().unwrap_or("?").to_string();
|
|
*per.entry(pak).or_default() += 1;
|
|
}
|
|
println!(" by pak:");
|
|
for (k, v) in &per { println!(" {k:<28} {v}"); }
|
|
println!(" paks with NONE: (any UI pak not listed above)");
|
|
if let Ok(f) = std::env::var("KF_SHOW") {
|
|
println!("\n all lines for {f}:");
|
|
for l in both_nz.iter().filter(|l| l.starts_with(&f)) { println!(" {l}"); }
|
|
}
|
|
}
|