summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2026-10-27 00:29:52 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2026-10-27 00:29:52 -0400
commit81ebe0dfd449166e00de31ce9be2d7449e31536c (patch)
tree0f7b648f69950c3d5edd916041ac52697c94ca4d /include
parent02de6b772d06b2ed15bbe7b25d01901fdca84966 (diff)
Work on JAS inlines, fix limits/climits headers
Diffstat (limited to 'include')
-rw-r--r--include/JSystem/JAudio/JASAiCtrl.h10
-rw-r--r--include/JSystem/JAudio/JASAudioThread.h3
-rw-r--r--include/JSystem/JAudio/JASHardStream.h27
-rw-r--r--include/JSystem/JAudio/JASRegisterParam.h32
-rw-r--r--include/JSystem/JAudio/JASSeqCtrl.h8
-rw-r--r--include/JSystem/JKernel/JKRThread.h13
-rw-r--r--include/JSystem/JMath/random.h9
-rw-r--r--include/JSystem/JUtility/JUTException.h2
-rw-r--r--include/dolphin/types.h12
9 files changed, 67 insertions, 49 deletions
diff --git a/include/JSystem/JAudio/JASAiCtrl.h b/include/JSystem/JAudio/JASAiCtrl.h
index d6701af5..4f9d892c 100644
--- a/include/JSystem/JAudio/JASAiCtrl.h
+++ b/include/JSystem/JAudio/JASAiCtrl.h
@@ -32,7 +32,15 @@ namespace JASystem {
extern s16* (*extMixCallback)(s32);
extern u8 extMixMode;
- inline void JASAiMixLimit16(s32) {} // TODO
+ inline s16 JASAiMixLimit16(s32 val) {
+ if (val < -0x8000) {
+ return -0x7fff;
+ } else if (val > 0x7fff) {
+ return 0x7fff;
+ } else {
+ return val;
+ }
+ }
}
}
diff --git a/include/JSystem/JAudio/JASAudioThread.h b/include/JSystem/JAudio/JASAudioThread.h
index acb06c71..d2fde599 100644
--- a/include/JSystem/JAudio/JASAudioThread.h
+++ b/include/JSystem/JAudio/JASAudioThread.h
@@ -25,6 +25,9 @@ namespace JASystem {
extern OSPriority sDVDPrio;
extern vs32 snIntCount;
extern int sbIsDSPBoot;
+
+ inline u32 getDSPSyncCount() { return snIntCount; }
+ inline void setDSPSyncCount(u32 count) { snIntCount = count; }
};
}
diff --git a/include/JSystem/JAudio/JASHardStream.h b/include/JSystem/JAudio/JASHardStream.h
index 94e60b4d..cce3aa30 100644
--- a/include/JSystem/JAudio/JASHardStream.h
+++ b/include/JSystem/JAudio/JASHardStream.h
@@ -59,23 +59,24 @@ namespace JASystem {
void calcCurVolume();
u8 volFloatToU8(f32);
- void getLastAddrBefore() {}
TPlayList* getList() { return mpList; }
- void getPlayArea() {}
- void getRestart() {}
- void getState() {}
void setList(TPlayList* list) { mpList = list; }
- void setPlayArea(u16) {}
- void setRestart(u8) {}
- void setState(u8) {}
+ u16 getPlayArea() { return mPlayArea; }
+ void setPlayArea(u16 area) { mPlayArea = area; }
+ u8 getRestart() { return mRestart; }
+ void setRestart(u8 restart) { mRestart = restart; }
+ u8 getState() { return mState; }
+ void setState(u8 state) { mState = state; }
+ u32 getLastAddrBefore() { return mAddrs[mAddrIdx ^ 1]; }
+ private:
/* 0x00 */ int field_0x0;
/* 0x04 */ TPlayList* mpList;
- /* 0x08 */ u16 field_0x8;
- /* 0x0A */ u8 field_0xa;
- /* 0x0B */ u8 field_0xb;
+ /* 0x08 */ u16 mPlayArea;
+ /* 0x0A */ u8 mRestart;
+ /* 0x0B */ u8 mState;
/* 0x0C */ f32 field_0xc;
- /* 0x10 */ f32 field_0x10;
+ /* 0x10 */ f32 mCurVolume;
/* 0x14 */ u32 field_0x14;
/* 0x18 */ u32 field_0x18;
/* 0x1C */ u32 field_0x1c;
@@ -88,8 +89,8 @@ namespace JASystem {
/* 0x38 */ u32 field_0x38;
/* 0x3C */ u32 field_0x3c;
/* 0x40 */ u32 field_0x40;
- /* 0x44 */ u32 field_0x44[2];
- /* 0x4C */ u8 field_0x4c;
+ /* 0x44 */ u32 mAddrs[2];
+ /* 0x4C */ u8 mAddrIdx;
};
extern TControl strCtrl;
diff --git a/include/JSystem/JAudio/JASRegisterParam.h b/include/JSystem/JAudio/JASRegisterParam.h
index 96145686..2990717a 100644
--- a/include/JSystem/JAudio/JASRegisterParam.h
+++ b/include/JSystem/JAudio/JASRegisterParam.h
@@ -7,9 +7,13 @@
namespace JASystem {
class TRegisterParam {
public:
- static const u8 PARAM_REG_XY = 0x23;
- static const u8 PARAM_REG_AR0 = 0x28;
- static const u8 PARAM_REG_AR3 = 0x2B;
+ enum {
+ /* 0x23 */ PARAM_REG_XY = 0x23,
+ /* 0x28 */ PARAM_REG_AR0 = 0x28,
+ /* 0x29 */ PARAM_REG_AR1 = 0x29,
+ /* 0x2A */ PARAM_REG_AR2 = 0x2A,
+ /* 0x2B */ PARAM_REG_AR3 = 0x2B,
+ };
TRegisterParam();
void init();
@@ -20,15 +24,14 @@ namespace JASystem {
u32 getAddress(int index) const {
JUT_ASSERT(130, index >= 0);
JUT_ASSERT(131, index < 4);
- return field_0x20[index];
+ return mAddress[index];
}
void setAddress(int index, u32 value) {
JUT_ASSERT(124, index >= 0);
JUT_ASSERT(125, index < 4);
- field_0x20[index] = value;
+ mAddress[index] = value;
}
- void getBendSense() const {}
u16 getPanPowerBank() const {
return mPanPower[0];
}
@@ -44,18 +47,23 @@ namespace JASystem {
u16 getPanPowerTrack() const {
return mPanPower[4];
}
- void getPriority() const {}
+ void setPanPower(int i, u16 power) { mPanPower[i] = power; }
+
u16 getFlag() const { return field_0x0[3]; }
void setFlag(u16 flag) { field_0x0[3] = flag; }
- void setPanPower(int i, u16 power) { mPanPower[i] = power; }
- /* 0x00 */ u16 field_0x0[6];
+ // TODO
+ void getBendSense() const {}
+ void getPriority() const {}
+
+ // private:
+ /* 0x00 */ u16 field_0x0[6]; // TODO unsure how long this array really is
/* 0x0C */ u16 field_0xc;
- /* 0x0E */ u16 field_0xe;
+ /* 0x0E */ u16 field_0xe; // BendSense?
/* 0x10 */ u16 mPanPower[5];
- /* 0x1A */ u16 field_0x1a;
+ /* 0x1A */ u16 field_0x1a; // Priority?
/* 0x1C */ int field_0x1c;
- /* 0x20 */ u32 field_0x20[4];
+ /* 0x20 */ u32 mAddress[4];
};
}
diff --git a/include/JSystem/JAudio/JASSeqCtrl.h b/include/JSystem/JAudio/JASSeqCtrl.h
index 3c5b3c09..123e6a13 100644
--- a/include/JSystem/JAudio/JASSeqCtrl.h
+++ b/include/JSystem/JAudio/JASSeqCtrl.h
@@ -12,7 +12,8 @@ namespace JASystem {
mLoopStartPositions[mLoopIndex++] = mCurrentFilePtr;
mCurrentFilePtr = mRawFilePtr + offset;
}
- void clrIntr() { mPreviousFilePtr = 0; }
+ void clrIntr() { mPreviousFilePtr = NULL; }
+ bool isIntr() const { return mPreviousFilePtr != NULL; }
u8* getAddr(u32 offset) { return mRawFilePtr + offset; }
u8* getBase() { return mRawFilePtr; }
u8 getByte(u32 offset) const { return mRawFilePtr[offset]; }
@@ -23,7 +24,6 @@ namespace JASystem {
return mLoopTimers[mLoopIndex - 1];
}
s32 getWait() const { return mWaitTimer; }
- void isIntr() const {}
void jump(u32 offset) {
mCurrentFilePtr = mRawFilePtr + offset;
}
@@ -33,6 +33,9 @@ namespace JASystem {
}
u8 readByte() { return *mCurrentFilePtr++; }
bool ret() {
+ if (mLoopIndex == 0) {
+ return false;
+ }
mCurrentFilePtr = mLoopStartPositions[--mLoopIndex];
return true;
}
@@ -52,6 +55,7 @@ namespace JASystem {
u16 read16();
u32 read24();
+ // private:
/* 0x00 */ u8* mRawFilePtr;
/* 0x04 */ u8* mCurrentFilePtr;
/* 0x08 */ s32 mWaitTimer;
diff --git a/include/JSystem/JKernel/JKRThread.h b/include/JSystem/JKernel/JKRThread.h
index c8645a8d..b239cd28 100644
--- a/include/JSystem/JKernel/JKRThread.h
+++ b/include/JSystem/JKernel/JKRThread.h
@@ -10,7 +10,6 @@ struct JKRThreadName_ {
char* name;
};
-class JUTConsole;
class JKRThread : public JKRDisposer {
public:
JKRThread(u32 stack_size, int message_count, int param_3);
@@ -20,7 +19,6 @@ public:
/* vt[03] */ virtual void* run() { return NULL; }
OSThread* getThreadRecord() const { return mThreadRecord; }
- void* getStack() const { return mStackMemory; }
JKRHeap* getCurrentHeap() const { return mCurrentHeap; }
s32 getCurrentHeapError() const { return mCurrentHeapError; }
@@ -30,25 +28,14 @@ public:
void resume() { OSResumeThread(mThreadRecord); }
protected:
- BOOL sendMessage(OSMessage message) {
- return OSSendMessage(&mMessageQueue, message, OS_MESSAGE_NOBLOCK);
- }
BOOL sendMessageBlock(OSMessage message) {
return OSSendMessage(&mMessageQueue, message, OS_MESSAGE_BLOCK);
}
OSMessage waitMessage() {
OSMessage message;
- OSReceiveMessage(&mMessageQueue, &message, OS_MESSAGE_NOBLOCK);
- return message;
- }
- OSMessage waitMessageBlock() {
- OSMessage message;
OSReceiveMessage(&mMessageQueue, &message, OS_MESSAGE_BLOCK);
return message;
}
- void jamMessageBlock(OSMessage message) {
- OSJamMessage(&mMessageQueue, message, OS_MESSAGE_BLOCK);
- }
private:
/* 0x00 */ // vtable
diff --git a/include/JSystem/JMath/random.h b/include/JSystem/JMath/random.h
index 2d4382e6..c5d42ea3 100644
--- a/include/JSystem/JMath/random.h
+++ b/include/JSystem/JMath/random.h
@@ -2,6 +2,7 @@
#define RANDOM_H
#include "dolphin/types.h"
+#include <limits>
namespace JMath {
struct TRandom_fast_ {
@@ -56,6 +57,14 @@ public:
u32 get_uint32(u32 param_0) {
return this->get_ufloat_1() * param_0;
}
+
+ f32 get_ufloat(f32 param_0) {
+ return this->get_ufloat_1() * param_0;
+ }
+
+ f32 get_float(f32 param_0) {
+ return this->get_ufloat(param_0) - ((param_0 / 2.0f) - std::numeric_limits<f32>::epsilon());
+ }
};
} // namespace JMath
diff --git a/include/JSystem/JUtility/JUTException.h b/include/JSystem/JUtility/JUTException.h
index aa3ad31a..e3ef995f 100644
--- a/include/JSystem/JUtility/JUTException.h
+++ b/include/JSystem/JUtility/JUTException.h
@@ -3,12 +3,14 @@
#include "JSystem/JKernel/JKRThread.h"
#include "JSystem/JUtility/JUTGamePad.h"
+#include "dolphin/gx/GX.h"
#include "stdarg.h"
#include "dolphin/gx/GXEnum.h"
#include "dolphin/os/OSError.h"
#include "global.h"
class JUTDirectPrint;
+class JUTConsole;
class JUTExternalFB {
public:
diff --git a/include/dolphin/types.h b/include/dolphin/types.h
index 7fddbfaf..8be45190 100644
--- a/include/dolphin/types.h
+++ b/include/dolphin/types.h
@@ -84,13 +84,9 @@ typedef unsigned int uint;
#define __REGISTER
#endif
-#include "stddef.h" // IWYU pragma: export
-#include "stdint.h" // IWYU pragma: export
-
-#define INT32_MAX (0x7fffffff)
-#define UINT32_MAX (0xffffffff)
-
-#define FLOAT_MIN (1.175494351e-38f)
-#define FLOAT_MAX (3.40282346638528860e+38f)
+#include <stddef.h> // IWYU pragma: export
+#include <stdint.h> // IWYU pragma: export
+#include <limits.h> // IWYU pragma: export
+#include <float.h> // IWYU pragma: export
#endif