//! Why does a named resource never decode? Reports the furthest gate its best //! candidate reached. Usage: why_missed [name-substring] use sylpheed_formats::mesh::{debug_best_rejection, xbg7_resource_names, Xbg7Model}; use std::collections::HashSet; fn main() { let a: Vec = std::env::args().collect(); let bytes = std::fs::read(&a[1]).unwrap(); let filter = a.get(2).cloned().unwrap_or_default(); let decoded: HashSet = Xbg7Model::stage_models(&bytes).into_iter().map(|m| m.name).collect(); for n in xbg7_resource_names(&bytes) { if decoded.contains(&n) || (!filter.is_empty() && !n.contains(&filter)) { continue; } match debug_best_rejection(&bytes, &n) { Some((rank, why)) => println!("{n:<28} rank {rank} {why}"), None => println!("{n:<28} (no candidate reached any gate / skipped before anchoring)"), } } }