Files
benilla-octo/crates/benilla-m2/examples/dump_attach.rs
T
SamandClaude Fable 5.1 00150c55b5 a crash leaves a report, and the wire's counts are capped
- a panic writes benilla-config/Diagnostics/crash-<time>.txt with the build id, the location, a backtrace and the last 200 log lines, and names the file as its last line, so a bug report can attach it (2266)
- every wire-count allocation hint is capped and the compressed update object reads through the cursor, so a malformed packet can no longer ask for gigabytes (2266)
- the 23 in-world run conditions are one set, the 45 probe variables one registry, the install-gated tests say when they skip, and every gate is timed (2266)
- one workspace-level lint allowance replaces 413 per-site attributes, and the decision corpus gets a lint in the gate (2266)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 16:38:59 +07:00

39 lines
1.5 KiB
Rust

//! Session probe: dump an M2's attachment table (+ each attach bone's parent/pivot) —
//! `cargo run -p benilla-m2 --example dump_attach <file.m2>`. Extract the file first via
//! `mpqx` (benilla-mpq). Built for the nocked-ammo RE round (decision 2273 follow-up), kept
//! because "which attach ids does this model actually have" keeps coming up.
use std::io::Cursor;
fn main() {
let path = std::env::args()
.nth(1)
.expect("usage: dump_attach <file.m2>");
let data = std::fs::read(&path).expect("read m2");
let m2 = benilla_m2::parse_m2(&mut Cursor::new(data.as_slice())).expect("parse m2");
let model = m2.model();
println!("attachments: {}", model.attachments.len());
for a in &model.attachments {
let bone = model.bones.get(a.bone as usize);
let parent = bone.map_or(-1, |b| b.parent);
println!(
"id {:2} bone {:3} (parent {:3}) pos ({:+.3},{:+.3},{:+.3})",
a.id, a.bone, parent, a.position[0], a.position[1], a.position[2]
);
}
println!("event markers: {}", model.event_markers.len());
for m in &model.event_markers {
let bone = model.bones.get(m.bone as usize);
let parent = bone.map_or(-1, |b| b.parent);
println!(
"{} bone {:3} (parent {:3}) pos ({:+.3},{:+.3},{:+.3})",
String::from_utf8_lossy(&m.ident),
m.bone,
parent,
m.position[0],
m.position[1],
m.position[2]
);
}
}