JAUSeqCollection, JAUSoundTable OK (#1932)

This commit is contained in:
hatal175
2023-09-19 13:45:39 +03:00
committed by GitHub
parent 6726d1cf47
commit e5cb9ce472
17 changed files with 231 additions and 466 deletions
+18
View File
@@ -40,6 +40,24 @@ struct J3DTextureSRTInfo {
/* 0x08 */ s16 mRotation;
/* 0x0C */ f32 mTranslationX;
/* 0x10 */ f32 mTranslationY;
inline void operator=(J3DTextureSRTInfo const& other) {
register const f32* src = &other.mScaleX;
register f32* dst = &mScaleX;
register f32 xy;
asm {
psq_l xy, 0(src), 0, 0
psq_st xy, 0(dst), 0, 0
};
// Unclear why there's a 4 byte copy here.
*(u32*)&mRotation = *(u32*)&other.mRotation;
src = &other.mTranslationX;
dst = &mTranslationX;
asm {
psq_l xy, 0(src), 0, 0
psq_st xy, 0(dst), 0, 0
};
}
}; // Size: 0x14
struct J3DTexMtxInfo {
+7 -1
View File
@@ -9,6 +9,11 @@ struct JAISeqData {
field_0x4 = param_1;
}
void set(void* param_0, u32 param_1) {
field_0x0 = param_0;
field_0x4 = param_1;
}
/* 0x00 */ void* field_0x0;
/* 0x04 */ u32 field_0x4;
};
@@ -36,8 +41,9 @@ struct JAISeqDataUser {
};
struct JAISeqDataMgr {
enum SeqDataReturnValue{ SeqDataReturnValue_0 = 0, SeqDataReturnValue_1 = 1, SeqDataReturnValue_2 = 2};
virtual ~JAISeqDataMgr();
virtual s32 getSeqData(JAISoundID, JAISeqData*) = 0;
virtual SeqDataReturnValue getSeqData(JAISoundID, JAISeqData*) = 0;
virtual int releaseSeqData() = 0;
virtual bool setSeqDataUser(JAISeqDataUser*) = 0;
};
+11 -3
View File
@@ -6,18 +6,26 @@
class JAISeqData;
class JAISeqDataRegion;
struct JAUSeqCollectionData {
s8 field_0x0;
s8 field_0x1;
u16 field_0x2;
u32 field_0x4;
u32 field_0x8;
};
class JAUSeqCollection {
public:
/* 802A66A0 */ JAUSeqCollection();
/* 802A66AC */ void init(void const*);
/* 802A66FC */ bool getSeqData(int, int, JAISeqData*);
/* 802A6754 */ void getSeqDataRegion(JAISeqDataRegion*);
/* 802A6754 */ bool getSeqDataRegion(JAISeqDataRegion*);
bool isValid() { return field_0x8; }
/* 0x00 */ u16 field_0x0;
/* 0x04 */ const u32* field_0x4;
/* 0x08 */ const void* field_0x8;
/* 0x08 */ const JAUSeqCollectionData* field_0x8;
/* 0x0C */ int field_0xc;
};
@@ -26,7 +34,7 @@ public:
/* 802A677C */ JAUSeqDataMgr_SeqCollection();
/* 802A67D0 */ bool setSeqDataUser(JAISeqDataUser*);
/* 802A67DC */ int releaseSeqData();
/* 802A683C */ s32 getSeqData(JAISoundID, JAISeqData*);
/* 802A683C */ SeqDataReturnValue getSeqData(JAISoundID, JAISeqData*);
/* 802A6894 */ ~JAUSeqDataMgr_SeqCollection();
/* 0x14 */ JAISeqDataUser* user_;
+125 -10
View File
@@ -4,31 +4,146 @@
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASGadget.h"
class JAUSoundTable : public JASGlobalInstance<JAUSoundTable> {
public:
JAUSoundTable(bool param_0) : JASGlobalInstance<JAUSoundTable>(param_0) {
template<typename Root, typename Section, typename Group, typename Typename_0>
struct JAUSoundTable_ {
JAUSoundTable_() {
field_0x0 = NULL;
field_0x4 = 0;
}
void reset() {
field_0x0 = NULL;
field_0x4 = NULL;
}
void init(const void* param_0) {
field_0x0 = param_0;
// magic number is not in debug rom. I'm not sure what this comparison is (maybe some sort of '' number?)
// I also do not know how it is different between JAUSoundTable and JAUSoundNameTable
if (*(u32*)field_0x0 + 0xbdad0000 != Root::magicNumber()) {
field_0x0 = NULL;
} else {
field_0x4 = (Root*)((u8*)field_0x0 + *((u32*)field_0x0 + 3));
}
}
Section* getSection(int index) const {
if (index < 0) {
return NULL;
}
if ((u32)index >= field_0x4->mSectionNumber) {
return NULL;
}
u32 offset = field_0x4->mSectionOffsets[index];
if (offset == 0) {
return NULL;
}
return (Section*)((u8*)field_0x0 + offset);
}
Group* getGroup(Section* param_1, int index) const {
int iVar1;
if (index < 0) {
return NULL;
}
if ((u32)index >= param_1->mNumGroups) {
return NULL;
}
u32 offset = param_1->getGroupOffset(index);
if (offset == 0) {
return NULL;
}
return (Group*)((u8*)field_0x0 + offset);
}
const void* field_0x0;
Root* field_0x4;
u32 field_0x8;
u32 field_0xc;
};
struct JAUSoundTableRoot {
static inline u32 magicNumber() { return 0x5420; }
u32 mSectionNumber;
u32 mSectionOffsets[0];
};
struct JAUSoundTableSection {
int getGroupOffset(int index) const {
if (index < 0) {
return 0;
}
if (index >= mNumGroups) {
return 0;
}
return mGroupOffsets[index];
}
u32 mNumGroups;
u32 mGroupOffsets[0];
};
struct JAUSoundTableGroup {
u8 getTypeID(int index) const {
if (index < 0) {
return 0;
}
if (index >= mNumItems) {
return 0xff;
}
return mTypeIds[index * 4];
}
u32 getItemOffset(int index) const {
if (index < 0) {
return 0;
}
if (index >= mNumItems) {
return 0;
}
return *(u32*)(mTypeIds + index * 4) & 0xffffff;
}
u32 mNumItems;
u32 field_0x4;
u8 mTypeIds[0];
};
struct JAUSoundTable : public JASGlobalInstance<JAUSoundTable> {
JAUSoundTable(bool param_0) : JASGlobalInstance<JAUSoundTable>(param_0) {
}
~JAUSoundTable() {}
/* 802A7114 */ void init(void const*);
/* 802A7160 */ u8 getTypeID(JAISoundID) const;
/* 802A728C */ void getData(JAISoundID) const;
/* 802A728C */ void* getData(JAISoundID) const;
void* field_0x0;
int field_0x4;
void* getItem(JAUSoundTableGroup* group, int index) const {
u32 offset = group->getItemOffset(index);
if (offset == 0) {
return NULL;
}
return (void*)((u8*)field_0x0.field_0x0 + offset);
}
JAUSoundTable_<JAUSoundTableRoot,JAUSoundTableSection,JAUSoundTableGroup,void> field_0x0;
};
struct JAUSoundNameTableRoot {
static inline u32 magicNumber() { return 0x544e; }
u32 mSectionNumber;
u32 mSectionOffsets[0];
};
struct JAUSoundNameTableSection {};
struct JAUSoundNameTableGroup {};
struct JAUSoundNameTable : public JASGlobalInstance<JAUSoundNameTable> {
JAUSoundNameTable(bool param_0) : JASGlobalInstance<JAUSoundNameTable>(param_0) {
field_0x0 = NULL;
field_0x4 = 0;
}
~JAUSoundNameTable() {}
/* 802A73D4 */ void init(void const*);
void* field_0x0;
int field_0x4;
JAUSoundTable_<JAUSoundNameTableRoot,JAUSoundNameTableSection,JAUSoundNameTableGroup,void> field_0x0;
};
#endif /* JAUSOUNDTABLE_H */