Wave Dictionary: Difference between revisions

m
 
(38 intermediate revisions by 3 users not shown)
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>.
 
= Layout =
{| class="wikitable" style=text-align:left
! Offset
! Name
! Type
! Value
! Description
|-
| 0x00 || uint32_t || <code>0x809</code> || Magic number.
! colspan="5" | Header
|-
| 0x04 || uint32_t || || The single byte at 0x04 seems to be a Big Endian bool.
|-
| 0x08 || uintptr_t || || Pointer to audio data.
|-
| 0x0C || [[Wave Dictionary#RwaWaveDict|RwaWaveDict]]* || || Pointer to wave dictionary.
|-
| 0x10 || uint32_t || ||
|-
| 0x14 || uint32_t || || Audio 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.
|-
| 0x28 || uintptr_t || || Pointer to audio data.
|-
|}
 
== RwaUUID ==
{{ MemoryLocationTableRow | name= | offset=0x00 | type=RwUInt32 | value=0x809 | description=Magic Number. }}
{| class="wikitable" style=text-align:left
! Offset
! Type
! Name
|-
| 0x00 || uint32_t || time_low
{{ MemoryLocationTableRow | name= | offset=0x04 | value= | type=uintptr_t | description=Pointer to location in system memory. Usually <code>nullptr</code>. }}
|-
| 0x04 || uint16_t || time_mid
{{ MemoryLocationTableRow | name= | offset=0x08 | value= | type=UInt32 | description=Container size. }}
|-
| 0x06 || uint16_t || time_hi_and_version
{{ MemoryLocationTableRow | name= | offset=0x0C | value= | type=UInt32 | description=Container header size. }}
|-
| 0x08 || uint8_t[8] || node
{{ MemoryLocationTableRow | name= | offset=0x10 | value= | type=UInt32 | description=If value at <code>0x04</code> is non-zero then this will be, too. }}
|-
|}
{{ MemoryLocationTableRow | name= | offset=0x14 | value= | type=UInt32 | description=Audio data size. }}‎
 
== RwaUniqueID ==
{| class="wikitable" style=text-align:left
! Offset
! Type
! Name
|-
| 0x00 || RwaUUID* || uuid
{{ MemoryLocationTableRow | name= | offset=0x18 | type=byte[128] | value=<div style="text-align:center">0x73F2018B75DFF0814BC8E45F453A2D04 (Xbox)<br>0x‎‎‎‎5393C7DBEA6481AE4917FC38AAEAC9AC (PS2)</div> | description=Platform UUID. }}
|-
| 0x04 || char* || name
{{ MemoryLocationTableRow | name= | offset=0x28 | value= | type=UInt32 | description=Audio data position. }}
|-
| 0x08 || uint32_t || flags
! colspan="5" | Wave Dictionary
|-
|}
{{ MemoryLocationTableRow | offset=0x2C | name=uniqueID | type=RwaUniqueID | value= | description= }}
 
== RwaWaveDict ==
{| class="wikitable" style=text-align:left
! Offset
! Type
! Name
|-
| 0x00 || RwaUniqueID || uniqueID
{{ MemoryLocationTableRow | offset=0x38 | name=waveListHead | type=RwaLLNode | value= | description= }}
|-
| 0x0C || RwaLLNode || waveListHead
{{ MemoryLocationTableRow | offset=0x44 | name=pad | type=byte[2] | value= | description= }}
|-
| 0x18 || int8_t || flagsAux
{{ MemoryLocationTableRow | offset=0x46 | name=flagsAux | type=RwUInt8 | value= | description= }}
|-
| 0x19 || int8_t || flags
{{ MemoryLocationTableRow | offset=0x47 | name=flags | type=RwUInt8 | value= | description= }}
|-
| 0x1C || RwLLLink || link
{{ MemoryLocationTableRow | offset=0x48 | name=link | type=RwLLLink | value= | description= }}
|-
| 0x24 || void* || dumpAddr
{{ MemoryLocationTableRow | offset=0x50 | name=dumpAddr | type=void* | value= | description= }}
|-
| 0x28 || void* || waveRAMHandle
{{ MemoryLocationTableRow | offset=0x54 | name=waveRAMHandle | type=void* | value= | description= }}
|-
| 0x2C || void* || waveRAMSize
{{ MemoryLocationTableRow | offset=0x58 | name=waveRAMSize | type=RwUInt32 | value= | description= }}
|-
|}
! colspan="5" | <br> <!-- TODO: wtf is this called -->
 
== RwaWaveFormat ==
{| class="wikitable" style=text-align:left
! Offset
! Type
! Name
! Description
|-
| 0x00 || uint32_t || sampleRate ||
{{ MemoryLocationTableRow | offset=0x5C | name= | value= | type=char[] | description=Name of the AWD.<br>Size between 1 and 12 characters.<br>Padded to the nearest 4-byte boundary. }}
|-
| 0x04 || uint32_t || dataType || 0: Sony PS ADPCM<br>1: Signed 16-bit PCM<br>3: Nintendo DSP ADPCM<br>4: Xbox IMA ADPCM
{{ MemoryLocationTableRow | offset= | name= | value= | type=RwLinkList<RwaLLNode> | description=Node data is of type <code>RwaWave</code> (see below.) }}
|-
| 0x08 || uint32_t || length ||
|-
| 0x0C || uint8_t || bitDepth ||
|-
| 0x0D || uint8_t || noChannels ||
|-
| 0x10 || void* || miscData || Has a "00: GCN ADPCM Header" chunk which contains Nintendo DSP ADPCM coefficients and initial history data.
|-
| 0x14 || uint32_t || miscDataSize ||
|-
| 0x18 || uint8_t || flags ||
|-
| 0x19 || uint8_t || reserved ||
|-
|}
 
== RwaWave ==
{| class="wikitable" style=text-align:left
Each wave is of type <code>RwaWave</code> and is stored in a <code>RwLLNode</code> in an <code>RwLinkList</code>.
! Offset
! Type
! Name
|-
| 0x00 || RwaUniqueID || uniqueID
|-
| 0x0C || RwaWaveDef* || waveDef
|-
| 0x10 || RwaWaveFormat || format
|-
| 0x2C || RwaWaveFormat || targetFormat
|-
| 0x48 || uint32_t || uncompressedLength
|-
| 0x4C || void* || data
|-
| 0x50 || void* || state
|-
| 0x54 || uint32_t || flags
|-
| 0x58 || RwaObj* || obj
|-
|}
 
<syntaxhighlight lang="cpp">
class RwaWave
{
RwaUniqueID uniqueID;
RwaWaveDef* waveDef; // Pointer to location in system memory.
RwaWaveFormat format;
RwaWaveFormat targetFormat; // Usually identical to format.
RwUInt32 uncompressedLength;
void* data;
void* state;
RwUInt32 flags;
RwaObj* obj;
};
</syntaxhighlight>
 
[[Category:Formats_(Takedown-Dominator)]]
== RwaUniqueID ==
<syntaxhighlight lang="cpp">
struct RwaUniqueID {
union {
RwaUUID* uuid;
RwaUUID* copyUUID;
}
 
struct name {
char* uniqueName;
char* copyName;
}
};
</syntaxhighlight>
 
== RwaWaveFormat ==
<syntaxhighlight lang="cpp">
struct RwaWaveFormat {
uint32_t sampleRate;
RwaUUID* dataType;
uint32_t length;
uint8_t bitDepth;
uint8_t noChannels;
// uint8_t pad[2];
void* miscData;
uint8_t miscDataSize;
uint8_t flags;
uint8_t reserved;
};
</syntaxhighlight>