`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
74 lines
3.1 KiB
Rust
74 lines
3.1 KiB
Rust
//! Does a `.rat` leaf record decode with the same reader as a whole bundle?
|
|
//!
|
|
//! The port needs the position of `ptbtneff01.t32`, the focus ring, which is
|
|
//! declared *inside* the nested `ptbtn0Nf.rat` leaf and is therefore invisible
|
|
//! to anything that walks only a bundle's top-level elements.
|
|
//!
|
|
//! The leaf's first 32 bytes have the same shape as a bundle header --
|
|
//! `"RATC"`, `0x3c` declaration-entry size at `+4`, element count at `+20`,
|
|
//! design size at `+24`/`+28` -- so the hypothesis is that `parse_build` reads
|
|
//! it unchanged. The control is the BASE record `ptbtn0N.rat`, whose single
|
|
//! element's position is already known independently: the parent screen's
|
|
//! `screen info` reports `ptbtn01.rat` resting at (542,162).
|
|
//!
|
|
//! cargo run -p sylpheed-formats --example rat_leaf_placement -- <GP_TITLE.pak>
|
|
use sylpheed_formats::{pak, ratc, ui_layout};
|
|
|
|
fn main() {
|
|
let path = std::env::args().nth(1).expect("usage: … <pak>");
|
|
let ar = pak::PakArchive::open(&path).expect("open pak");
|
|
let entries: Vec<_> = ar.entries().to_vec();
|
|
|
|
for (ei, e) in entries.iter().enumerate() {
|
|
let Ok(bytes) = ar.read(e) else { continue };
|
|
let Some(kids) = ratc::parse(&bytes) else {
|
|
continue;
|
|
};
|
|
// Only the title-family bundles carry ptbtn records.
|
|
if !kids.iter().any(|c| c.name == "ptbtn01f.rat") {
|
|
continue;
|
|
}
|
|
println!("=== pak entry {ei}");
|
|
for c in &kids {
|
|
if c.kind != "RATC" || !c.name.starts_with("ptbtn") {
|
|
continue;
|
|
}
|
|
let leaf = &bytes[c.offset..c.offset + c.size];
|
|
match ui_layout::parse_build(leaf) {
|
|
None => println!(" {:16} …parse_build says no", c.name),
|
|
Some(b) => {
|
|
println!(
|
|
" {:16} {}x{} {} element(s), fallback={}",
|
|
c.name,
|
|
b.design_w,
|
|
b.design_h,
|
|
b.elements.len(),
|
|
b.from_fallback
|
|
);
|
|
for el in &b.elements {
|
|
let r = el.rest();
|
|
println!(
|
|
" [{}] {:18} pivot ({:4},{:4}) rest ({:5},{:5}) kf {}",
|
|
el.index,
|
|
el.name,
|
|
el.pivot_x,
|
|
el.pivot_y,
|
|
r.map(|k| k.x).unwrap_or(-1),
|
|
r.map(|k| k.y).unwrap_or(-1),
|
|
el.keyframes.len()
|
|
);
|
|
for (i, k) in el.keyframes.iter().enumerate() {
|
|
println!(
|
|
" kf{i} t={:?} pos=({},{}) scale={}%,{}% a={} rot={} tint={:#010x}",
|
|
k.time, k.x, k.y, k.scale_x, k.scale_y,
|
|
k.fade >> 24, k.rotation_deg, k.tint
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
println!();
|
|
}
|
|
}
|