`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
63 lines
2.2 KiB
Rust
63 lines
2.2 KiB
Rust
//! Does a resource's DESCRIPTOR carry its bounding box?
|
|
//!
|
|
//! The last cross-container disagreements are 24-vertex bound boxes swapping
|
|
//! identities; no anchoring rule can pin them (see docs). If the descriptor
|
|
//! states the box, that is the missing information. This decodes the resource,
|
|
//! takes the box its geometry actually spans, and searches the descriptor for
|
|
//! those float values.
|
|
//!
|
|
//! Usage: bounds_in_descriptor <container.xpr> <resource>...
|
|
use std::collections::HashSet;
|
|
use sylpheed_formats::mesh::{xbg7_descriptor_range, Xbg7Model};
|
|
|
|
fn main() {
|
|
let a: Vec<String> = std::env::args().collect();
|
|
let bytes = std::fs::read(&a[1]).expect("container");
|
|
let want: HashSet<String> = a[2..].iter().cloned().collect();
|
|
for m in Xbg7Model::models_named(&bytes, &want, &|| false) {
|
|
let (mut lo, mut hi) = ([f32::MAX; 3], [f32::MIN; 3]);
|
|
for s in &m.meshes {
|
|
for q in &s.positions {
|
|
for k in 0..3 {
|
|
lo[k] = lo[k].min(q[k]);
|
|
hi[k] = hi[k].max(q[k]);
|
|
}
|
|
}
|
|
}
|
|
let Some((d0, d1)) = xbg7_descriptor_range(&bytes, &m.name) else {
|
|
continue;
|
|
};
|
|
println!(
|
|
"{} descriptor 0x{d0:x}..0x{d1:x} ({} bytes), box lo{:?} hi{:?}",
|
|
m.name,
|
|
d1 - d0,
|
|
lo.map(|v| v.round()),
|
|
hi.map(|v| v.round())
|
|
);
|
|
// Where in the descriptor does each bound value appear (±0.01)?
|
|
let targets: Vec<(&str, f32)> = vec![
|
|
("lo.x", lo[0]),
|
|
("lo.y", lo[1]),
|
|
("lo.z", lo[2]),
|
|
("hi.x", hi[0]),
|
|
("hi.y", hi[1]),
|
|
("hi.z", hi[2]),
|
|
];
|
|
for (label, v) in targets {
|
|
let mut at: Vec<usize> = Vec::new();
|
|
let mut o = d0;
|
|
while o + 4 <= d1 {
|
|
let f = f32::from_be_bytes(bytes[o..o + 4].try_into().unwrap());
|
|
if (f - v).abs() <= 0.01 * (1.0 + v.abs()) {
|
|
at.push(o - d0);
|
|
}
|
|
o += 4;
|
|
}
|
|
println!(
|
|
" {label:5} {v:10.3} at descriptor offsets {:x?}",
|
|
&at[..at.len().min(6)]
|
|
);
|
|
}
|
|
}
|
|
}
|