dm2-graphics: Champion::palette is mislabeled — (0x16, htype, 0x02, 0x82) is the champion's voice SFX #190

Closed
opened 2026-07-05 07:48:13 +02:00 by jqueuniet · 1 comment
jqueuniet commented 2026-07-05 07:48:13 +02:00 (Migrated from codeberg.org)

Problem

Champion::palette (crates/dm2-graphics/src/champion.rs ~169) documents the (0x16, htype, 0x02, 0x82) record as a "Per-champion palette", with a note that champion 14's missing record means "the engine presumably falls back to one of the 6 shared palettes at cls2=0xFE".

Those records are not palettes. cls3 = 0x02 is dtSnd, and the payloads carry the standard SFX framing: rate 11127 Hz LE (77 2b), the signed-PCM header quartet 08 01 00 00, and 7-8 KB bodies — speech-length audio. They are the champions' voice samples (the line played when hiring), served by the same dtSnd load path as every other SFX ([SKPROJECT] v5/bgdat.cpp:940-975 reads (b_02, b_03, 2, b_04) tuples).

dos-en carries 21 such records under cls1 = 0x16; champion 14 simply has no dedicated voice sample.

Fix direction

Rename the field (e.g. voice: Option<EntryRef>) or, better, expose it as a parsed Sfx once the SFX API keys on cls3 = 0x02 (see the console-SFX issue); fix the docstring and drop the shared-palette speculation. Check dm2 info / extract output for anything that labels it a palette.

Probe: scratch/probe_champal.py (gitignored).

## Problem `Champion::palette` (`crates/dm2-graphics/src/champion.rs` ~169) documents the `(0x16, htype, 0x02, 0x82)` record as a "Per-champion palette", with a note that champion 14's missing record means "the engine presumably falls back to one of the 6 shared palettes at cls2=0xFE". Those records are not palettes. `cls3 = 0x02` is `dtSnd`, and the payloads carry the standard SFX framing: rate 11127 Hz LE (`77 2b`), the signed-PCM header quartet `08 01 00 00`, and 7-8 KB bodies — speech-length audio. They are the champions' **voice samples** (the line played when hiring), served by the same dtSnd load path as every other SFX (`[SKPROJECT] v5/bgdat.cpp:940-975` reads `(b_02, b_03, 2, b_04)` tuples). dos-en carries 21 such records under cls1 = 0x16; champion 14 simply has no dedicated voice sample. ## Fix direction Rename the field (e.g. `voice: Option<EntryRef>`) or, better, expose it as a parsed `Sfx` once the SFX API keys on cls3 = 0x02 (see the console-SFX issue); fix the docstring and drop the shared-palette speculation. Check `dm2 info` / extract output for anything that labels it a palette. Probe: `scratch/probe_champal.py` (gitignored).
jqueuniet commented 2026-07-06 06:22:44 +02:00 (Migrated from codeberg.org)

Fixed by #208 (merged into main).

Fixed by #208 (merged into `main`).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jqueuniet/dm2-tools#190
No description provided.