summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJcw87 <Jcw87@users.noreply.github.com>2023-09-07 09:50:36 -0700
committerGitHub <noreply@github.com>2023-09-07 19:50:36 +0300
commit3dd1963a59c4cf80c0348f10532d2ce445dec7de (patch)
tree0d948d80170ec4a0193acb3b8c62d24889561f88
parentd56a9719ea1f2a325a5013bd4f8c94fb76f21599 (diff)
JAUInitializer (#1915)
* JAUInitializer * forgot a couple things
-rw-r--r--asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JAIInitializerFv.s10
-rw-r--r--asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JASInitializerFv.s23
-rw-r--r--include/JSystem/JAudio2/JAIStream.h42
-rw-r--r--include/JSystem/JAudio2/JASAramStream.h94
-rw-r--r--include/JSystem/JAudio2/JASAudioThread.h1
-rw-r--r--include/JSystem/JAudio2/JASHeapCtrl.h30
-rw-r--r--include/JSystem/JAudio2/JASTrack.h10
-rw-r--r--include/JSystem/JAudio2/JASWaveArcLoader.h34
-rw-r--r--include/JSystem/JAudio2/JAUInitializer.h33
-rw-r--r--include/JSystem/JKernel/JKRThread.h1
-rw-r--r--libs/JSystem/JAudio2/JAIStream.cpp34
-rw-r--r--libs/JSystem/JAudio2/JASAramStream.cpp38
-rw-r--r--libs/JSystem/JAudio2/JASHeapCtrl.cpp25
-rw-r--r--libs/JSystem/JAudio2/JAUInitializer.cpp215
-rw-r--r--libs/Z2AudioLib/Z2AudioMgr.cpp4
-rw-r--r--src/d/a/d_a_alink.cpp4
16 files changed, 302 insertions, 296 deletions
diff --git a/asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JAIInitializerFv.s b/asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JAIInitializerFv.s
deleted file mode 100644
index 145ad83f62..0000000000
--- a/asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JAIInitializerFv.s
+++ /dev/null
@@ -1,10 +0,0 @@
-lbl_802A4D3C:
-/* 802A4D3C 38 00 00 64 */ li r0, 0x64
-/* 802A4D40 90 03 00 00 */ stw r0, 0(r3)
-/* 802A4D44 38 00 00 04 */ li r0, 4
-/* 802A4D48 90 03 00 04 */ stw r0, 4(r3)
-/* 802A4D4C 38 00 00 02 */ li r0, 2
-/* 802A4D50 90 03 00 08 */ stw r0, 8(r3)
-/* 802A4D54 38 00 00 10 */ li r0, 0x10
-/* 802A4D58 90 03 00 0C */ stw r0, 0xc(r3)
-/* 802A4D5C 4E 80 00 20 */ blr
diff --git a/asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JASInitializerFv.s b/asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JASInitializerFv.s
deleted file mode 100644
index dad27130f3..0000000000
--- a/asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JASInitializerFv.s
+++ /dev/null
@@ -1,23 +0,0 @@
-lbl_802A4AD0:
-/* 802A4AD0 38 A0 00 00 */ li r5, 0
-/* 802A4AD4 90 A3 00 00 */ stw r5, 0(r3)
-/* 802A4AD8 90 A3 00 04 */ stw r5, 4(r3)
-/* 802A4ADC 38 00 FF FF */ li r0, -1
-/* 802A4AE0 90 03 00 14 */ stw r0, 0x14(r3)
-/* 802A4AE4 90 03 00 18 */ stw r0, 0x18(r3)
-/* 802A4AE8 38 00 10 00 */ li r0, 0x1000
-/* 802A4AEC 90 03 00 08 */ stw r0, 8(r3)
-/* 802A4AF0 38 00 00 03 */ li r0, 3
-/* 802A4AF4 90 03 00 0C */ stw r0, 0xc(r3)
-/* 802A4AF8 38 80 00 02 */ li r4, 2
-/* 802A4AFC 90 83 00 10 */ stw r4, 0x10(r3)
-/* 802A4B00 38 00 00 80 */ li r0, 0x80
-/* 802A4B04 90 03 00 1C */ stw r0, 0x1c(r3)
-/* 802A4B08 C0 02 BE 10 */ lfs f0, lit_730(r2)
-/* 802A4B0C D0 03 00 2C */ stfs f0, 0x2c(r3)
-/* 802A4B10 38 00 27 60 */ li r0, 0x2760
-/* 802A4B14 90 03 00 24 */ stw r0, 0x24(r3)
-/* 802A4B18 90 83 00 28 */ stw r4, 0x28(r3)
-/* 802A4B1C 90 A3 00 20 */ stw r5, 0x20(r3)
-/* 802A4B20 90 A3 00 30 */ stw r5, 0x30(r3)
-/* 802A4B24 4E 80 00 20 */ blr
diff --git a/include/JSystem/JAudio2/JAIStream.h b/include/JSystem/JAudio2/JAIStream.h
index 91b83630fe..59a8f63232 100644
--- a/include/JSystem/JAudio2/JAIStream.h
+++ b/include/JSystem/JAudio2/JAIStream.h
@@ -2,5 +2,47 @@
#define JAISTREAM_H
#include "JSystem/JAudio2/JAISound.h"
+#include "JSystem/JAudio2/JASAramStream.h"
+#include "JSystem/JSupport/JSUList.h"
+
+class JAIStreamMgr;
+
+class JAIStream : public JAISound, JSULink<JAIStream> {
+public:
+ struct TInner {
+ JASAramStream field_0x0;
+ };
+
+ /* 802A3104 */ JAIStream(JAIStreamMgr*, JAISoundStrategyMgr<JAIStream>*);
+ /* 802A319C */ void JAIStreamMgr_startID_(JAISoundID, s32, JGeometry::TVec3<f32> const*,
+ JAIAudience*, int);
+ /* 802A3230 */ void prepare_prepareStream_();
+ /* 802A33F4 */ void prepare_();
+ /* 802A3498 */ void prepare_startStream_();
+ /* 802A34E4 */ void JAIStreamMgr_mixOut_(JASSoundParams const&, JAISoundActivity);
+ /* 802A3720 */ void die_JAIStream_();
+ /* 802A37FC */ bool JAISound_tryDie_();
+ /* 802A388C */ void JAIStreamMgr_calc_();
+ /* 802A3948 */ s32 getNumChild() const;
+ /* 802A3950 */ JAISoundChild* getChild(int);
+ /* 802A3A24 */ void releaseChild(int);
+ /* 802A3ABC */ JASTrack* getTrack();
+ /* 802A3AC4 */ JASTrack* getChildTrack(int);
+ /* 802A3ACC */ JAIStream* asStream();
+ /* 802A3AD0 */ JAITempoMgr* getTempoMgr();
+
+ /* 0x0A8 */ TInner field_0x0a8;
+ /* 0x290 */ int field_0x290;
+ /* 0x294 */ s32 field_0x294;
+ /* 0x298 */ int field_0x298;
+ /* 0x29C */ int field_0x29c;
+ /* 0x2A0 */ JAISoundChild* field_0x2a0[6];
+ /* 0x2B8 */ JAIStreamMgr* field_0x2b8;
+ /* 0x2BC */ int field_0x2bc;
+ /* 0x2C0 */ JAISoundStrategyMgr<JAIStream>* field_0x2c0;
+ /* 0x2C4 */ u8 field_0x2C4;
+ /* 0x2C5 */ u8 field_0x2c5;
+ /* 0x2C6 */ u8 field_0x2c6;
+};
#endif /* JAISTREAM_H */
diff --git a/include/JSystem/JAudio2/JASAramStream.h b/include/JSystem/JAudio2/JASAramStream.h
index c366a63a61..39859901ca 100644
--- a/include/JSystem/JAudio2/JASAramStream.h
+++ b/include/JSystem/JAudio2/JASAramStream.h
@@ -1,6 +1,98 @@
#ifndef JASARAMSTREAM_H
#define JASARAMSTREAM_H
-#include "dolphin/types.h"
+#include "dolphin/os/OSMessage.h"
+
+class JASChannel;
+
+namespace JASDsp {
+ class TChannel;
+}
+
+class JASAramStream {
+public:
+ /* 8029631C */ static void initSystem(u32, u32);
+ /* 802963A8 */ JASAramStream();
+ /* 8029649C */ void init(u32, u32, void (*)(u32, JASAramStream*, void*), void*);
+ /* 8029655C */ void prepare(s32, int);
+ /* 80296618 */ void start();
+ /* 8029664C */ void stop(u16);
+ /* 80296684 */ void pause(bool);
+ /* 802966CC */ void cancel();
+ /* 80296710 */ void getBlockSamples() const;
+ /* 8029673C */ void headerLoadTask(void*);
+ /* 8029676C */ void firstLoadTask(void*);
+ /* 80296848 */ void loadToAramTask(void*);
+ /* 80296868 */ void finishTask(void*);
+ /* 802968C8 */ void prepareFinishTask(void*);
+ /* 80296920 */ void headerLoad(u32, int);
+ /* 80296AE8 */ void load();
+ /* 80296D74 */ void channelProcCallback(void*);
+ /* 80296D94 */ void dvdErrorCheck(void*);
+ /* 80296DF0 */ void channelCallback(u32, JASChannel*, JASDsp::TChannel*, void*);
+ /* 80296E2C */ void updateChannel(u32, JASChannel*, JASDsp::TChannel*);
+ /* 802974AC */ void channelProc();
+ /* 80297658 */ void channelStart();
+ /* 80297870 */ void channelStop(u16);
+
+ /* 0x000 */ OSMessageQueue field_0x000;
+ /* 0x020 */ OSMessageQueue field_0x020;
+ /* 0x040 */ void* field_0x040[16];
+ /* 0x080 */ void* field_0x080[4];
+ /* 0x090 */ JASChannel* field_0x090[6];
+ /* 0x0A8 */ int field_0x0a8;
+ /* 0x0AC */ u8 field_0x0ac;
+ /* 0x0AD */ u8 field_0x0ad;
+ /* 0x0AE */ u8 field_0x0ae;
+ /* 0x0AF */ u8 field_0x0AF[0x0B0 - 0x0AF];
+ /* 0x0B0 */ int field_0x0b0;
+ /* 0x0B4 */ int field_0x0b4;
+ /* 0x0B8 */ int field_0x0b8;
+ /* 0x0BC */ int field_0x0bc;
+ /* 0x0C0 */ u8 field_0x0c0;
+ /* 0x0C1 */ u8 field_0x0C1[0x0C4 - 0x0C1];
+ /* 0x0C4 */ int field_0x0c4;
+ /* 0x0C8 */ f32 field_0x0c8;
+ /* 0x0CC */ u8 field_0x0CC[0x108 - 0x0CC];
+ /* 0x108 */ int field_0x108;
+ /* 0x10C */ int field_0x10c;
+ /* 0x110 */ int field_0x110;
+ /* 0x114 */ u8 field_0x114;
+ /* 0x115 */ u8 field_0x115[0x118 - 0x115];
+ /* 0x118 */ int field_0x118;
+ /* 0x11C */ int field_0x11c;
+ /* 0x120 */ int field_0x120;
+ /* 0x124 */ int field_0x124;
+ /* 0x128 */ short field_0x128;
+ /* 0x12A */ u8 field_0x12A[0x12C - 0x12A];
+ /* 0x12C */ int field_0x12c;
+ /* 0x130 */ short field_0x130[6];
+ /* 0x13C */ short field_0x13c[6];
+ /* 0x148 */ int field_0x148;
+ /* 0x14C */ int field_0x14c;
+ /* 0x150 */ void* field_0x150;
+ /* 0x154 */ int field_0x154;
+ /* 0x158 */ short field_0x158;
+ /* 0x15A */ short field_0x15a;
+ /* 0x15C */ int field_0x15c;
+ /* 0x160 */ int field_0x160;
+ /* 0x164 */ int field_0x164;
+ /* 0x168 */ u8 field_0x168;
+ /* 0x169 */ u8 field_0x169[0x16C - 0x169];
+ /* 0x16C */ int field_0x16c;
+ /* 0x170 */ int field_0x170;
+ /* 0x174 */ f32 field_0x174;
+ /* 0x178 */ f32 field_0x178;
+ /* 0x17C */ float field_0x17c[6];
+ /* 0x194 */ float field_0x194[6];
+ /* 0x1AC */ float field_0x1ac[6];
+ /* 0x1C4 */ float field_0x1c4[6];
+ /* 0x1DC */ short field_0x1dc[6];
+
+ static u8 sLoadThread[4];
+ static u8 sReadBuffer[4];
+ static u8 sBlockSize[4];
+ static u8 sChannelMax[4];
+};
#endif /* JASARAMSTREAM_H */
diff --git a/include/JSystem/JAudio2/JASAudioThread.h b/include/JSystem/JAudio2/JASAudioThread.h
index 4eb9ebc18d..04dd028eb4 100644
--- a/include/JSystem/JAudio2/JASAudioThread.h
+++ b/include/JSystem/JAudio2/JASAudioThread.h
@@ -19,6 +19,7 @@ struct JASAudioThread : public JKRThread, public JASGlobalInstance<JASAudioThrea
/* 8029CFBC */ static void DSPCallback(void*);
/* 8029D028 */ virtual ~JASAudioThread() {}
+ static JASAudioThread* getThreadPointer() { return getInstance(); }
static int getDSPSyncCount() { return snIntCount; }
static void setDSPSyncCount(u32 param_0) { snIntCount = param_0; }
diff --git a/include/JSystem/JAudio2/JASHeapCtrl.h b/include/JSystem/JAudio2/JASHeapCtrl.h
index ce17158c6f..db02654e35 100644
--- a/include/JSystem/JAudio2/JASHeapCtrl.h
+++ b/include/JSystem/JAudio2/JASHeapCtrl.h
@@ -2,15 +2,19 @@
#define JASHEAPCTRL_H
#include "JSystem/JSupport/JSUList.h"
+#include "dolphin/os/OSInterrupt.h"
#include "dolphin/os/OSMutex.h"
class JASDisposer;
+class JKRHeap;
+class JKRSolidHeap;
class JASHeap {
+public:
/* 80290140 */ JASHeap(JASDisposer*);
/* 802901AC */ void initRootHeap(void*, u32);
- /* 8029021C */ void alloc(JASHeap*, u32);
- /* 802903F4 */ void allocTail(JASHeap*, u32);
+ /* 8029021C */ bool alloc(JASHeap*, u32);
+ /* 802903F4 */ bool allocTail(JASHeap*, u32);
/* 802904E4 */ void free();
/* 80290608 */ void insertChild(JASHeap*, JASHeap*, void*, u32, bool);
/* 802906F0 */ void getTailHeap();
@@ -18,12 +22,27 @@ class JASHeap {
/* 802907E0 */ void getCurOffset();
/* 80290B54 */ ~JASHeap();
+ void* getBase() { return mBase; }
+
/* 0x00 */ JSUTree<JASHeap> mTree;
/* 0x1C */ OSMutex mMutex;
/* 0x34 */ JASDisposer* mDisposer;
- /* 0x38 */ int field_0x38;
- /* 0x3c */ int field_0x3c;
- /* 0x40 */ void* field_0x40;
+ /* 0x38 */ void* mBase;
+ /* 0x3c */ u32 mSize;
+ /* 0x40 */ JASHeap* field_0x40;
+};
+
+namespace JASKernel {
+ /* 802909B8 */ void setupRootHeap(JKRSolidHeap*, u32);
+ /* 80290AC0 */ JKRHeap* getSystemHeap();
+ /* 80290AC8 */ u32 getCommandHeap();
+ /* 80290AD0 */ void setupAramHeap(u32, u32);
+ /* 80290B08 */ JASHeap* getAramHeap();
+
+ extern u8 audioAramHeap[68];
+ extern u8 sAramBase[4];
+ extern JKRHeap* sSystemHeap;
+ extern u8 sCommandHeap[4];
};
struct JASGenericMemPool {
@@ -125,7 +144,6 @@ private:
}
};
-struct JKRSolidHeap;
extern JKRSolidHeap* JASDram;
#endif /* JASHEAPCTRL_H */
diff --git a/include/JSystem/JAudio2/JASTrack.h b/include/JSystem/JAudio2/JASTrack.h
index bc8b332fa3..7e2106e46a 100644
--- a/include/JSystem/JAudio2/JASTrack.h
+++ b/include/JSystem/JAudio2/JASTrack.h
@@ -9,14 +9,10 @@
struct JASSoundParams;
-struct JASDsp {
- struct TChannel {
- /* 8029E00C */ void setFilterMode(u16);
- /* 8029E044 */ void setIIRFilterParam(s16*);
- /* 8029E06C */ void setFIR8FilterParam(s16*);
- };
+namespace JASDsp {
+ class TChannel;
- static u32 FILTER_MODE_IIR;
+ extern u32 FILTER_MODE_IIR;
};
struct JASChannel {
diff --git a/include/JSystem/JAudio2/JASWaveArcLoader.h b/include/JSystem/JAudio2/JASWaveArcLoader.h
index 971298dcf4..26719245d5 100644
--- a/include/JSystem/JAudio2/JASWaveArcLoader.h
+++ b/include/JSystem/JAudio2/JASWaveArcLoader.h
@@ -1,6 +1,7 @@
#ifndef JASWAVEARCLOADER_H
#define JASWAVEARCLOADER_H
+#include "JSystem/JAudio2/JASHeapCtrl.h"
#include "JSystem/JSupport/JSUList.h"
#include "dol2asm.h"
#include "dolphin/os/OSMutex.h"
@@ -14,39 +15,6 @@ struct JASDisposer {
/* 80290BCC */ virtual void onDispose();
};
-struct JASHeap : JSUTree<JASHeap> {
- /* 80290140 */ JASHeap(JASDisposer*);
- /* 802901AC */ void initRootHeap(void*, u32);
- /* 8029021C */ bool alloc(JASHeap*, u32);
- /* 802903F4 */ bool 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() {}
- void* getBase() { return mBase; }
-
- /* 0x1C */ OSMutex mMutex;
- /* 0x38 */ JASDisposer* mDisposer;
- /* 0x3C */ void* mBase;
- /* 0x40 */ u32 _3c;
- /* 0x44 */ u32 _40;
-};
-
-struct JASKernel {
- /* 802909B8 */ void setupRootHeap(JKRSolidHeap*, u32);
- /* 80290AC0 */ static JKRHeap* getSystemHeap();
- /* 80290AC8 */ u32 getCommandHeap();
- /* 80290AD0 */ void setupAramHeap(u32, u32);
- /* 80290B08 */ static JASHeap* getAramHeap();
-
- static u8 audioAramHeap[68];
- static u8 sAramBase[4];
- static JKRHeap* sSystemHeap;
- static u8 sCommandHeap[4];
-};
-
#define DIR_MAX 64
struct JASWaveArcLoader {
/* 8029A0A0 */ static JASHeap* getRootHeap();
diff --git a/include/JSystem/JAudio2/JAUInitializer.h b/include/JSystem/JAudio2/JAUInitializer.h
index e97740914b..bf00750a5b 100644
--- a/include/JSystem/JAudio2/JAUInitializer.h
+++ b/include/JSystem/JAudio2/JAUInitializer.h
@@ -3,4 +3,37 @@
#include "dolphin/types.h"
+class JKRSolidHeap;
+
+class JAU_JASInitializer {
+public:
+ /* 802A4AD0 */ JAU_JASInitializer();
+ /* 802A4B28 */ void initJASystem(JKRSolidHeap*);
+
+ /* 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;
+ /* 0x1C */ int field_0x1c;
+ /* 0x20 */ int field_0x20;
+ /* 0x24 */ int field_0x24;
+ /* 0x28 */ int field_0x28;
+ /* 0x2C */ f32 field_0x2c;
+ /* 0x30 */ char* field_0x30;
+};
+
+class JAU_JAIInitializer {
+public:
+ /* 802A4D3C */ JAU_JAIInitializer();
+ /* 802A4D60 */ void initJAInterface();
+
+ int field_0x0;
+ int field_0x4;
+ int field_0x8;
+ int field_0xc;
+};
+
#endif /* JAUINITIALIZER_H */
diff --git a/include/JSystem/JKernel/JKRThread.h b/include/JSystem/JKernel/JKRThread.h
index 4d29462554..c2b89de847 100644
--- a/include/JSystem/JKernel/JKRThread.h
+++ b/include/JSystem/JKernel/JKRThread.h
@@ -133,6 +133,7 @@ public:
JKRThread* enter(JKRThread* param_1, int param_2);
static void callback(OSThread* param_1, OSThread* param_2);
+ static JKRThreadSwitch* getManager() { return sManager; }
static u32 getTotalCount() { return sTotalCount; }
private:
diff --git a/libs/JSystem/JAudio2/JAIStream.cpp b/libs/JSystem/JAudio2/JAIStream.cpp
index 35cb0a4a74..b70f89f2d2 100644
--- a/libs/JSystem/JAudio2/JAIStream.cpp
+++ b/libs/JSystem/JAudio2/JAIStream.cpp
@@ -16,40 +16,10 @@ struct JASGenericMemPool {
/* 80290994 */ void free(void*, u32);
};
-struct JASAramStream {
- /* 802963A8 */ JASAramStream();
- /* 8029649C */ void init(u32, u32, void (*)(u32, JASAramStream*, void*), void*);
- /* 8029655C */ void prepare(s32, int);
- /* 80296618 */ void start();
- /* 8029664C */ void stop(u16);
- /* 80296684 */ void pause(bool);
- /* 802966CC */ void cancel();
-};
-
struct JAIStreamMgr {};
struct JAIAudience {};
-struct JAIStream {
- /* 802A3104 */ JAIStream(JAIStreamMgr*, JAISoundStrategyMgr<JAIStream>*);
- /* 802A319C */ void JAIStreamMgr_startID_(JAISoundID, s32, JGeometry::TVec3<f32> const*,
- JAIAudience*, int);
- /* 802A3230 */ void prepare_prepareStream_();
- /* 802A33F4 */ void prepare_();
- /* 802A3498 */ void prepare_startStream_();
- /* 802A34E4 */ void JAIStreamMgr_mixOut_(JASSoundParams const&, JAISoundActivity);
- /* 802A3720 */ void die_JAIStream_();
- /* 802A37FC */ void JAISound_tryDie_();
- /* 802A388C */ void JAIStreamMgr_calc_();
- /* 802A3948 */ s32 getNumChild() const;
- /* 802A3950 */ void getChild(int);
- /* 802A3A24 */ void releaseChild(int);
- /* 802A3ABC */ JASTrack* getTrack();
- /* 802A3AC4 */ JASTrack* getChildTrack(int);
- /* 802A3ACC */ JAIStream* asStream();
- /* 802A3AD0 */ JAITempoMgr* getTempoMgr();
-};
-
struct JAISoundChild {
/* 802A2AB0 */ void init();
/* 802A2B7C */ void calc();
@@ -247,7 +217,7 @@ asm void JAIStream::die_JAIStream_() {
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
-asm void JAIStream::JAISound_tryDie_() {
+asm bool JAIStream::JAISound_tryDie_() {
nofralloc
#include "asm/JSystem/JAudio2/JAIStream/JAISound_tryDie___9JAIStreamFv.s"
}
@@ -272,7 +242,7 @@ s32 JAIStream::getNumChild() const {
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
-asm void JAIStream::getChild(int param_0) {
+asm JAISoundChild* JAIStream::getChild(int param_0) {
nofralloc
#include "asm/JSystem/JAudio2/JAIStream/getChild__9JAIStreamFi.s"
}
diff --git a/libs/JSystem/JAudio2/JASAramStream.cpp b/libs/JSystem/JAudio2/JASAramStream.cpp
index 6c843ad1b1..cec32a2cf1 100644
--- a/libs/JSystem/JAudio2/JASAramStream.cpp
+++ b/libs/JSystem/JAudio2/JASAramStream.cpp
@@ -40,10 +40,6 @@ struct JASGenericMemPool {
/* 80290948 */ void alloc(u32);
};
-struct JASDsp {
- struct TChannel {};
-};
-
struct JASDriver {
/* 8029C9E8 */ void getDacRate();
/* 8029E1C4 */ void rejectCallback(s32 (*)(void*), void*);
@@ -58,37 +54,6 @@ struct JASChannel {
/* 8029AB98 */ void setMixConfig(u32, u16);
};
-struct JASAramStream {
- /* 8029631C */ void initSystem(u32, u32);
- /* 802963A8 */ JASAramStream();
- /* 8029649C */ void init(u32, u32, void (*)(u32, JASAramStream*, void*), void*);
- /* 8029655C */ void prepare(s32, int);
- /* 80296618 */ void start();
- /* 8029664C */ void stop(u16);
- /* 80296684 */ void pause(bool);
- /* 802966CC */ void cancel();
- /* 80296710 */ void getBlockSamples() const;
- /* 8029673C */ void headerLoadTask(void*);
- /* 8029676C */ void firstLoadTask(void*);
- /* 80296848 */ void loadToAramTask(void*);
- /* 80296868 */ void finishTask(void*);
- /* 802968C8 */ void prepareFinishTask(void*);
- /* 80296920 */ void headerLoad(u32, int);
- /* 80296AE8 */ void load();
- /* 80296D74 */ void channelProcCallback(void*);
- /* 80296D94 */ void dvdErrorCheck(void*);
- /* 80296DF0 */ void channelCallback(u32, JASChannel*, JASDsp::TChannel*, void*);
- /* 80296E2C */ void updateChannel(u32, JASChannel*, JASDsp::TChannel*);
- /* 802974AC */ void channelProc();
- /* 80297658 */ void channelStart();
- /* 80297870 */ void channelStop(u16);
-
- static u8 sLoadThread[4];
- static u8 sReadBuffer[4];
- static u8 sBlockSize[4];
- static u8 sChannelMax[4];
-};
-
//
// Forward References:
//
@@ -145,9 +110,6 @@ extern "C" void __dl__FPv();
extern "C" void mainRamToAram__7JKRAramFPUcUlUl15JKRExpandSwitchUlP7JKRHeapiPUl();
extern "C" void OSDisableInterrupts();
extern "C" void OSRestoreInterrupts();
-extern "C" void OSInitMessageQueue();
-extern "C" void OSSendMessage();
-extern "C" void OSReceiveMessage();
extern "C" void DVDFastOpen();
extern "C" void DVDReadPrio();
extern "C" void DVDGetDriveStatus();
diff --git a/libs/JSystem/JAudio2/JASHeapCtrl.cpp b/libs/JSystem/JAudio2/JASHeapCtrl.cpp
index 89431411c6..290d2c2df7 100644
--- a/libs/JSystem/JAudio2/JASHeapCtrl.cpp
+++ b/libs/JSystem/JAudio2/JASHeapCtrl.cpp
@@ -20,19 +20,6 @@ struct JKRExpHeap {
/* 802CEE2C */ void create(u32, JKRHeap*, bool);
};
-struct JASKernel {
- /* 802909B8 */ void setupRootHeap(JKRSolidHeap*, u32);
- /* 80290AC0 */ u32 getSystemHeap();
- /* 80290AC8 */ u32 getCommandHeap();
- /* 80290AD0 */ void setupAramHeap(u32, u32);
- /* 80290B08 */ void getAramHeap();
-
- static u8 audioAramHeap[68];
- static u8 sAramBase[4];
- static u8 sSystemHeap[4];
- static u8 sCommandHeap[4];
-};
-
struct JASDisposer {
/* 80290BCC */ void onDispose();
};
@@ -122,7 +109,7 @@ asm void JASHeap::initRootHeap(void* param_0, u32 param_1) {
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
-asm void JASHeap::alloc(JASHeap* param_0, u32 param_1) {
+asm bool JASHeap::alloc(JASHeap* param_0, u32 param_1) {
nofralloc
#include "asm/JSystem/JAudio2/JASHeapCtrl/alloc__7JASHeapFP7JASHeapUl.s"
}
@@ -132,7 +119,7 @@ asm void JASHeap::alloc(JASHeap* param_0, u32 param_1) {
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
-asm void JASHeap::allocTail(JASHeap* param_0, u32 param_1) {
+asm bool JASHeap::allocTail(JASHeap* param_0, u32 param_1) {
nofralloc
#include "asm/JSystem/JAudio2/JASHeapCtrl/allocTail__7JASHeapFP7JASHeapUl.s"
}
@@ -250,7 +237,7 @@ asm void JASGenericMemPool::free(void* param_0, u32 param_1) {
u8 JASKernel::sAramBase[4];
/* 80451218-8045121C 000718 0004+00 2/1 0/0 0/0 .sbss sSystemHeap__9JASKernel */
-u8 JASKernel::sSystemHeap[4];
+JKRHeap* JASKernel::sSystemHeap;
/* 8045121C-80451220 00071C 0004+00 2/1 0/0 0/0 .sbss sCommandHeap__9JASKernel */
u8 JASKernel::sCommandHeap[4];
@@ -267,8 +254,8 @@ asm void JASKernel::setupRootHeap(JKRSolidHeap* param_0, u32 param_1) {
#pragma pop
/* 80290AC0-80290AC8 -00001 0008+00 0/0 0/0 0/0 .text getSystemHeap__9JASKernelFv */
-u32 JASKernel::getSystemHeap() {
- return *(u32*)(&JASKernel::sSystemHeap);
+JKRHeap* JASKernel::getSystemHeap() {
+ return JASKernel::sSystemHeap;
}
/* 80290AC8-80290AD0 -00001 0008+00 0/0 0/0 0/0 .text getCommandHeap__9JASKernelFv */
@@ -297,7 +284,7 @@ asm void JASKernel::setupAramHeap(u32 param_0, u32 param_1) {
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
-asm void JASKernel::getAramHeap() {
+asm JASHeap* JASKernel::getAramHeap() {
nofralloc
#include "asm/JSystem/JAudio2/JASHeapCtrl/getAramHeap__9JASKernelFv.s"
}
diff --git a/libs/JSystem/JAudio2/JAUInitializer.cpp b/libs/JSystem/JAudio2/JAUInitializer.cpp
index 3aca3cac82..9e27a06558 100644
--- a/libs/JSystem/JAudio2/JAUInitializer.cpp
+++ b/libs/JSystem/JAudio2/JAUInitializer.cpp
@@ -4,105 +4,28 @@
//
#include "JSystem/JAudio2/JAUInitializer.h"
+#include "JSystem/JAudio2/JAISe.h"
+#include "JSystem/JAudio2/JAISeq.h"
+#include "JSystem/JAudio2/JAISoundChild.h"
+#include "JSystem/JAudio2/JAIStream.h"
+#include "JSystem/JAudio2/JASAramStream.h"
+#include "JSystem/JAudio2/JASAudioThread.h"
+#include "JSystem/JAudio2/JASDriverIF.h"
+#include "JSystem/JAudio2/JASDvdThread.h"
+#include "JSystem/JAudio2/JASHeapCtrl.h"
+#include "JSystem/JAudio2/JASTaskThread.h"
+#include "JSystem/JAudio2/JASTrack.h"
+#include "JSystem/JAudio2/JASWaveArcLoader.h"
+#include "JSystem/JKernel/JKRAram.h"
+#include "JSystem/JKernel/JKRSolidHeap.h"
+#include "JSystem/JKernel/JKRThread.h"
#include "dol2asm.h"
+#include "dolphin/os/OSRtc.h"
//
// Types:
//
-struct JKRThread {};
-
-struct JKRThreadSwitch {
- /* 802D1A70 */ void enter(JKRThread*, int);
-
- static u8 sManager[4];
-};
-
-struct JKRSolidHeap {};
-
-struct JKRHeap {
- /* 802CE72C */ void getFreeSize();
-};
-
-struct JKRAram {
- static u8 sAramObject[4];
-};
-
-struct JAU_JASInitializer {
- /* 802A4AD0 */ JAU_JASInitializer();
- /* 802A4B28 */ void initJASystem(JKRSolidHeap*);
-};
-
-struct JAU_JAIInitializer {
- /* 802A4D3C */ JAU_JAIInitializer();
- /* 802A4D60 */ void initJAInterface();
-};
-
-struct JASWaveArcLoader {
- /* 8029A0D0 */ void setCurrentDir(char const*);
-};
-
-template <typename A0>
-struct JASMemPool_MultiThreaded {};
-/* JASMemPool_MultiThreaded<JASTrack> */
-struct JASMemPool_MultiThreaded__template0 {
- /* 802932E0 */ void func_802932E0(void* _this);
-};
-
-/* JASMemPool_MultiThreaded<JASTrack::TChannelMgr> */
-struct JASMemPool_MultiThreaded__template1 {
- /* 80293334 */ void func_80293334(void* _this);
-};
-
-template <typename A0>
-struct JASMemPool {};
-/* JASMemPool<JAISe> */
-struct JASMemPool__template0 {
- /* 8029FC34 */ void func_8029FC34(void* _this);
-};
-
-/* JASMemPool<JAISoundChild> */
-struct JASMemPool__template1 {
- /* 802A1268 */ void func_802A1268(void* _this);
-};
-
-/* JASMemPool<JAISeq> */
-struct JASMemPool__template2 {
- /* 802A1AF4 */ void func_802A1AF4(void* _this);
-};
-
-/* JASMemPool<JAIStream> */
-struct JASMemPool__template3 {
- /* 802A3E68 */ void func_802A3E68(void* _this);
-};
-
-struct JASKernel {
- /* 802909B8 */ void setupRootHeap(JKRSolidHeap*, u32);
- /* 80290AD0 */ void setupAramHeap(u32, u32);
-};
-
-struct JASGenericMemPool {
- /* 80290848 */ JASGenericMemPool();
- /* 802908C8 */ void newMemPool(u32, int);
-};
-
-struct JASDvd {
- /* 8028FF04 */ void createThread(s32, int, u32);
-};
-
-struct JASDriver {
- /* 8029E130 */ void setDSPLevel(f32);
- /* 8029E178 */ void setOutputMode(u32);
-};
-
-struct JASAudioThread {
- /* 8029CD4C */ void create(s32);
-};
-
-struct JASAramStream {
- /* 8029631C */ void initSystem(u32, u32);
-};
-
//
// Forward References:
//
@@ -135,9 +58,6 @@ extern "C" void func_802A1AF4(void* _this);
extern "C" void func_802A3E68(void* _this);
extern "C" void getFreeSize__7JKRHeapFv();
extern "C" void enter__15JKRThreadSwitchFP9JKRThreadi();
-extern "C" void OSDisableInterrupts();
-extern "C" void OSRestoreInterrupts();
-extern "C" void OSGetSoundMode();
extern "C" void __register_global_object();
extern "C" void _savegpr_29();
extern "C" void _restgpr_29();
@@ -148,7 +68,6 @@ extern "C" extern u8 data_804340B0[16];
extern "C" extern u8 data_804340CC[16 + 4 /* padding */];
extern "C" extern u8 data_804340FC[16 + 4 /* padding */];
extern "C" extern u8 data_80450B8C[4];
-extern "C" extern u8 JASDram[4];
extern "C" extern u8 struct_80451230[8];
extern "C" extern u8 data_80451310[8];
extern "C" extern u8 data_80451318[8];
@@ -162,23 +81,22 @@ extern "C" extern u8 __OSReport_disable;
// Declarations:
//
-/* ############################################################################################## */
-/* 80455810-80455818 003E10 0004+04 1/1 0/0 0/0 .sdata2 @730 */
-SECTION_SDATA2 static f32 lit_730[1 + 1 /* padding */] = {
- 1.0f,
- /* padding */
- 0.0f,
-};
-
/* 802A4AD0-802A4B28 29F410 0058+00 0/0 1/1 0/0 .text __ct__18JAU_JASInitializerFv */
-#pragma push
-#pragma optimization_level 0
-#pragma optimizewithasm off
-asm JAU_JASInitializer::JAU_JASInitializer() {
- nofralloc
-#include "asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JASInitializerFv.s"
+JAU_JASInitializer::JAU_JASInitializer() {
+ field_0x00 = 0;
+ field_0x04 = 0;
+ field_0x14 = -1;
+ field_0x18 = -1;
+ field_0x08 = 0x1000;
+ field_0x0c = 3;
+ field_0x10 = 2;
+ field_0x1c = 0x80;
+ field_0x2c = 1.0f;
+ field_0x24 = 0x2760;
+ field_0x28 = 2;
+ field_0x20 = 0;
+ field_0x30 = NULL;
}
-#pragma pop
/* ############################################################################################## */
/* 80434110-8043411C 060E30 000C+00 2/2 0/0 0/0 .bss @757 */
@@ -189,6 +107,53 @@ static u8 lit_763[12];
/* 802A4B28-802A4D3C 29F468 0214+00 0/0 1/1 0/0 .text
* initJASystem__18JAU_JASInitializerFP12JKRSolidHeap */
+// extra destructors
+#ifdef NONMATCHING
+void JAU_JASInitializer::initJASystem(JKRSolidHeap* param_0) {
+ if (JASAudioThread::getThreadPointer()) {
+
+ } else if (JASDvd::getThreadPointer()) {
+
+ } else {
+ JASKernel::setupRootHeap(param_0, field_0x08);
+ if (field_0x00 == 0) {
+ field_0x00 = JKRAram::getManager()->getAudioMemory();
+ }
+ if (field_0x04 == 0) {
+ field_0x04 = JKRAram::getManager()->getAudioMemSize();
+ }
+ JASKernel::setupAramHeap(field_0x00, field_0x04);
+ JASPoolAllocObject_MultiThreaded<JASTrack>::newMemPool(field_0x1c);
+ if (field_0x20 > 0) {
+ JASPoolAllocObject_MultiThreaded<JASTrack::TChannelMgr>::newMemPool(field_0x20);
+ }
+ JASDvd::createThread(field_0x0c,0x80,0x1000);
+ JASAudioThread::create(field_0x10);
+ JKRThreadSwitch* threadSwitch = JKRThreadSwitch::getManager();
+ if (threadSwitch) {
+ if (field_0x14 >= 0) {
+ threadSwitch->enter(JASDvd::getThreadPointer(), field_0x14);
+ }
+ if (field_0x18 >= 0) {
+ threadSwitch->enter(JASAudioThread::getThreadPointer(), field_0x18);
+ }
+ }
+ JASDriver::setDSPLevel(field_0x2c);
+ JASAramStream::initSystem(field_0x24,field_0x28);
+ }
+ if (field_0x30) {
+ JASWaveArcLoader::setCurrentDir(field_0x30);
+ }
+ switch (OSGetSoundMode()) {
+ case 0:
+ JASDriver::setOutputMode(0);
+ break;
+ case 1:
+ JASDriver::setOutputMode(1);
+ break;
+ }
+}
+#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -197,16 +162,15 @@ asm void JAU_JASInitializer::initJASystem(JKRSolidHeap* param_0) {
#include "asm/JSystem/JAudio2/JAUInitializer/initJASystem__18JAU_JASInitializerFP12JKRSolidHeap.s"
}
#pragma pop
+#endif
/* 802A4D3C-802A4D60 29F67C 0024+00 0/0 1/1 0/0 .text __ct__18JAU_JAIInitializerFv */
-#pragma push
-#pragma optimization_level 0
-#pragma optimizewithasm off
-asm JAU_JAIInitializer::JAU_JAIInitializer() {
- nofralloc
-#include "asm/JSystem/JAudio2/JAUInitializer/__ct__18JAU_JAIInitializerFv.s"
+JAU_JAIInitializer::JAU_JAIInitializer() {
+ field_0x0 = 100;
+ field_0x4 = 4;
+ field_0x8 = 2;
+ field_0xc = 16;
}
-#pragma pop
/* ############################################################################################## */
/* 80434128-80434134 060E48 000C+00 0/1 0/0 0/0 .bss @855 */
@@ -234,6 +198,18 @@ static u8 lit_867[12 + 96 /* padding */];
#pragma pop
/* 802A4D60-802A4EE8 29F6A0 0188+00 0/0 1/1 0/0 .text initJAInterface__18JAU_JAIInitializerFv */
+// extra destructors
+#ifdef NONMATCHING
+void JAU_JAIInitializer::initJAInterface() {
+ s32 r30 = JASDram->getFreeSize();
+ JASPoolAllocObject<JAIStream>::newMemPool(field_0x8);
+ JASPoolAllocObject<JAISeq>::newMemPool(field_0x4);
+ JASPoolAllocObject<JAISe>::newMemPool(field_0x0);
+ JASPoolAllocObject<JAISoundChild>::newMemPool(field_0xc);
+ s32 r29 = JASDram->getFreeSize();
+ //OSReport("JAU_JAIInitializer uses %d bytes\n", r30 - r29);
+}
+#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -242,3 +218,4 @@ asm void JAU_JAIInitializer::initJAInterface() {
#include "asm/JSystem/JAudio2/JAUInitializer/initJAInterface__18JAU_JAIInitializerFv.s"
}
#pragma pop
+#endif
diff --git a/libs/Z2AudioLib/Z2AudioMgr.cpp b/libs/Z2AudioLib/Z2AudioMgr.cpp
index bcc367119c..8e14b25f64 100644
--- a/libs/Z2AudioLib/Z2AudioMgr.cpp
+++ b/libs/Z2AudioLib/Z2AudioMgr.cpp
@@ -82,10 +82,6 @@ struct JASResArcLoader {
/* 80290C04 */ void getResMaxSize(JKRArchive const*);
};
-struct JASKernel {
- /* 80290B08 */ void getAramHeap();
-};
-
struct JASAramStream {
static u8 sBlockSize[4];
};
diff --git a/src/d/a/d_a_alink.cpp b/src/d/a/d_a_alink.cpp
index f34909d07d..974e8d3881 100644
--- a/src/d/a/d_a_alink.cpp
+++ b/src/d/a/d_a_alink.cpp
@@ -64,10 +64,6 @@ struct dPaPoF_c {
static u8 m_emitterFourData[60 + 28 /* padding */];
};
-struct JASKernel {
- /* 80290B08 */ void getAramHeap();
-};
-
struct JAISeq {
/* 802A0A8C */ JAISeq(JAISeqMgr*, JAISoundStrategyMgr<JAISeq>*);
};