use sylpheed_formats::idxd::IdxdObject;
use sylpheed_formats::pak::PakArchive;
fn main() {
    let disc = std::env::args().nth(1).unwrap();
    let want = std::env::args().nth(2).unwrap();
    let pak = PakArchive::open(format!("{disc}/dat/GP_MAIN_GAME_E.pak")).unwrap();
    for e in pak.entries() {
        let Ok(b) = pak.read(e) else { continue };
        let Ok(o) = IdxdObject::parse(&b) else { continue };
        let Some(id) = o.get_raw("ID") else { continue };
        if !id.contains(&want) { continue; }
        println!("=== {id}");
        let mut seen = std::collections::BTreeSet::new();
        for k in o.tokens() {
            if let Some(v) = o.get_f32(k) {
                if v != 0.0 && seen.insert(k.clone()) {
                    println!("  {:<28} {:<12} 0x{:08x}", k, v, v.to_bits());
                }
            }
        }
    }
}
