`cargo fmt --all -- --check` has failed on every run in this repository's history, identically on `main` and on every branch. This is #12. Mechanical: `cargo fmt --all`, nothing else. 154 files, all `.rs`, no other extension touched. `cargo check --workspace` exits 0 afterwards, so nothing changed semantically. ON THE ORDERING, WHICH WAS THE REAL QUESTION. HANDOFF-2026-09-06 section 7 warns this is the expensive fix: a whole-tree reformat before #7 and #8 return "would put a conflict in every file of 861 commits and make the reviews those items exist to enable unreadable". That is measurably too pessimistic, and it had been reasoned rather than tested. Measured here by three-way merging a rustfmt'd `main` against both unmerged branches, file by file: file/branch pairs tested 32 merges CLEAN 28 merges CONFLICTING 4 (8 conflict hunks total) sylpheed-cli/src/main.rs 1 hunk sylpheed-export/src/check.rs 1 sylpheed-export/src/screen.rs 4 sylpheed-export/src/video.rs 2 All four are against `auto/frame-blend-draw-path` only; `auto/port-p6-audio` does not conflict anywhere. The earlier framing -- 154 dirty files, 133 that cannot collide, 21 that can, the collision set carrying 147 of 774 hunks (19%) -- reproduces exactly. What it did not say is that most of the 21 still merge cleanly, because rustfmt's edits and the branches' edits rarely land on the same lines. So the cost of sweeping now is 4 files and 8 hunks for one branch, against a check that is otherwise red forever. Deliberately NOT folded into the WASM PR: 154 reformatted files would make that one unreviewable. Closes #12
98 lines
3.6 KiB
Rust
98 lines
3.6 KiB
Rust
use sylpheed_formats::{idxd::IdxdObject, PakArchive};
|
|
fn main() {
|
|
let disc = std::env::var("SYLPHEED_DISC").unwrap();
|
|
let arc = PakArchive::open(format!("{disc}/dat/GP_MAIN_GAME_E.pak")).unwrap();
|
|
// 1. All stages: BackGroundID + phases + stage tag (from EnumUnit_SNN)
|
|
println!("=== STAGES (StageResource 3c9ae32e) ===");
|
|
let mut rows = vec![];
|
|
for e in arc.entries() {
|
|
let Ok(b) = arc.read(e) else { continue };
|
|
let Ok(o) = IdxdObject::parse(&b) else {
|
|
continue;
|
|
};
|
|
if o.schema_hash != 0x3c9ae32e {
|
|
continue;
|
|
}
|
|
let t = o.tokens();
|
|
let bg = o.get_raw("BackGroundID").unwrap_or("?").to_string();
|
|
let stage = t
|
|
.iter()
|
|
.find_map(|s| {
|
|
s.strip_prefix("EnumUnit_")
|
|
.map(|x| x.trim_end_matches(".tbl").to_string())
|
|
})
|
|
.unwrap_or("?".into());
|
|
let phases = t.iter().filter(|s| s.starts_with("Phase_")).count();
|
|
let unitgrp = t.iter().any(|s| s.starts_with("UnitGroup_"));
|
|
let route = t.iter().any(|s| s.starts_with("Route_"));
|
|
let formation = t.iter().any(|s| s.starts_with("FormationSet_"));
|
|
rows.push((stage, bg, phases, unitgrp, route, formation));
|
|
}
|
|
rows.sort();
|
|
for (s, bg, p, ug, rt, fm) in &rows {
|
|
println!(
|
|
" {s:8} location={bg:14} phases={p} [squadrons:{} route:{} formations:{}]",
|
|
if *ug { "Y" } else { "·" },
|
|
if *rt { "Y" } else { "·" },
|
|
if *fm { "Y" } else { "·" }
|
|
);
|
|
}
|
|
|
|
// 2. Parse objectives table into (stage,phase) -> key counts
|
|
println!("\n=== OBJECTIVES (033b5b7e) — per stage/phase key groups ===");
|
|
for e in arc.entries() {
|
|
let Ok(b) = arc.read(e) else { continue };
|
|
let Ok(o) = IdxdObject::parse(&b) else {
|
|
continue;
|
|
};
|
|
if o.schema_hash != 0x033b5b7e {
|
|
continue;
|
|
}
|
|
let t = o.tokens();
|
|
let mut groups: std::collections::BTreeMap<String, u32> = Default::default();
|
|
for tok in t {
|
|
if let Some(p) = tok
|
|
.find("_Objective_")
|
|
.or_else(|| tok.find("_Lose_"))
|
|
.or_else(|| tok.find("_Hint_"))
|
|
{
|
|
let key = &tok[..p];
|
|
*groups
|
|
.entry(
|
|
key.trim_start_matches(|c: char| !c.is_ascii_alphabetic())
|
|
.into(),
|
|
)
|
|
.or_default() += 1;
|
|
}
|
|
}
|
|
let stages: std::collections::BTreeSet<String> = groups
|
|
.keys()
|
|
.filter_map(|k| k.get(..3).map(|s| s.to_string()))
|
|
.collect();
|
|
println!(" covers {} stages: {:?}", stages.len(), stages);
|
|
println!(
|
|
" sample S01_P1 group counts: {:?}",
|
|
groups
|
|
.iter()
|
|
.filter(|(k, _)| k.starts_with("S01_P1"))
|
|
.collect::<Vec<_>>()
|
|
);
|
|
break;
|
|
}
|
|
|
|
// 3. Resolve objective TEXT: search all pak entries for the key "S01_P1_Objective_00" as an ID with English text
|
|
println!("\n=== OBJECTIVE TEXT resolution probe ===");
|
|
for e in arc.entries() {
|
|
let Ok(b) = arc.read(e) else { continue };
|
|
let Ok(o) = IdxdObject::parse(&b) else {
|
|
continue;
|
|
};
|
|
let t = o.tokens();
|
|
if let Some(i) = t.iter().position(|s| s == "S01_P1_Objective_00") {
|
|
let lo = i.saturating_sub(1);
|
|
let hi = (i + 3).min(t.len());
|
|
println!(" schema {:08x}: ...{:?}...", o.schema_hash, &t[lo..hi]);
|
|
}
|
|
}
|
|
}
|