Wave Dictionary: Difference between revisions

Content added Content deleted
(Updated basically everything.)
Line 1: Line 1:
The '''RenderWare Audio Wave Dictionary''' container format is used to store a collection of audio files, or "waves." It uses the file extension <code>.awd</code>. Each wave is of type <code>RwaWave</code> and is stored in a <code>RwLLNode</code> in an <code>RwLinkList</code>.
The '''RenderWare Audio Wave Dictionary''' container format stores audio assets in a linked list. It is normally given the file extensions <code>.awd</code>, <code>.hwd</code>, and <code>.lwd</code>.


Wave dictionaries are used in Burnout 3, Revenge, and Dominator, as well as Black and Call of Duty: Finest Hour. Note that although Burnout Legends uses .*wd extensions, its files are not the same format as described here.
= Layout =

{| class="wikitable" style=text-align:left
= Structures =
! Offset
=== Stream header ===
! Type
{| class="wikitable"
! Value
! Description
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x00 || uint32_t || <code>0x809</code> || Magic number.
| 0x0 || 0x4 || RwUInt32 || ? || Magic number || 0x809
|-
|-
| 0x4 || 0x1 || bool || ? || Indicates the stream header should be byteswapped || Causes <code>_RwaWaveDictStreamHeaderByteSwap()</code> to be run
| 0x04 || uint32_t || || The single byte at 0x04 seems to be a Big Endian bool.
|-
|-
| 0x08 || uintptr_t || || Pointer to audio data.
| 0x5 || 0x3 || || || Padding ||
|-
|-
| 0x0C || [[Wave Dictionary#RwaWaveDict|RwaWaveDict]]* || || Pointer to wave dictionary.
| 0x8 || 0x4 || RwUInt32 || ? || Size of the header data to read for wave loading ||
|-
|-
| 0xC || 0x4 || [[#RwaWaveDict|RwaWaveDict]]* || ? || Wave dictionary ||
| 0x10 || uint32_t || ||
|-
|-
| 0x10 || 0x4 || RwUInt32 || ? || || Unknown, but set at runtime if used
| 0x14 || uint32_t || || Audio data size. ‎
|-
|-
| 0x14 || 0x4 || RwUInt32 || ? || Wave data size ||
| 0x18 || [[Wave Dictionary#RwaUUID|RwaUUID]] || style="text-align:right" | Xbox: <code>73F2018B 75DFF081 4BC8E45F 453A2D04</code><br>‎‎‎‎PS2: <code>5393C7DB EA6481AE 4917FC38 AAEAC9AC</code><br>GCN: <code>48F6C70A 72142484 6A4279E1 D3329DFD</code> || Platform UUID.
|-
|-
| 0x18 || 0x10 || [[#RwaUUID|RwaUUID]] || ? || Platform UUID || See [[#Platform|platform]]
| 0x28 || uintptr_t || || Pointer to audio data.
|-
|-
| 0x28 || 0x4 || void* || ? || Wave data ||
|}
|}


== RwaUUID ==
=== RwaWaveDict ===
{{todo|Research and list flags.}}
{| class="wikitable" style=text-align:left

! Offset
{| class="wikitable"
! Type
! Offset !! Length !! Type !! Name !! Description !! Comments
! Name
|-
|-
| 0x0 || 0xC || [[#RwaUniqueID|RwaUniqueID]] || uniqueID || Dictionary ID || UUID set at runtime
| 0x00 || uint32_t || time_low
|-
|-
| 0xC || 0xC || [[#RwaLLNode|RwaLLNode]] || waveListHead || || Prev wraps to final node, next is first node, and data is nullptr<br>In wave dictionaries, data is an [[#RwaWave|RwaWave]]
| 0x04 || uint16_t || time_mid
|-
|-
| 0x18 || 0x2 || RwUInt8[2] || pad || Padding ||
| 0x06 || uint16_t || time_hi_and_version
|-
|-
| 0x1A || 0x1 || RwUInt8 || flagsAux || Auxiliary flags ||
| 0x08 || uint8_t[8] || node
|-
|-
| 0x1B || 0x1 || RwUInt8 || flags || Flags ||
|-
| 0x1C || 0x4 || RwLLLink || link || || Set at runtime<br>Structure not documented here
|-
| 0x24 || 0x4 || void* || dumpAddr || Wave dump address || Set at runtime
|-
| 0x28 || 0x4 || void* || waveRAMHandle || Wave handle || Set at runtime
|-
| 0x2C || 0x4 || RwUInt32 || waveRAMSize || Wave size in memory || Set at runtime
|}
|}


== RwaUniqueID ==
=== RwaUniqueID ===
{{todo|Research and list flags.}}
{| class="wikitable" style=text-align:left

! Offset
{| class="wikitable"
! Type
! Offset !! Length !! Type !! Name !! Description !! Comments
! Name
|-
|-
| 0x0 || 0x4 || [[#RwaUniqueID__uuid|RwaUniqueID__uuid]] || uuid || UUID ||
| 0x00 || RwaUUID* || uuid
|-
| 0x4 || 0x4 || [[#RwaUniqueID__uuid|RwaUniqueID__name]] || name || Name ||
|-
| 0x8 || 0x4 || RwUInt32 || flags || Flags ||
|}

=== RwaLLNode ===
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x0 || 0x4 || RwaLLNode* || prev || Previous node ||
| 0x04 || char* || name
|-
|-
| 0x4 || 0x4 || RwaLLNode* || next || Next node ||
| 0x08 || uint32_t || flags
|-
|-
| 0x8 || 0x4 || void* || data || Current node's data ||
|}
|}


== RwaWaveDict ==
=== RwaWave ===
{| class="wikitable" style=text-align:left
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset
! Type
! Name
|-
|-
| 0x00 || RwaUniqueID || uniqueID
| 0x0 || 0xC || [[#RwaUniqueID|RwaUniqueID]] || uniqueID || Wave ID || Data set at runtime
|-
|-
| 0xC || 0x4 || RwaWaveDef* || waveDef || Wave definition<br>Primarily contains function pointers || Set at runtime<br>Structure not described here
| 0x0C || RwaLLNode || waveListHead
|-
|-
| 0x10 || 0x1C || [[#RwaWaveFormat|RwaWaveFormat]] || format || Source wave format ||
| 0x18 || int8_t || flagsAux
|-
|-
| 0x2C || 0x1C || [[#RwaWaveFormat|RwaWaveFormat]] || targetFormat || Target wave format ||
| 0x19 || int8_t || flags
|-
|-
| 0x48 || 0x4 || RwUInt32 || uncompressedLength || || Null in samples. Set at runtime?
| 0x1C || RwLLLink || link
|-
|-
| 0x24 || void* || dumpAddr
| 0x4C || 0x4 || void* || data || Wave data || Set at runtime
|-
|-
| 0x28 || void* || waveRAMHandle
| 0x50 || 0x4 || void* || state || Wave state || Set at runtime
|-
|-
| 0x54 || 0x4 || RwUInt32 || flags || Flags ||
| 0x2C || void* || waveRAMSize
|-
|-
| 0x58 || 0x4 || RwaObj* || obj || Object data || Set at runtime<br>Structure not described here
|}
|}


== RwaWaveFormat ==
=== RwaWaveFormat ===
{{todo|Research and list flags.<br>Research misc data.}}
{| class="wikitable" style=text-align:left

! Offset
{| class="wikitable"
! Type
! Offset !! Length !! Type !! Name !! Description !! Comments
! Name
! Description
|-
|-
| 0x00 || uint32_t || sampleRate ||
| 0x0 || 0x4 || RwUInt32 || sampleRate || Sample rate ||
|-
|-
| 0x04 || uint32_t || dataType || 0: Sony PS ADPCM<br>1: Signed 16-bit PCM<br>3: Nintendo DSP ADPCM<br>4: Xbox IMA ADPCM
| 0x4 || 0x4 || RwaUUID* || dataType || Sample format || Index in asset, set to pointer at runtime.<br>See [[#Data type|data type]]
|-
|-
| 0x08 || uint32_t || length ||
| 0x8 || 0x4 || RwUInt32 || length || Duration (milliseconds) ||
|-
|-
| 0x0C || uint8_t || bitDepth ||
| 0xC || 0x1 || uint8_t || bitDepth || Bit depth ||
|-
|-
| 0x0D || uint8_t || noChannels ||
| 0xD || 0x1 || uint8_t || noChannels || Number of channels ||
|-
|-
| 0xE || 0x2 || RwUInt8[2] || pad || Padding ||
| 0x10 || void* || miscData || Has a "00: GCN ADPCM Header" chunk which contains Nintendo DSP ADPCM coefficients and initial history data.
|-
|-
| 0x10 || 0x4 || void* || miscData || Additional platform-specific data || Only used on GameCube in practice, where an additional header with coefficients and initial history data is present.
| 0x14 || uint32_t || miscDataSize ||
|-
|-
| 0x14 || 0x4 || RwUInt32 || miscDataSize || Additional data size ||
| 0x18 || uint8_t || flags ||
|-
|-
| 0x19 || uint8_t || reserved ||
| 0x18 || 0x1 || uint8_t || flags || Flags ||
|-
|-
| 0x19 || 0x1 || uint8_t || reserved || ||
|-
| 0x1A || 0x2 || || || Padding ||
|}
|}


== RwaWave ==
=== RwaUUID ===
{| class="wikitable" style=text-align:left
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
! Offset
! Type
! Name
|-
|-
| 0x0 || 0x4 || RwUInt32 || time_low || rowspan=3|Timestamp if version 1, otherwise random || rowspan=3|Always a random value as UUID version is always 4<br>See [https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-4 RFC 9562 Section 5.4]
| 0x00 || RwaUniqueID || uniqueID
|-
|-
| 0x0C || RwaWaveDef* || waveDef
| 0x4 || 0x2 || RwUInt16 || time_mid
|-
|-
| 0x6 || 0x2 || RwUInt16 || time_hi_and_version
| 0x10 || RwaWaveFormat || format
|-
|-
| 0x8 || 0x8 || RwUInt8[8] || node || ||
| 0x2C || RwaWaveFormat || targetFormat
|}

= Unions =
=== RwaUniqueID__uuid ===
{| class="wikitable"
! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x4 || [[#RwaUUID|RwaUUID]]* || uuid || ||
| 0x48 || uint32_t || uncompressedLength
|-
|-
| 0x4C || void* || data
| 0x4 || [[#RwaUUID|RwaUUID]]* || copyUUID || ||
|}

=== RwaUniqueID__name ===
{| class="wikitable"
! Length !! Type !! Name !! Description !! Comments
|-
|-
| 0x50 || void* || state
| 0x4 || RwChar* || uniqueName || ||
|-
|-
| 0x54 || uint32_t || flags
| 0x4 || RwChar* || copyName || ||
|}

= Enumerations =
=== Data type ===
{| class="wikitable"
! Index !! Name !! Format || UUID
|-
|-
| 0 || rwaWAVEFORMAT_VAG || PlayStation VAG ADPCM || d9ea9798-bbbc-447b-96b2-654759102e16
| 0x58 || RwaObj* || obj
|-
|-
| 1 || rwaWAVEFORMAT_PCM || Signed 16-bit PCM || d01bd217-3587-4eed-b9d9-b8e86ea9b995
|-
| 2 || rwaWAVEFORMAT_FLOAT || || da1e4382-2c99-4c61-ad99-7f364b211537
|-
| 3 || rwaWAVEFORMAT_GCNADPCM || Nintendo DSP-ADPCM || f86215b0-31d5-4c29-bd37-cdbf9bd10c53
|-
| 4 || rwaWAVEFORMAT_XADPCM || Xbox IMA ADPCM || 632fa22b-11dd-458f-aa27-a5c346e9790e
|-
| 5 || rwaWAVEFORMAT_WMA || Windows Media Audio || 3f1d8147-b7c4-41e6-a69b-3cc0025b33c7
|-
| 6 || rwaWAVEFORMAT_MP3 || MPEG-1/2 Audio Layer III || bacfb36e-529d-4692-bf53-324256b0734f
|-
| 7 || rwaWAVEFORMAT_MP2 || MPEG-1/2 Audio Layer II || 34d09a54-57d3-409e-a6ad-2bc845aec339
|-
| 8 || rwaWAVEFORMAT_MPG || MPEG-1/2 Audio Layer I || 04c15ba7-f907-40ab-a49f-eefef8c4d296
|-
| 9 || rwaWAVEFORMAT_AC3 || Dolby AC-3 || a30db390-58a9-43c4-b9d2-55d84d3ae754
|-
| 10 || rwaWAVEFORMAT_IMAADPCM || Microsoft IMA ADPCM || ef386593-b611-432d-957f-a71ade44227a
|}
|}


=== Platform ===
{| class="wikitable"
! Name !! UUID
|-
| rwaHOST_PS2 || aaeac9ac-fc38-4917-ae81-64eadbc79353
|-
| rwaHOST_WIN32 || 44e50a10-08ba-4250-b971-69e921b9cf4f
|-
| rwaHOST_XBOX || 453a2d04-e45f-4bc8-81f0-df758b01f273
|-
| rwaHOST_GCN || fd9d32d3-e179-426a-8424-14720ac7f648
|}


[[Category:Formats_(Takedown-Dominator)]]
[[Category:Formats_(Takedown-Dominator)]]