Files
benilla-octo/crates/benilla-m2/examples/dump_attach.rs
T
Sam SungandClaude Opus 5.5 7b66dac9db comments cite the reference by address, not by private note (#30)
Comments that pointed into the maintainer's private reverse-engineering notes (a note by name, a
path, a section or finding id, the analysis's own name for a client function, a process word) now
carry the fact itself, cited by the reference client's address, by vmangos file and line, or as
"the reference". Nobody outside could follow those pointers.

Comment text only, plus the test-assert and log strings that carried the same pointers. No claim
changes: a comment the notes have since corrected keeps its wording here, and correcting it is
separate work.

The two reference generators, `scripts/gen-reference-globals.py` and
`scripts/gen-reference-verb-events.py`, named the private notes' layout to find their inputs. They
now take the input files as arguments (`--capture`, `--framexml`, `--names`, `--extents`,
`--disasm`). Run on the same inputs, both write the committed tables row for row; only the two
header lines that named the old environment variable change.

Checked per file:
- the code is identical: each file with its comments stripped compares equal before and after; a
  changed string literal is compared under a mask that proves only literal text moved and every
  literal kept its line count;
- no client address the old text cited was dropped;
- a second reviewer checked every added address against its derivation;
- a detector for the notes' names, paths, ids, function names and process words finds none left;
- `scripts/gates.sh` is green.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 12:14:08 +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 investigation (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]
);
}
}