From 5119de575ad4e7b1a59ce71fd9a048992ce78d6e Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 4 Mar 2023 17:15:30 -0800 Subject: [PATCH] Add CAudioSoundEffect --- CAudioSoundEffect.bt | 141 +++++++++++++++++++++++++++++++++++++++++++ CCharInfo.bt | 63 +++++++++++-------- CMayaSpline.bt | 32 ++++++++++ CVector2f.bt | 10 +++ CVectorField.bt | 2 +- Run.bt | 4 ++ 6 files changed, 225 insertions(+), 27 deletions(-) create mode 100644 CAudioSoundEffect.bt create mode 100644 CMayaSpline.bt create mode 100644 CVector2f.bt diff --git a/CAudioSoundEffect.bt b/CAudioSoundEffect.bt new file mode 100644 index 0000000..21cc19a --- /dev/null +++ b/CAudioSoundEffect.bt @@ -0,0 +1,141 @@ +#ifndef _CAUDIOSOUNDEFFECT +#define _CAUDIOSOUNDEFFECT + +#include "CMayaSpline.bt" +#include "CVector3f.bt" +#include "Common.bt" + +typedef struct STimelineEvent { + uint unk1; + float unk2; +} STimelineEvent; + +typedef struct SFilterSettings { + ubyte type; + switch (type) { + case 1: + case 2: + case 3: + case 4: + uint unk1; + uint unk2; + break; + case 5: + uint unk1; + uint unk2; + break; + case 6: + case 7: + uint unk; + break; + case 8: + uint unk; + break; + case 0xFF: + case 9: + break; + default: + uint unk; + break; + } +} SFilterSettings; + +typedef struct CAudioMetaSample { + GUID csmp; + float unk1; + uint unk2; + float unk3; + float unk4; + float unk5; + float unk6; + float unk7; + float unk8; + float unk9; + float unk10; + float unk11; + float unk12; + int unk13; + float unk14; + int unk15; + float unk16; + float unk17; + float unk18; + float unk19; + float unk20; + float unk21; + bool unk22; + bool unk23; + bool unk24; + bool unk25; + bool unk26; + CMayaSpline spline1; + CMayaSpline spline2; + CMayaSpline spline3; + CMayaSpline spline4; + uint timelineEventCount; + STimelineEvent timelineEvents[timelineEventCount]; + uint unk27; + float unk28; + CMayaSpline spline5; + CVector3f unk29; + SFilterSettings filterSettings1; + SFilterSettings filterSettings2; +} CAudioMetaSample; + +typedef struct STimelineEventPairs { + uint unk1; + uint timelineEventCount; + STimelineEvent timelineEvents[timelineEventCount]; +} STimelineEventPairs; + +typedef struct CAudioSoundEffectEvent { + GUID guid; + uint unk1; + uint unk2; + char unk3[unk2]; +} CAudioSoundEffectEvent; + +typedef struct CAudioSoundEffect { + uint nameLen; + char name[nameLen]; + float unk1; + // Loaded by CAudioSoundEffect::FinishConstructing + float unk2; + uint unk3; + if (((unk3 << 1) >> 6) & 1) { + ubyte unk4; + float unk5; + } else if ((unk3 & 4)) { + float unk5; + } + + if ((unk3 >> 3) & 1) { + float unk6; + } + + uchar unk7; + GUID objectId; + uint gobCount; + typedef struct CGobData { + byte unk1; + byte unk2; + float unk3; + uint metaSampleCount; + CAudioMetaSample metaSamples[metaSampleCount]; + uint timelineEventPairCount; + STimelineEventPairs + timelineEventPairs[timelineEventPairCount]; + if (unk1 != 0) { + uint eventDataCount; + typedef struct CEventData { + CAudioSoundEffectEvent effectEvent; + uint timelineEventCount; + STimelineEvent timelineEvents[timelineEventCount]; + } CEventData; + CEventData eventData[eventDataCount]; + } + } CGobData; + CGobData gobs[gobCount]; +} CAudioSoundEffect; + +#endif // _CAUDIOSOUNDEFFECT diff --git a/CCharInfo.bt b/CCharInfo.bt index 489772e..53ee2c4 100644 --- a/CCharInfo.bt +++ b/CCharInfo.bt @@ -54,16 +54,27 @@ struct CCharInfo { CPooledNameData namePool; } - byte unk; - byte unk; //boolean - - byte unk; - byte unk; + byte unk1; + byte unk2; //boolean + char data[(unk1 & 0x7FFF) * 2]; + byte unk3; + byte unk4; if (isDKCTF) { byte unk2[12]; byte flags1; uint16 flags2; + } else { + uint16 unk5; + uint16 unk6; + uint16 unk7; + char animData1[unk3 * 6]; + char animData2[unk5]; + byte unk8; + uint16 unk9; + uint16 unk10; + uint16 unk11; + uint16 unk12; } }; @@ -76,13 +87,13 @@ struct CAnimationIdMap struct CCharacterModelSet { - if (ReadByte() == 0) - { - CStringFixed name; - } - else - { - CString name; + if (ReadByte() == 0) + { + CStringFixed name; + } + else + { + CString name; } GUID skeletonID; CAABox aabox; @@ -90,13 +101,13 @@ struct CCharacterModelSet struct CAnimationInfo { - if (ReadByte() == 0) - { - CStringFixed name; - } - else - { - CString name; + if (ReadByte() == 0) + { + CStringFixed name; + } + else + { + CString name; } GUID skeletonID; FourCC chunkID; @@ -112,13 +123,13 @@ struct FCharInf if (isDKCTF) { CCharInfo charInfo; - if (ReadByte() == 0) - { - CStringFixed name; - } - else - { - CString name; + if (ReadByte() == 0) + { + CStringFixed name; + } + else + { + CString name; } GUID skeletonID; uint32 modelSets; diff --git a/CMayaSpline.bt b/CMayaSpline.bt new file mode 100644 index 0000000..aa86bb2 --- /dev/null +++ b/CMayaSpline.bt @@ -0,0 +1,32 @@ +#ifndef _CMAYASPLINE +#define _CMAYASPLINE + +#include "Common.bt" +#include "CVector2f.bt" + +typedef struct CMayaSplineKnot { + float unk1; + float unk2; + byte unk3; + byte unk4; + + if (unk3 == 5) { + CVector2f tangentA; + } + + if (unk4 == 5) { + CVector2f tangentB; + } +} CMayaSplineKnot; + +typedef struct CMayaSpline { + uint knotCount; + CMayaSplineKnot knots[knotCount] ; + float minAmplitudeTime; + float maxAmplitudeTime; + byte unk1; + byte unk2; + byte unk3; +} CMayaSpline; + +#endif// _CMAYASPLINE diff --git a/CVector2f.bt b/CVector2f.bt new file mode 100644 index 0000000..35e1a12 --- /dev/null +++ b/CVector2f.bt @@ -0,0 +1,10 @@ +#ifndef _CVECTOR2F +#define _CVECTOR2F + +typedef struct { + float x, y; +} CVector2f; + + + +#endif// _CVECTOR2F diff --git a/CVectorField.bt b/CVectorField.bt index f4cc934..266bb4a 100644 --- a/CVectorField.bt +++ b/CVectorField.bt @@ -17,7 +17,7 @@ struct CVectorField { Printf("v %f %f %f\n", vectors[i].x, vectors[i].y, vectors[i].z); Printf("v %f %f %f\n", vectors[i].x + 0.00005, vectors[i].y + 0.00005, vectors[i].z + 0.00005); } - for (i = 0; i < vectorCount; ++i) { + for (i = 0; i < vectorCount * 3; i += 3) { Printf("f %i %i %i\n", i + 1, i + 2, i + 3); } }; diff --git a/Run.bt b/Run.bt index 6ab421c..d899dcc 100644 --- a/Run.bt +++ b/Run.bt @@ -16,6 +16,7 @@ if (!exists(isDKCTF)) { // Files #include "CAudioBusHierarchy.bt" #include "CAudioSampleBank.bt" +#include "CAudioSoundEffect.bt" #include "CCharInfo.bt" #include "CCollisionTree.bt" #include "CDataEnumObject.bt" @@ -53,6 +54,9 @@ typedef struct { case "MATI": CMaterialInstanceResource materialInstance; break; + case "CAUD": + CAudioSoundEffect audioSoundEffect; + break; case "CBNK": CAudioSampleBank audioSampleBank; break;