//! Independent check of "DIFFICULTY is a dialog: GP_DIALOG entries 2/3". //! //! The Decoder identified `DLG_SELECT_DIFFICULTY` as `GP_DIALOG.pak` entries 2/3 //! by three routes, one of which is button count and geometry. That half is //! readable from the disc with this port's own reader, so it is checked here //! rather than taken on their word — the same form as re-deriving `ptbtn11`'s //! row order from my export when they offered it. //! //! ⚠️ What this CANNOT check is their binding claim, and they flagged it first: //! entries 2/3 are identified by button count and geometry, **not** by a binding //! from the `DLG_` name to a pak entry. Another four-button dialog with the same //! rows would be indistinguishable by this evidence. Reproducing the geometry //! confirms the geometry; it does not name the screen. use sylpheed_formats::{pak, ratc, ui_layout}; fn main() { let root = std::env::var("SYLPHEED_DISC").unwrap_or_else(|_| "/disc".into()); let path = format!("{root}/dat/GP_DIALOG.pak"); let ar = pak::PakArchive::open(&path).expect("GP_DIALOG.pak"); for (i, e) in ar.entries().iter().enumerate() { let Ok(by) = ar.read(e) else { continue }; if !ratc::is_ratc(&by) { continue } let Some(b) = ui_layout::parse_build(&by) else { continue }; let mut rows: Vec<(String, i32)> = b.elements.iter() .filter(|el| el.name.starts_with("pcbtn")) .filter_map(|el| el.rest().map(|r| (el.name.clone(), r.y))) .collect(); if rows.is_empty() { continue } rows.sort_by(|a, b| a.1.cmp(&b.1)); let ys: Vec = rows.iter().map(|r| r.1).collect(); let gaps: Vec = ys.windows(2).map(|w| w[1] - w[0]).collect(); println!(" entry {i:>2} {} button record(s): {}", rows.len(), rows.iter().map(|r| r.0.as_str()).collect::>().join(" ")); println!(" rows {ys:?} gaps {gaps:?}"); } }