This commit is contained in:
Jcw87
2023-07-20 02:43:10 -07:00
parent 250110cd10
commit 7e2cf84a88
11 changed files with 433 additions and 215 deletions
+47
View File
@@ -1,8 +1,55 @@
#ifndef JAISEQ_H
#define JAISEQ_H
#include "JSystem/JAudio2/JAISeqDataMgr.h"
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASHeapCtrl.h"
#include "JSystem/JAudio2/JASTrack.h"
#include "JSystem/JSupport/JSUList.h"
class JAISeqMgr;
class JAISoundChild;
class JAISeq : public JAISound, JSULink<JAISeq> {
public:
class TInner {
public:
TInner() : mSeqData(NULL, 0) {}
/* 0x000 */ JASTrack outputTrack;
/* 0x248 */ JASPoolAllocObject<JAISoundChild>* mSoundChild[32];
/* 0x2C8 */ JAITempoMgr mTempoMgr;
/* 0x2D8 */ JASSoundParams mSoundParams;
/* 0x2EC */ JAISeqData mSeqData;
/* 0x2F4 */ s32 field_0x39c;
/* 0x2F8 */ JAISeqMgr* seqMgr;
/* 0x2FC */ JAISoundStrategyMgr<JAISeq>* strategyMgr;
};
/* 802A1570 */ virtual s32 getNumChild() const;
/* 802A1578 */ virtual JAISoundChild* getChild(int);
/* 802A165C */ virtual void releaseChild(int);
/* 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);
/* 802A0CA4 */ void reserveChildTracks_(int);
/* 802A0E48 */ void releaseChildTracks_();
/* 802A0EDC */ bool prepare_getSeqData_();
/* 802A0F90 */ bool prepare_(JASSoundParams const&, JAISoundActivity);
/* 802A108C */ void JAISeqMgr_calc_();
/* 802A1180 */ void die_();
/* 802A1348 */ void mixOut_(JASSoundParams const&, JAISoundActivity);
/* 802A14FC */ void JAISeqMgr_mixOut_(JASSoundParams const&, JAISoundActivity);
/* 0x0a8 */ TInner inner_;
/* 0x3A8 */ JAISoundStrategyMgr__unknown<JAISeq>* field_0x3a8;
};
#endif /* JAISEQ_H */
+5 -3
View File
@@ -27,11 +27,13 @@ public:
/* 802A1804 */ virtual bool isUsingSeqData(JAISeqDataRegion const&);
/* 802A1870 */ virtual int releaseSeqData(JAISeqDataRegion const&);
JAISeqDataMgr* getSeqDataMgr() { return seqDataMgr_; }
private:
/* 0x04 */ JAISoundActivity mActivity;
/* 0x08 */ void* field_0x8;
/* 0x0C */ JAIAudience* mAudience;
/* 0x10 */ JAISeqDataMgr* seqDataMgr_;
/* 0x08 */ JAIAudience* mAudience;
/* 0x0C */ JAISeqDataMgr* seqDataMgr_;
/* 0x10 */ void* field_0x10;
/* 0x14 */ JAISoundParamsMove mMove;
/* 0x64 */ JSUList<JAISeq> mSeqList;
/* 0x70 */ int field_0x70;
+5 -4
View File
@@ -185,6 +185,7 @@ class JAIAudible;
class JAIAudience;
class JAISe;
class JAISeq;
class JAISoundChild;
class JAIStream;
class JAITempoMgr;
class JAISound {
@@ -203,14 +204,14 @@ public:
/* 802A26B8 */ bool calc_JAISound_();
/* 802A29DC */ void initTrack_JAISound_(JASTrack*);
virtual void getNumChild() = 0;
virtual void getChild() = 0;
virtual void releaseChild() = 0;
virtual s32 getNumChild() const = 0;
virtual JAISoundChild* getChild(int) = 0;
virtual void releaseChild(int) = 0;
/* 802A25D8 */ virtual JAISe* asSe();
/* 802A25E0 */ virtual JAISeq* asSeq();
/* 802A25E8 */ virtual JAIStream* asStream();
virtual JASTrack* getTrack() = 0;
virtual JASTrack* getChildTrack() = 0;
virtual JASTrack* getChildTrack(int) = 0;
virtual JAITempoMgr* getTempoMgr() = 0;
virtual bool JAISound_tryDie_() = 0;
+2
View File
@@ -11,6 +11,8 @@ struct JAISoundChild {
/* 802A2B28 */ void mixOut(JASTrack*);
/* 802A2B7C */ void calc();
JAISoundChild() { init(); }
/* 0x00 */ JAISoundParamsMove mMove;
/* 0x50 */ JASSoundParams mParams;
}; // Size: 0x64
+113 -2
View File
@@ -1,14 +1,125 @@
#ifndef JASHEAPCTRL_H
#define JASHEAPCTRL_H
#include "dolphin/types.h"
#include "JSystem/JSupport/JSUList.h"
#include "dolphin/os/OSInterrupt.h"
#include "dolphin/os/OSMutex.h"
class JASDisposer;
class JASHeap {
/* 80290140 */ JASHeap(JASDisposer*);
/* 802901AC */ void initRootHeap(void*, u32);
/* 8029021C */ void alloc(JASHeap*, u32);
/* 802903F4 */ void allocTail(JASHeap*, u32);
/* 802904E4 */ void free();
/* 80290608 */ void insertChild(JASHeap*, JASHeap*, void*, u32, bool);
/* 802906F0 */ void getTailHeap();
/* 8029077C */ void getTailOffset();
/* 802907E0 */ void getCurOffset();
/* 80290B54 */ ~JASHeap();
/* 0x00 */ JSUTree<JASHeap> mTree;
/* 0x1C */ OSMutex mMutex;
/* 0x34 */ JASDisposer* mDisposer;
/* 0x38 */ int field_0x38;
/* 0x3c */ int field_0x3c;
/* 0x40 */ void* field_0x40;
};
struct JASGenericMemPool {
/* 80290848 */ JASGenericMemPool();
/* 80290860 */ ~JASGenericMemPool();
/* 802908C8 */ void newMemPool(u32, int);
/* 80290948 */ void alloc(u32);
/* 80290948 */ void* alloc(u32);
/* 80290994 */ void free(void*, u32);
/* 0x00 */ void* field_0x0;
/* 0x04 */ int freeMemCount;
/* 0x08 */ int totalMemCount;
/* 0x0C */ int field_0xc;
};
namespace JASThreadingModel {
template <typename A0>
struct InterruptsDisable {
struct Lock {
Lock(const A0& param_0) { field_0x0 = OSDisableInterrupts(); }
~Lock() { OSRestoreInterrupts(field_0x0); }
BOOL field_0x0;
};
};
};
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); }
};
template <typename T>
class JASPoolAllocObject : public T {
public:
static void* operator new(size_t n) {
JASMemPool<T>* memPool = getMemPool();
return memPool->alloc(n);
}
static void operator delete(void* ptr, size_t n) {
JASMemPool<T>* memPool_ = getMemPool();
memPool_->free(ptr, n);
}
static void newMemPool(int param_0) {
JASMemPool<T>* memPool_ = getMemPool();
memPool_->newMemPool(param_0);
}
private:
static JASMemPool<T>* getMemPool() {
static JASMemPool<T> memPool_;
return &memPool_;
}
};
template <typename T>
class JASMemPool_MultiThreaded : public JASGenericMemPool {
public:
void newMemPool(int param_0) {
JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
JASGenericMemPool::newMemPool(sizeof(T), param_0);
}
void* alloc(size_t count) {
JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
return JASGenericMemPool::alloc(count);
}
void free(void* ptr, u32 param_1) {
JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
JASGenericMemPool::free(ptr, param_1);
}
};
template <typename T>
class JASPoolAllocObject_MultiThreaded : public T {
public:
static void* operator new(size_t n) {
JASMemPool_MultiThreaded<T>* memPool_ = getMemPool();
return memPool_->alloc(n);
}
static void operator delete(void* ptr, size_t n) {
JASMemPool_MultiThreaded<T>* memPool_ = getMemPool();
memPool_->free(ptr, n);
}
private:
static JASMemPool_MultiThreaded<T>* getMemPool() {
static JASMemPool_MultiThreaded<T> memPool_;
return &memPool_;
}
};
#endif /* JASHEAPCTRL_H */
+4 -1
View File
@@ -125,7 +125,10 @@ struct JASTrack {
int getChannelMgrCount() { return channelMgrCount; }
u8 getStatus() const { return mStatus; }
JASTrack* getChild(int index) { return field_0x130[index]; }
JASTrack* getChild(u32 index) { return field_0x130[index]; }
void setAutoDelete(bool param_0) {
field_0x216 = (param_0 << 4) | field_0x216 & ~0x10;
}
/* 0x000 */ u8 field_0x0[0x5c]; // JASSeqCtrl
/* 0x05C */ u8 field_0x5c[0x24]; // JASTrackPort