WAV (Waveform Audio)
While standard RIFF WAV files are supported, KOTOR utilizes a multi-tiered routing structure to evaluate audio buffers dynamically based on whether the file encapsulates voice-overs (VO), ambient sound effects (SFX), or unmodified bytes.
At a Glance
| Property | Value |
|---|---|
| Extension(s) | .wav |
| Magic Signature | RIFF |
| Type | Streamed / Buffered Audio |
| Rust Reference | View rakata_formats::Wav in Rustdocs |
Engine Audits & Decompilation
The following documents the engine’s exact load sequence for audio formats mapped from swkotor.exe.
(Decompilation logic for this section was audited and verified via native Ghidra pipeline against swkotor.exe, explicitly pulling from CExoSoundInternal::LoadSoundProvider at 0x005d9140.)
| Pipeline Event | Ghidra Provenance & Engine Behavior |
|---|---|
Standard Audio (WAV) | If the payload begins with the exact "RIFF" 4-byte signature and evaluates dynamically as a non-MP3 track, the parser initiates at offset 0 and transmits the contiguous buffer to the Miles Sound System without execution modification. |
Ambient Audio (SFX) | When evaluated as an SFX structure, the "RIFF" signature is deliberately absent from offset 0. The engine interprets a custom proprietary configuration prefix that displaces the standard "RIFF" block exactly 470 bytes into the payload buffer (+0x01d6). The execution structure calculates size = file_size - 0x1d6 and strictly extracts the resulting sub-segment. |
Voice Audio (VO) | For streaming voice-over tracks, the .wav wrapper successfully begins with a "RIFF" tag. However, structural logic asserting riff_size + 8 < file_size effectively succeeds. The memory engine immediately seeks to byte offset riff_size + 8 and subsequently pipes the remaining data exclusively as a literal .mp3 stream. |
| Delegation Hand-off | The main executable natively acts as a dispatch router, executing almost zero internal chunk structural parsing routines. Total specialization for deep RIFF chunk deserialization is deferred unconditionally to the external Miles Sound System layer. |