Files
benilla-octo/crates/benilla-formats/examples/dbc_head.rs
T
SamandClaude Fable 5 6b980b9efb the player build: one binary that carries its content
- a player build ships beside the dev one — dev chords and probe surfaces go dark, and a gate enforces what a player can still reach, by medium not by module
- the binary carries its own shaders and its shipped UI, finds the WoW folder by itself, and keeps its local state in one benilla-config folder
- the glue screens get a capture shutter, and the engine stops depending on the protocol crate

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 18:18:02 +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 = benilla_formats::wow_data().expect("no WoW install found (set $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(())
}