JAUAudioArcInterpreter, JAUAudioArcLoader (#1917)

* JAUAudioArcInterpreter

* JAUAudioArcLoader OK
This commit is contained in:
Jcw87
2023-09-08 22:26:01 -07:00
committed by GitHub
parent 6deaa22a19
commit 64faf5012c
30 changed files with 430 additions and 737 deletions
+41 -1
View File
@@ -1,7 +1,7 @@
#ifndef JASGADGET_H
#define JASGADGET_H
#include "dolphin/types.h"
#include "JSystem/JUtility/JUTAssert.h"
template<class T>
class JASGlobalInstance {
@@ -12,6 +12,7 @@ public:
JASGlobalInstance(bool param_1) {
if (param_1) {
JUT_ASSERT("JASGadget.h", 0xba, sInstance == 0);
sInstance = (T*)this;
}
}
@@ -27,4 +28,43 @@ public:
static T* sInstance;
};
template<class T>
class JASPtrTable {
public:
JASPtrTable(T** param_0, u32 size) {
mTable = param_0;
mSize = size;
memset(mTable, 0, size * 4);
}
T* get(u32 index) {
if (index >= mSize) {
return NULL;
}
return mTable[index];
}
T* get(u32 index) const {
if (index >= mSize) {
return NULL;
}
return mTable[index];
}
void set(u32 index, T* value) {
JUT_ASSERT("JASGadget.h", 0xe5, index < mSize);
mTable[index] = value;
}
private:
/* 0x00 */ T** mTable;
/* 0x04 */ u32 mSize;
};
template<class T, size_t N>
class JASPtrArray : public JASPtrTable<T> {
public:
JASPtrArray() : JASPtrTable(mArray, N) {}
private:
/* 0x08 */ T* mArray[N];
};
#endif /* JASGADGET_H */
@@ -3,4 +3,41 @@
#include "dolphin/types.h"
class JAUAudioArcInterpreter {
public:
/* 802A4244 */ JAUAudioArcInterpreter();
/* 802A4260 */ virtual ~JAUAudioArcInterpreter();
virtual void readWS(u32, void const*, u32) = 0;
virtual void readBNK(u32, void const*) = 0;
virtual void readBSC(void const*, u32) = 0;
virtual void readBST(void const*, u32) = 0;
virtual void readBSTN(void const*, u32) = 0;
virtual void readBMS(u32, void const*, u32) = 0;
virtual void readBMS_fromArchive(u32) = 0;
virtual void newVoiceBank(u32, u32) = 0;
virtual void newDynamicSeqBlock(u32) = 0;
virtual void readBSFT(void const*) = 0;
virtual void readMaxSeCategory(int, int, int) = 0;
virtual void beginBNKList(u32, u32) = 0;
virtual void endBNKList() = 0;
/* 802A42A8 */ bool parse(void const*);
/* 802A4314 */ virtual bool readCommandMore(u32);
/* 802A431C */ bool readCommand_();
u8 readU8_() {
return *mReadPtr++;
}
u32 readU32_() {
u32 temp = *(u32*)mReadPtr;
mReadPtr = mReadPtr + 4;
return temp;
}
const void* getContent_(u32 param_0) { return mBase + param_0; }
/* 0x04 */ const u8* mReadPtr;
/* 0x08 */ const u8* mBase;
};
#endif /* JAUAUDIOARCINTERPRETER_H */
+23 -1
View File
@@ -1,8 +1,30 @@
#ifndef JAUAUDIOARCLOADER_H
#define JAUAUDIOARCLOADER_H
#include "dolphin/types.h"
#include "JSystem/JAudio2/JAUAudioArcInterpreter.h"
struct JAUSection;
class JAUAudioArcLoader : public JAUAudioArcInterpreter {
public:
/* 802A4740 */ JAUAudioArcLoader(JAUSection*);
/* 802A478C */ bool load(void const*);
/* 802A47AC */ virtual void readWS(u32, void const*, u32);
/* 802A4804 */ virtual void readBNK(u32, void const*);
/* 802A4834 */ virtual void readBSC(void const*, u32);
/* 802A4858 */ virtual void readBST(void const*, u32);
/* 802A4880 */ virtual void readBSTN(void const*, u32);
/* 802A48A8 */ virtual void readBMS(u32, void const*, u32);
/* 802A48D4 */ virtual void readBMS_fromArchive(u32);
/* 802A4900 */ virtual void newVoiceBank(u32, u32);
/* 802A4930 */ virtual void newDynamicSeqBlock(u32);
/* 802A4968 */ virtual void readBSFT(void const*);
/* 802A4990 */ virtual void beginBNKList(u32, u32);
/* 802A49B4 */ virtual void endBNKList();
/* 802A49D8 */ virtual void readMaxSeCategory(int, int, int);
/* 802A49FC */ virtual ~JAUAudioArcLoader();
/* 0x0C */ JAUSection* mSection;
};
#endif /* JAUAUDIOARCLOADER_H */
+9 -12
View File
@@ -1,20 +1,9 @@
#ifndef JAUBANKTABLE_H
#define JAUBANKTABLE_H
#include "JSystem/JAudio2/JASGadget.h"
#include "JSystem/JSupport/JSUList.h"
template <typename T>
struct JASPtrTable {
T* get(u32 value) const {
if (value >= mLength) {
return NULL;
}
return mTable[value];
}
T** mTable;
u32 mLength;
};
struct JASBank;
struct JAUBankTable {
/* 802A4AA0 */ /*virtual*/ JASBank* getBank(u32) const;
@@ -26,4 +15,12 @@ struct JAUBankTableDictionary : JSUList<JAUBankTable> {
/* 802A4A80 */ void appendBankTable(JSULink<JAUBankTable>*);
};
class JASWaveBank;
class JAUWaveBankTable : private JASPtrArray<JASWaveBank,255> {
public:
JASWaveBank* getWaveBank(u32 index) { return get(index); }
JASWaveBank* getWaveBank(u32 index) const { return get(index); }
void registWaveBank(u32 index, JASWaveBank* bank) { set(index, bank); }
};
#endif /* JAUBANKTABLE_H */
+103 -1
View File
@@ -1,6 +1,108 @@
#ifndef JAUSECTIONHEAP_H
#define JAUSECTIONHEAP_H
#include "dolphin/types.h"
#include "JSystem/JAudio2/JAISeqDataMgr.h"
#include "JSystem/JAudio2/JASGadget.h"
#include "JSystem/JAudio2/JAUBankTable.h"
#include "JSystem/JAudio2/JAUSeqDataBlockMgr.h"
#include "JSystem/JKernel/JKRDisposer.h"
#include "MSL_C/bitset.h"
class JAISeqData;
class JAISeqDataUser;
class JAIStreamDataMgr;
class JAUDisposer_;
class JAUSectionHeap;
class JAUSeqDataMgr_SeqCollection;
class JKRArchive;
class JKRSolidHeap;
class JAUSection /* : public JKRDisposer, JSULink<JAUSection> */ {
public:
struct TSectionData {
/* 802A4EE8 */ TSectionData();
/* 802A4F68 */ void resetRegisteredBankTables();
/* 802A4FE4 */ void resetRegisteredWaveBankTables();
/* 0x00 */ JAUDynamicSeqDataBlocks field_0x00;
/* 0x28 */ JSUList<JAUSeqDataBlock> field_0x28;
/* 0x34 */ std::bitset<255> field_0x34;
/* 0x54 */ std::bitset<255> field_0x54;
/* 0x74 */ JAUBankTableDictionary field_0x74;
/* 0x80 */ int field_0x80;
/* 0x84 */ int field_0x84;
/* 0x88 */ int field_0x88;
/* 0x8C */ JSUList<JAUDisposer_> field_0x8c;
/* 0x98 */ s32 field_0x98;
/* 0x9C */ int field_0x9c;
/* 0xA0 */ int field_0xa0;
};
/* 802A5060 */ JAUSection(JAUSectionHeap*, u32, s32);
/* 802A50F8 */ void finishBuild();
/* 802A5160 */ void dispose();
/* 802A51E4 */ void newSoundTable(void const*, u32, bool);
/* 802A52A0 */ void newSoundNameTable(void const*, u32, bool);
/* 802A535C */ void newStreamFileTable(void const*, bool);
/* 802A5500 */ void newSeSeqCollection(void const*, u32);
/* 802A5598 */ void newStaticSeqDataBlock_(JAISoundID, u32);
/* 802A56C8 */ void newStaticSeqData(JAISoundID, void const*, u32);
/* 802A5730 */ void newStaticSeqData(JAISoundID);
/* 802A57F0 */ void newCopy(void const*, u32, s32);
/* 802A5854 */ void newWaveBank(u32, void const*);
/* 802A5948 */ void loadWaveArc(u32, u32);
/* 802A5A50 */ void newBank(void const*, u32);
/* 802A5B84 */ void newVoiceBank(u32, u32);
/* 802A5CAC */ void beginNewBankTable(u32, u32);
/* 802A5D9C */ void endNewBankTable();
/* 802A6468 */ ~JAUSection();
bool isBuilding() { return field_0x2c; }
//bool isOpen() { return this == sectionHeap_->getOpenSection(); }
JAUSectionHeap* asSectionHeap() { return (JAUSection*)sectionHeap_ == this ? sectionHeap_ : NULL; }
/* 0x00 */ JKRDisposer base1;
/* 0x18 */ JSULink<JAUSection> base2;
/* 0x28 */ u32 field_0x28;
/* 0x2C */ bool field_0x2c;
/* 0x30 */ JAUSectionHeap* sectionHeap_;
/* 0x34 */ int field_0x34;
/* 0x38 */ TSectionData mSectionData;
};
class JAUSectionHeap /* : public JAUSection, JASGlobalInstance<JAUSectionHeap>, JAISeqDataMgr */ {
public:
struct TSectionHeapData {
/* 802A5DF4 */ TSectionHeapData();
/* 0x000 */ JAUWaveBankTable field_0x000;
/* 0x404 */ JAISeqDataUser* seqDataUser;
/* 0x408 */ JAUDynamicSeqDataBlocks field_0x408;
/* 0x430 */ JAUSeqDataMgr_SeqCollection* field_0x430;
/* 0x434 */ JAIStreamDataMgr* field_0x434;
/* 0x438 */ int field_0x438;
/* 0x43C */ int field_0x43c;
};
/* 802A5E60 */ void setSeqDataArchive(JKRArchive*);
/* 802A5EC0 */ void loadDynamicSeq(JAISoundID, bool);
/* 802A5EF8 */ void releaseIdleDynamicSeqDataBlock();
/* 802A5FE0 */ JAUSectionHeap(JKRSolidHeap*, bool, s32);
/* 802A6094 */ JAUSection* getOpenSection();
/* 802A60A0 */ void setSeqDataUser(JAISeqDataUser*);
/* 802A60AC */ void newDynamicSeqBlock(u32);
/* 802A61D0 */ int getSeqData(JAISoundID, JAISeqData*);
/* 802A6270 */ int releaseSeqData();
/* 802A6278 */ ~JAUSectionHeap();
/* 0x00 */ JAUSection base1;
/* 0xDC */ u8 base2[0xE0 - 0xDC]; // JAISeqDataMgr
/* 0xE0 */ JKRSolidHeap* mHeap;
/* 0xE4 */ int field_0xe4;
/* 0xE8 */ JSUList<JAUSection> mSectionList;
/* 0xF4 */ TSectionHeapData field_0xf4;
};
JAUSectionHeap* JAUNewSectionHeap(bool);
#endif /* JAUSECTIONHEAP_H */
@@ -1,5 +1,43 @@
#ifndef JAUSEQDATABLOCKMGR_H
#define JAUSEQDATABLOCKMGR_H
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JSupport/JSUList.h"
class JAISeqData;
class JAISeqDataUser;
class JKRArchive;
struct JAUSeqDataBlock {
/* 802A68F4 */ JAUSeqDataBlock();
};
class JAUSeqDataBlocks {
public:
/* 802A6928 */ void getSeqData(JAISoundID);
/* 802A6974 */ void seekFreeBlock(u32);
/* 802A69D8 */ void append(JSULink<JAUSeqDataBlock>*);
/* 802A69F8 */ void remove(JSULink<JAUSeqDataBlock>*);
/* 802A6A18 */ void hasFailedBlock(JAISoundID);
/* 0x00 */ JSUList<JAUSeqDataBlock> field_0x0;
};
class JAUDynamicSeqDataBlocks {
public:
/* 802A6A58 */ JAUDynamicSeqDataBlocks();
/* 802A6AA0 */ void setSeqDataArchive(JKRArchive*);
/* 802A6AA8 */ void getSeqData(JAISoundID, JAISeqDataUser*, JAISeqData*, bool);
/* 802A6B8C */ void appendDynamicSeqDataBlock(JAUSeqDataBlock*);
/* 802A6C18 */ void loadDynamicSeq(JAISoundID, bool, JAISeqDataUser*);
/* 802A6D48 */ void releaseIdleDynamicSeqDataBlock(JAISeqDataUser*);
/* 802A6E00 */ void releaseIdleDynamicSeqDataBlock_(JAISeqDataUser*, u32);
/* 802A6EDC */ void rearrangeLoadingSeqs_();
/* 0x00 */ JAUSeqDataBlocks field_0x0;
/* 0x0C */ JAUSeqDataBlocks field_0xc;
/* 0x18 */ JAUSeqDataBlocks field_0x18;
/* 0x24 */ JKRArchive* seqDataArchive_;
};
#endif /* JAUSEQDATABLOCKMGR_H */