`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
81 lines
2.9 KiB
Rust
81 lines
2.9 KiB
Rust
//! RE probe: the GamePart_ChallengeMission screen config.
|
|
//!
|
|
//! The class's code range (`0x82187E60`..`0x8218CF10`, bounded by the factory
|
|
//! creator thunks either side) references these config keys:
|
|
//! MISSIONS, MISSION_ID, NEW_STAGE, REQUIREMENT, REQUIREMENT_DESC, "Always",
|
|
//! GRAY_BUTTON, NORMAL_BUTTON, THUMBNAIL, STAGE_DESC, TEXT_STAGE,
|
|
//! RECORD_TYPE, "Time", TEXT_RECORD, BASE_INFO
|
|
//! i.e. the challenge list is a *config record* with a per-mission REQUIREMENT.
|
|
//! It lives in `tables.pak` (one copy per language), not in GP_CHALLENGE.pak.
|
|
//!
|
|
//! Run: cargo run --release -p sylpheed-formats --example challenge_screen -- <disc-root>
|
|
|
|
use sylpheed_formats::{idxd::IdxdObject, pak::PakArchive};
|
|
|
|
const KEYS: &[&str] = &[
|
|
"MISSIONS",
|
|
"MISSION_ID",
|
|
"REQUIREMENT",
|
|
"REQUIREMENT_DESC",
|
|
"NEW_STAGE",
|
|
"GRAY_BUTTON",
|
|
"NORMAL_BUTTON",
|
|
"RECORD_TYPE",
|
|
"THUMBNAIL",
|
|
"STAGE_DESC",
|
|
];
|
|
|
|
fn find(h: &[u8], n: &[u8]) -> bool {
|
|
h.windows(n.len()).any(|w| w == n)
|
|
}
|
|
|
|
fn main() {
|
|
let disc = std::env::args().nth(1).unwrap_or_else(|| {
|
|
std::env::var("SYLPHEED_DISC").expect("pass disc root or set SYLPHEED_DISC")
|
|
});
|
|
|
|
let dat = format!("{disc}/dat");
|
|
let mut paks: Vec<_> = std::fs::read_dir(&dat)
|
|
.expect("dat dir")
|
|
.filter_map(|e| e.ok())
|
|
.map(|e| e.path())
|
|
.filter(|p| p.extension().is_some_and(|x| x == "pak"))
|
|
.collect();
|
|
paks.sort();
|
|
|
|
for p in &paks {
|
|
let Ok(arc) = PakArchive::open(p) else {
|
|
continue;
|
|
};
|
|
for (i, e) in arc.entries().iter().enumerate() {
|
|
let Ok(b) = arc.read(e) else { continue };
|
|
if KEYS.iter().filter(|k| find(&b, k.as_bytes())).count() < KEYS.len() {
|
|
continue;
|
|
}
|
|
let name = p.file_name().unwrap().to_string_lossy().to_string();
|
|
match IdxdObject::parse(&b) {
|
|
Ok(o) => {
|
|
let toks = o.tokens();
|
|
// language tag: the PATH value, e.g. "dat\GP_CHALLENGE.pak+eng\"
|
|
let lang = toks
|
|
.iter()
|
|
.find(|t| t.contains("GP_CHALLENGE.pak+"))
|
|
.map(|t| t.to_string())
|
|
.unwrap_or_default();
|
|
println!(
|
|
"\n===== {name} entry #{i} schema {:08x} {} tokens [{lang}] =====",
|
|
o.schema_hash,
|
|
toks.len()
|
|
);
|
|
// Print the pool in order; the record is key/value interleaved and
|
|
// IDXD dedupes repeats, so pairing is read by eye, not asserted.
|
|
for (j, t) in toks.iter().enumerate() {
|
|
println!(" {j:3} {t}");
|
|
}
|
|
}
|
|
Err(e) => println!("\n===== {name} entry #{i}: IDXD parse failed: {e} ====="),
|
|
}
|
|
}
|
|
}
|
|
}
|