This branch predates CI on `main`. `cargo fmt --all` only; no behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
30 lines
1.2 KiB
Rust
30 lines
1.2 KiB
Rust
//! How is `GP_DIALOG.pak` organised? Testing whether dialog id maps positionally.
|
|
//!
|
|
//! The dialog table gives name -> id (70 records, `DLG_SELECT_DIFFICULTY` = 2000)
|
|
//! and the disc gives a unique four-button build at GP_DIALOG entries 2/3. Nothing
|
|
//! joins them. If the archive were laid out in table order, or in id order, the
|
|
//! join would be positional — this checks.
|
|
//!
|
|
//! cargo run -p sylpheed-formats --example dialog_pak_shape
|
|
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_DIALOG.pak")).expect("GP_DIALOG");
|
|
let n = ar.entries().len();
|
|
let mut builds = 0;
|
|
let mut with_btn = 0;
|
|
for e in ar.entries() {
|
|
let Ok(by) = ar.read(e) else { continue };
|
|
if let Some(b) = ui_layout::parse_build(&by) {
|
|
builds += 1;
|
|
if b.elements.iter().any(|el| el.name.contains("btn")) {
|
|
with_btn += 1;
|
|
}
|
|
}
|
|
}
|
|
println!("entries {n}, parse as builds {builds}, of those with a btn element {with_btn}");
|
|
println!("dialog table has 70 records; 70 x 2 (EN/JP) = 140");
|
|
}
|