Work on J2DMaterialFactory (#394)

* Work on J2DMaterialFactory

* J3DUClipper OK

* Work on JAISoundStarter

* JAISoundHandles OK

* JAISoundInfo OK

* Fix JAISound::isStopping

* Work on J2DTextBoxEx

* dspproc OK

* osdsp OK

* osdsp_task OK

* Work on dsptask

* Import some JASCalc code

* JASCallback OK

* JASOscillator OK

* JASLfo OK
This commit is contained in:
hatal175
2023-08-01 10:17:21 +03:00
committed by GitHub
parent 396449b597
commit 2275eb710b
122 changed files with 1901 additions and 4402 deletions
+1 -5
View File
@@ -47,11 +47,7 @@ public:
JAISoundParamsMove* getParams() { return &mParams; }
int getMaxSe() const {
if (mMaxActiveSe == 0) {
return 0;
}
return mMaxActiveSe + mMaxInactiveSe;
return (mMaxActiveSe == 0) ? 0 : mMaxActiveSe + mMaxInactiveSe;
}
int getMaxActiveSe() const { return mMaxActiveSe; }
void setMaxActiveSe(int se) { mMaxActiveSe = se; }
+32 -5
View File
@@ -2,6 +2,7 @@
#define JAISOUND_H
#include "JSystem/JAudio2/JAISoundParams.h"
#include "JSystem/JAudio2/JAIAudible.h"
#include "JSystem/JGeometry.h"
#include "dolphin/types.h"
#include "global.h"
@@ -55,6 +56,9 @@ struct JAISoundStatus_ {
inline bool isMute() { return field_0x0.flags.mute; }
inline bool isPaused() { return field_0x0.flags.paused; }
void pauseWhenOut() {
field_0x1.flags.flag6 = 1;
}
/* 0x0 */ union {
u8 value;
@@ -115,10 +119,7 @@ struct JAISoundFader {
}
}
bool isOut() {
if (mTransition.mCount != 0 || mIntensity < 0.01f) {
return true;
}
return false;
return (mTransition.mCount == 0 && mIntensity < 0.01f);
}
inline void calc() { mIntensity = mTransition.apply(mIntensity); }
f32 getIntensity() { return mIntensity; }
@@ -227,7 +228,7 @@ public:
bool isStopping() {
bool isStopping = false;
if (status_.state.flags.flag1) {
isStopping = status_.state.flags.flag5 ? fader.isOut() : true;
isStopping = !status_.state.flags.flag5 || fader.isOut();
}
return isStopping;
}
@@ -236,6 +237,32 @@ public:
status_.field_0x0.flags.paused = param_0;
}
void updateLifeTime(u32 param_0) {
if (lifeTime < param_0) {
lifeTime = param_0;
}
}
void setLifeTime(u32 param_0, bool param_1) {
lifeTime = param_0;
setComesBack(param_1);
status_.field_0x1.flags.flag2 = 1;
}
void setComesBack(bool param_0) {
status_.field_0x1.flags.flag1 = 1;
if (param_0) {
status_.pauseWhenOut();
}
}
bool setPos(const JGeometry::TVec3<f32>& param_1) {
if (audible_ != NULL) {
audible_->setPos(param_1);
}
return audible_ != NULL;
}
/* 0x04 */ JAISoundHandle* handle_;
/* 0x08 */ JAIAudible* audible_;
/* 0x0C */ JAIAudience* audience_;
+1 -1
View File
@@ -36,7 +36,7 @@ public:
numHandles_ = param_1;
};
void getHandleSoundID(JAISoundID);
JAISoundHandle* getHandleSoundID(JAISoundID);
JAISoundHandle* getFreeHandle();
private:
+1 -1
View File
@@ -6,9 +6,9 @@
struct JAISoundStarter : public JASGlobalInstance<JAISoundStarter> {
/* 802A2F6C */ JAISoundStarter(bool);
/* 802A2FEC */ void startLevelSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
virtual ~JAISoundStarter();
/* 802A2FEC */ bool startLevelSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
};
#endif /* JAISOUNDSTARTER_H */
+24
View File
@@ -2,5 +2,29 @@
#define JASCALC_H
#include "dolphin/types.h"
#include "MSL_C/MSL_Common/Src/limits"
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);
/* 8028F578 */ static f32 pow2(f32);
template <typename A, typename B>
static A clamp(B x); /* {
if (std::numeric_limits<A>::min() >= x)
return std::numeric_limits<A>::min();
if (x >= std::numeric_limits<A>::max())
return std::numeric_limits<A>::max();
return x;
} */
f32 fake1();
f32 fake2(long x);
f32 fake3();
static u8 const CUTOFF_TO_IIR_TABLE[1024];
};
#endif /* JASCALC_H */
+29
View File
@@ -3,4 +3,33 @@
#include "dolphin/types.h"
typedef long JASCallback(void*);
struct JASCallbackMgr {
struct TCallback {
TCallback()
: mFunction(NULL)
, mArgument(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;
};
bool regist(JASCallback*, void*);
int reject(JASCallback*, void*);
void callback();
/* 0x00 */ TCallback mCallbacks[0x20];
};
#endif /* JASCALLBACK_H */
+17
View File
@@ -3,4 +3,21 @@
#include "dolphin/types.h"
struct JASLfo {
/* 8029BD14 */ JASLfo();
/* 8029BD44 */ f32 getValue() const;
/* 8029BDD8 */ void incCounter(f32);
/* 8029BE2C */ void resetCounter();
static JASLfo sFreeRunLfo;
/* 0x00 */ u32 field_0x0;
/* 0x04 */ u32 field_0x4;
/* 0x08 */ f32 field_0x8;
/* 0x0C */ f32 field_0xC;
/* 0x10 */ f32 field_0x10;
/* 0x14 */ u16 field_0x14;
/* 0x16 */ u16 field_0x16;
};
#endif /* JASLFO_H */
+41
View File
@@ -3,4 +3,45 @@
#include "dolphin/types.h"
struct JASOscillator {
struct Data {
/* 0x00 */ u32 _00;
/* 0x04 */ f32 _04;
/* 0x08 */ short* _08;
/* 0x0C */ short* _0C;
/* 0x10 */ f32 _10;
/* 0x14 */ f32 _14;
};
JASOscillator();
void initStart(const Data*);
void incCounter(f32 param_0);
f32 getValue() const;
void release();
void update();
void updateCurrentValue(f32 param_0);
void stop() {
_1C = 0;
}
/* 0x00 */ const Data* mData;
/* 0x04 */ f32 _04;
/* 0x08 */ f32 _08;
/* 0x0C */ f32 _0C;
/* 0x10 */ f32 _10;
/* 0x14 */ u16 _14;
/* 0x16 */ u16 _16;
/* 0x18 */ u8 _18;
/* 0x1A */ u16 _1A;
/* 0x1C */ int _1C;
static const f32 sCurveTableLinear[17];
static const f32 sCurveTableSampleCell[17];
static const f32 sCurveTableSqRoot[17];
static const f32 sCurveTableSquare[17];
};
#endif /* JASOSCILLATOR_H */
+3
View File
@@ -4,4 +4,7 @@
#include "dolphin/types.h"
#include "dolphin/dsp/dsp.h"
void DsyncFrame2ch(u32 param_0, u32 param_1, u32 param_2);
void DsyncFrame4ch(u32 param_0, u32 param_1, u32 param_2, u32 param_3, u32 param_4);
#endif /* DSPPROC_H */
+6
View File
@@ -3,4 +3,10 @@
#include "dolphin/types.h"
struct DSPTaskInfo;
struct STRUCT_DSP_TASK;
extern "C" DSPTaskInfo* DSPAddTask(DSPTaskInfo*);
void DSPAddPriorTask(STRUCT_DSP_TASK*);
#endif /* OSDSP_H */
+15
View File
@@ -2,5 +2,20 @@
#define OSDSP_TASK_H
#include "dolphin/types.h"
#include "dolphin/os/OSInterrupt.h"
struct DSPTaskInfo;
extern DSPTaskInfo* DSP_prior_task;
#ifdef __cplusplus
extern "C" {
#endif
void __DSPHandler(OSInterrupt interrupt, OSContext* context);
#ifdef __cplusplus
}
#endif
#endif /* OSDSP_TASK_H */