From 250110cd1058ebfb01248d638325df7c9419f6fb Mon Sep 17 00:00:00 2001 From: Jcw87 Date: Tue, 18 Jul 2023 22:57:25 -0700 Subject: [PATCH] JAISe --- include/JSystem/JAudio2/JAIAudible.h | 9 +- include/JSystem/JAudio2/JAISe.h | 52 +++- include/JSystem/JAudio2/JAISeMgr.h | 24 +- include/JSystem/JAudio2/JAISeq.h | 4 +- include/JSystem/JAudio2/JAISeqDataMgr.h | 13 +- include/JSystem/JAudio2/JAISound.h | 65 ++++- include/JSystem/JAudio2/JAIStream.h | 3 +- include/JSystem/JAudio2/JASTrack.h | 58 ++++- libs/JSystem/JAudio2/JAISe.cpp | 303 ++++++++++++++++++------ libs/JSystem/JAudio2/JAISeq.cpp | 69 +----- libs/JSystem/JAudio2/JAISound.cpp | 12 +- libs/JSystem/JAudio2/JAIStream.cpp | 67 +----- 12 files changed, 450 insertions(+), 229 deletions(-) diff --git a/include/JSystem/JAudio2/JAIAudible.h b/include/JSystem/JAudio2/JAIAudible.h index 1f89a60d73a..a7db5ee39c8 100644 --- a/include/JSystem/JAudio2/JAIAudible.h +++ b/include/JSystem/JAudio2/JAIAudible.h @@ -1,14 +1,21 @@ #ifndef JAIAUDIBLE_H #define JAIAUDIBLE_H +#include "JSystem/JGeometry.h" #include "dolphin/types.h" struct JASSoundParams; -struct JAIAudible { +class JAIAudible { +public: virtual ~JAIAudible(); virtual JASSoundParams* getOuterParams(int) = 0; virtual void calc() = 0; + + JGeometry::TVec3& getPos() { return mPos; } + void setPos(const JGeometry::TVec3& other) { mPos.set(other); } + + /* 0x04 */ JGeometry::TVec3 mPos; }; #endif /* JAIAUDIBLE_H */ diff --git a/include/JSystem/JAudio2/JAISe.h b/include/JSystem/JAudio2/JAISe.h index cd398bd72a1..3c28fa464a8 100644 --- a/include/JSystem/JAudio2/JAISe.h +++ b/include/JSystem/JAudio2/JAISe.h @@ -1,6 +1,56 @@ #ifndef JAISE_H #define JAISE_H -#include "dolphin/types.h" +#include "JSystem/JAudio2/JAISeqDataMgr.h" +#include "JSystem/JAudio2/JAISound.h" +#include "JSystem/JAudio2/JASTrack.h" +#include "JSystem/JSupport/JSUList.h" + +class JAISeMgr; + +class JAISe : public JSULink, public JAISound { +public: + class TInner { + public: + TInner() : mSeqData(NULL, 0) {} + + /* 0x000 */ u32 mProperPriority; + /* 0x004 */ u32 mPriority; + /* 0x008 */ JASSoundParams mSoundParams; + /* 0x01c */ JASTrack track; + /* 0x264 */ JAISeqData mSeqData; + /* 0x26c */ u8 field_0x26c; + /* 0x270 */ JAISeMgr* seMgr; + /* 0x274 */ JAISoundStrategyMgr* mSoundStrategyMgr; + /* 0x278 */ JAISoundStrategyMgr__unknown* field_0x278; + /* 0x27c */ JAITempoMgr mTempoMgr; + }; + + /* 8029F6D8 */ virtual bool getNumChild() const; + /* 8029F6E0 */ virtual bool getChild(int); + /* 8029F6E8 */ virtual void releaseChild(int); + /* 8029F84C */ virtual JASTrack* getTrack(); + /* 8029F854 */ virtual JASTrack* getChildTrack(int); + /* 8029F864 */ virtual JAISe* asSe(); + /* 8029F868 */ virtual JAITempoMgr* getTempoMgr(); + /* 8029F5C8 */ virtual bool JAISound_tryDie_(); + + /* 8029F03C */ JAISe(JAISeMgr*, JAISoundStrategyMgr*, u32); + /* 8029F0F8 */ void mixOut_(JASSoundParams const&); + /* 8029F214 */ void stopTrack_(); + /* 8029F250 */ void startTrack_(JASSoundParams const&); + /* 8029F304 */ void JAISeCategoryMgr_mixOut_(bool, JASSoundParams const&, JAISoundActivity); + /* 8029F4CC */ void JAISeCategoryMgr_calc_(); + /* 8029F650 */ void JAISeMgr_startID_(JAISoundID, JGeometry::TVec3 const*, JAIAudience*); + /* 8029F6EC */ bool prepare_getSeqData_(); + /* 8029F78C */ void prepare_(); + + JAISeqData* getSeqData() { return &inner_.mSeqData; } + u32 JAISeCategoryMgr_getProperPriority_() const { return inner_.mProperPriority; } + u32 JAISeCategoryMgr_getPriority_() const { return inner_.mPriority; } + bool isFarAway() const { return mPriority == -1; } + + /* 0x0ac */ TInner inner_; +}; #endif /* JAISE_H */ diff --git a/include/JSystem/JAudio2/JAISeMgr.h b/include/JSystem/JAudio2/JAISeMgr.h index 67b79c362d6..c34adf04b52 100644 --- a/include/JSystem/JAudio2/JAISeMgr.h +++ b/include/JSystem/JAudio2/JAISeMgr.h @@ -1,6 +1,7 @@ #ifndef JAISEMGR_H #define JAISEMGR_H +#include "JSystem/JAudio2/JAISe.h" #include "JSystem/JAudio2/JAISeqDataMgr.h" #include "JSystem/JAudio2/JAISound.h" #include "JSystem/JAudio2/JAISoundParams.h" @@ -27,28 +28,6 @@ struct JAISeCategoryArrangement { class JAISeMgr; -struct JAISePlaceHolder { - u8 field_0x0[0x10]; -}; - -struct JAISe : public JAISePlaceHolder, public JAISound { - /* 8029F03C */ JAISe(JAISeMgr*, JAISoundStrategyMgr*, u32); - /* 8029F304 */ void JAISeCategoryMgr_mixOut_(bool, JASSoundParams const&, JAISoundActivity); - /* 8029F4CC */ void JAISeCategoryMgr_calc_(); - /* 8029F650 */ void JAISeMgr_startID_(JAISoundID, JGeometry::TVec3 const*, JAIAudience*); - - JAISeqData* getSeqData() { return &mSeqData; } - u32 JAISeCategoryMgr_getProperPriority_() const { return mProperPriority; } - u32 JAISeCategoryMgr_getPriority_() const { return mPriority;} - bool isFarAway() const { return mPriority == -1; } - - /* 0x0aa */ u8 field_0x0[2]; - /* 0x0ac */ u32 mProperPriority; - /* 0x0b0 */ u32 mPriority; - /* 0x0b4 */ u8 field_0xb4[0x25c]; - /* 0x310 */ JAISeqData mSeqData; -}; - class JAISeCategoryMgr : public JAISeqDataUser { public: /* 8029F9C4 */ void JAISeMgr_calc_(); @@ -117,6 +96,7 @@ public: } return mAudience; } + JAISeqDataMgr* getSeqDataMgr() { return mSeqDataMgr; } private: /* 0x008 */ JAIAudience* mAudience; diff --git a/include/JSystem/JAudio2/JAISeq.h b/include/JSystem/JAudio2/JAISeq.h index ed6c6dee9fb..411125cf466 100644 --- a/include/JSystem/JAudio2/JAISeq.h +++ b/include/JSystem/JAudio2/JAISeq.h @@ -1,6 +1,8 @@ #ifndef JAISEQ_H #define JAISEQ_H -#include "dolphin/types.h" +#include "JSystem/JAudio2/JAISound.h" +#include "JSystem/JAudio2/JASTrack.h" +#include "JSystem/JSupport/JSUList.h" #endif /* JAISEQ_H */ diff --git a/include/JSystem/JAudio2/JAISeqDataMgr.h b/include/JSystem/JAudio2/JAISeqDataMgr.h index f97e502ce1c..afa630f0e3a 100644 --- a/include/JSystem/JAudio2/JAISeqDataMgr.h +++ b/include/JSystem/JAudio2/JAISeqDataMgr.h @@ -5,16 +5,21 @@ #include "dolphin/types.h" struct JAISeqData { - /* 0x00 */ u32 field_0x0; + JAISeqData(void* param_0, u32 param_1) { + field_0x0 = param_0; + field_0x4 = param_1; + } + + /* 0x00 */ void* field_0x0; /* 0x04 */ u32 field_0x4; }; struct JAISeqDataRegion { bool intersects(JAISeqData& seqData) const { - if (field_0x0 + field_0x4 < seqData.field_0x0) { + if (field_0x0 + field_0x4 < (u32)seqData.field_0x0) { return false; } - if (seqData.field_0x0 + seqData.field_0x4 < field_0x0) { + if ((u32)seqData.field_0x0 + seqData.field_0x4 < field_0x0) { return false; } return true; @@ -33,7 +38,7 @@ struct JAISeqDataUser { struct JAISeqDataMgr { virtual ~JAISeqDataMgr(); - virtual void getSeqData(JAISoundID, JAISeqData*) = 0; + virtual int getSeqData(JAISoundID, JAISeqData*) = 0; virtual int releaseSeqData() = 0; virtual void setSeqDataUser(JAISeqDataUser*) = 0; }; diff --git a/include/JSystem/JAudio2/JAISound.h b/include/JSystem/JAudio2/JAISound.h index 2896ec23571..bc6fc490ea9 100644 --- a/include/JSystem/JAudio2/JAISound.h +++ b/include/JSystem/JAudio2/JAISound.h @@ -53,12 +53,13 @@ struct JAISoundStatus_ { inline bool isPlaying() { return state.unk == 5; } + inline bool isMute() { return field_0x0.flags.mute; } inline bool isPaused() { return field_0x0.flags.paused; } /* 0x0 */ union { u8 value; struct { - u8 flag1 : 1; + u8 mute : 1; u8 paused : 1; u8 flag3 : 1; u8 flag4 : 1; @@ -120,13 +121,24 @@ struct JAISoundFader { return false; } inline void calc() { mIntensity = mTransition.apply(mIntensity); } + f32 getIntensity() { return mIntensity; } /* 0x00 */ f32 mIntensity; /* 0x04 */ JAISoundParamsTransition::TTransition mTransition; }; // Size: 0x10 +template +struct JAISoundStrategyMgr__unknown { + virtual void virtual2(); + virtual void virtual3(A0*); + virtual void virtual4(A0*, const JASSoundParams&); +}; template -struct JAISoundStrategyMgr {}; +struct JAISoundStrategyMgr { + virtual void virtual2(); + virtual JAISoundStrategyMgr__unknown* virtual3(JAISoundID); + virtual void virtual4(JAISoundStrategyMgr__unknown*); +}; /* JAISoundStrategyMgr */ struct JAISoundStrategyMgr__template0 {}; /* JAISoundStrategyMgr */ @@ -136,14 +148,45 @@ struct JAISoundStrategyMgr__template2 {}; class JAISoundActivity { public: - void init() { field_0x0 = 0; } + void init() { field_0x0.value = 0; } - /* 0x0 */ u8 field_0x0; + /* 0x0 */ union { + u8 value; + struct { + u8 flag1 : 1; + u8 flag2 : 1; + u8 flag3 : 1; + u8 flag4 : 1; + u8 flag5 : 1; + u8 flag6 : 1; + u8 flag7 : 1; + u8 flag8 : 1; + } flags; + } field_0x0; +}; + +class JAITempoMgr { +public: + /* 0x00 */ f32 mTempo; + /* 0x04 */ JAISoundParamsTransition::TTransition field_0x4; + + JAITempoMgr() { init(); } + void init() { setTempo(1.0f); } + void setTempo(f32 param_0) { + mTempo = param_0; + field_0x4.zero(); + } + f32 getTempo() { return mTempo; } + void calc() { mTempo = field_0x4.apply(mTempo); } }; class JAISoundHandle; class JAIAudible; class JAIAudience; +class JAISe; +class JAISeq; +class JAIStream; +class JAITempoMgr; class JAISound { public: /* 802A21A0 */ void releaseHandle(); @@ -163,12 +206,12 @@ public: virtual void getNumChild() = 0; virtual void getChild() = 0; virtual void releaseChild() = 0; - /* 802A25D8 */ virtual bool asSe(); - /* 802A25E0 */ virtual bool asSeq(); - /* 802A25E8 */ virtual bool asStream(); - virtual void getTrack() = 0; - virtual void getChildTrack() = 0; - virtual void getTempoMgr() = 0; + /* 802A25D8 */ virtual JAISe* asSe(); + /* 802A25E0 */ virtual JAISeq* asSeq(); + /* 802A25E8 */ virtual JAIStream* asStream(); + virtual JASTrack* getTrack() = 0; + virtual JASTrack* getChildTrack() = 0; + virtual JAITempoMgr* getTempoMgr() = 0; virtual bool JAISound_tryDie_() = 0; JAISoundID getID() const; @@ -200,7 +243,7 @@ public: /* 0x18 */ JAISoundID soundID; /* 0x1C */ JAISoundStatus_ status_; /* 0x24 */ JAISoundFader fader; - /* 0x34 */ s32 mPriority; + /* 0x34 */ u32 mPriority; /* 0x38 */ s32 mCount; /* 0x3C */ JAISoundParams params; }; // Size: 0x98 diff --git a/include/JSystem/JAudio2/JAIStream.h b/include/JSystem/JAudio2/JAIStream.h index 8fd4ea9e32b..ec9f25ec94c 100644 --- a/include/JSystem/JAudio2/JAIStream.h +++ b/include/JSystem/JAudio2/JAIStream.h @@ -1,6 +1,7 @@ #ifndef JAISTREAM_H #define JAISTREAM_H -#include "dolphin/types.h" +#include "JSystem/JAudio2/JAISound.h" +#include "JSystem/JSupport/JSUList.h" #endif /* JAISTREAM_H */ diff --git a/include/JSystem/JAudio2/JASTrack.h b/include/JSystem/JAudio2/JASTrack.h index 396a32ae150..9347a193a25 100644 --- a/include/JSystem/JAudio2/JASTrack.h +++ b/include/JSystem/JAudio2/JASTrack.h @@ -30,12 +30,23 @@ struct JASChannel { }; struct JASTrack { + enum Status { + STATUS_FREE, + STATUS_RUN, + }; + struct TChannelMgr { /* 802930DC */ TChannelMgr(JASTrack*); /* 80293148 */ void init(); /* 802931B0 */ void releaseAll(); /* 80293220 */ void noteOff(u32, u16); /* 802932A0 */ void setPauseFlag(bool); + + /* 0x00 */ JASChannel* field_0x0[8]; + /* 0x20 */ u8 field_0x20[0x18]; // JASChannelParams + /* 0x38 */ short field_0x38[8]; + /* 0x48 */ JASSoundParams* field_0x48; + /* 0x4c */ JASTrack* field_0x4c; }; struct TList { @@ -47,6 +58,10 @@ struct JASTrack { struct MoveParam_ { /* 802932C8 */ MoveParam_(); + + /* 0x00 */ f32 field_0x0; + /* 0x04 */ f32 field_0x4; + /* 0x08 */ int field_0x8; }; /* 80291228 */ JASTrack(); @@ -109,9 +124,50 @@ struct JASTrack { static u8 sTrackList[16]; int getChannelMgrCount() { return channelMgrCount; } + u8 getStatus() const { return mStatus; } + JASTrack* getChild(int index) { return field_0x130[index]; } - /* 0x000 */ u8 field_0x0[0x1d0]; + /* 0x000 */ u8 field_0x0[0x5c]; // JASSeqCtrl + /* 0x05C */ u8 field_0x5c[0x24]; // JASTrackPort + /* 0x080 */ u8 field_0x80[0x1c]; // JASRegisterParam + /* 0x09C */ MoveParam_ field_0x9c[6]; + /* 0x0e4 */ u8 mOscParam[0x30]; // JASOscillator::Data[2] + /* 0x114 */ u8 field_0x114[0x18]; // JASOscillator::Point[4] + /* 0x12C */ JASTrack* mParent; + /* 0x130 */ JASTrack* field_0x130[16]; + /* 0x170 */ TChannelMgr* field_0x170[4]; + /* 0x180 */ TChannelMgr field_0x180; /* 0x1D0 */ int channelMgrCount; + /* 0x1D4 */ void* field_0x1d4; + /* 0x1D8 */ f32 field_0x1d8; + /* 0x1DC */ f32 field_0x1dc; + /* 0x1E0 */ f32 field_0x1e0; + /* 0x1E4 */ f32 field_0x1e4; + /* 0x1E8 */ f32 field_0x1e8; + /* 0x1EC */ f32 field_0x1ec; + /* 0x1F0 */ u16 field_0x1f0; + /* 0x1F2 */ u16 field_0x1f2; + /* 0x1F4 */ short field_0x1f4[8]; + /* 0x204 */ short field_0x204[8]; + /* 0x214 */ char field_0x214; + /* 0x215 */ u8 mStatus; + /* 0x216 */ u8 field_0x216; + /* 0x218 */ f32 field_0x218; + /* 0x21C */ f32 field_0x21c; + /* 0x220 */ u32 field_0x220; + /* 0x224 */ short field_0x224; + /* 0x226 */ u16 field_0x226; + /* 0x228 */ u16 field_0x228; + /* 0x22A */ s8 field_0x22a; + /* 0x22B */ char field_0x22b; + /* 0x22C */ short field_0x22c; + /* 0x22E */ short field_0x22e; + /* 0x230 */ char field_0x230; + /* 0x231 */ char field_0x231; + /* 0x232 */ char field_0x232; + /* 0x233 */ char field_0x233; + /* 0x234 */ u16 field_0x234[6]; + /* 0x240 */ u8 field_0x240[0x08]; // TLinkListNode }; struct JASDefaultBankTable : public JASGlobalInstance { diff --git a/libs/JSystem/JAudio2/JAISe.cpp b/libs/JSystem/JAudio2/JAISe.cpp index 41e97ec9ea0..40d46c30846 100644 --- a/libs/JSystem/JAudio2/JAISe.cpp +++ b/libs/JSystem/JAudio2/JAISe.cpp @@ -3,7 +3,12 @@ // Translation Unit: JAISe // -#include "JSystem/JAudio2/JAISe.h" +//#include "JSystem/JAudio2/JAISe.h" +#include "JSystem/JAudio2/JAIAudience.h" +//#include "JSystem/JAudio2/JAISeMgr.h" +#include "JSystem/JAudio2/JAISound.h" +#include "JSystem/JAudio2/JASTrack.h" +#include "JSystem/JSupport/JSUList.h" #include "dol2asm.h" #include "dolphin/types.h" @@ -11,58 +16,6 @@ // Types: // -struct JSUPtrLink { - /* 802DBDFC */ JSUPtrLink(void*); -}; - -struct JGeometry { - template - struct TVec3 {}; - /* TVec3 */ - struct TVec3__template0 {}; -}; - -struct JASSoundParams {}; - -struct JASTrack { - /* 80291228 */ JASTrack(); - /* 80291444 */ void setChannelMgrCount(u32); - /* 802915D4 */ void init(); - /* 802919F4 */ void assignExtBuffer(u32, JASSoundParams*); - /* 80291A08 */ void setSeqData(void*, u32); - /* 80291A28 */ void startSeq(); - /* 80291A78 */ void stopSeq(); - /* 802927A0 */ void mute(bool); - /* 80292A3C */ void pause(bool); - /* 80292B8C */ void setTempoRate(f32); -}; - -template -struct JAISoundStrategyMgr {}; -/* JAISoundStrategyMgr */ -struct JAISoundStrategyMgr__template0 {}; - -struct JAISoundParams { - /* 802A2280 */ void mixOutAll(JASSoundParams const&, JASSoundParams*, f32); -}; - -struct JAISoundID {}; - -struct JAISoundActivity {}; - -struct JAIAudience {}; - -struct JAISound { - /* 802A22F8 */ JAISound(); - /* 802A2328 */ void start_JAISound_(JAISoundID, JGeometry::TVec3 const*, JAIAudience*); - /* 802A25E0 */ bool asSeq(); - /* 802A25E8 */ bool asStream(); - /* 802A25F0 */ void die_JAISound_(); - /* 802A266C */ void increasePrepareCount_JAISound_(); - /* 802A26B8 */ void calc_JAISound_(); - /* 802A29DC */ void initTrack_JAISound_(JASTrack*); -}; - struct JAISeMgr {}; struct JAISe { @@ -72,17 +25,17 @@ struct JAISe { /* 8029F250 */ void startTrack_(JASSoundParams const&); /* 8029F304 */ void JAISeCategoryMgr_mixOut_(bool, JASSoundParams const&, JAISoundActivity); /* 8029F4CC */ void JAISeCategoryMgr_calc_(); - /* 8029F5C8 */ void JAISound_tryDie_(); + /* 8029F5C8 */ bool JAISound_tryDie_(); /* 8029F650 */ void JAISeMgr_startID_(JAISoundID, JGeometry::TVec3 const*, JAIAudience*); /* 8029F6D8 */ bool getNumChild() const; /* 8029F6E0 */ bool getChild(int); /* 8029F6E8 */ void releaseChild(int); - /* 8029F6EC */ void prepare_getSeqData_(); + /* 8029F6EC */ bool prepare_getSeqData_(); /* 8029F78C */ void prepare_(); - /* 8029F84C */ void getTrack(); - /* 8029F854 */ void getChildTrack(int); - /* 8029F864 */ void asSe(); - /* 8029F868 */ void getTempoMgr(); + /* 8029F84C */ JASTrack* getTrack(); + /* 8029F854 */ JASTrack* getChildTrack(int); + /* 8029F864 */ JAISe* asSe(); + /* 8029F868 */ JAITempoMgr* getTempoMgr(); }; // @@ -191,6 +144,14 @@ SECTION_SDATA2 static f32 lit_628 = 0.5f; /* 8029F03C-8029F0F8 29997C 00BC+00 0/0 1/1 0/0 .text * __ct__5JAISeFP8JAISeMgrP27JAISoundStrategyMgr<5JAISe>Ul */ +// multiple inheritance thunks +#ifdef NONMATCHING +JAISe::JAISe(JAISeMgr* param_0, JAISoundStrategyMgr* param_1, u32 param_2) : JSULink(this) { + inner_.mSoundStrategyMgr = param_1; + inner_.seMgr = param_0; + inner_.mProperPriority = param_2; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -199,9 +160,29 @@ asm JAISe::JAISe(JAISeMgr* param_0, JAISoundStrategyMgr* param_1, u32 par #include "asm/JSystem/JAudio2/JAISe/func_8029F03C.s" } #pragma pop +#endif /* 8029F0F8-8029F214 299A38 011C+00 1/1 0/0 0/0 .text mixOut___5JAISeFRC14JASSoundParams */ +// multiple inheritance thunks +#ifdef NONMATCHING +void JAISe::mixOut_(JASSoundParams const& param_0) { + inner_.track.setTempoRate(inner_.mTempoMgr.getTempo()); + JASSoundParams stackParams; + params.mixOutAll(param_0, &stackParams, fader.getIntensity()); + if (inner_.field_0x278) { + inner_.field_0x278->virtual4(this, stackParams); + } + if (audible_) { + int maxChannels = audience_->getMaxChannels(); + for (int i = 0; i < maxChannels; i++) { + audience_->mixChannelOut(stackParams, audible_, i); + } + } else { + inner_.mSoundParams = stackParams; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -210,8 +191,23 @@ asm void JAISe::mixOut_(JASSoundParams const& param_0) { #include "asm/JSystem/JAudio2/JAISe/mixOut___5JAISeFRC14JASSoundParams.s" } #pragma pop +#endif /* 8029F214-8029F250 299B54 003C+00 1/1 0/0 0/0 .text stopTrack___5JAISeFv */ +// multiple inheritance thunks +#ifdef NONMATCHING +void JAISe::stopTrack_() { + switch (inner_.track.getStatus()) { + case 0: + break; + case 1: + inner_.track.stopSeq(); + break; + case 2: + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -220,8 +216,27 @@ asm void JAISe::stopTrack_() { #include "asm/JSystem/JAudio2/JAISe/stopTrack___5JAISeFv.s" } #pragma pop +#endif /* 8029F250-8029F304 299B90 00B4+00 1/1 0/0 0/0 .text startTrack___5JAISeFRC14JASSoundParams */ +// multiple inheritance thunks +#ifdef NONMATCHING +void JAISe::startTrack_(JASSoundParams const& param_0) { + if (inner_.track.getStatus() == 2) { + inner_.track.init(); + } + if (audible_) { + initTrack_JAISound_(&inner_.track); + } else { + params.mixOutAll(param_0, &inner_.mSoundParams, fader.getIntensity()); + inner_.track.setChannelMgrCount(1); + inner_.track.assignExtBuffer(0, &inner_.mSoundParams); + } + inner_.field_0x26c = 1; + inner_.track.setSeqData(inner_.mSeqData.field_0x0, inner_.mSeqData.field_0x4); + inner_.track.startSeq(); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -230,6 +245,7 @@ asm void JAISe::startTrack_(JASSoundParams const& param_0) { #include "asm/JSystem/JAudio2/JAISe/startTrack___5JAISeFRC14JASSoundParams.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80455784-80455788 003D84 0004+00 2/2 0/0 0/0 .sdata2 @736 */ @@ -237,6 +253,43 @@ SECTION_SDATA2 static f32 lit_736 = 1.0f / 100.0f; /* 8029F304-8029F4CC 299C44 01C8+00 0/0 1/1 0/0 .text * JAISeCategoryMgr_mixOut___5JAISeFbRC14JASSoundParams16JAISoundActivity */ +// isStopping inline +#ifdef NONMATCHING +void JAISe::JAISeCategoryMgr_mixOut_(bool param_0, JASSoundParams const& param_1, JAISoundActivity param_2) { + mixOut_(param_1); + if (isStopping()) { + stopTrack_(); + } else if (param_0) { + if (status_.isPlaying()) { + if (inner_.field_0x26c) { + switch (inner_.track.getStatus()) { + case 2: + if (status_.field_0x1.flags.flag1) { + startTrack_(param_1); + } else { + stop_JAISound_(); + } + break; + case 1: + inner_.track.pause(status_.isPaused() || param_2.field_0x0.flags.flag2); + inner_.track.mute(status_.isMute() || param_2.field_0x0.flags.flag1); + } + } else { + startTrack_(param_1); + } + } + } else if (status_.field_0x1.flags.flag1) { + if (status_.field_0x1.flags.flag3) { + inner_.track.pause(true); + } else { + stopTrack_(); + } + } else { + stopTrack_(); + stop_JAISound_(); + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -246,8 +299,26 @@ asm void JAISe::JAISeCategoryMgr_mixOut_(bool param_0, JASSoundParams const& par #include "asm/JSystem/JAudio2/JAISe/JAISeCategoryMgr_mixOut___5JAISeFbRC14JASSoundParams16JAISoundActivity.s" } #pragma pop +#endif /* 8029F4CC-8029F5C8 299E0C 00FC+00 0/0 1/1 0/0 .text JAISeCategoryMgr_calc___5JAISeFv */ +// isStopping inline +#ifdef NONMATCHING +void JAISe::JAISeCategoryMgr_calc_() { + prepare_(); + if (calc_JAISound_()) { + inner_.mTempoMgr.calc(); + if (inner_.field_0x278) { + inner_.field_0x278->virtual3(this); + } + } + if (isStopping() || mPriority == -1) { + inner_.mPriority = -1; + } else { + inner_.mPriority = inner_.mProperPriority + mPriority; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -256,19 +327,51 @@ asm void JAISe::JAISeCategoryMgr_calc_() { #include "asm/JSystem/JAudio2/JAISe/JAISeCategoryMgr_calc___5JAISeFv.s" } #pragma pop +#endif /* 8029F5C8-8029F650 299F08 0088+00 2/1 0/0 0/0 .text JAISound_tryDie___5JAISeFv */ +// multiple inheritance thunks +#ifdef NONMATCHING +bool JAISe::JAISound_tryDie_() { + switch (inner_.track.getStatus()) { + case 0: + case 2: + if (inner_.field_0x278) { + inner_.mSoundStrategyMgr->virtual4(inner_.field_0x278); + inner_.field_0x278 = NULL; + } + die_JAISound_(); + return true; + case 1: + break; + } + return false; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JAISe::JAISound_tryDie_() { +asm bool JAISe::JAISound_tryDie_() { nofralloc #include "asm/JSystem/JAudio2/JAISe/JAISound_tryDie___5JAISeFv.s" } #pragma pop +#endif /* 8029F650-8029F6D8 299F90 0088+00 0/0 1/1 0/0 .text * JAISeMgr_startID___5JAISeF10JAISoundIDPCQ29JGeometry8TVec3P11JAIAudience */ +// multiple inheritance thunks +#ifdef NONMATCHING +void JAISe::JAISeMgr_startID_(JAISoundID param_0, JGeometry::TVec3 const* param_1, JAIAudience* param_2) { + start_JAISound_(param_0, param_1, param_2); + inner_.field_0x26c = 0; + if (inner_.mSoundStrategyMgr) { + inner_.field_0x278 = inner_.mSoundStrategyMgr->virtual3(param_0); + } else { + inner_.field_0x278 = NULL; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -278,6 +381,7 @@ asm void JAISe::JAISeMgr_startID_(JAISoundID param_0, JGeometry::TVec3 cons #include "asm/JSystem/JAudio2/JAISe/func_8029F650.s" } #pragma pop +#endif /* 8029F6D8-8029F6E0 29A018 0008+00 2/1 0/0 0/0 .text getNumChild__5JAISeCFv */ bool JAISe::getNumChild() const { @@ -295,16 +399,61 @@ void JAISe::releaseChild(int param_0) { } /* 8029F6EC-8029F78C 29A02C 00A0+00 1/1 0/0 0/0 .text prepare_getSeqData___5JAISeFv */ +// multiple inheritance thunks +#ifdef NONMATCHING +bool JAISe::prepare_getSeqData_() { + switch (inner_.seMgr->getSeqDataMgr()->getSeqData(soundID, &inner_.mSeqData)) { + case 0: + status_.state.unk = 2; + return false; + case 1: + increasePrepareCount_JAISound_(); + return false; + case 2: + return true; + } + return false; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JAISe::prepare_getSeqData_() { +asm bool JAISe::prepare_getSeqData_() { nofralloc #include "asm/JSystem/JAudio2/JAISe/prepare_getSeqData___5JAISeFv.s" } #pragma pop +#endif /* 8029F78C-8029F84C 29A0CC 00C0+00 1/1 0/0 0/0 .text prepare___5JAISeFv */ +// multiple inheritance thunks +#ifdef NONMATCHING +void JAISe::prepare_() { + switch (status_.state.unk) { + case 6: + break; + case 2: + stop_JAISound_(); + break; + case 0: + if (prepare_getSeqData_()) { + status_.state.unk = 5; + } + break; + case 1: + if (prepare_getSeqData_()) { + status_.state.unk = 3; + } + break; + case 4: + status_.state.unk = 5; + break; + case 3: + case 5: + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -313,41 +462,63 @@ asm void JAISe::prepare_() { #include "asm/JSystem/JAudio2/JAISe/prepare___5JAISeFv.s" } #pragma pop +#endif /* 8029F84C-8029F854 29A18C 0008+00 2/1 0/0 0/0 .text getTrack__5JAISeFv */ +// multiple inheritance thunks +#ifdef NONMATCHING +JASTrack* JAISe::getTrack() { + return &inner_.track; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JAISe::getTrack() { +asm JASTrack* JAISe::getTrack() { nofralloc #include "asm/JSystem/JAudio2/JAISe/getTrack__5JAISeFv.s" } #pragma pop +#endif /* 8029F854-8029F864 29A194 0010+00 2/1 0/0 0/0 .text getChildTrack__5JAISeFi */ +// multiple inheritance thunks +#ifdef NONMATCHING +JASTrack* JAISe::getChildTrack(int param_0) { + return inner_.track.getChild(param_0); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JAISe::getChildTrack(int param_0) { +asm JASTrack* JAISe::getChildTrack(int param_0) { nofralloc #include "asm/JSystem/JAudio2/JAISe/getChildTrack__5JAISeFi.s" } #pragma pop +#endif /* 8029F864-8029F868 29A1A4 0004+00 2/1 0/0 0/0 .text asSe__5JAISeFv */ -void JAISe::asSe() { - /* empty function */ +JAISe* JAISe::asSe() { + return this; } /* 8029F868-8029F870 29A1A8 0008+00 2/1 0/0 0/0 .text getTempoMgr__5JAISeFv */ +// multiple inheritance thunks +#ifdef NONMATCHING +JAITempoMgr* JAISe::getTempoMgr() { + return &inner_.mTempoMgr; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JAISe::getTempoMgr() { +asm JAITempoMgr* JAISe::getTempoMgr() { nofralloc #include "asm/JSystem/JAudio2/JAISe/getTempoMgr__5JAISeFv.s" } #pragma pop +#endif /* 8029F870-8029F878 29A1B0 0008+00 1/0 0/0 0/0 .text @16@JAISound_tryDie___5JAISeFv */ #pragma push diff --git a/libs/JSystem/JAudio2/JAISeq.cpp b/libs/JSystem/JAudio2/JAISeq.cpp index 207358d2c79..a6986d8f599 100644 --- a/libs/JSystem/JAudio2/JAISeq.cpp +++ b/libs/JSystem/JAudio2/JAISeq.cpp @@ -11,33 +11,6 @@ // Types: // -struct JSUPtrLink { - /* 802DBDFC */ JSUPtrLink(void*); -}; - -struct JGeometry { - template - struct TVec3 {}; - /* TVec3 */ - struct TVec3__template0 {}; -}; - -struct JASSoundParams {}; - -struct JASTrack { - /* 80291228 */ JASTrack(); - /* 8029131C */ ~JASTrack(); - /* 80291444 */ void setChannelMgrCount(u32); - /* 802919F4 */ void assignExtBuffer(u32, JASSoundParams*); - /* 80291A08 */ void setSeqData(void*, u32); - /* 80291A28 */ void startSeq(); - /* 80291A78 */ void stopSeq(); - /* 80291B8C */ void connectChild(u32, JASTrack*); - /* 802927A0 */ void mute(bool); - /* 80292A3C */ void pause(bool); - /* 80292B8C */ void setTempoRate(f32); -}; - template struct JASMemPool_MultiThreaded {}; /* JASMemPool_MultiThreaded */ @@ -59,38 +32,14 @@ struct JASGenericMemPool { /* 80290994 */ void free(void*, u32); }; -template -struct JAISoundStrategyMgr {}; -/* JAISoundStrategyMgr */ -struct JAISoundStrategyMgr__template1 {}; - -struct JAISoundParams { - /* 802A2280 */ void mixOutAll(JASSoundParams const&, JASSoundParams*, f32); -}; - -struct JAISoundID {}; - struct JAISoundChild { /* 802A2AB0 */ void init(); /* 802A2B28 */ void mixOut(JASTrack*); /* 802A2B7C */ void calc(); }; -struct JAISoundActivity {}; - struct JAIAudience {}; -struct JAISound { - /* 802A22F8 */ JAISound(); - /* 802A2328 */ void start_JAISound_(JAISoundID, JGeometry::TVec3 const*, JAIAudience*); - /* 802A25D8 */ bool asSe(); - /* 802A25E8 */ bool asStream(); - /* 802A25F0 */ void die_JAISound_(); - /* 802A266C */ void increasePrepareCount_JAISound_(); - /* 802A26B8 */ void calc_JAISound_(); - /* 802A29DC */ void initTrack_JAISound_(JASTrack*); -}; - struct JAISeqMgr {}; struct JAISeq { @@ -110,10 +59,10 @@ struct JAISeq { /* 802A1570 */ s32 getNumChild() const; /* 802A1578 */ void getChild(int); /* 802A165C */ void releaseChild(int); - /* 802A1728 */ void getTrack(); - /* 802A1730 */ void getChildTrack(int); - /* 802A1768 */ void asSeq(); - /* 802A176C */ void getTempoMgr(); + /* 802A1728 */ JASTrack* getTrack(); + /* 802A1730 */ JASTrack* getChildTrack(int); + /* 802A1768 */ JAISeq* asSeq(); + /* 802A176C */ JAITempoMgr* getTempoMgr(); }; // @@ -435,7 +384,7 @@ asm void JAISeq::releaseChild(int param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JAISeq::getTrack() { +asm JASTrack* JAISeq::getTrack() { nofralloc #include "asm/JSystem/JAudio2/JAISeq/getTrack__6JAISeqFv.s" } @@ -445,22 +394,22 @@ asm void JAISeq::getTrack() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JAISeq::getChildTrack(int param_0) { +asm JASTrack* JAISeq::getChildTrack(int param_0) { nofralloc #include "asm/JSystem/JAudio2/JAISeq/getChildTrack__6JAISeqFi.s" } #pragma pop /* 802A1768-802A176C 29C0A8 0004+00 1/0 0/0 0/0 .text asSeq__6JAISeqFv */ -void JAISeq::asSeq() { - /* empty function */ +JAISeq* JAISeq::asSeq() { + return this; } /* 802A176C-802A1774 29C0AC 0008+00 1/0 0/0 0/0 .text getTempoMgr__6JAISeqFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void JAISeq::getTempoMgr() { +asm JAITempoMgr* JAISeq::getTempoMgr() { nofralloc #include "asm/JSystem/JAudio2/JAISeq/getTempoMgr__6JAISeqFv.s" } diff --git a/libs/JSystem/JAudio2/JAISound.cpp b/libs/JSystem/JAudio2/JAISound.cpp index 2d6b1fc82d2..c9848856259 100644 --- a/libs/JSystem/JAudio2/JAISound.cpp +++ b/libs/JSystem/JAudio2/JAISound.cpp @@ -253,18 +253,18 @@ void JAISound::stop() { } /* 802A25D8-802A25E0 29CF18 0008+00 1/0 2/0 0/0 .text asSe__8JAISoundFv */ -bool JAISound::asSe() { - return false; +JAISe* JAISound::asSe() { + return NULL; } /* 802A25E0-802A25E8 29CF20 0008+00 1/0 2/0 0/0 .text asSeq__8JAISoundFv */ -bool JAISound::asSeq() { - return false; +JAISeq* JAISound::asSeq() { + return NULL; } /* 802A25E8-802A25F0 29CF28 0008+00 1/0 2/0 0/0 .text asStream__8JAISoundFv */ -bool JAISound::asStream() { - return false; +JAIStream* JAISound::asStream() { + return NULL; } /* 802A25F0-802A266C 29CF30 007C+00 0/0 3/3 0/0 .text die_JAISound___8JAISoundFv */ diff --git a/libs/JSystem/JAudio2/JAIStream.cpp b/libs/JSystem/JAudio2/JAIStream.cpp index 9319b66b1dc..6a902295b39 100644 --- a/libs/JSystem/JAudio2/JAIStream.cpp +++ b/libs/JSystem/JAudio2/JAIStream.cpp @@ -11,26 +11,6 @@ // Types: // -struct JSUPtrLink { - /* 802DBDFC */ JSUPtrLink(void*); -}; - -struct JGeometry { - template - struct TVec3 {}; - /* TVec3 */ - struct TVec3__template0 {}; -}; - -struct JASSoundParams {}; - -template -struct JASMemPool {}; -/* JASMemPool */ -struct JASMemPool__template1 { - /* 802A1268 */ void func_802A1268(void* _this); -}; - struct JASGenericMemPool { /* 80290848 */ JASGenericMemPool(); /* 80290948 */ void alloc(u32); @@ -49,17 +29,8 @@ struct JASAramStream { struct JAIStreamMgr {}; -struct JAISoundActivity {}; - -template -struct JAISoundStrategyMgr {}; -/* JAISoundStrategyMgr */ -struct JAISoundStrategyMgr__template2 {}; - struct JAIAudience {}; -struct JAISoundID {}; - struct JAIStream { /* 802A3104 */ JAIStream(JAIStreamMgr*, JAISoundStrategyMgr*); /* 802A319C */ void JAIStreamMgr_startID_(JAISoundID, s32, JGeometry::TVec3 const*, @@ -74,14 +45,10 @@ struct JAIStream { /* 802A3948 */ s32 getNumChild() const; /* 802A3950 */ void getChild(int); /* 802A3A24 */ void releaseChild(int); - /* 802A3ABC */ bool getTrack(); - /* 802A3AC4 */ bool getChildTrack(int); - /* 802A3ACC */ void asStream(); - /* 802A3AD0 */ bool getTempoMgr(); -}; - -struct JAISoundParams { - /* 802A2280 */ void mixOutAll(JASSoundParams const&, JASSoundParams*, f32); + /* 802A3ABC */ JASTrack* getTrack(); + /* 802A3AC4 */ JASTrack* getChildTrack(int); + /* 802A3ACC */ JAIStream* asStream(); + /* 802A3AD0 */ JAITempoMgr* getTempoMgr(); }; struct JAISoundChild { @@ -89,16 +56,6 @@ struct JAISoundChild { /* 802A2B7C */ void calc(); }; -struct JAISound { - /* 802A22F8 */ JAISound(); - /* 802A2328 */ void start_JAISound_(JAISoundID, JGeometry::TVec3 const*, JAIAudience*); - /* 802A25D8 */ bool asSe(); - /* 802A25E0 */ bool asSeq(); - /* 802A25F0 */ void die_JAISound_(); - /* 802A266C */ void increasePrepareCount_JAISound_(); - /* 802A26B8 */ void calc_JAISound_(); -}; - // // Forward References: // @@ -333,21 +290,21 @@ asm void JAIStream::releaseChild(int param_0) { #pragma pop /* 802A3ABC-802A3AC4 29E3FC 0008+00 1/0 0/0 0/0 .text getTrack__9JAIStreamFv */ -bool JAIStream::getTrack() { - return false; +JASTrack* JAIStream::getTrack() { + return NULL; } /* 802A3AC4-802A3ACC 29E404 0008+00 1/0 0/0 0/0 .text getChildTrack__9JAIStreamFi */ -bool JAIStream::getChildTrack(int param_0) { - return false; +JASTrack* JAIStream::getChildTrack(int param_0) { + return NULL; } /* 802A3ACC-802A3AD0 29E40C 0004+00 1/0 0/0 0/0 .text asStream__9JAIStreamFv */ -void JAIStream::asStream() { - /* empty function */ +JAIStream* JAIStream::asStream() { + return this; } /* 802A3AD0-802A3AD8 29E410 0008+00 1/0 0/0 0/0 .text getTempoMgr__9JAIStreamFv */ -bool JAIStream::getTempoMgr() { - return false; +JAITempoMgr* JAIStream::getTempoMgr() { + return NULL; }