Files
benilla-octo/crates/benilla-formats/examples/dbc_head.rs
T
SamandClaude Fable 5 ff1524f85f key bindings become real, and the pet knows when to refuse
- every rebindable key runs through one chord-to-command engine, set in the era Key Bindings window, and buttons show their real keys
- a spell aimed at the ground sends its projectile to that spot, arcing to the point instead of a target
- a pet ordered onto something it can't attack refuses cleanly, and its frame shows the happiness face read from the client's own data
- a window's tabs clamp to the drawn edge and highlight exactly where they sit

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 19:04:33 +07:00

39 lines
1.5 KiB
Rust

//! Throwaway: dump a DBC's header (record count / field count / record size) and the first rows'
//! raw dwords, so a claimed column offset can be checked against the real shipped file.
fn main() -> anyhow::Result<()> {
let data = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../WoW/Data");
let mut chain = benilla_formats::open_chain(&data)?;
for name in std::env::args().skip(1) {
let path = format!("DBFilesClient\\{name}.dbc");
let Ok(bytes) = chain.read_file(&path) else {
println!("{name}: NOT IN CHAIN");
continue;
};
let g = |o: usize| u32::from_le_bytes(bytes[o..o + 4].try_into().unwrap());
let (rows, fields, rec) = (g(4), g(8), g(12));
println!(
"{name}: {rows} rows x {fields} fields, record {rec} bytes (0x{rec:x}), stringblock {}",
g(16)
);
for r in 0..rows.min(4) as usize {
let base = 20 + r * rec as usize;
let mut out = String::new();
for f in 0..fields as usize {
let v = g(base + f * 4);
let fl = f32::from_le_bytes(v.to_le_bytes());
out += &format!(
" [{:#04x}]{}",
f * 4,
if (0.0001..100000.0).contains(&fl.abs()) && v > 0x1000 {
format!("{fl:.3}f")
} else {
format!("{v}")
}
);
}
println!(" row{r}:{out}");
}
}
Ok(())
}