Add File Type - Wwise Event

Lucas Schwiderski 2024-07-12 11:53:47 +02:00
parent 6f132ad27a
commit a8e6464dd7

@ -0,0 +1,145 @@
```101editor
//------------------------------------------------
//--- 010 Editor v12.0.1 Binary Template
//
// File: dt_wwise_event.bt
// Authors: Lucas Schwiderski
// Version:
// Purpose:
// Category: Darktide
// File Mask: *.wwise_event
// ID Bytes:
// History:
//------------------------------------------------
// Definitions for Wwise Bank are taken from the repository.
// Copyright Alexander Lombardi
/***********************************************************************
Typedef's Section:
***********************************************************************/
typedef struct(uint32 dataLen)
{
local uint32 i, numFiles = dataLen / 12; // 12 = 3 * uint32 entries.
for(i = 0; i < numFiles; i++)
{
struct d_entry
{
uint32 fileId <format=hex, comment=".wem file id">;
uint32 dOffset <comment="offset from start of DATA section">;
uint32 dSize <comment="length in bytes of .wem file">;
} a_wem_file;
}
} data_DIDX;
typedef struct(data_DIDX &DIDX_dataObj)
{
local uint32 i;
local const uint64 pos = FTell();
for(i = 0; i < DIDX_dataObj.numFiles; i++)
{
FSeek(pos + DIDX_dataObj.a_wem_file[i].dOffset);
struct d_entry_data(data_DIDX &DIDX_dataObj)
{
byte rawdata[DIDX_dataObj.a_wem_file[i].dSize] <comment="The .wem file with the length as given in the DIDX section, and starting with 52 49 46 46 -- RIFF.">;
} aFileData (DIDX_dataObj);
}
FSeek(pos + parentof(this).secLen);
} data_DATA;
typedef struct {
byte object_type;
uint32 object_length;
uint32 id <format=hex>;
byte data[object_length-4];
} data_HIRC_object;
typedef struct {
uint32 object_count;
data_HIRC_object objects[object_count] <optimize=false>;
} data_HIRC;
typedef struct
{
char secName[4];
if(Strcmp(secName, "ffff") != 0) {
uint32 secLen <comment="length of section">;
if(secLen > 0)
{
if(Strcmp(secName, "DIDX") == 0)
{
data_DIDX data(secLen);
parentof(this).flag_DIDX_defined = TRUE;
parentof(this).idxOf_DIDX_sec = parentof(this).i;
}
else if(Strcmp(secName, "DATA") == 0 && parentof(this).flag_DIDX_defined)
data_DATA data(parentof(this).aSection[parentof(this).idxOf_DIDX_sec].data);
else if(Strcmp(secName, "HIRC") == 0)
data_HIRC data;
else
byte data[secLen];
};
};
} section <read=getSecName>;
/***********************************************************************
File Definition:
***********************************************************************/
uint32 version <format=hex>;
Assert(version == 0x1b);
uint32 length;
// A section of values that don't belong the actual Wwise bank
struct {
uint32 unknown1;
// Does not match the file name
// TODO: Check if this corresponds to some other file/bundle in the game
uint64 hash <format=hex>;
uint32 unknown2;
Assert(unknown2 == 0x40);
uint32 unknown3;
Assert(unknown3 == 0x0);
// The following hash-like values will probably define some of these values:
// - name of the event
// - Wwise bus the event runs on
// Corresponds to the `id` value of a HIRC object of type "event" later on in the file
uint32 unknown4 <format=hex, comment="Looks like a short hash">;
// Only shows one of a few values:
// - 0x41c80000
// - 0xffff7f7f
uint32 unknown5 <format=hex, comment="Hex, but with leading zeroes">;
uint32 unknown6 <format=hex, comment="Looks like a short hash">;
// At least in one instance, this was identical with `unknown6`
uint32 unknown7 <format=hex, comment="Looks like a short hash">;
uint32 unknown8;
uint32 unknown9;
uint32 unknown10;
uint32 unknown11;
} header <open=true>;
struct bnk
{
local byte flag_DIDX_defined = FALSE; // Used later to ensure DATA section is defined and declared after DIDX.
local int32 i; // i is used later to find the index of the DIDX section.
local int32 idxOf_DIDX_sec = -1; // Will get set to i's value when DIDX gets parsed.
for(i = 0; !FEof(); i++)
section aSection;
} wwise_bank <open=true>;
/***********************************************************************
Function definitions:
***********************************************************************/
string getSecName(section &aSec)
{
return aSec.secName;
}
```