JAUSectionHeap, Z2SoundInfo, others (#1925)

* Z2SoundInfo

* JAUSectionHeap

* Z2EnvSeMgr

* Z2AudioMgr

* m_Do_audio

* d_a_alink
This commit is contained in:
Jcw87
2023-09-15 05:20:09 -07:00
committed by GitHub
parent f834379a8b
commit 287ae62349
159 changed files with 1349 additions and 1511 deletions
+1
View File
@@ -89,6 +89,7 @@ public:
return mAudience;
}
JAISeqDataMgr* getSeqDataMgr() { return mSeqDataMgr; }
JAISoundParamsMove* getParams() { return &mParams; }
private:
/* 0x008 */ JAIAudience* mAudience;
+17
View File
@@ -4,6 +4,7 @@
#include "JSystem/JAudio2/JAISeqDataMgr.h"
#include "JSystem/JAudio2/JASGadget.h"
#include "JSystem/JSupport/JSUList.h"
#include "JSystem/JUtility/JUTAssert.h"
struct JAIAudience;
class JAISeq;
@@ -25,7 +26,23 @@ public:
/* 802A1804 */ virtual bool isUsingSeqData(JAISeqDataRegion const&);
/* 802A1870 */ virtual int releaseSeqData(JAISeqDataRegion const&);
void setAudience(JAIAudience* param_0) { mAudience = param_0; }
JAISeqDataMgr* getSeqDataMgr() { return seqDataMgr_; }
void setSeqDataMgr(JAISeqDataMgr* param_0) {
JUT_ASSERT("JAISeqMgr.h", 0x7c, !isActive());
resetSeqDataMgr();
seqDataMgr_ = param_0;
seqDataMgr_->setSeqDataUser(this);
}
void resetSeqDataMgr() {
JUT_ASSERT("JAISeqMgr.h", 0x83, !isActive());
if (seqDataMgr_) {
seqDataMgr_->setSeqDataUser(NULL);
seqDataMgr_ = NULL;
}
}
JAISoundParamsMove* getParams() { return &mMove; }
bool isActive() { return mSeqList.getNumLinks() != 0; }
private:
/* 0x04 */ JAISoundActivity mActivity;
+1
View File
@@ -17,6 +17,7 @@ public:
JAISoundID() {}
bool isAnonymous() { return mId.mFullId == 0xffffffff; }
void setAnonymous() { mId.mFullId = -1; }
union {
u32 mFullId;
+1 -1
View File
@@ -10,7 +10,7 @@ class JAISoundID;
class JAISoundHandle {
public:
JAISoundHandle() {sound_ = NULL;};
~JAISoundHandle() {}
~JAISoundHandle() { releaseSound(); }
bool isSoundAttached() const { return sound_ != NULL; }
+2 -2
View File
@@ -4,12 +4,12 @@
#include "JSystem/JAudio2/JAISound.h"
struct JAIStreamDataMgr {
virtual void getStreamFileEntry(JAISoundID) = 0;
virtual s32 getStreamFileEntry(JAISoundID) = 0;
virtual ~JAIStreamDataMgr();
};
struct JAIStreamAramMgr {
virtual void newStreamAram(u32*) = 0;
virtual void* newStreamAram(u32*) = 0;
virtual void deleteStreamAram(u32) = 0;
virtual ~JAIStreamAramMgr();
};
+15 -2
View File
@@ -4,7 +4,10 @@
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASGadget.h"
#include "JSystem/JSupport/JSUList.h"
#include "JSystem/JUtility/JUTAssert.h"
class JAIStreamAramMgr;
class JAIStreamDataMgr;
class JAIStreamMgr;
class JAIStream {
@@ -29,13 +32,23 @@ public:
/* 802A4174 */ void newStream_();
/* 802B9978 */ void isActive() const;
JAISoundParamsMove* getParams() { return &mParams; }
void setStreamDataMgr(JAIStreamDataMgr* param_0) {
JUT_ASSERT("JAIStreamMgr.h", 0x8b, !isActive());
mStreamDataMgr = param_0;
}
void setStreamAramMgr(JAIStreamAramMgr* param_0) {
JUT_ASSERT("JAIStreamMgr.h", 0x9d, !isActive());
mStreamAramMgr = param_0;
}
private:
/* 0x00 */ JAISoundActivity mActivity;
/* 0x04 */ JAISoundParamsMove mParams;
/* 0x54 */ int field_0x54;
/* 0x58 */ JSUList<JAIStream> mStreamList;
/* 0x64 */ int field_0x64;
/* 0x68 */ int field_0x68;
/* 0x64 */ JAIStreamDataMgr * mStreamDataMgr;
/* 0x68 */ JAIStreamAramMgr* mStreamAramMgr;
/* 0x6C */ int field_0x6c;
}; // Size: 0x70
+3 -1
View File
@@ -89,9 +89,11 @@ public:
/* 0x1C4 */ float field_0x1c4[6];
/* 0x1DC */ short field_0x1dc[6];
u32 getBlockSize() { return sBlockSize; }
static u8 sLoadThread[4];
static u8 sReadBuffer[4];
static u8 sBlockSize[4];
static u32 sBlockSize;
static u8 sChannelMax[4];
};
+31 -1
View File
@@ -1,6 +1,36 @@
#ifndef JASBNKPARSER_H
#define JASBNKPARSER_H
#include "dolphin/types.h"
#include "JSystem/JAudio2/JASOscillator.h"
class JASBank;
class JASBasicBank;
class JKRHeap;
namespace JASBNKParser {
namespace Ver1 {
/* 80299600 */ void findChunk(void const*, u32);
/* 8029963C */ void createBasicBank(void const*, JKRHeap*);
};
namespace Ver0 {
struct THeader {};
struct TOsc {};
/* 80299A3C */ void createBasicBank(void const*, JKRHeap*);
/* 80299E68 */ void findOscPtr(JASBasicBank*, JASBNKParser::Ver0::THeader const*,
JASBNKParser::Ver0::TOsc const*);
/* 80299F8C */ void getOscTableEndPtr(JASOscillator::Point const*);
};
/* 80299538 */ JASBank* createBank(void const*, JKRHeap*);
/* 80299558 */ JASBasicBank* createBasicBank(void const*, JKRHeap*);
inline u32 getBankNumber(const void* param_0) { return ((u32*)param_0)[2]; }
extern u8 sUsedHeapSize[4];
};
#endif /* JASBNKPARSER_H */
+13
View File
@@ -0,0 +1,13 @@
#ifndef JASBANKLIST_H
#define JASBANKLIST_H
#include "dolphin/types.h"
class JASBank;
class JASBankList {
public:
virtual JASBank* getBank(u32 param_0) const = 0;
};
#endif /* JASBANKLIST_H */
+22
View File
@@ -0,0 +1,22 @@
#ifndef JASBANKTABLE_H
#define JASBANKTABLE_H
#include "JSystem/JAudio2/JASBankList.h"
#include "JSystem/JAudio2/JASGadget.h"
template<size_t N>
class JASBankTable : public JASBankList {
public:
JASBank* getBank(u32 param_0) { return mArray.get(param_0); }
virtual JASBank* getBank(u32 param_0) const { return mArray.get(param_0); }
void registBank(u32 param_0, JASBank* param_1) { mArray.set(param_0, param_1); }
private:
JASPtrArray<JASBank, N> mArray;
};
class JASDefaultBankTable : public JASBankTable<256>, public JASGlobalInstance<JASDefaultBankTable> {
public:
};
#endif /* JASBANKLIST_H */
+2 -1
View File
@@ -2,6 +2,7 @@
#define JASGADGET_H
#include "JSystem/JUtility/JUTAssert.h"
#include "MSL_C/string.h"
template<class T>
class JASGlobalInstance {
@@ -61,7 +62,7 @@ private:
template<class T, size_t N>
class JASPtrArray : public JASPtrTable<T> {
public:
JASPtrArray() : JASPtrTable(mArray, N) {}
JASPtrArray() : JASPtrTable<T>(mArray, N) {}
private:
/* 0x08 */ T* mArray[N];
+1 -1
View File
@@ -11,7 +11,7 @@ class JKRSolidHeap;
class JASHeap {
public:
/* 80290140 */ JASHeap(JASDisposer*);
/* 80290140 */ JASHeap(JASDisposer* param_0 = NULL);
/* 802901AC */ void initRootHeap(void*, u32);
/* 8029021C */ bool alloc(JASHeap*, u32);
/* 802903F4 */ bool allocTail(JASHeap*, u32);
+2
View File
@@ -86,6 +86,8 @@ public:
/* 802956B0 */ s32 parseCommand(JASTrack*, u8, u16);
/* 80295864 */ s32 parseRegCommand(JASTrack*, int);
static void registerSeqCallback(u16 (*param_0)(JASTrack*, u16)) { sCallBackFunc = param_0; }
static CmdInfo sCmdInfo[96];
static CmdInfo sExtCmdInfo[255];
static u16 (*sCallBackFunc)(JASTrack*, u16);
+32
View File
@@ -0,0 +1,32 @@
#ifndef JAUAUDIBLEPARAM_H
#define JAUAUDIBLEPARAM_H
#include "dolphin/types.h"
struct JAUAudibleParam {
f32 getDopplerPower() const {
return (u32)((*(u8*)&field_0x0.raw >> 4) & 0xf) * (1.0f / 15.0f);
}
union {
struct {
u16 f0;
u16 f1;
} half;
struct {
u8 b0_0 : 1;
u8 b0_1 : 1;
u8 b0_2 : 1;
u8 b0_3 : 1;
u8 b0_4 : 1;
u8 b0_5 : 1;
u8 b0_6 : 1;
u8 b0_7 : 1;
u8 b1;
u8 b2;
u8 b3;
} bytes;
u32 raw;
} field_0x0;
};
#endif /* JAUAUDIBLEPARAM_H */
+18 -3
View File
@@ -2,13 +2,28 @@
#define JAUBANKTABLE_H
#include "JSystem/JAudio2/JASGadget.h"
#include "JSystem/JAudio2/JASBankList.h"
#include "JSystem/JSupport/JSUList.h"
struct JASBank;
struct JAUBankTable {
/* 802A4AA0 */ /*virtual*/ JASBank* getBank(u32) const;
class JASBank;
class JAUBankTable /* : public JASBankList */ {
public:
JAUBankTable(u32 param_0, JASBank** param_1, u32 param_2) : mBankPtrTable(param_1, param_2) {
field_0xc = param_0;
}
/* 802A4AA0 */ JASBank* getBank(u32) const;
JASBank* getBank(u32 param_0) { return mBankPtrTable.get(param_0); }
void registBank(u32 param_0, JASBank* param_1) { mBankPtrTable.set(param_0, param_1); }
/* 0x0 */ void* vtable;
/* 0x4 */ JASPtrTable<JASBank> mBankPtrTable;
/* 0xC */ u32 field_0xc;
};
class JAUBankTableLink : public JSULink<JAUBankTable>, public JAUBankTable {
public:
JAUBankTableLink(u32 param_0, JASBank** param_1, u32 param_2) : JSULink<JAUBankTable>(this), JAUBankTable(param_0, param_1, param_2) {}
};
struct JAUBankTableDictionary : JSUList<JAUBankTable> {
+47 -37
View File
@@ -9,15 +9,19 @@
#include "MSL_C/bitset.h"
class JAISeqData;
class JAISeqDataMgr;
class JAISeqDataUser;
class JAIStreamDataMgr;
class JASVoiceBank;
class JAUBankTableLink;
class JAUDisposer_;
class JAUSectionHeap;
class JAUSeqDataMgr_SeqCollection;
class JAUSoundTable;
class JAUSoundNameTable;
class JKRArchive;
class JKRSolidHeap;
class JAUSection /* : public JKRDisposer, JSULink<JAUSection> */ {
class JAUSection /* : public JKRDisposer, protected JSULink<JAUSection> */ {
public:
struct TSectionData {
/* 802A4EE8 */ TSectionData();
@@ -26,12 +30,12 @@ public:
/* 0x00 */ JAUDynamicSeqDataBlocks field_0x00;
/* 0x28 */ JSUList<JAUSeqDataBlock> field_0x28;
/* 0x34 */ std::bitset<255> field_0x34;
/* 0x54 */ std::bitset<255> field_0x54;
/* 0x34 */ std::bitset<255> registeredWaveBankTables;
/* 0x54 */ std::bitset<255> registeredBankTables;
/* 0x74 */ JAUBankTableDictionary field_0x74;
/* 0x80 */ int field_0x80;
/* 0x84 */ int field_0x84;
/* 0x88 */ int field_0x88;
/* 0x80 */ JAISeqDataMgr* field_0x80;
/* 0x84 */ const void* mBstDst;
/* 0x88 */ const void* mBstnDst;
/* 0x8C */ JSUList<JAUDisposer_> field_0x8c;
/* 0x98 */ s32 field_0x98;
/* 0x9C */ int field_0x9c;
@@ -40,34 +44,35 @@ public:
/* 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();
/* 802A5160 */ /* virtual */ void dispose();
/* 802A51E4 */ JAUSoundTable* newSoundTable(void const*, u32, bool);
/* 802A52A0 */ JAUSoundNameTable* newSoundNameTable(void const*, u32, bool);
/* 802A535C */ JAIStreamDataMgr* newStreamFileTable(void const*, bool);
/* 802A5500 */ JAISeqDataMgr* newSeSeqCollection(void const*, u32);
/* 802A5598 */ u8* newStaticSeqDataBlock_(JAISoundID, u32);
/* 802A56C8 */ bool newStaticSeqData(JAISoundID, void const*, u32);
/* 802A5730 */ bool newStaticSeqData(JAISoundID);
/* 802A57F0 */ void* newCopy(void const*, u32, s32);
/* 802A5854 */ JASWaveBank* newWaveBank(u32, void const*);
/* 802A5948 */ bool loadWaveArc(u32, u32);
/* 802A5A50 */ JASBank* newBank(void const*, u32);
/* 802A5B84 */ JASVoiceBank* newVoiceBank(u32, u32);
/* 802A5CAC */ bool beginNewBankTable(u32, u32);
/* 802A5D9C */ JAUBankTable* endNewBankTable();
/* 802A6468 */ /* virtual */ ~JAUSection();
bool isBuilding() { return field_0x2c; }
//bool isOpen() { return this == sectionHeap_->getOpenSection(); }
bool isOpen();
JAUSectionHeap* asSectionHeap() { return (JAUSection*)sectionHeap_ == this ? sectionHeap_ : NULL; }
JKRHeap* getHeap_();
/* 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;
/* 0x34 */ JAUBankTableLink* buildingBankTable_;
/* 0x38 */ TSectionData data_;
};
class JAUSectionHeap /* : public JAUSection, JASGlobalInstance<JAUSectionHeap>, JAISeqDataMgr */ {
@@ -75,34 +80,39 @@ public:
struct TSectionHeapData {
/* 802A5DF4 */ TSectionHeapData();
/* 0x000 */ JAUWaveBankTable field_0x000;
/* 0x000 */ JAUWaveBankTable waveBankTable;
/* 0x404 */ JAISeqDataUser* seqDataUser;
/* 0x408 */ JAUDynamicSeqDataBlocks field_0x408;
/* 0x430 */ JAUSeqDataMgr_SeqCollection* field_0x430;
/* 0x434 */ JAIStreamDataMgr* field_0x434;
/* 0x438 */ int field_0x438;
/* 0x43C */ int field_0x43c;
/* 0x430 */ JAISeqDataMgr* seSeqDataMgr_;
/* 0x434 */ JAIStreamDataMgr* streamDataMgr_;
/* 0x438 */ JAUSoundTable* soundTable;
/* 0x43C */ JAUSoundNameTable* soundNameTable;
};
/* 802A5E60 */ void setSeqDataArchive(JKRArchive*);
/* 802A5EC0 */ void loadDynamicSeq(JAISoundID, bool);
/* 802A5EC0 */ bool 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*);
/* 802A60A0 */ bool setSeqDataUser(JAISeqDataUser*);
/* 802A60AC */ bool newDynamicSeqBlock(u32);
/* 802A61D0 */ s32 getSeqData(JAISoundID, JAISeqData*);
/* 802A6270 */ int releaseSeqData();
/* 802A6278 */ ~JAUSectionHeap();
JAUWaveBankTable& getWaveBankTable() { return sectionHeapData_.waveBankTable; }
/* 0x00 */ JAUSection base1;
/* 0xDC */ u8 base2[0xE0 - 0xDC]; // JAISeqDataMgr
/* 0xE0 */ JKRSolidHeap* mHeap;
/* 0xE0 */ JKRHeap* mHeap;
/* 0xE4 */ int field_0xe4;
/* 0xE8 */ JSUList<JAUSection> mSectionList;
/* 0xF4 */ TSectionHeapData field_0xf4;
/* 0xF4 */ TSectionHeapData sectionHeapData_;
};
inline JKRHeap* JAUSection::getHeap_() { return sectionHeap_->mHeap; }
inline bool JAUSection::isOpen() { return this == sectionHeap_->getOpenSection(); }
JAUSectionHeap* JAUNewSectionHeap(bool);
#endif /* JAUSECTIONHEAP_H */
+1 -1
View File
@@ -21,7 +21,7 @@ public:
/* 0x0C */ int field_0xc;
};
class JAUSeqDataMgr_SeqCollection : JAISeqDataMgr, JAUSeqCollection {
class JAUSeqDataMgr_SeqCollection : public JAISeqDataMgr, public JAUSeqCollection {
public:
/* 802A677C */ JAUSeqDataMgr_SeqCollection();
/* 802A67D0 */ bool setSeqDataUser(JAISeqDataUser*);
+11 -3
View File
@@ -10,6 +10,12 @@ class JKRArchive;
struct JAUSeqDataBlock {
/* 802A68F4 */ JAUSeqDataBlock();
/* 0x00 */ JSULink<JAUSeqDataBlock> field_0x0;
/* 0x10 */ JAISoundID field_0x10;
/* 0x14 */ u8* field_0x14;
/* 0x18 */ u32 field_0x18;
/* 0x1C */ int field_0x1c;
};
class JAUSeqDataBlocks {
@@ -27,13 +33,15 @@ 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*);
/* 802A6AA8 */ s32 getSeqData(JAISoundID, JAISeqDataUser*, JAISeqData*, bool);
/* 802A6B8C */ bool appendDynamicSeqDataBlock(JAUSeqDataBlock*);
/* 802A6C18 */ bool loadDynamicSeq(JAISoundID, bool, JAISeqDataUser*);
/* 802A6D48 */ void releaseIdleDynamicSeqDataBlock(JAISeqDataUser*);
/* 802A6E00 */ void releaseIdleDynamicSeqDataBlock_(JAISeqDataUser*, u32);
/* 802A6EDC */ void rearrangeLoadingSeqs_();
JKRArchive* getSeqDataArchive() { return seqDataArchive_; }
/* 0x00 */ JAUSeqDataBlocks field_0x0;
/* 0x0C */ JAUSeqDataBlocks field_0xc;
/* 0x18 */ JAUSeqDataBlocks field_0x18;
+14
View File
@@ -0,0 +1,14 @@
#ifndef JAUSOUNDINFO_H
#define JAUSOUNDINFO_H
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASGadget.h"
class JAUSoundInfo : public JASGlobalInstance<JAUSoundInfo> {
public:
JAUSoundInfo(bool param_0) : JASGlobalInstance<JAUSoundInfo>(param_0) {}
virtual void getAudibleSw(JAISoundID) const = 0;
virtual u16 getBgmSeqResourceID(JAISoundID) const = 0;
};
#endif /* JAUSOUNDINFO_H */
+19 -2
View File
@@ -4,14 +4,31 @@
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASGadget.h"
struct JAUSoundTable : public JASGlobalInstance<JAUSoundTable> {
class JAUSoundTable : public JASGlobalInstance<JAUSoundTable> {
public:
JAUSoundTable(bool param_0) : JASGlobalInstance<JAUSoundTable>(param_0) {
field_0x0 = NULL;
field_0x4 = 0;
}
~JAUSoundTable() {}
/* 802A7114 */ void init(void const*);
/* 802A7160 */ void getTypeID(JAISoundID) const;
/* 802A7160 */ u8 getTypeID(JAISoundID) const;
/* 802A728C */ void getData(JAISoundID) const;
void* field_0x0;
int field_0x4;
};
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;
};
#endif /* JAUSOUNDTABLE_H */
@@ -0,0 +1,92 @@
#ifndef JAUSTREAMSTATICARAMMGR_H
#define JAUSTREAMSTATICARAMMGR_H
#include "JSystem/JAudio2/JAIStreamDataMgr.h"
#include "JSystem/JAudio2/JASAramStream.h"
#include "JSystem/JAudio2/JASHeapCtrl.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "MSL_C/bitset.h"
template <size_t A0>
class JAUStreamAramMgrBase_ : public JAIStreamAramMgr {
public:
JAUStreamAramMgrBase_() {
for (int i = 0; i < A0; i++) {
field_0x4.reset(0);
}
}
~JAUStreamAramMgrBase_() { releaseAram_JAUStreamAramMgrBase_(); }
bool isStreamUsingAram() { return field_0x4.any(); }
void releaseAram_JAUStreamAramMgrBase_() {
JUT_ASSERT("JAUStreamAramMgr.h", 0x26, ! isStreamUsingAram());
for (int i = 0; i >= 0; i--) {
if (mHeaps[i].isAllocated()) {
JASHeap* heap = mHeaps[i];
heap.free();
if (!heap) {
JUT_ASSERT("JAUStreamAramMgr.h", 0x2f, 0);
}
}
}
}
protected:
std::bitset<A0> field_0x4;
JASHeap mHeaps[A0];
};
template <size_t MAX_CHUNKS_>
class JAUStreamStaticAramMgr_ : public JAUStreamAramMgrBase_<MAX_CHUNKS_> {
public:
JAUStreamStaticAramMgr_() { field_0x4c = 0; }
virtual void* newStreamAram(u32* param_0) {
for (int i = 0; i < field_0x4c; i++) {
if (this->field_0x4.test(i)) {
continue;
}
this->field_0x4.set(i, true);
param_0 = this->mHeaps[i].getSize();
return this->mHeaps[i].getBase();
}
return 0;
}
virtual void deleteStreamAram(u32 param_0) {
for (int i = 0; i < field_0x4c; i++) {
if (!this->field_0x4.test(i)) {
continue;
}
if (this->mHeaps[i].getBase() == param_0) {
continue;
}
this->field_0x4.reset(i);
return 1;
}
return 0;
}
bool isAramReserved() const { return field_0x4c; }
void reserveAram(JASHeap* heap, int numReserve, u32 param_2) {
JUT_ASSERT("JAUStreamAramMgr.h", 0x48, ! isAramReserved());
JUT_ASSERT("JAUStreamAramMgr.h", 0x49, ! JAUStreamAramMgrBase_ < MAX_CHUNKS_ >::isStreamUsingAram());
if (!heap) {
heap = JASKernel::getAramHeap();
}
if (numReserve < 1) {
numReserve = 1;
}
JUT_ASSERT("JAUStreamAramMgr.h", 0x53, numReserve <= MAX_CHUNKS);
int r27 = param_2 * JASAramStream::getBlockSize();
for (int i = 0; i < numReserve; i++) {
if (!this->mHeaps[i].alloc(heap, r27)) {
break;
}
field_0x4c = i + 1;
}
}
private:
static const size_t MAX_CHUNKS = MAX_CHUNKS_;
int field_0x4c;
};
#endif /* JAUSTREAMSTATICARAMMGR_H */
+6 -10
View File
@@ -1,7 +1,7 @@
#ifndef JAUSTREAMFILETABLE_H
#define JAUSTREAMFILETABLE_H
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JAIStreamDataMgr.h"
struct BinaryStreamFileTable {
/* 0x0 */ char mIdentifier[4];
@@ -14,19 +14,15 @@ struct JAUStreamFileTable {
/* 802A742C */ void init(void const*);
/* 802A7478 */ int getNumFiles() const;
/* 802A7484 */ const char* getFilePath(int) const;
bool isValid() { return mData; }
/* 0x0 */ const BinaryStreamFileTable* mData;
};
struct JAIStreamDataMgr {
/* 802A3AD8 */ ~JAIStreamDataMgr();
};
struct JAUStreamDataMgr_StreamFileTable : JAIStreamDataMgr {
/* 802A74AC */ virtual int getStreamFileEntry(JAISoundID);
struct JAUStreamDataMgr_StreamFileTable : public JAIStreamDataMgr, JAUStreamFileTable {
/* 802A74AC */ virtual s32 getStreamFileEntry(JAISoundID);
/* 802A74E8 */ virtual ~JAUStreamDataMgr_StreamFileTable() {}
/* 0x4 */ JAUStreamFileTable mStreamFileTable;
};
#endif /* JAUSTREAMFILETABLE_H */
+4
View File
@@ -223,6 +223,10 @@ inline JKRHeap* JKRGetCurrentHeap() {
return JKRHeap::getCurrentHeap();
}
inline JKRHeap* JKRSetCurrentHeap(JKRHeap* heap) {
return heap->becomeCurrentHeap();
}
inline u32 JKRGetMemBlockSize(JKRHeap* heap, void* block) {
return JKRHeap::getSize(block, heap);
}
+4
View File
@@ -57,4 +57,8 @@ public:
static JKRSolidHeap* create(u32, JKRHeap*, bool);
};
inline JKRSolidHeap* JKRCreateSolidHeap(u32 param_0, JKRHeap* heap, bool param_2) {
return JKRSolidHeap::create(param_0, heap, param_2);
}
#endif /* JKRSOLIDHEAP_H */
+33
View File
@@ -10,6 +10,39 @@ ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, const T
template<class InputIt, class UnaryPredicate>
InputIt find_if(InputIt first, InputIt last, UnaryPredicate p);
/*
template<class OutputIt, class Size, int A2>
struct __fill_n {
OutputIt fill_n(OutputIt first, Size count, const unsigned long& value);
};
template<>
unsigned long* __fill_n<unsigned long, long, 0>::fill_n(unsigned long* first, long count, const unsigned long& value) {
for (; count > 0; count--) {
*first++ = value;
}
return first;
}
template<class OutputIt, class Size, class T>
OutputIt fill_n(OutputIt first, Size count, const T& value) {
return __fill_n::fill_n(first, count, value);
}
template<class ForwardIt, class T>
void __fill(ForwardIt first, ForwardIt last, const T& value, std::random_access_iterator_tag param_3) {
fill_n(first, last - first, value);
}
*/
template<class ForwardIt, class T>
void fill(ForwardIt first, ForwardIt last, const T& value) {
for (; first != last; ++first){
*first = value;
}
}
} // namespace std
#endif
+58 -6
View File
@@ -1,8 +1,17 @@
#ifndef MSL_BITSET_H_
#define MSL_BITSET_H_
#include "MSL_C/algorithm.h"
#include "MSL_C/stdio.h"
#include "MSL_C/stdlib.h"
namespace std {
// TODO: where does this go?
inline void __msl_error(const char* param_0) {
fprintf(stderr, param_0);
abort();
}
template<size_t N> class __bitset_base {
public:
__bitset_base();
@@ -15,13 +24,56 @@ private:
size_t data[N];
};
template<size_t N> class bitset : private __bitset_base<(N - 1) / sizeof(size_t) + 1> {
public:
bitset();
template<size_t N> __bitset_base<N>::__bitset_base() {
std::fill(data, data + N, 0);
}
void set(size_t pos, bool val);
void reset(size_t pos);
bool test(size_t pos) const;
template<size_t N> bool __bitset_base<N>::test(size_t pos) const {
size_t i = pos / (sizeof(size_t) * 8);
size_t mask = 1 << (pos % (sizeof(size_t) * 8));
return data[i] & mask;
}
template<size_t N> void __bitset_base<N>::set(size_t pos, bool val) {
size_t i = pos / (sizeof(size_t) * 8);
size_t mask = 1 << (pos % (sizeof(size_t) * 8));
if (val) {
data[i] |= mask;
} else {
data[i] &= ~mask;
}
}
template<size_t N> void __bitset_base<N>::reset(size_t pos) {
size_t i = pos / (sizeof(size_t) * 8);
size_t mask = 1 << (pos % (sizeof(size_t) * 8));
data[i] &= ~mask;
}
template<size_t N> class bitset : private __bitset_base<(N - 1) / (sizeof(size_t) * 8) + 1> {
public:
typedef __bitset_base<(N - 1) / (sizeof(size_t) * 8) + 1> base;
bitset() {};
void set(size_t pos, bool val) {
if (pos >= N) {
__msl_error("index out of range of bitset::set");
}
base::set(pos, val);
}
void reset(size_t pos) {
if (pos >= N) {
__msl_error("index out of range of bitset::reset");
}
base::reset(pos);
}
bool test(size_t pos) const {
if (pos >= N) {
__msl_error("index out of range of bitset::test");
}
return base::test(pos);
}
bool any() const;
};
} // namespace std
+1 -26
View File
@@ -6,37 +6,12 @@
#include "JSystem/JAudio2/JAIAudible.h"
#include "JSystem/JAudio2/JASSoundParams.h"
#include "JSystem/JAudio2/JASHeapCtrl.h"
#include "JSystem/JAudio2/JAUAudibleParam.h"
#include "JSystem/TPosition3.hh"
#include "dolphin/mtx/mtxvec.h"
struct Z2Audible;
struct JAUAudibleParam {
f32 getDopplerPower() const {
return (u32)((*(u8*)&field_0x0.raw >> 4) & 0xf) * (1.0f / 15.0f);
}
union {
struct {
u16 f0;
u16 f1;
} half;
struct {
u8 b0_0 : 1;
u8 b0_1 : 1;
u8 b0_2 : 1;
u8 b0_3 : 1;
u8 b0_4 : 1;
u8 b0_5 : 1;
u8 b0_6 : 1;
u8 b0_7 : 1;
u8 b1;
u8 b2;
u8 b3;
} bytes;
u32 raw;
} field_0x0;
};
struct Z2AudibleAbsPos {
/* 802BBCDC */ void calc(JGeometry::TVec3<f32> const&);
/* 802BBD18 */ void init(JGeometry::TVec3<f32>*, JGeometry::TVec3<f32> const&,
+5 -4
View File
@@ -3,13 +3,14 @@
#include "JSystem/JAudio2/JAUAudioArcLoader.h"
class Z2AudioArcLoader {
class Z2AudioArcLoader : public JAUAudioArcLoader {
public:
Z2AudioArcLoader(JAUSection*);
~Z2AudioArcLoader();
virtual ~Z2AudioArcLoader();
void readCommandMore(u32);
virtual bool readCommandMore(u32);
void readBFCA(const void*);
void readBSTN(const void*, u32);
virtual void readBSTN(const void*, u32);
};
#endif /* Z2AUDIOARCLOADER_H */
+4 -9
View File
@@ -7,6 +7,7 @@
#include "Z2AudioLib/Z2SceneMgr.h"
#include "Z2AudioLib/Z2SeMgr.h"
#include "Z2AudioLib/Z2SeqMgr.h"
#include "Z2AudioLib/Z2SoundInfo.h"
#include "Z2AudioLib/Z2SoundMgr.h"
#include "Z2AudioLib/Z2SoundObjMgr.h"
#include "Z2AudioLib/Z2SpeechMgr2.h"
@@ -17,7 +18,7 @@
class JKRArchive;
class JKRSolidHeap;
class Z2AudioMgr {
class Z2AudioMgr : public Z2SeMgr, public Z2SeqMgr, public Z2SceneMgr, public Z2StatusMgr, public Z2SoundObjMgr {
public:
Z2AudioMgr();
~Z2AudioMgr() {}
@@ -33,19 +34,13 @@ public:
static Z2AudioMgr* mAudioMgrPtr;
/* 0x0000 */ Z2SeMgr mSeMgr;
/* 0x03D0 */ Z2SeqMgr mSeqMgr;
/* 0x04A4 */ Z2SceneMgr mSceneMgr;
/* 0x04C4 */ Z2StatusMgr mStatusMgr;
/* 0x04F4 */ Z2SoundObjMgr mSoundObjMgr;
/* 0x0514 */ virtual void startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
/* 0x0514 */ virtual int startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
/* 0x0518 */ bool mResettingFlag;
/* 0x0519 */ bool field_0x519;
/* 0x051C */ JASAudioReseter mAudioReseter;
/* 0x052C */ Z2SoundStarter mSoundStarter;
/* 0x0530 */ Z2SoundMgr mSoundMgr;
/* 0x0D40 */ // Z2SoundInfo mSoundInfo;
/* 0x0D40 */ void* mSoundInfo[3]; // remove later
/* 0x0D40 */ Z2SoundInfo mSoundInfo;
/* 0x0D4C */ Z2Audience mAudience;
/* 0x0F2C */ Z2SpeechMgr2 mSpeechMgr;
/* 0x1370 */ Z2FxLineMgr mFxLineMgr;
+6
View File
@@ -10,6 +10,12 @@ enum CurveSign {
};
struct FNoise1f {
FNoise1f(float param_0 = 0.1f, float param_1 = 0.0f, float param_2 = 0.01f) {
unk0 = param_0;
unk4 = param_0;
unk8 = param_2;
unk12 = param_1;
}
void setParam(float, float, float);
float tau(float);
float calcNoise1f();
+4 -4
View File
@@ -6,7 +6,7 @@
#include "global.h"
struct Z2EnvSeBase {
/* 802C589C */ Z2EnvSeBase(Vec*);
/* 802C589C */ Z2EnvSeBase(Vec* param_0 = NULL);
/* 802C58AC */ ~Z2EnvSeBase();
/* 802C5908 */ void startEnvSe(JAISoundID, f32, f32, f32, f32, f32, u32);
/* 802C5AB4 */ void startEnvSeLevel(JAISoundID, f32, f32, f32, f32, f32, u32);
@@ -31,7 +31,7 @@ struct Z2EnvSeAutoPan : public Z2EnvSeBase {
}; // Size: 0x1C
struct Z2EnvSeDir : public Z2EnvSeBase {
/* 802C5C9C */ Z2EnvSeDir(Vec*);
/* 802C5C9C */ Z2EnvSeDir(Vec* param_0 = NULL);
/* 802C5D1C */ ~Z2EnvSeDir();
/* 802C5D70 */ void setPanDir(Vec*);
/* 802C5D9C */ void calcPan(f32);
@@ -111,7 +111,7 @@ struct Z2EnvSeMgr : public JASGlobalInstance<Z2EnvSeMgr> {
/* 0x120 */ Z2Calc::FNoise1f field_0x120;
/* 0x130 */ Z2Calc::FNoise1f field_0x130;
/* 0x140 */ u8 field_0x140;
/* 0x141 */ u8 field_0x141;
/* 0x141 */ u8 mSnowPower;
/* 0x144 */ Z2EnvSeDir field_0x144;
/* 0x160 */ u8 mWindType;
/* 0x164 */ Z2MultiSeMgr field_0x164;
@@ -158,7 +158,7 @@ struct Z2EnvSeMgr : public JASGlobalInstance<Z2EnvSeMgr> {
/* 0x2E4 */ u8 field_0x2e4;
/* 0x2E8 */ Z2Calc::FNoise1f field_0x2e8;
/* 0x2F8 */ Z2Calc::FNoise1f field_0x2f8;
/* 0x308 */ f32 field_0x308;
/* 0x308 */ f32 mFogDensity;
}; // Size: 0x30C
STATIC_ASSERT(sizeof(Z2EnvSeMgr) == 0x30C);
+2
View File
@@ -13,6 +13,8 @@ struct Z2MultiSeMgr {
void getPanPower();
void getDolbyPower();
void setVolumeScale(f32 param_0) { mVolumeScale = param_0; }
/* 0x00 */ float mVolumeScale;
/* 0x04 */ float mMaxVolume;
/* 0x08 */ float mMaxPowL;
+19 -25
View File
@@ -2,33 +2,27 @@
#define Z2SOUNDINFO_H
#include "JSystem/JAudio2/JAISoundInfo.h"
#include "JSystem/JAudio2/JAIStreamDataMgr.h"
#include "JSystem/JAudio2/JAUSoundInfo.h"
struct JAUSoundInfo : public JASGlobalInstance<JAUSoundInfo> {
virtual void getAudibleSw(JAISoundID) const = 0;
virtual void getBgmSeqResourceID(JAISoundID) const = 0;
};
struct JAIStreamDataMgr {
virtual void getStreamFileEntry(JAISoundID) = 0;
virtual ~JAIStreamDataMgr();
};
struct Z2SoundInfo /* : public JAISoundInfo, public JAUSoundInfo, public JAIStreamDataMgr */ : public JASGlobalInstance<Z2SoundInfo> {
/* 802BB00C */ void getBgmSeqResourceID(JAISoundID) const;
/* 802BB158 */ u32 getAudibleSwFull(JAISoundID);
/* 802BB448 */ void getAudibleSw(JAISoundID) const;
/* 802BBA10 */ void getStreamFilePath(JAISoundID);
/* 802BBA88 */ void getStreamFileEntry(JAISoundID);
/* 802BBAC8 */ void getSwBit(JAISoundID) const;
/* 802BBB48 */ void getSoundInfo_(JAISoundID, JAISound*) const;
/* 802BB090 */ void getSoundType(JAISoundID) const;
/* 802BB0D8 */ void getCategory(JAISoundID) const;
/* 802BB0E0 */ void getPriority(JAISoundID) const;
/* 802BB6DC */ void getSeInfo(JAISoundID, JAISe*) const;
/* 802BB8B4 */ void getSeqInfo(JAISoundID, JAISeq*) const;
/* 802BB8E0 */ void getStreamInfo(JAISoundID, JAIStream*) const;
class Z2SoundInfo : public JAISoundInfo, public JAUSoundInfo, public JAIStreamDataMgr, public JASGlobalInstance<Z2SoundInfo> {
public:
Z2SoundInfo() : JAISoundInfo(true), JAUSoundInfo(true), JASGlobalInstance<Z2SoundInfo>(true) {}
/* 802BB448 */ virtual void getAudibleSw(JAISoundID) const;
/* 802BB00C */ virtual u16 getBgmSeqResourceID(JAISoundID) const;
/* 802BBA88 */ virtual s32 getStreamFileEntry(JAISoundID);
/* 802BB090 */ virtual u32 getSoundType(JAISoundID) const;
/* 802BB0D8 */ virtual int getCategory(JAISoundID) const;
/* 802BB0E0 */ virtual u32 getPriority(JAISoundID) const;
/* 802BB6DC */ virtual void getSeInfo(JAISoundID, JAISe*) const;
/* 802BB8B4 */ virtual void getSeqInfo(JAISoundID, JAISeq*) const;
/* 802BB8E0 */ virtual void getStreamInfo(JAISoundID, JAIStream*) const;
/* 802BBBE0 */ virtual ~Z2SoundInfo();
/* 802BB158 */ u32 getAudibleSwFull(JAISoundID);
/* 802BBA10 */ const char* getStreamFilePath(JAISoundID);
/* 802BBAC8 */ int getSwBit(JAISoundID) const;
/* 802BBB48 */ void getSoundInfo_(JAISoundID, JAISound*) const;
};
inline Z2SoundInfo* Z2GetSoundInfo() {
+5 -1
View File
@@ -6,6 +6,8 @@
#include "JSystem/JAudio2/JAIStreamMgr.h"
#include "global.h"
u16 seqCallback(JASTrack* param_0, u16 param_1);
class Z2SoundMgr : public JASGlobalInstance<Z2SoundMgr> {
public:
/* 802A9E80 */ Z2SoundMgr();
@@ -23,10 +25,12 @@ public:
/* 802AA9E8 */ void multiVolumeSoundID(JAISoundID, f32);
/* 802AAAC4 */ void isPlayingSoundID(JAISoundID);
/* 802A9EE8 */ virtual void startSound(JAISoundID, JAISoundHandle*,
/* 802A9EE8 */ virtual int startSound(JAISoundID, JAISoundHandle*,
JGeometry::TVec3<f32> const*);
JAISeMgr* getSeMgr() { return &mSeMgr; }
JAISeqMgr* getSeqMgr() { return &mSeqMgr; }
JAIStreamMgr* getStreamMgr() { return &mStreamMgr; }
private:
/* 0x004 */ JAISeMgr mSeMgr;
+19 -21
View File
@@ -4,7 +4,7 @@
#include "Z2AudioLib/Z2AudioMgr.h"
#include "Z2AudioLib/Z2EnvSeMgr.h"
class mDoAud_zelAudio_c {
class mDoAud_zelAudio_c : public Z2AudioMgr {
public:
void reset();
mDoAud_zelAudio_c() {}
@@ -22,8 +22,6 @@ public:
static bool mInitFlag;
static bool mResetFlag;
static bool mBgmSet;
Z2AudioMgr mAudioMgr;
};
extern JKRSolidHeap* g_mDoAud_audioHeap;
@@ -38,73 +36,73 @@ static void mDoAud_setLinkHp(s32 param_0, s32 param_1);
static void mDoAud_seStartLevel(u32 param_0, Vec const* param_1, u32 param_2, s8 param_3);
inline void mDoAud_bgmSetSwordUsing(s32 id) {
Z2AudioMgr::getInterface()->mSeqMgr.bgmSetSwordUsing(id);
Z2AudioMgr::getInterface()->bgmSetSwordUsing(id);
}
inline void mDoAud_bgmStart(u32 i_bgmID) {
Z2AudioMgr::getInterface()->mSeqMgr.bgmStart(i_bgmID, 0, 0);
Z2AudioMgr::getInterface()->bgmStart(i_bgmID, 0, 0);
}
inline void mDoAud_subBgmStart(u32 i_bgmID) {
Z2AudioMgr::getInterface()->mSeqMgr.subBgmStart(i_bgmID);
Z2AudioMgr::getInterface()->subBgmStart(i_bgmID);
}
inline void mDoAud_bgmNowBattle(f32 param_0) {
Z2AudioMgr::getInterface()->mSeqMgr.bgmNowBattle(param_0);
Z2AudioMgr::getInterface()->bgmNowBattle(param_0);
}
inline void mDoAud_bgmStreamPrepare(u32 param_0) {
Z2AudioMgr::getInterface()->mSeqMgr.bgmStreamPrepare(param_0);
Z2AudioMgr::getInterface()->bgmStreamPrepare(param_0);
}
inline void mDoAud_bgmStreamPlay() {
Z2AudioMgr::getInterface()->mSeqMgr.bgmStreamPlay();
Z2AudioMgr::getInterface()->bgmStreamPlay();
}
inline void mDoAud_setHour(s32 hour) {
Z2AudioMgr::getInterface()->mStatusMgr.setHour(hour);
Z2AudioMgr::getInterface()->setHour(hour);
}
inline void mDoAud_setMinute(s32 min) {
Z2AudioMgr::getInterface()->mStatusMgr.setMinute(min);
Z2AudioMgr::getInterface()->setMinute(min);
}
inline void mDoAud_setWeekday(s32 day) {
Z2AudioMgr::getInterface()->mStatusMgr.setWeekday(day);
Z2AudioMgr::getInterface()->setWeekday(day);
}
inline void mDoAud_setInDarkness(bool state) {
Z2AudioMgr::getInterface()->mSceneMgr.setInDarkness(state);
Z2AudioMgr::getInterface()->setInDarkness(state);
}
inline void mDoAud_seStart(u32 i_sfxID, const Vec* i_sePos, u32 param_2, s8 i_reverb) {
Z2AudioMgr::getInterface()->mSeMgr.seStart(i_sfxID, i_sePos, param_2, i_reverb, 1.0f, 1.0f,
Z2AudioMgr::getInterface()->seStart(i_sfxID, i_sePos, param_2, i_reverb, 1.0f, 1.0f,
-1.0f, -1.0f, 0);
}
inline void i_mDoAud_seStartLevel(u32 i_sfxID, const Vec* i_sePos, u32 param_2, s8 i_reverb) {
Z2AudioMgr::getInterface()->mSeMgr.seStartLevel(i_sfxID, i_sePos, param_2, i_reverb, 1.0f, 1.0f,
Z2AudioMgr::getInterface()->seStartLevel(i_sfxID, i_sePos, param_2, i_reverb, 1.0f, 1.0f,
-1.0f, -1.0f, 0);
}
inline void mDoAud_messageSePlay(u16 param_0, Vec* position, s8 param_2) {
Z2AudioMgr::getInterface()->mSeMgr.messageSePlay(param_0, position, param_2);
Z2AudioMgr::getInterface()->messageSePlay(param_0, position, param_2);
}
inline void mDoAud_sceneBgmStart() {
Z2AudioMgr::getInterface()->mSceneMgr.sceneBgmStart();
Z2AudioMgr::getInterface()->sceneBgmStart();
}
inline void mDoAud_load2ndDynamicWave() {
Z2AudioMgr::getInterface()->mSceneMgr.load2ndDynamicWave();
Z2AudioMgr::getInterface()->load2ndDynamicWave();
}
inline bool mDoAud_check1stDynamicWave() {
return Z2AudioMgr::getInterface()->mSceneMgr.check1stDynamicWave();
return Z2AudioMgr::getInterface()->check1stDynamicWave();
}
inline void mDoAud_bgmStop(u32 param_0) {
Z2AudioMgr::getInterface()->mSeqMgr.bgmStop(param_0, 0);
Z2AudioMgr::getInterface()->bgmStop(param_0, 0);
}
inline void mDoAud_rainPlay(s32 enable) {
@@ -112,7 +110,7 @@ inline void mDoAud_rainPlay(s32 enable) {
}
inline void mDoAud_heartGaugeOn() {
Z2AudioMgr::getInterface()->mStatusMgr.heartGaugeOn();
Z2AudioMgr::getInterface()->heartGaugeOn();
}
inline void mDoAud_setSnowPower(s8 i_power) {