dm2-graphics: console-family SFX missed entirely — 2-byte dtSnd header at fixed 5500 Hz (inline word bit 0x20) #187
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Sfx::parse(crates/dm2-graphics/src/sfx.rs) requires a 6-byte header whose bytes[2..6]equal08 01 00 00, and reads the sample rate from bytes[0..2]. That matches only the ports where bit0x20of the(0, 0, 0x0b, 0)inline feature word is set (DOS, Mac US, Amiga —0x7b/0x7b/0x2b).The engine dispatches on that bit (
[SKPROJECT] v5/bgdat.cpp:946-966): when it is clear, dtSnd payloads have a 2-byte header (skipped, content unused) and play at a fixed rate of 0x157c = 5500 Hz. Mac JP / Sega CD / FM-Towns / PC-98x1 / IBM PS/V all have the bit clear, soiter_sfxyields zero SFX there — silently.Evidence the console records are real PCM sound effects:
Two documentation claims are refuted:
sfx.rsmodule doc: "DM2 stores 107 SFX insidegraphics.daton every port (DOS, Mac, Amiga, Sega CD). They are byte-identical across ports" — 107 holds only for DOS / Mac US / Amiga; the 2-byte-header ports have their own (smaller, non-identical) sets.docs/formats/graphics-dat.md§ "Sound effects (SFX)": "The console-family ports … do not carry SFX ingraphics.dat… SFX on the console family live elsewhere on the disc — most likely insideSKUL.FTL" — they are right there ingraphics.dat, cls3 = 0x02, 2-byte header, 5500 Hz.Bonus decode of the "marker": the four bytes are not an opaque constant.
DM2_47eb_00a4(bgdat.cpp:851-883) treats byte 3 bit 0 as a "signed PCM, XOR 0x80 at load" latch and word[4:6]as the conversion-state field — which independently confirms the crate's signed→unsigned WAV conversion for the 6-byte-header ports.Caveat
PC-9801's 10 dtSnd records do not look like PCM (lag-1 ≈ 0, tiny sizes) — likely FM/beeper data for its sound hardware; fine to keep those undecoded. FM-Towns bodies sit between (median 0.62, values centred on 0x80) and may use an unsigned or different convention; worth a listen before committing.
Fix direction
Key SFX discovery on the ENT1 record (
cls3 = 0x02, as the engine does) plus the archive's inline-word bit 0x20 to pick the header form: bit set → current 6-byte parse; bit clear → 2-byte header, rate 5500 Hz, body from offset 2 (signed PCM, same XOR-0x80 WAV conversion — the engine's load-time conversion for these ports is latched in the allocation header, not the payload). Updateiter_sfx,dm2 infoSFX counts,dm2 extract, the module doc, and graphics-dat.md § SFX.Probe:
scratch/probe_console_sfx.py(gitignored); exports two Mac JP samples asscratch/macjp_snd_*.wavfor listening.Fixed by #208 (merged into
main).