summaryrefslogtreecommitdiff
path: root/include/JSystem
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2025-11-27 21:19:33 -0800
committerGitHub <noreply@github.com>2025-11-27 21:19:33 -0800
commit6f96e665186c87f15acb6f5cb8d27665afee3130 (patch)
tree3ea70fe7d635a0f55aae44b1a386814766a46597 /include/JSystem
parent767caeecc3e374779cccc9960b6546b74e7a9e50 (diff)
various Z2Audio / JAudio debug cleanup (#2876)
* some JAudio work * audio cleanup checkpoint * checkpoint more audio cleanup * fix symbols * more z2 cleanup * fix regression * fix build * some fixes
Diffstat (limited to 'include/JSystem')
-rw-r--r--include/JSystem/JAudio2/JAISe.h12
-rw-r--r--include/JSystem/JAudio2/JAISeMgr.h66
-rw-r--r--include/JSystem/JAudio2/JAISeq.h24
-rw-r--r--include/JSystem/JAudio2/JAISeqDataMgr.h6
-rw-r--r--include/JSystem/JAudio2/JAISeqMgr.h29
-rw-r--r--include/JSystem/JAudio2/JAISound.h193
-rw-r--r--include/JSystem/JAudio2/JAISoundHandles.h21
-rw-r--r--include/JSystem/JAudio2/JAISoundParams.h103
-rw-r--r--include/JSystem/JAudio2/JAISoundStarter.h6
-rw-r--r--include/JSystem/JAudio2/JAIStream.h29
-rw-r--r--include/JSystem/JAudio2/JAIStreamMgr.h24
-rw-r--r--include/JSystem/JAudio2/JASCalc.h12
-rw-r--r--include/JSystem/JAudio2/JASCallback.h25
-rw-r--r--include/JSystem/JAudio2/JASDriverIF.h4
-rw-r--r--include/JSystem/JAudio2/JASDvdThread.h2
-rw-r--r--include/JSystem/JAudio2/JASGadget.h4
-rw-r--r--include/JSystem/JAudio2/JASHeapCtrl.h12
-rw-r--r--include/JSystem/JAudio2/JASTaskThread.h22
-rw-r--r--include/JSystem/JAudio2/JASTrack.h11
-rw-r--r--include/JSystem/JAudio2/JASWaveArcLoader.h2
-rw-r--r--include/JSystem/JAudio2/JAUAudibleParam.h3
-rw-r--r--include/JSystem/JAudio2/JAUAudioArcInterpreter.h2
-rw-r--r--include/JSystem/JAudio2/JAUInitializer.h24
-rw-r--r--include/JSystem/JAudio2/JAUSectionHeap.h4
-rw-r--r--include/JSystem/JAudio2/JAUSeqCollection.h2
-rw-r--r--include/JSystem/JAudio2/JAUSoundTable.h3
-rw-r--r--include/JSystem/JGeometry.h19
-rw-r--r--include/JSystem/JKernel/JKRThread.h1
-rw-r--r--include/JSystem/JMath/JMath.h4
-rw-r--r--include/JSystem/JSupport/JSUList.h8
-rw-r--r--include/JSystem/TPosition3.h12
31 files changed, 373 insertions, 316 deletions
diff --git a/include/JSystem/JAudio2/JAISe.h b/include/JSystem/JAudio2/JAISe.h
index e34cd71c45..6accefb8fc 100644
--- a/include/JSystem/JAudio2/JAISe.h
+++ b/include/JSystem/JAudio2/JAISe.h
@@ -37,17 +37,17 @@ public:
/* 8029F868 */ virtual JAITempoMgr* getTempoMgr();
/* 8029F5C8 */ virtual bool JAISound_tryDie_();
- /* 8029F03C */ JAISe(JAISeMgr*, JAISoundStrategyMgr<JAISe>*, u32);
- /* 8029F0F8 */ void mixOut_(JASSoundParams const&);
+ /* 8029F03C */ JAISe(JAISeMgr* seMgr, JAISoundStrategyMgr<JAISe>* soundStrategyMgr, u32 priority);
+ /* 8029F0F8 */ void mixOut_(const JASSoundParams& params);
/* 8029F214 */ void stopTrack_();
- /* 8029F250 */ void startTrack_(JASSoundParams const&);
- /* 8029F304 */ void JAISeCategoryMgr_mixOut_(bool, JASSoundParams const&, JAISoundActivity);
+ /* 8029F250 */ void startTrack_(const JASSoundParams& params);
+ /* 8029F304 */ void JAISeCategoryMgr_mixOut_(bool, const JASSoundParams& params, JAISoundActivity activity);
/* 8029F4CC */ void JAISeCategoryMgr_calc_();
- /* 8029F650 */ void JAISeMgr_startID_(JAISoundID, JGeometry::TVec3<f32> const*, JAIAudience*);
+ /* 8029F650 */ void JAISeMgr_startID_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience);
/* 8029F6EC */ bool prepare_getSeqData_();
/* 8029F78C */ void prepare_();
- JAISeqData* getSeqData() { return &inner_.mSeqData; }
+ const JAISeqData* getSeqData() const { return &inner_.mSeqData; }
u32 JAISeCategoryMgr_getProperPriority_() const { return inner_.mProperPriority; }
u32 JAISeCategoryMgr_getPriority_() const { return inner_.mPriority; }
bool isFarAway() const { return inner_.mPriority == -1; }
diff --git a/include/JSystem/JAudio2/JAISeMgr.h b/include/JSystem/JAudio2/JAISeMgr.h
index 37e530c925..733d7ee66c 100644
--- a/include/JSystem/JAudio2/JAISeMgr.h
+++ b/include/JSystem/JAudio2/JAISeMgr.h
@@ -12,6 +12,8 @@ struct JASSoundParams;
*
*/
struct JASNonCopyable {
+ JASNonCopyable() {}
+
/* 0x0 */ int field_0x0;
}; // Size: 0x4
@@ -38,40 +40,43 @@ class JAISeMgr;
* @ingroup jsystem-jaudio
*
*/
-class JAISeCategoryMgr : public JAISeqDataUser {
+class JAISeCategoryMgr : public JAISeqDataUser, public JASNonCopyable {
public:
/* 8029F9C4 */ void JAISeMgr_calc_();
/* 8029FB30 */ void JAISeMgr_freeDeadSe_();
- /* 8029FC88 */ bool JAISeMgr_acceptsNewSe_(u32) const;
+ /* 8029FC88 */ bool JAISeMgr_acceptsNewSe_(u32 priority) const;
/* 8029FD40 */ void sortByPriority_();
- /* 8029FDE0 */ void stop(u32);
+ /* 8029FDE0 */ void stop(u32 fadeTime);
/* 8029FE34 */ void stop();
- /* 8029FE78 */ void stopSoundID(JAISoundID);
+ /* 8029FE78 */ void stopSoundID(JAISoundID id);
/* 8029FEEC */ void pause(bool);
- /* 8029FF18 */ void JAISeMgr_mixOut_(JAISoundParamsMove const&, JAISoundActivity);
+ /* 8029FF18 */ void JAISeMgr_mixOut_(const JAISoundParamsMove& params, JAISoundActivity activity);
/* 802A0994 */ JAISeCategoryMgr() {
mParams.init();
mMaxActiveSe = 0;
mMaxInactiveSe = 0;
- field_0x4.field_0x0 = 0;
+ field_0x0 = 0;
}
- /* 8029F8B0 */ virtual bool isUsingSeqData(JAISeqDataRegion const&);
- /* 8029F91C */ virtual int releaseSeqData(JAISeqDataRegion const&);
+ /* 8029F8B0 */ virtual bool isUsingSeqData(const JAISeqDataRegion& seqDataRegion);
+ /* 8029F91C */ virtual int releaseSeqData(const JAISeqDataRegion& seqDataRegion);
JAISoundParamsMove* getParams() { return &mParams; }
int getMaxSe() const {
- return (mMaxActiveSe == 0) ? 0 : mMaxActiveSe + mMaxInactiveSe;
+ if (mMaxActiveSe == 0) {
+ return 0;
+ }
+
+ return mMaxActiveSe + mMaxInactiveSe;
}
int getMaxActiveSe() const { return mMaxActiveSe; }
- void setMaxActiveSe(int se) { mMaxActiveSe = se; }
- void setMaxInactiveSe(int se) { mMaxInactiveSe = se; }
- JSUList<JAISe>* getSeList() { return &mSeList; }
+ void setMaxActiveSe(int num) { mMaxActiveSe = num; }
+ void setMaxInactiveSe(int num) { mMaxInactiveSe = num; }
+ const JSUList<JAISe>* getSeList() const { return &mSeList; }
int getNumSe() const { return mSeList.getNumLinks(); }
- JAIAudience* getAudience() { return (JAIAudience*)field_0x4.field_0x0; }
+ JAIAudience* getAudience() { return (JAIAudience*)field_0x0; }
void JAISeMgr_appendSe_(JAISe* se) { mSeList.append(se); }
- /* 0x04 */ JASNonCopyable field_0x4;
/* 0x08 */ JAISoundParamsMove mParams;
/* 0x58 */ JSUList<JAISe> mSeList;
/* 0x64 */ int mMaxInactiveSe;
@@ -86,27 +91,28 @@ class JAISeMgr : public JASGlobalInstance<JAISeMgr>,
public JAISeqDataUser,
public JAISoundActivity {
public:
- /* 802A0074 */ JAISeMgr(bool);
- /* 802A0268 */ void setCategoryArrangement(JAISeCategoryArrangement const&);
+ /* 802A0074 */ JAISeMgr(bool setInstance);
+ /* 802A0268 */ void setCategoryArrangement(const JAISeCategoryArrangement& arrangement);
/* 802A02A0 */ void stop();
- /* 802A02F4 */ void stopSoundID(JAISoundID);
+ /* 802A02F4 */ void stopSoundID(JAISoundID id);
/* 802A0358 */ void initParams();
- /* 802A03D8 */ void setAudience(JAIAudience*);
- /* 802A03E0 */ void setSeqDataMgr(JAISeqDataMgr*);
+ /* 802A03D8 */ void setAudience(JAIAudience* audience);
+ /* 802A03E0 */ void setSeqDataMgr(JAISeqDataMgr* seqDataMgr);
/* 802A0434 */ void resetSeqDataMgr();
- /* 802A0484 */ JAISe* newSe_(int, u32);
+ /* 802A0484 */ JAISe* newSe_(int category, u32 priority);
/* 802A0574 */ void calc();
/* 802A0704 */ void mixOut();
- /* 802A0768 */ bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
+ /* 802A0768 */ bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr);
/* 802A08D0 */ int getNumActiveSe() const;
- /* 802A0168 */ virtual bool isUsingSeqData(JAISeqDataRegion const&);
- /* 802A01D8 */ virtual int releaseSeqData(JAISeqDataRegion const&);
+ /* 802A0168 */ virtual bool isUsingSeqData(const JAISeqDataRegion& seqDataRegion);
+ /* 802A01D8 */ virtual int releaseSeqData(const JAISeqDataRegion& seqDataRegion);
- JAISeCategoryMgr* getCategory(int categoryIndex) { return &mCategoryMgrs[categoryIndex]; }
- JAIAudience* getAudience(int categoryIndex) {
- if (categoryIndex >= 0 && categoryIndex < 16) {
- JAIAudience* rv = mCategoryMgrs[categoryIndex].getAudience();
+ JAISeCategoryMgr* getCategory(int index) { return &mCategoryMgrs[index]; }
+ JAIAudience* getAudience() { return mAudience; }
+ JAIAudience* getAudience(int index) {
+ if (index >= 0 && index < NUM_CATEGORIES) {
+ JAIAudience* rv = mCategoryMgrs[index].getAudience();
if (rv) return rv;
}
return mAudience;
@@ -114,11 +120,15 @@ public:
JAISeqDataMgr* getSeqDataMgr() { return mSeqDataMgr; }
JAISoundParamsMove* getParams() { return &mParams; }
+ bool isActive() const { return getNumActiveSe() > 0; }
+
+ static const int NUM_CATEGORIES = 16;
+
private:
/* 0x008 */ JAIAudience* mAudience;
/* 0x00C */ JAISeqDataMgr* mSeqDataMgr;
/* 0x010 */ JAISoundStrategyMgr<JAISe>* mStrategyMgr;
- /* 0x014 */ JAISeCategoryMgr mCategoryMgrs[16];
+ /* 0x014 */ JAISeCategoryMgr mCategoryMgrs[NUM_CATEGORIES];
/* 0x6D4 */ JAISoundParamsMove mParams;
}; // Size: 0x724
diff --git a/include/JSystem/JAudio2/JAISeq.h b/include/JSystem/JAudio2/JAISeq.h
index 469212b890..b1f602b7aa 100644
--- a/include/JSystem/JAudio2/JAISeq.h
+++ b/include/JSystem/JAudio2/JAISeq.h
@@ -14,12 +14,14 @@ class JAISoundChild;
*/
class JAISeq : public JASPoolAllocObject<JAISeq>, public JAISound, public JSULink<JAISeq> {
public:
+ static const int NUM_CHILDREN = 32;
+
class TInner {
public:
TInner() : mSeqData(NULL, 0) {}
/* 0x000 */ JASTrack outputTrack;
- /* 0x248 */ JAISoundChild* mSoundChild[32];
+ /* 0x248 */ JAISoundChild* mSoundChild[NUM_CHILDREN];
/* 0x2C8 */ JAITempoMgr mTempoMgr;
/* 0x2D8 */ JASSoundParams mSoundParams;
/* 0x2EC */ JAISeqData mSeqData;
@@ -29,30 +31,30 @@ public:
};
/* 802A1570 */ virtual s32 getNumChild() const;
- /* 802A1578 */ virtual JAISoundChild* getChild(int);
- /* 802A165C */ virtual void releaseChild(int);
+ /* 802A1578 */ virtual JAISoundChild* getChild(int index);
+ /* 802A165C */ virtual void releaseChild(int index);
/* 802A1768 */ virtual JAISeq* asSeq();
/* 802A1728 */ virtual JASTrack* getTrack();
/* 802A1730 */ virtual JASTrack* getChildTrack(int);
/* 802A176C */ virtual JAITempoMgr* getTempoMgr();
/* 802A12BC */ virtual bool JAISound_tryDie_();
- /* 802A0A8C */ JAISeq(JAISeqMgr*, JAISoundStrategyMgr<JAISeq>*);
- /* 802A0B64 */ void JAISeqMgr_startID_(JAISoundID, JGeometry::TVec3<f32> const*, JAIAudience*,
- int, int);
- /* 802A0C04 */ void playSeqData_(JASSoundParams const&, JAISoundActivity);
+ /* 802A0A8C */ JAISeq(JAISeqMgr* seqMgr, JAISoundStrategyMgr<JAISeq>* soundStrategyMgr);
+ /* 802A0B64 */ void JAISeqMgr_startID_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience,
+ int category, int);
+ /* 802A0C04 */ void playSeqData_(const JASSoundParams& params, JAISoundActivity activity);
/* 802A0CA4 */ void reserveChildTracks_(int);
/* 802A0E48 */ void releaseChildTracks_();
/* 802A0EDC */ bool prepare_getSeqData_();
- /* 802A0F90 */ bool prepare_(JASSoundParams const&, JAISoundActivity);
+ /* 802A0F90 */ bool prepare_(const JASSoundParams& params, JAISoundActivity activity);
/* 802A108C */ void JAISeqMgr_calc_();
/* 802A1180 */ void die_();
- /* 802A1348 */ void mixOut_(JASSoundParams const&, JAISoundActivity);
- /* 802A14FC */ void JAISeqMgr_mixOut_(JASSoundParams const&, JAISoundActivity);
+ /* 802A1348 */ void mixOut_(const JASSoundParams& params, JAISoundActivity activity);
+ /* 802A14FC */ void JAISeqMgr_mixOut_(const JASSoundParams& params, JAISoundActivity activity);
JAISeqData& getSeqData() { return inner_.mSeqData; }
- /* 0x0a8 */ TInner inner_;
+ /* 0x0A8 */ TInner inner_;
/* 0x3A8 */ JAISoundStrategyMgr__unknown<JAISeq>* field_0x3a8;
};
diff --git a/include/JSystem/JAudio2/JAISeqDataMgr.h b/include/JSystem/JAudio2/JAISeqDataMgr.h
index d4118ffd94..bbedc12a18 100644
--- a/include/JSystem/JAudio2/JAISeqDataMgr.h
+++ b/include/JSystem/JAudio2/JAISeqDataMgr.h
@@ -9,8 +9,8 @@
*
*/
struct JAISeqData {
- JAISeqData(void* param_0, u32 param_1) {
- field_0x0 = param_0;
+ JAISeqData(const void* param_0, u32 param_1) {
+ field_0x0 = (void*)param_0;
field_0x4 = param_1;
}
@@ -28,7 +28,7 @@ struct JAISeqData {
*
*/
struct JAISeqDataRegion {
- bool intersects(JAISeqData& seqData) const {
+ bool intersects(const JAISeqData& seqData) const {
if ((uintptr_t)addr + size < (uintptr_t)seqData.field_0x0) {
return false;
}
diff --git a/include/JSystem/JAudio2/JAISeqMgr.h b/include/JSystem/JAudio2/JAISeqMgr.h
index 6d4a116e4e..1357d7806c 100644
--- a/include/JSystem/JAudio2/JAISeqMgr.h
+++ b/include/JSystem/JAudio2/JAISeqMgr.h
@@ -18,29 +18,33 @@ public:
RELEASE_SEQ_1 = 1,
RELEASE_SEQ_2 = 2,
};
- /* 802A1914 */ JAISeqMgr(bool);
+ /* 802A1914 */ JAISeqMgr(bool setInstance);
/* 802A1A08 */ void freeDeadSeq_();
- /* 802A1B48 */ bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
+ /* 802A1B48 */ bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr);
/* 802A1C90 */ void calc();
/* 802A1DFC */ void stop();
- /* 802A1E3C */ void stop(u32);
- /* 802A1E8C */ void stopSoundID(JAISoundID);
+ /* 802A1E3C */ void stop(u32 fadeTime);
+ /* 802A1E8C */ void stopSoundID(JAISoundID id);
/* 802A1EFC */ void mixOut();
/* 802A1F58 */ JAISeq* beginStartSeq_();
- /* 802A1FE8 */ bool endStartSeq_(JAISeq*, JAISoundHandle*);
+ /* 802A1FE8 */ bool endStartSeq_(JAISeq* seq, JAISoundHandle* handle);
/* 802A20F0 */ virtual ~JAISeqMgr() {}
- /* 802A1804 */ virtual bool isUsingSeqData(JAISeqDataRegion const&);
- /* 802A1870 */ virtual int releaseSeqData(JAISeqDataRegion const&);
+ /* 802A1804 */ virtual bool isUsingSeqData(const JAISeqDataRegion& seqDataRegion);
+ /* 802A1870 */ virtual int releaseSeqData(const JAISeqDataRegion& seqDataRegion);
+
+ void setAudience(JAIAudience* audience) { mAudience = audience; }
+ JAIAudience* getAudience() { return mAudience; }
- void setAudience(JAIAudience* param_0) { mAudience = param_0; }
JAISeqDataMgr* getSeqDataMgr() { return seqDataMgr_; }
- void setSeqDataMgr(JAISeqDataMgr* param_0) {
+
+ void setSeqDataMgr(JAISeqDataMgr* seqDataMgr) {
JUT_ASSERT(124, !isActive());
resetSeqDataMgr();
- seqDataMgr_ = param_0;
+ seqDataMgr_ = seqDataMgr;
seqDataMgr_->setSeqDataUser(this);
}
+
void resetSeqDataMgr() {
JUT_ASSERT(131, !isActive());
if (seqDataMgr_) {
@@ -48,10 +52,11 @@ public:
seqDataMgr_ = NULL;
}
}
+
JAISoundParamsMove* getParams() { return &mMove; }
- bool isActive() { return mSeqList.getNumLinks() != 0; }
+ bool isActive() const { return mSeqList.getNumLinks() != 0; }
int getNumActiveSeqs() const { return mSeqList.getNumLinks(); }
- void pause(bool i_pause) { mActivity.field_0x0.flags.flag2 = i_pause; }
+ void pause(bool paused) { mActivity.field_0x0.flags.flag2 = paused; }
private:
/* 0x04 */ JAISoundActivity mActivity;
diff --git a/include/JSystem/JAudio2/JAISound.h b/include/JSystem/JAudio2/JAISound.h
index 6e4c8ab597..10c1eee3a2 100644
--- a/include/JSystem/JAudio2/JAISound.h
+++ b/include/JSystem/JAudio2/JAISound.h
@@ -3,6 +3,7 @@
#include "JSystem/JAudio2/JAISoundParams.h"
#include "JSystem/JAudio2/JAIAudible.h"
+#include "JSystem/JUtility/JUTAssert.h"
#include "global.h"
/**
@@ -11,31 +12,30 @@
*/
class JAISoundID {
public:
- operator u32() const { return this->mId.mFullId; }
+ operator u32() const { return id_.composite_; }
- JAISoundID(u32 pId) { mId.mFullId = pId; };
+ JAISoundID(u32 id) { id_.composite_ = id; };
- JAISoundID(JAISoundID const& other) { mId.mFullId = other.mId.mFullId; };
+ JAISoundID(const JAISoundID& other) { id_.composite_ = other.id_.composite_; };
JAISoundID() {}
- bool isAnonymous() const { return mId.mFullId == 0xffffffff; }
- void setAnonymous() { mId.mFullId = -1; }
+ bool isAnonymous() const { return id_.composite_ == 0xFFFFFFFF; }
+ void setAnonymous() { id_.composite_ = 0xFFFFFFFF; }
union {
- u32 mFullId;
+ u32 composite_;
struct {
- u8 b0;
- u8 b1;
- u8 b2;
- u8 b3;
- } mBytes;
- struct {
- u16 mSoundType;
- u16 mShortId;
- } mAdvancedId; // Debug doesn't have an inline for referencing the short ID so I assume
- // it's similar to this
- } mId;
+ union {
+ u16 value;
+ struct {
+ u8 sectionID;
+ u8 groupID;
+ } parts;
+ } type;
+ u16 waveID;
+ } info;
+ } id_;
};
class JASTrack;
@@ -52,16 +52,16 @@ struct JAISoundStatus_ {
field_0x0.value = 0;
field_0x1.value = 0;
*((u16*)&state) = 0;
- user_data = 0;
+ userdata_ = 0;
}
- bool isAlive() { return state.unk != 6; }
- bool isDead() { return state.unk == 6;}
+ bool isAlive() const { return state.unk != 6; }
+ bool isDead() const { return state.unk == 6;}
- inline bool isPlaying() { return state.unk == 5; }
- bool isPrepared() { return state.unk >= 3; }
- inline bool isMute() { return field_0x0.flags.mute; }
- inline bool isPaused() { return field_0x0.flags.paused; }
+ bool isPlaying() const { return state.unk == 5; }
+ bool isPrepared() const { return state.unk >= 3; }
+ bool isMute() const { return field_0x0.flags.mute; }
+ bool isPaused() const { return field_0x0.flags.paused; }
void pauseWhenOut() {
field_0x1.flags.flag6 = 1;
}
@@ -96,7 +96,7 @@ struct JAISoundStatus_ {
u8 unk;
struct {
u8 flag1 : 1;
- u8 flag2 : 1;
+ u8 calcedOnce : 1;
u8 animationState : 2;
u8 flag5 : 1;
u8 flag6 : 1;
@@ -104,7 +104,7 @@ struct JAISoundStatus_ {
u8 flag8 : 1;
} flags;
} state;
- /* 0x4 */ u32 user_data;
+ /* 0x4 */ u32 userdata_;
}; // Size: 0x8
/**
@@ -113,38 +113,44 @@ struct JAISoundStatus_ {
*/
struct JAISoundFader {
void forceIn() {
- mIntensity = 1.0f;
+ value_ = 1.0f;
mTransition.zero();
}
+
void forceOut() {
- mIntensity = 0.0f;
+ value_ = 0.0f;
mTransition.zero();
}
- void fadeOut(u32 fadeCount) {
- if (fadeCount != 0) {
- mTransition.set(0.0f, mIntensity, fadeCount);
+
+ void fadeOut(u32 maxSteps) {
+ if (maxSteps != 0) {
+ mTransition.set(0.0f, value_, maxSteps);
} else {
forceOut();
}
}
- void fadeIn(u32 param_1) {
- if (param_1 != 0) {
- mTransition.set(1.0f, mIntensity, param_1);
+
+ void fadeIn(u32 maxSteps) {
+ if (maxSteps != 0) {
+ mTransition.set(1.0f, value_, maxSteps);
} else {
forceIn();
}
}
- void fadeInFromOut(u32 param_1) {
- mIntensity = 0.0f;
- fadeIn(param_1);
+
+ void fadeInFromOut(u32 maxSteps) {
+ value_ = 0.0f;
+ fadeIn(maxSteps);
}
- bool isOut() {
- return (mTransition.mCount == 0 && mIntensity < 0.01f);
+
+ bool isOut() const {
+ return (mTransition.remainingSteps_ == 0 && value_ < 0.01f);
}
- inline void calc() { mIntensity = mTransition.apply(mIntensity); }
- f32 getIntensity() { return mIntensity; }
- /* 0x00 */ f32 mIntensity;
+ void calc() { value_ = mTransition.apply(value_); }
+ f32 getIntensity() const { return value_; }
+
+ /* 0x00 */ f32 value_;
/* 0x04 */ JAISoundParamsTransition::TTransition mTransition;
}; // Size: 0x10
@@ -169,12 +175,6 @@ struct JAISoundStrategyMgr {
virtual JAISoundStrategyMgr__unknown<A0>* calc(JAISoundID);
virtual void virtual4(JAISoundStrategyMgr__unknown<A0>*);
};
-/* JAISoundStrategyMgr<JAISe> */
-struct JAISoundStrategyMgr__template0 {};
-/* JAISoundStrategyMgr<JAISeq> */
-struct JAISoundStrategyMgr__template1 {};
-/* JAISoundStrategyMgr<JAIStream> */
-struct JAISoundStrategyMgr__template2 {};
/**
* @ingroup jsystem-jaudio
@@ -205,17 +205,17 @@ public:
*/
class JAITempoMgr {
public:
- /* 0x00 */ f32 mTempo;
- /* 0x04 */ JAISoundParamsTransition::TTransition field_0x4;
+ /* 0x00 */ f32 tempo_;
+ /* 0x04 */ JAISoundParamsTransition::TTransition transition_;
JAITempoMgr() { init(); }
void init() { setTempo(1.0f); }
- void setTempo(f32 param_0) {
- mTempo = param_0;
- field_0x4.zero();
+ void setTempo(f32 tempo) {
+ tempo_ = tempo;
+ transition_.zero();
}
- f32 getTempo() { return mTempo; }
- void calc() { mTempo = field_0x4.apply(mTempo); }
+ f32 getTempo() const { return tempo_; }
+ void calc() { tempo_ = transition_.apply(tempo_); }
};
class JAISoundHandle;
@@ -234,18 +234,18 @@ class JAITempoMgr;
class JAISound {
public:
/* 802A21A0 */ void releaseHandle();
- /* 802A21BC */ void attachHandle(JAISoundHandle*);
+ /* 802A21BC */ void attachHandle(JAISoundHandle* handle);
/* 802A22F8 */ JAISound();
- /* 802A2328 */ void start_JAISound_(JAISoundID, JGeometry::TVec3<f32> const*, JAIAudience*);
+ /* 802A2328 */ void start_JAISound_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience);
/* 802A244C */ bool acceptsNewAudible() const;
- /* 802A2474 */ void newAudible(JGeometry::TVec3<f32> const&, JGeometry::TVec3<f32> const*, u32,
+ /* 802A2474 */ void newAudible(const JGeometry::TVec3<f32>&, JGeometry::TVec3<f32> const*, u32,
JAIAudience*);
/* 802A2598 */ void stop();
- /* 802A24DC */ void stop(u32 fadeout);
+ /* 802A24DC */ void stop(u32 fadeTime);
/* 802A25F0 */ void die_JAISound_();
/* 802A266C */ void increasePrepareCount_JAISound_();
/* 802A26B8 */ bool calc_JAISound_();
- /* 802A29DC */ void initTrack_JAISound_(JASTrack*);
+ /* 802A29DC */ void initTrack_JAISound_(JASTrack* track);
virtual s32 getNumChild() const = 0;
virtual JAISoundChild* getChild(int) = 0;
@@ -258,19 +258,24 @@ public:
virtual JAITempoMgr* getTempoMgr() = 0;
virtual bool JAISound_tryDie_() = 0;
- JAISoundID getID() const { return soundID; }
- u8 getAnimationState() const { return status_.state.flags.animationState; }
+ JAISoundID getID() const { return soundID_; }
+ u32 getAnimationState() const { return status_.state.flags.animationState; }
bool isAnimated() const { return getAnimationState() != 0; }
- void setAnimationState(u8 pState) {
- status_.state.flags.animationState = pState;
+ void setAnimationState(u32 state) {
+ status_.state.flags.animationState = state;
}
- u32 getUserData() const { return status_.user_data; }
- void setUserData(u32 pUserData) { status_.user_data = pUserData; }
- JAIAudible* getAudible() const { return audible_; }
+ u32 getUserData() const { return status_.userdata_; }
+ void setUserData(u32 userData) { status_.userdata_ = userData; }
+ JAIAudible* getAudible() { return audible_; }
bool isHandleAttached() const { return handle_ != NULL; }
bool hasLifeTime() const { return status_.field_0x1.flags.flag2; }
- void removeLifeTime_() { status_.field_0x1.flags.flag1 = false; }
- bool isPrepared() { return status_.isPrepared(); }
+
+ void removeLifeTime_() {
+ status_.field_0x1.flags.flag1 = false;
+ status_.field_0x1.flags.flag2 = 0;
+ }
+
+ bool isPrepared() const { return status_.isPrepared(); }
void unlockIfLocked() { status_.unlockIfLocked(); }
void lockWhenPrepared() { status_.lockWhenPrepared(); }
void stop_JAISound_() {
@@ -278,65 +283,63 @@ public:
status_.state.flags.flag1 = 1;
}
- bool isStopping() {
- bool isStopping = false;
- if (status_.state.flags.flag1) {
- isStopping = !status_.state.flags.flag5 || fader.isOut();
- }
- return isStopping;
+ bool isStopping() const {
+ return status_.state.flags.flag1 && (!status_.state.flags.flag5 || fader_.isOut());
}
void pause(bool param_0) {
status_.field_0x0.flags.paused = param_0;
}
- void updateLifeTime(u32 param_0) {
- if (param_0 > lifeTime) {
- lifeTime = param_0;
+ void updateLifeTime(u32 lifeTime) {
+ if (lifeTime > lifeTime_) {
+ lifeTime_ = lifeTime;
}
}
- void setLifeTime(u32 param_0, bool param_1) {
- lifeTime = param_0;
+ void setLifeTime(u32 lifeTime, bool param_1) {
+ JUT_ASSERT(333, status_.state.flags.calcedOnce == 0);
+ lifeTime_ = lifeTime;
setComesBack(param_1);
status_.field_0x1.flags.flag2 = 1;
}
void setComesBack(bool param_0) {
+ JUT_ASSERT(354, status_.state.flags.calcedOnce == 0);
status_.field_0x1.flags.flag1 = 1;
if (param_0) {
status_.pauseWhenOut();
}
}
- bool setPos(const JGeometry::TVec3<f32>& param_1) {
+ bool setPos(const JGeometry::TVec3<f32>& pos) {
if (audible_ != NULL) {
- audible_->setPos(param_1);
+ audible_->setPos(pos);
}
return audible_ != NULL;
}
- JAISoundFader& getFader() { return fader; }
- void fadeIn(u32 i_count) { fader.fadeInFromOut(i_count); }
- void fadeOut(u32 i_count) { fader.fadeOut(i_count); }
+ JAISoundFader& getFader() { return fader_; }
+ void fadeIn(u32 maxSteps) { fader_.fadeInFromOut(maxSteps); }
+ void fadeOut(u32 maxSteps) { fader_.fadeOut(maxSteps); }
- JAISoundParamsProperty& getProperty() { return params.mProperty; }
+ JAISoundParamsProperty& getProperty() { return params_.property_; }
- s32 getCount() const { return mCount; }
+ s32 getCount() const { return count_; }
- JAISoundParamsMove& getAuxiliary() { return params.mMove; }
+ JAISoundParamsMove& getAuxiliary() { return params_.move_; }
/* 0x04 */ JAISoundHandle* handle_;
/* 0x08 */ JAIAudible* audible_;
/* 0x0C */ JAIAudience* audience_;
- /* 0x10 */ u32 lifeTime;
- /* 0x14 */ s32 prepareCount;
- /* 0x18 */ JAISoundID soundID;
+ /* 0x10 */ u32 lifeTime_;
+ /* 0x14 */ s32 prepareCount_;
+ /* 0x18 */ JAISoundID soundID_;
/* 0x1C */ JAISoundStatus_ status_;
- /* 0x24 */ JAISoundFader fader;
- /* 0x34 */ u32 mPriority;
- /* 0x38 */ s32 mCount;
- /* 0x3C */ JAISoundParams params;
+ /* 0x24 */ JAISoundFader fader_;
+ /* 0x34 */ u32 priority_;
+ /* 0x38 */ s32 count_;
+ /* 0x3C */ JAISoundParams params_;
}; // Size: 0x98
STATIC_ASSERT(sizeof(JAISound) == 0x98);
diff --git a/include/JSystem/JAudio2/JAISoundHandles.h b/include/JSystem/JAudio2/JAISoundHandles.h
index f754e4976c..9bcd7de88a 100644
--- a/include/JSystem/JAudio2/JAISoundHandles.h
+++ b/include/JSystem/JAudio2/JAISoundHandles.h
@@ -18,6 +18,11 @@ public:
bool isSoundAttached() const { return sound_ != NULL; }
+ JAISound* getSound() {
+ JUT_ASSERT(41, sound_ != NULL);
+ return sound_;
+ }
+
JAISound* operator->() const {
JUT_ASSERT(58, sound_ != NULL);
return sound_;
@@ -27,9 +32,7 @@ public:
void releaseSound();
- JAISound* getSound() { return sound_; }
-
- JAISound* sound_; // member from assert in operator->()
+ JAISound* sound_;
};
/**
@@ -38,18 +41,18 @@ public:
*/
class JAISoundHandles {
public:
- JAISoundHandles(JAISoundHandle* pHandle, int param_1) {
- mSoundHandle = pHandle;
- numHandles_ = param_1;
+ JAISoundHandles(JAISoundHandle* handle, int handleNum) {
+ handle_ = handle;
+ numHandles_ = handleNum;
};
- JAISoundHandle& operator[](int n) { return mSoundHandle[n]; }
+ JAISoundHandle& operator[](int n) { return handle_[n]; }
- JAISoundHandle* getHandleSoundID(JAISoundID);
+ JAISoundHandle* getHandleSoundID(JAISoundID id);
JAISoundHandle* getFreeHandle();
private:
- JAISoundHandle* mSoundHandle;
+ JAISoundHandle* handle_;
int numHandles_;
};
diff --git a/include/JSystem/JAudio2/JAISoundParams.h b/include/JSystem/JAudio2/JAISoundParams.h
index 66daf59276..1e3189bd8b 100644
--- a/include/JSystem/JAudio2/JAISoundParams.h
+++ b/include/JSystem/JAudio2/JAISoundParams.h
@@ -26,56 +26,56 @@ struct JAISoundParamsProperty {
struct JAISoundParamsTransition {
struct TTransition {
void zero() {
- mStep = 0.0f;
- mCount = 0;
- mDest = 0.0f;
+ step_ = 0.0f;
+ remainingSteps_ = 0;
+ targetValue_ = 0.0f;
}
- void set(f32 newValue, f32 intensity, u32 fadeCount) {
- mCount = fadeCount;
- mStep = (newValue - intensity) / mCount;
- mDest = newValue;
+ void set(f32 newValue, f32 currentValue, u32 maxSteps) {
+ remainingSteps_ = maxSteps;
+ step_ = (newValue - currentValue) / remainingSteps_;
+ targetValue_ = newValue;
}
- f32 apply(f32 param_0) {
- if (mCount > 1) {
- mCount--;
- param_0 += mStep;
+ f32 apply(f32 value) {
+ if (remainingSteps_ > 1) {
+ remainingSteps_--;
+ value += step_;
} else {
- if (mCount == 1) {
- mCount = 0;
- param_0 = mDest;
+ if (remainingSteps_ == 1) {
+ remainingSteps_ = 0;
+ value = targetValue_;
}
}
- return param_0;
+ return value;
}
- /* 0x0 */ f32 mStep;
- /* 0x4 */ f32 mDest;
- /* 0x8 */ u32 mCount;
+ /* 0x0 */ f32 step_;
+ /* 0x4 */ f32 targetValue_;
+ /* 0x8 */ u32 remainingSteps_;
}; // Size: 0xC
void init() {
- mVolume.zero();
- mPitch.zero();
- mFxMix.zero();
- mPan.zero();
- mDolby.zero();
+ volume_.zero();
+ pitch_.zero();
+ fxMix_.zero();
+ pan_.zero();
+ dolby_.zero();
}
- void apply(JASSoundParams* pParams) {
- pParams->mVolume = mVolume.apply(pParams->mVolume);
- pParams->mPitch = mPitch.apply(pParams->mPitch);
- pParams->mFxMix = mFxMix.apply(pParams->mFxMix);
- pParams->mDolby = mDolby.apply(pParams->mDolby);
- pParams->mPan = mPan.apply(pParams->mPan);
+ void apply(JASSoundParams* params) {
+ params->mVolume = volume_.apply(params->mVolume);
+ params->mPitch = pitch_.apply(params->mPitch);
+ params->mFxMix = fxMix_.apply(params->mFxMix);
+ params->mDolby = dolby_.apply(params->mDolby);
+ params->mPan = pan_.apply(params->mPan);
}
- /* 0x00 */ TTransition mVolume;
- /* 0x0C */ TTransition mPitch;
- /* 0x18 */ TTransition mFxMix;
- /* 0x24 */ TTransition mPan;
- /* 0x30 */ TTransition mDolby;
+ /* 0x00 */ TTransition volume_;
+ /* 0x0C */ TTransition pitch_;
+ /* 0x18 */ TTransition fxMix_;
+ /* 0x24 */ TTransition pan_;
+ /* 0x30 */ TTransition dolby_;
}; // Size: 0x3C
/**
@@ -83,23 +83,23 @@ struct JAISoundParamsTransition {
*
*/
struct JAISoundParamsMove {
- JAISoundParamsMove() : mParams() {}
+ JAISoundParamsMove() : params_() {}
void init() {
- mParams.init();
- mTransition.init();
+ params_.init();
+ transition_.init();
}
- void calc() { mTransition.apply(&mParams); }
+ void calc() { transition_.apply(&params_); }
- /* 802A2DB4 */ void moveVolume(f32, u32);
- /* 802A2E0C */ void movePitch(f32, u32);
- /* 802A2E64 */ void moveFxMix(f32, u32);
- /* 802A2EBC */ void movePan(f32, u32);
- /* 802A2F14 */ void moveDolby(f32, u32);
+ /* 802A2DB4 */ void moveVolume(f32 newValue, u32 maxSteps);
+ /* 802A2E0C */ void movePitch(f32 newValue, u32 maxSteps);
+ /* 802A2E64 */ void moveFxMix(f32 newValue, u32 maxSteps);
+ /* 802A2EBC */ void movePan(f32 newValue, u32 maxSteps);
+ /* 802A2F14 */ void moveDolby(f32 newValue, u32 maxSteps);
- /* 0x00 */ JASSoundParams mParams;
- /* 0x14 */ JAISoundParamsTransition mTransition;
+ /* 0x00 */ JASSoundParams params_;
+ /* 0x14 */ JAISoundParamsTransition transition_;
}; // Size: 0x50
/**
@@ -107,17 +107,16 @@ struct JAISoundParamsMove {
*
*/
struct JAISoundParams {
- JAISoundParams() : mMove() {}
- void mixOutAll(JASSoundParams const&, JASSoundParams*, f32);
+ JAISoundParams() : move_() {}
+ void mixOutAll(const JASSoundParams& inParams, JASSoundParams* outParams, f32);
void init() {
- mMove.init();
- mProperty.init();
+ move_.init();
+ property_.init();
}
- /* 0x0 */ JAISoundParamsProperty mProperty;
- /* 0xC */ JAISoundParamsMove mMove;
+ /* 0x0 */ JAISoundParamsProperty property_;
+ /* 0xC */ JAISoundParamsMove move_;
}; // Size: 0x5C
-// OG Size: 0x20
#endif /* JAISOUNDPARAMS_H */
diff --git a/include/JSystem/JAudio2/JAISoundStarter.h b/include/JSystem/JAudio2/JAISoundStarter.h
index fda197b260..ef177adcd1 100644
--- a/include/JSystem/JAudio2/JAISoundStarter.h
+++ b/include/JSystem/JAudio2/JAISoundStarter.h
@@ -9,11 +9,11 @@
*
*/
struct JAISoundStarter : public JASGlobalInstance<JAISoundStarter> {
- /* 802A2F6C */ JAISoundStarter(bool);
+ /* 802A2F6C */ JAISoundStarter(bool setInstance);
virtual ~JAISoundStarter();
- virtual bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*) = 0;
- /* 802A2FEC */ bool startLevelSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
+ virtual bool startSound(JAISoundID id, JAISoundHandle* handlePtr, const JGeometry::TVec3<f32>* posPtr) = 0;
+ /* 802A2FEC */ bool startLevelSound(JAISoundID id, JAISoundHandle* handlePtr, const JGeometry::TVec3<f32>* posPtr);
};
#endif /* JAISOUNDSTARTER_H */
diff --git a/include/JSystem/JAudio2/JAIStream.h b/include/JSystem/JAudio2/JAIStream.h
index 4f7b37e627..e430d790f0 100644
--- a/include/JSystem/JAudio2/JAIStream.h
+++ b/include/JSystem/JAudio2/JAIStream.h
@@ -14,39 +14,42 @@ class JAIStreamMgr;
class JAIStream : public JASPoolAllocObject<JAIStream>, public JAISound, public JSULink<JAIStream> {
public:
struct TInner {
- JASAramStream field_0x0;
+ JASAramStream aramStream_;
};
- /* 802A3104 */ JAIStream(JAIStreamMgr*, JAISoundStrategyMgr<JAIStream>*);
- /* 802A319C */ void JAIStreamMgr_startID_(JAISoundID, s32, JGeometry::TVec3<f32> const*,
- JAIAudience*, int);
+ /* 802A3104 */ JAIStream(JAIStreamMgr* streamMgr, JAISoundStrategyMgr<JAIStream>* soundStrategyMgr);
+ /* 802A319C */ void JAIStreamMgr_startID_(JAISoundID id, s32 streamFileEntry,
+ const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience,
+ int category);
/* 802A3230 */ bool prepare_prepareStream_();
/* 802A33F4 */ void prepare_();
/* 802A3498 */ void prepare_startStream_();
- /* 802A34E4 */ void JAIStreamMgr_mixOut_(JASSoundParams const&, JAISoundActivity);
+ /* 802A34E4 */ void JAIStreamMgr_mixOut_(const JASSoundParams& inParams, JAISoundActivity activity);
/* 802A3720 */ void die_JAIStream_();
/* 802A37FC */ bool JAISound_tryDie_();
/* 802A388C */ void JAIStreamMgr_calc_();
/* 802A3948 */ s32 getNumChild() const;
- /* 802A3950 */ JAISoundChild* getChild(int);
- /* 802A3A24 */ void releaseChild(int);
+ /* 802A3950 */ JAISoundChild* getChild(int index);
+ /* 802A3A24 */ void releaseChild(int index);
/* 802A3ABC */ JASTrack* getTrack();
/* 802A3AC4 */ JASTrack* getChildTrack(int);
/* 802A3ACC */ JAIStream* asStream();
/* 802A3AD0 */ JAITempoMgr* getTempoMgr();
- void* JAIStreamMgr_getAramAddr_() { return field_0x29c; }
+ void* JAIStreamMgr_getAramAddr_() const { return streamAramAddr_; }
- /* 0x0A8 */ TInner field_0x0a8;
+ static const int NUM_CHILDREN = 6;
+
+ /* 0x0A8 */ TInner inner_;
/* 0x290 */ int field_0x290;
/* 0x294 */ s32 field_0x294;
/* 0x298 */ int field_0x298;
- /* 0x29C */ void* field_0x29c;
- /* 0x2A0 */ JAISoundChild* field_0x2a0[6];
- /* 0x2B8 */ JAIStreamMgr* field_0x2b8;
+ /* 0x29C */ void* streamAramAddr_;
+ /* 0x2A0 */ JAISoundChild* children_[NUM_CHILDREN];
+ /* 0x2B8 */ JAIStreamMgr* streamMgr_;
/* 0x2BC */ JAISoundStrategyMgr__unknown<JAIStream>* field_0x2bc;
/* 0x2C0 */ JAISoundStrategyMgr<JAIStream>* field_0x2c0;
- /* 0x2C4 */ u8 field_0x2c4;
+ /* 0x2C4 */ bool field_0x2c4;
/* 0x2C5 */ u8 field_0x2c5;
/* 0x2C6 */ u8 field_0x2c6;
};
diff --git a/include/JSystem/JAudio2/JAIStreamMgr.h b/include/JSystem/JAudio2/JAIStreamMgr.h
index 5dbe8d3ab0..41ac1b0445 100644
--- a/include/JSystem/JAudio2/JAIStreamMgr.h
+++ b/include/JSystem/JAudio2/JAIStreamMgr.h
@@ -14,34 +14,38 @@ class JAIStreamDataMgr;
*/
class JAIStreamMgr : public JASGlobalInstance<JAIStreamMgr> {
public:
- /* 802A3B68 */ JAIStreamMgr(bool);
- /* 802A3C3C */ bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
+ /* 802A3B68 */ JAIStreamMgr(bool setInstance);
+ /* 802A3C3C */ bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr);
/* 802A3D70 */ void freeDeadStream_();
/* 802A3EBC */ void calc();
/* 802A4028 */ void stop();
- /* 802A4068 */ void stop(u32);
- /* 802A40B8 */ void stopSoundID(JAISoundID);
+ /* 802A4068 */ void stop(u32 fadeTime);
+ /* 802A40B8 */ void stopSoundID(JAISoundID id);
/* 802A4118 */ void mixOut();
/* 802A4174 */ JAIStream* newStream_();
/* 802B9978 */ bool isActive() const { return mStreamList.getNumLinks() != 0; }
+ JAIAudience* getAudience() { return mAudience; }
JAISoundParamsMove* getParams() { return &mParams; }
JAIStreamAramMgr* getStreamAramMgr() { return mStreamAramMgr; }
JSUList<JAIStream>* getStreamList() { return &mStreamList; }
- void setStreamDataMgr(JAIStreamDataMgr* param_0) {
+
+ void setStreamDataMgr(JAIStreamDataMgr* streamDataMgr) {
JUT_ASSERT(139, !isActive());
- streamDataMgr_ = param_0;
+ streamDataMgr_ = streamDataMgr;
}
- void setStreamAramMgr(JAIStreamAramMgr* param_0) {
+
+ void setStreamAramMgr(JAIStreamAramMgr* streamDataMgr) {
JUT_ASSERT(157, !isActive());
- mStreamAramMgr = param_0;
+ mStreamAramMgr = streamDataMgr;
}
- void pause(bool i_pause) { mActivity.field_0x0.flags.flag2 = i_pause; }
+
+ void pause(bool paused) { mActivity.field_0x0.flags.flag2 = paused; }
private:
/* 0x00 */ JAISoundActivity mActivity;
/* 0x04 */ JAISoundParamsMove mParams;
- /* 0x54 */ JAIAudience* field_0x54;
+ /* 0x54 */ JAIAudience* mAudience;
/* 0x58 */ JSUList<JAIStream> mStreamList;
/* 0x64 */ JAIStreamDataMgr* streamDataMgr_;
/* 0x68 */ JAIStreamAramMgr* mStreamAramMgr;
diff --git a/include/JSystem/JAudio2/JASCalc.h b/include/JSystem/JAudio2/JASCalc.h
index 6f2b545c84..ea6773821c 100644
--- a/include/JSystem/JAudio2/JASCalc.h
+++ b/include/JSystem/JAudio2/JASCalc.h
@@ -8,11 +8,11 @@
*
*/
struct JASCalc {
- /* 8028F2E8 */ static void imixcopy(s16 const*, s16 const*, s16*, u32);
- /* 8028F318 */ static void bcopyfast(void const*, void*, u32);
- /* 8028F354 */ static void bcopy(void const*, void*, u32);
- /* 8028F454 */ static void bzerofast(void*, u32);
- /* 8028F480 */ static void bzero(void*, u32);
+ /* 8028F2E8 */ static void imixcopy(const s16*, const s16*, s16*, u32);
+ /* 8028F318 */ static void bcopyfast(const void* src, void* dest, u32 size);
+ /* 8028F354 */ static void bcopy(const void* src, void* dest, u32 size);
+ /* 8028F454 */ static void bzerofast(void* dest, u32 size);
+ /* 8028F480 */ static void bzero(void* dest, u32 size);
/* 8028F578 */ static f32 pow2(f32);
// Could not make it work as inline - specialization is in JASCalc.cpp
@@ -39,7 +39,7 @@ struct JASCalc {
f32 fake2(long x);
f32 fake3();
- static s16 const CUTOFF_TO_IIR_TABLE[128][4];
+ static const s16 CUTOFF_TO_IIR_TABLE[128][4];
};
#endif /* JASCALC_H */
diff --git a/include/JSystem/JAudio2/JASCallback.h b/include/JSystem/JAudio2/JASCallback.h
index 33bd5e7f5e..5aa3267d9d 100644
--- a/include/JSystem/JAudio2/JASCallback.h
+++ b/include/JSystem/JAudio2/JASCallback.h
@@ -12,28 +12,21 @@ typedef long JASCallback(void*);
struct JASCallbackMgr {
struct TCallback {
TCallback()
- : mFunction(NULL)
- , mArgument(NULL) {
+ : callback_(NULL)
+ , arg_(NULL) {
}
- /** @fabricated */
- bool isMatch(JASCallback* function, void* argument) { return (mFunction == function && mArgument == argument); }
-
- /** @fabricated */
- void clear() {
- mFunction = NULL;
- mArgument = NULL;
- }
-
- /* 0x00 */ JASCallback* mFunction;
- /* 0x04 */ void* mArgument;
+ /* 0x00 */ JASCallback* callback_;
+ /* 0x04 */ void* arg_;
};
- bool regist(JASCallback*, void*);
- int reject(JASCallback*, void*);
+ bool regist(JASCallback* callback, void* argument);
+ int reject(JASCallback* callback, void* argument);
void callback();
- /* 0x00 */ TCallback mCallbacks[0x20];
+ static const int NUM_CALLBACKS = 32;
+
+ /* 0x00 */ TCallback callbacks_[NUM_CALLBACKS];
};
#endif /* JASCALLBACK_H */
diff --git a/include/JSystem/JAudio2/JASDriverIF.h b/include/JSystem/JAudio2/JASDriverIF.h
index ff2f42cad0..edb4574015 100644
--- a/include/JSystem/JAudio2/JASDriverIF.h
+++ b/include/JSystem/JAudio2/JASDriverIF.h
@@ -26,4 +26,8 @@ namespace JASDriver {
extern u32 JAS_SYSTEM_OUTPUT_MODE;
};
+inline void JAISetOutputMode(u32 mode) {
+ JASDriver::setOutputMode(mode);
+}
+
#endif /* JASDRIVERIF_H */
diff --git a/include/JSystem/JAudio2/JASDvdThread.h b/include/JSystem/JAudio2/JASDvdThread.h
index c76511ee58..38c022c058 100644
--- a/include/JSystem/JAudio2/JASDvdThread.h
+++ b/include/JSystem/JAudio2/JASDvdThread.h
@@ -12,7 +12,7 @@ class JASTaskThread;
class JASDvd {
public:
/* 8028FEFC */ static JASTaskThread* getThreadPointer();
- /* 8028FF04 */ static bool createThread(s32, int, u32);
+ /* 8028FF04 */ static bool createThread(s32 priority, int msgCount, u32 stackSize);
static JASTaskThread* sThread;
};
diff --git a/include/JSystem/JAudio2/JASGadget.h b/include/JSystem/JAudio2/JASGadget.h
index b48b234b2a..5c3e9f5542 100644
--- a/include/JSystem/JAudio2/JASGadget.h
+++ b/include/JSystem/JAudio2/JASGadget.h
@@ -15,8 +15,8 @@ public:
sInstance = inst;
}
- JASGlobalInstance(bool param_1) {
- if (param_1) {
+ JASGlobalInstance(bool setInstance) {
+ if (setInstance) {
JUT_ASSERT(186, sInstance == NULL);
sInstance = (T*)this;
}
diff --git a/include/JSystem/JAudio2/JASHeapCtrl.h b/include/JSystem/JAudio2/JASHeapCtrl.h
index c6cc34ae30..db26f57f8e 100644
--- a/include/JSystem/JAudio2/JASHeapCtrl.h
+++ b/include/JSystem/JAudio2/JASHeapCtrl.h
@@ -94,8 +94,16 @@ template <typename T>
class JASMemPool : public JASGenericMemPool {
public:
void newMemPool(int param_0) { JASGenericMemPool::newMemPool(sizeof(T), param_0); }
- void* alloc(u32 n) { return JASGenericMemPool::alloc(n); }
- void free(void* ptr, u32 n) { JASGenericMemPool::free(ptr, n); }
+
+ void* alloc(u32 n) {
+ JUT_ASSERT(182, n == sizeof(T));
+ return JASGenericMemPool::alloc(n);
+ }
+
+ void free(void* ptr, u32 n) {
+ JUT_ASSERT(187, n == sizeof(T));
+ JASGenericMemPool::free(ptr, n);
+ }
};
namespace JASKernel { JKRHeap* getSystemHeap(); };
diff --git a/include/JSystem/JAudio2/JASTaskThread.h b/include/JSystem/JAudio2/JASTaskThread.h
index b3e338ee28..7a16331d8d 100644
--- a/include/JSystem/JAudio2/JASTaskThread.h
+++ b/include/JSystem/JAudio2/JASTaskThread.h
@@ -4,6 +4,8 @@
#include "JSystem/JKernel/JKRThread.h"
#include "JSystem/JAudio2/JASHeapCtrl.h"
+typedef void (*JASThreadCallback)(void*);
+
/**
* @ingroup jsystem-jaudio
*
@@ -11,27 +13,27 @@
class JASTaskThread : public JKRThread {
private:
struct JASThreadCallStack {
- /* 0x00 */ void (*mRunFunc)(void*);
- /* 0x04 */ u32 field_0x4;
+ /* 0x00 */ JASThreadCallback callback_;
+ /* 0x04 */ u32 msgType_;
/* 0x08 */ union {
u8 buffer[0x400];
- void* pBuffer;
- }field_0x8;
+ void* bufferPtr;
+ } msg;
};
public:
typedef JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable> ThreadMemPool;
- /* 8028F6C4 */ JASTaskThread(int, int, u32);
- /* 8028F9EC */ void* allocCallStack(void (*)(void*), void*);
- /* 8028F850 */ void* allocCallStack(void (*)(void*), void const*, u32);
- /* 8028FC54 */ int sendCmdMsg(void (*)(void*), void*);
- /* 8028FB5C */ int sendCmdMsg(void (*)(void*), void const*, u32);
+ /* 8028F6C4 */ JASTaskThread(int priority, int msgCount, u32 stackSize);
+ /* 8028F9EC */ void* allocCallStack(JASThreadCallback callback, void* msg);
+ /* 8028F850 */ void* allocCallStack(JASThreadCallback callback, const void* msg, u32 msgSize);
+ /* 8028FC54 */ int sendCmdMsg(JASThreadCallback callback, void* msg);
+ /* 8028FB5C */ int sendCmdMsg(JASThreadCallback callback, const void* msg, u32 msgSize);
/* 8028FE88 */ void pause(bool);
/* 8028F724 */ virtual ~JASTaskThread();
/* 8028FD4C */ virtual void* run();
- /* 0x7C */ OSThreadQueue mpThreadQueue;
+ /* 0x7C */ OSThreadQueue threadQueue_;
/* 0x84 */ bool field_0x84;
};
diff --git a/include/JSystem/JAudio2/JASTrack.h b/include/JSystem/JAudio2/JASTrack.h
index 884f09b3d7..9a6c14c995 100644
--- a/include/JSystem/JAudio2/JASTrack.h
+++ b/include/JSystem/JAudio2/JASTrack.h
@@ -25,6 +25,7 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
enum Status {
STATUS_FREE,
STATUS_RUN,
+ STATUS_STOP,
};
struct TChannelMgr : public JASPoolAllocObject_MultiThreaded<TChannelMgr> {
@@ -34,9 +35,11 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
/* 80293220 */ bool noteOff(u32, u16);
/* 802932A0 */ void setPauseFlag(bool);
- /* 0x00 */ JASChannel* mChannels[8];
+ static const int CHANNEL_MAX = 8;
+
+ /* 0x00 */ JASChannel* mChannels[CHANNEL_MAX];
/* 0x20 */ JASChannelParams mParams;
- /* 0x38 */ short field_0x38[8];
+ /* 0x38 */ s16 field_0x38[CHANNEL_MAX];
/* 0x48 */ JASSoundParams* mSoundParams;
/* 0x4c */ JASTrack* mTrack;
};
@@ -138,7 +141,7 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
JUT_ASSERT(115, index < MAX_CHILDREN)
return mChildren[index];
}
- int getChannelMgrCount() { return mChannelMgrCount; }
+ int getChannelMgrCount() const { return mChannelMgrCount; }
f32 getVibDepth() const { return mVibDepth; }
void setVibDepth(f32 param_0) { mVibDepth = param_0; }
f32 getVibPitch() const { return mVibPitch; }
@@ -152,7 +155,7 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
u32 getTremDelay() const { return mTremDelay; }
void setTremDelay(u32 param_0) { mTremDelay = param_0; }
u8 getStatus() const { return mStatus; }
- void setAutoDelete(u8 param_0) { mFlags.autoDelete = param_0; }
+ void setAutoDelete(bool param_0) { mFlags.autoDelete = param_0; }
f32 getPanPower() const { return mPanPower; }
void setPanPower(f32 param_0) { mPanPower = param_0; }
u32 getSkipSample() const { return mSkipSample; }
diff --git a/include/JSystem/JAudio2/JASWaveArcLoader.h b/include/JSystem/JAudio2/JASWaveArcLoader.h
index 288905339a..bf8e967b42 100644
--- a/include/JSystem/JAudio2/JASWaveArcLoader.h
+++ b/include/JSystem/JAudio2/JASWaveArcLoader.h
@@ -54,7 +54,7 @@ struct JASWaveArc : JASDisposer {
/* 80298FA0 */ virtual void onLoadDone() {}
/* 80298FA4 */ virtual void onEraseDone() {}
- s32 getStatus() { return mStatus; }
+ s32 getStatus() const { return mStatus; }
struct loadToAramCallbackParams {
// not official struct name
diff --git a/include/JSystem/JAudio2/JAUAudibleParam.h b/include/JSystem/JAudio2/JAUAudibleParam.h
index 83baf7c9b8..0fd3058f82 100644
--- a/include/JSystem/JAudio2/JAUAudibleParam.h
+++ b/include/JSystem/JAudio2/JAUAudibleParam.h
@@ -1,6 +1,8 @@
#ifndef JAUAUDIBLEPARAM_H
#define JAUAUDIBLEPARAM_H
+#include <dolphin/types.h>
+
/**
* @ingroup jsystem-jaudio
*
@@ -9,6 +11,7 @@ struct JAUAudibleParam {
f32 getDopplerPower() const {
return (u32)((*(u8*)&field_0x0.raw >> 4) & 0xf) * (1.0f / 15.0f);
}
+
union {
struct {
u16 f0;
diff --git a/include/JSystem/JAudio2/JAUAudioArcInterpreter.h b/include/JSystem/JAudio2/JAUAudioArcInterpreter.h
index 86724662d0..7be5775766 100644
--- a/include/JSystem/JAudio2/JAUAudioArcInterpreter.h
+++ b/include/JSystem/JAudio2/JAUAudioArcInterpreter.h
@@ -37,7 +37,7 @@ public:
mReadPtr += 4;
return temp;
}
- const void* getContent_(u32 param_0) { return mBase + param_0; }
+ const void* getContent_(u32 param_0) const { return mBase + param_0; }
/* 0x04 */ const u8* mReadPtr;
diff --git a/include/JSystem/JAudio2/JAUInitializer.h b/include/JSystem/JAudio2/JAUInitializer.h
index 7f5410527b..c0fd32380a 100644
--- a/include/JSystem/JAudio2/JAUInitializer.h
+++ b/include/JSystem/JAudio2/JAUInitializer.h
@@ -12,21 +12,21 @@ class JKRSolidHeap;
class JAU_JASInitializer {
public:
/* 802A4AD0 */ JAU_JASInitializer();
- /* 802A4B28 */ void initJASystem(JKRSolidHeap*);
+ /* 802A4B28 */ void initJASystem(JKRSolidHeap* heap);
- /* 0x00 */ u32 field_0x00;
- /* 0x04 */ u32 field_0x04;
- /* 0x08 */ int field_0x08;
- /* 0x0C */ int field_0x0c;
- /* 0x10 */ int field_0x10;
- /* 0x14 */ int field_0x14;
- /* 0x18 */ int field_0x18;
+ /* 0x00 */ u32 audioMemory_;
+ /* 0x04 */ u32 audioMemSize_;
+ /* 0x08 */ int heapSize_;
+ /* 0x0C */ int dvdThreadPriority_;
+ /* 0x10 */ int audioThreadPriority_;
+ /* 0x14 */ int dvdThreadId_;
+ /* 0x18 */ int audioThreadId_;
/* 0x1C */ int field_0x1c;
/* 0x20 */ int field_0x20;
- /* 0x24 */ int field_0x24;
- /* 0x28 */ int field_0x28;
- /* 0x2C */ f32 field_0x2c;
- /* 0x30 */ char* field_0x30;
+ /* 0x24 */ int aramBlockSize_;
+ /* 0x28 */ int aramChannelNum_;
+ /* 0x2C */ f32 dspLevel_;
+ /* 0x30 */ char* waveArcDir_;
};
/**
diff --git a/include/JSystem/JAudio2/JAUSectionHeap.h b/include/JSystem/JAudio2/JAUSectionHeap.h
index c8eef69c1a..14607e772f 100644
--- a/include/JSystem/JAudio2/JAUSectionHeap.h
+++ b/include/JSystem/JAudio2/JAUSectionHeap.h
@@ -66,6 +66,8 @@ public:
bool isBuilding() const { return field_0x2c; }
bool isOpen() const;
JAUSectionHeap* asSectionHeap() { return (JAUSection*)sectionHeap_ == this ? sectionHeap_ : NULL; }
+ const TSectionData& getSectionData() const { return data_; }
+
JKRHeap* getHeap_();
/* 0x28 */ u32 field_0x28;
@@ -95,7 +97,7 @@ public:
/* 802A5E60 */ void setSeqDataArchive(JKRArchive*);
/* 802A5EC0 */ bool loadDynamicSeq(JAISoundID, bool);
- /* 802A5EF8 */ void releaseIdleDynamicSeqDataBlock();
+ /* 802A5EF8 */ u32 releaseIdleDynamicSeqDataBlock();
/* 802A5FE0 */ JAUSectionHeap(JKRSolidHeap*, bool, s32);
/* 802A6094 */ JAUSection* getOpenSection();
/* 802A60A0 */ bool setSeqDataUser(JAISeqDataUser*);
diff --git a/include/JSystem/JAudio2/JAUSeqCollection.h b/include/JSystem/JAudio2/JAUSeqCollection.h
index 080473abfb..4831e1a020 100644
--- a/include/JSystem/JAudio2/JAUSeqCollection.h
+++ b/include/JSystem/JAudio2/JAUSeqCollection.h
@@ -49,6 +49,8 @@ public:
/* 802A683C */ SeqDataReturnValue getSeqData(JAISoundID, JAISeqData*);
/* 802A6894 */ ~JAUSeqDataMgr_SeqCollection();
+ const void* getResource() const { return field_0x4; }
+
/* 0x14 */ JAISeqDataUser* user_;
};
diff --git a/include/JSystem/JAudio2/JAUSoundTable.h b/include/JSystem/JAudio2/JAUSoundTable.h
index 13c60ea68e..5fb3e275fa 100644
--- a/include/JSystem/JAudio2/JAUSoundTable.h
+++ b/include/JSystem/JAudio2/JAUSoundTable.h
@@ -157,7 +157,8 @@ struct JAUSoundTable : public JASGlobalInstance<JAUSoundTable> {
return (JAUSoundTableItem*)((u8*)field_0x0.field_0x0 + offset);
}
- const void* getResource() { return field_0x0.field_0x0; }
+ const void* getResource() const { return field_0x0.field_0x0; }
+ bool isValid() const { return field_0x0.field_0x0 != NULL; }
JAUSoundTable_<JAUSoundTableRoot,JAUSoundTableSection,JAUSoundTableGroup,void> field_0x0;
};
diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h
index 99209023af..72123903fe 100644
--- a/include/JSystem/JGeometry.h
+++ b/include/JSystem/JGeometry.h
@@ -41,6 +41,16 @@ struct TUtil<f32> {
root = 0.5f * root * (3.0f - x * (root * root));
return root;
}
+
+ static inline f32 sqrt(f32 x) {
+ if (x <= 0.0f) {
+ return x;
+ }
+
+ f32 root = __frsqrte(x);
+ root = 0.5f * root * (3.0f - x * (root * root));
+ return x * root;
+ }
};
template<>
@@ -216,7 +226,7 @@ struct TVec3<f32> : public Vec {
}
inline TVec3<f32>& operator=(const TVec3<f32>& b) {
- set(b.x, b.y, b.z);
+ setTVec3f(&b.x, &this->x);
return *this;
}
@@ -439,12 +449,7 @@ struct TVec2 {
}
f32 length() const {
- f32 sqr = squared();
- if (sqr <= 0.0f) {
- return sqr;
- }
- sqr *= fsqrt_step(sqr);
- return sqr;
+ return TUtil<f32>::sqrt(squared());
}
T x;
diff --git a/include/JSystem/JKernel/JKRThread.h b/include/JSystem/JKernel/JKRThread.h
index f3e2d1b6ba..b82a22ae9b 100644
--- a/include/JSystem/JKernel/JKRThread.h
+++ b/include/JSystem/JKernel/JKRThread.h
@@ -80,7 +80,6 @@ public:
mCurrentHeap = heap ? heap : JKRHeap::getCurrentHeap();
}
-protected:
void resume() { OSResumeThread(mThreadRecord); }
BOOL sendMessage(OSMessage message) {
return OSSendMessage(&mMessageQueue, message, OS_MESSAGE_NOBLOCK);
diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h
index 4d9dd66608..7042cd8d6c 100644
--- a/include/JSystem/JMath/JMath.h
+++ b/include/JSystem/JMath/JMath.h
@@ -89,6 +89,10 @@ inline f32 fastReciprocal(f32 value) {
return JMAFastReciprocal(value);
}
+inline void fastVECNormalize(const Vec* src, Vec* dst) {
+ return JMAFastVECNormalize(src, dst);
+}
+
inline void gekko_ps_copy3(register void* dst, register const void* src) {
register f32 src0;
register f32 src1;
diff --git a/include/JSystem/JSupport/JSUList.h b/include/JSystem/JSupport/JSUList.h
index 884b8b9b64..75c18bb8d5 100644
--- a/include/JSystem/JSupport/JSUList.h
+++ b/include/JSystem/JSupport/JSUList.h
@@ -47,7 +47,7 @@ public:
T* getObject() const { return static_cast<T*>(mObject); }
- JSUList<T>* getSupervisor() const { return static_cast<JSUList<T>*>(this->getList()); }
+ JSUList<T>* getSupervisor() const { return static_cast<JSUList<T>*>(mList); }
JSULink<T>* getNext() const { return static_cast<JSULink*>(mNext); }
@@ -82,7 +82,7 @@ public:
u32 getNumLinks() const { return mLength; }
-private:
+protected:
JSUPtrLink* mHead;
JSUPtrLink* mTail;
u32 mLength;
@@ -114,11 +114,11 @@ public:
JSULink<T>* getLast() const { return (JSULink<T>*)getLastLink(); }
- JSULink<T>* getNth(int index) { return (JSULink<T>*)getNthLink(index); }
+ JSULink<T>* getNth(u32 index) const { return (JSULink<T>*)getNthLink(index); }
JSULink<T>* getEnd() const { return NULL; }
- u32 getNumLinks() const { return this->JSUPtrList::getNumLinks(); }
+ u32 getNumLinks() const { return mLength; }
};
/**
diff --git a/include/JSystem/TPosition3.h b/include/JSystem/TPosition3.h
index 807ce4fea5..92de4b5811 100644
--- a/include/JSystem/TPosition3.h
+++ b/include/JSystem/TPosition3.h
@@ -16,8 +16,6 @@ template <>
struct SMatrix34C<f32> {
f32 data[3][4];
- void identity() { MTXIdentity(data); }
-
typedef f32 ArrType[4];
void set(const ArrType* src) {
JMath::gekko_ps_copy12(data, src);
@@ -54,7 +52,9 @@ struct SMatrix33C {
};
template <typename T>
-struct TMatrix34 : public T {};
+struct TMatrix34 : public T {
+ void identity() { MTXIdentity(data); }
+};
template <typename T>
struct TRotation3 : public T {};
@@ -77,9 +77,11 @@ struct TRotation3<SMatrix33C<T> > : public SMatrix33C<T> {
};
template <typename T>
-struct TPosition3 : public T {};
+struct TPosition3 : public T {
+ TPosition3() {}
+};
-typedef TPosition3<TRotation3<TMatrix34<SMatrix34C<f32> > > > TPosition3f32;
+typedef TPosition3<TMatrix34<SMatrix34C<f32> > > TPosition3f32;
} // namespace JGeometry