mirror of
https://github.com/SwareJonge/mkdd.git
synced 2024-11-26 23:00:25 +00:00
Match and link JAUInitializer.cpp
This commit is contained in:
parent
5b0cb07813
commit
398b49d774
@ -523,6 +523,13 @@ libs/JSystem/JAudio/Utility/JAUAudioArcLoader.cpp:
|
||||
.sbss: [0x80415b10, 0x80415b20]
|
||||
.sdata2: [0x80418150, 0x80418160]
|
||||
|
||||
libs/JSystem/JAudio/Utility/JAUInitializer.cpp:
|
||||
.text: [0x800a6114, 0x800a65b0]
|
||||
.ctors: [0x8031616c, 0x80316170]
|
||||
.rodata: [0x8036a208, 0x8036a350]
|
||||
.bss: [0x803b12a0, 0x803b12f8]
|
||||
.sdata2: [0x80418160, 0x80418168]
|
||||
|
||||
libs/dolphin/base/PPCArch.c:
|
||||
.text: [0x800af634, 0x800af748]
|
||||
|
||||
|
@ -489,6 +489,13 @@ libs/JSystem/JAudio/Utility/JAUAudioArcLoader.cpp:
|
||||
.bss: [0x80370d30, 0x80370d60]
|
||||
.sbss: [0x803d4da0, 0x803d4db0]
|
||||
|
||||
libs/JSystem/JAudio/Utility/JAUInitializer.cpp:
|
||||
.text: [0x800a32d4, 0x800a371c]
|
||||
.ctors: [0x802d8570, 0x802d8574]
|
||||
.bss: [0x80370de0, 0x80370e38]
|
||||
.sdata2: [0x803d6f28, 0x803d6f30]
|
||||
|
||||
|
||||
libs/dolphin/base/PPCArch.c:
|
||||
.text: [0x800a9600, 0x800a9714]
|
||||
|
||||
|
@ -1266,13 +1266,19 @@ global:
|
||||
0x80090da4: alloc__17JASGenericMemPoolFUl
|
||||
0x80090df0: free__17JASGenericMemPoolFPvUl
|
||||
0x803d4ca8: JASDram
|
||||
# JASKernel.cpp
|
||||
0x80090e14: setupRootHeap__9JASKernelFP12JKRSolidHeapUl
|
||||
0x80090f38: setupAramHeap__9JASKernelFUlUl
|
||||
# JASReport.cpp
|
||||
0x80091270: JASReport__FPCce
|
||||
# JASTaskThread.cpp
|
||||
0x80091498: __ct__13JASTaskThreadFiiUl
|
||||
# JASAiCtrl.cpp
|
||||
0x80092544: registerMixCallback__9JASDriverFPFl_Ps10JASMixMode
|
||||
# JASAudioThread.cpp
|
||||
0x80092ab8: create__14JASAudioThreadFl
|
||||
# JASDriverIF.cpp
|
||||
0x800946dc: setDSPLevel__9JASDriverFf
|
||||
0x8009472c: getOutputMode__9JASDriverFv
|
||||
0x80094734: waitSubFrame__9JASDriverFv
|
||||
# JASDSPInterface.cpp
|
||||
@ -1282,6 +1288,8 @@ global:
|
||||
# JASInstRand.cpp
|
||||
0x8009853c: effect__11JASInstRandCFiiP14JASSoundParams
|
||||
0x8034b8b8: __vt__11JASInstRand
|
||||
# JASWaveArcLoader.cpp
|
||||
0x80098b78: setCurrentDir__16JASWaveArcLoaderFPCc
|
||||
# JASAramStream.cpp
|
||||
0x8009964c: initSystem__13JASAramStreamFUlUl
|
||||
0x800996dc: __ct__13JASAramStreamFv
|
||||
@ -1315,6 +1323,11 @@ global:
|
||||
# osdsp.c
|
||||
0x800a1f20: DSPAddTask # these overrride the ones in dsp.c and dsp_task.c
|
||||
0x800a2000: __DSPHandler
|
||||
# JAUInitializer.cpp
|
||||
0x800a32d4: __ct__18JAU_JASInitializerFv
|
||||
0x800a332c: initJASystem__18JAU_JASInitializerFP12JKRSolidHeap
|
||||
0x800a34a0: __ct__18JAU_JAIInitializerFv
|
||||
0x800a34c4: initJAInterface__18JAU_JAIInitializerFv
|
||||
# JAUAudioArcInterpreter.cpp
|
||||
0x800a23ec: __ct__22JAUAudioArcInterpreterFv
|
||||
0x800a2408: __dt__22JAUAudioArcInterpreterFv
|
||||
|
19
include/JSystem/JAudio/JASFakeMatch11.h
Normal file
19
include/JSystem/JAudio/JASFakeMatch11.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef JAUDIO_JASFAKEMATCH10_H
|
||||
#define JAUDIO_JASFAKEMATCH10_H
|
||||
|
||||
#ifdef MATCHING
|
||||
|
||||
#include "JSystem/JAudio/JASFakeMatch.h"
|
||||
class JAISoundChild;
|
||||
class JAIStream;
|
||||
class JAISeq;
|
||||
class JAISe;
|
||||
|
||||
JASMemPool<JAISoundChild> JASPoolAllocObject<JAISoundChild>::memPool_;
|
||||
JASMemPool<JAIStream> JASPoolAllocObject<JAIStream>::memPool_;
|
||||
JASMemPool<JAISeq> JASPoolAllocObject<JAISeq>::memPool_;
|
||||
JASMemPool<JAISe> JASPoolAllocObject<JAISe>::memPool_;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -3,33 +3,35 @@
|
||||
|
||||
#include <JSystem/JKernel/JKRHeap.h>
|
||||
|
||||
struct JAU_JASInitializer {
|
||||
struct JAU_JASInitializer
|
||||
{
|
||||
JAU_JASInitializer();
|
||||
void initJASystem(JKRSolidHeap *);
|
||||
|
||||
u32 mAudioMemory;
|
||||
u32 mAudioMemSize;
|
||||
u32 mHeapSize;
|
||||
s32 mDvdThreadPrio;
|
||||
s32 mAudioThreadPrio;
|
||||
int mDvdThreadID;
|
||||
int mAudioThreadID;
|
||||
u32 mTrackPools;
|
||||
u32 mChannelPools;
|
||||
u32 mBlockSize;
|
||||
u32 mChannelMax;
|
||||
f32 mDSPLevel;
|
||||
char *mDir;
|
||||
u32 mAudioMemory; // 00
|
||||
u32 mAudioMemSize; // 04
|
||||
u32 mHeapSize; // 08
|
||||
s32 mDvdThreadPrio; // 0C
|
||||
s32 mAudioThreadPrio; // 10
|
||||
int mDvdThreadID; // 14
|
||||
int mAudioThreadID; // 18
|
||||
int mTrackPoolCount; // 1C
|
||||
int mChannelPoolCount; // 20
|
||||
u32 mBlockSize; // 24
|
||||
u32 mChannelMax; // 28
|
||||
f32 mDSPLevel; // 2C
|
||||
char *mDir; // 30
|
||||
};
|
||||
|
||||
struct JAU_JAIInitializer {
|
||||
struct JAU_JAIInitializer
|
||||
{
|
||||
JAU_JAIInitializer();
|
||||
void initJAInterface();
|
||||
|
||||
u32 mSeCount;
|
||||
u32 mSeqCount;
|
||||
u32 mStreamCount;
|
||||
u32 mChildCount;
|
||||
|
||||
u32 mSeCount; // 0
|
||||
u32 mSeqCount; // 4
|
||||
u32 mStreamCount; // C
|
||||
u32 mChildCount; // 8
|
||||
};
|
||||
|
||||
#endif
|
@ -21,6 +21,7 @@ typedef s16 *(*JASMixCallBack)(s32);
|
||||
class JASDriver
|
||||
{
|
||||
public:
|
||||
static void setDSPLevel(f32);
|
||||
void startDMA();
|
||||
void stopDMA();
|
||||
void setOutputRate(JASOutputRate);
|
||||
|
@ -14,6 +14,7 @@ struct JASGenericMemPool
|
||||
{
|
||||
JASGenericMemPool();
|
||||
~JASGenericMemPool();
|
||||
void newMemPool(u32 n, int count);
|
||||
void free(void *, u32);
|
||||
void *alloc(u32 n);
|
||||
|
||||
@ -31,6 +32,11 @@ struct JASMemPool : public JASGenericMemPool
|
||||
|
||||
typedef JASMemPool<T> JASMemPoolT;
|
||||
|
||||
void newMemPool(int count) {
|
||||
JASThreadingModel::SingleThreaded<JASMemPoolT>::Lock(*this);
|
||||
JASGenericMemPool::newMemPool(sizeof(T), count);
|
||||
}
|
||||
|
||||
void free(void *p, u32 n) {
|
||||
#line 187
|
||||
JUT_ASSERT(n == sizeof(T));
|
||||
@ -188,6 +194,11 @@ public:
|
||||
template <typename T>
|
||||
struct JASPoolAllocObject
|
||||
{
|
||||
static void newMemPool(int count)
|
||||
{
|
||||
memPool_.newMemPool(count);
|
||||
}
|
||||
|
||||
static void operator delete(void *mem, u32 n)
|
||||
{
|
||||
memPool_.free(mem, n);
|
||||
@ -204,6 +215,13 @@ template <typename T>
|
||||
struct JASMemPool_MultiThreaded : public JASGenericMemPool
|
||||
{
|
||||
typedef JASMemPool_MultiThreaded<T> JASMemPool_MultiThreadedT;
|
||||
|
||||
void newMemPool(int count)
|
||||
{
|
||||
JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreadedT>::Lock lock(*this);
|
||||
JASGenericMemPool::newMemPool(sizeof(T), count);
|
||||
}
|
||||
|
||||
void *alloc(u32 n)
|
||||
{
|
||||
JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreadedT>::Lock lock(*this);
|
||||
@ -218,6 +236,11 @@ struct JASMemPool_MultiThreaded : public JASGenericMemPool
|
||||
template <typename T>
|
||||
struct JASPoolAllocObject_MultiThreaded
|
||||
{
|
||||
static void newMemPool(int count)
|
||||
{
|
||||
memPool_.newMemPool(count);
|
||||
}
|
||||
|
||||
static void *operator new(u32 n)
|
||||
{
|
||||
return memPool_.alloc(n);
|
||||
|
63
include/JSystem/JAudio/System/JASWaveArcLoader.h
Normal file
63
include/JSystem/JAudio/System/JASWaveArcLoader.h
Normal file
@ -0,0 +1,63 @@
|
||||
#ifndef JAUDIO_JASWAVEARCLOADER_H
|
||||
#define JAUDIO_JASWAVEARCLOADER_H
|
||||
|
||||
#include "JSystem/JAudio/System/JASHeap.h"
|
||||
#include "dolphin/os/OSMutex.h"
|
||||
|
||||
struct JASDisposer
|
||||
{
|
||||
JASDisposer() {}
|
||||
virtual ~JASDisposer() {}
|
||||
virtual void onDispose();
|
||||
};
|
||||
|
||||
#define DIR_MAX 64
|
||||
|
||||
struct JASWaveArcLoader
|
||||
{
|
||||
static JASHeap *getRootHeap();
|
||||
static void setCurrentDir(const char *);
|
||||
static char *getCurrentDir();
|
||||
|
||||
static char sCurrentDir[DIR_MAX];
|
||||
static JASHeap *sAramHeap;
|
||||
};
|
||||
|
||||
struct JASWaveArc : JASDisposer
|
||||
{
|
||||
JASWaveArc();
|
||||
bool loadSetup(u32);
|
||||
bool eraseSetup();
|
||||
static void loadToAramCallback(void *);
|
||||
bool sendLoadCmd();
|
||||
bool load(JASHeap *);
|
||||
bool loadTail(JASHeap *);
|
||||
void erase();
|
||||
void setEntryNum(s32);
|
||||
void setFileName(const char *);
|
||||
|
||||
virtual ~JASWaveArc();
|
||||
virtual void onDispose();
|
||||
virtual void onLoadDone();
|
||||
virtual void onEraseDone();
|
||||
|
||||
struct loadToAramCallbackParams // not official struct name
|
||||
{
|
||||
|
||||
JASWaveArc *mWavArc; // 0
|
||||
long mEntryNum; // 4
|
||||
u32 mBase; // 8
|
||||
u32 _c; // C
|
||||
};
|
||||
|
||||
JASHeap mHeap; // 04
|
||||
u32 _48; // 48
|
||||
volatile s32 _4c; // 4C
|
||||
int mEntryNum; // 50
|
||||
u32 mFileLength; // 54
|
||||
u16 _58; // 58
|
||||
u16 _5a; // 5A
|
||||
OSMutex mMutex; // 5C
|
||||
};
|
||||
|
||||
#endif
|
@ -34,6 +34,8 @@ public:
|
||||
|
||||
static u32 getTotalCount() { return sTotalCount; }
|
||||
|
||||
static JKRThreadSwitch *getManager() { return sManager; }
|
||||
|
||||
private:
|
||||
static JKRThreadSwitch *sManager;
|
||||
static u32 sTotalCount;
|
||||
|
@ -1,6 +1,17 @@
|
||||
#include <JSystem/JAudio/JAUInitializer.h>
|
||||
#include <JSystem/JKernel/JKRAram.h>
|
||||
#include <JSystem/JUtility/JUTDbg.h>
|
||||
#include "JSystem/JAudio/JAUInitializer.h"
|
||||
#include "JSystem/JAudio/Interface/JAIStream.h"
|
||||
#include "JSystem/JAudio/Interface/JAISeMgr.h"
|
||||
#include "JSystem/JAudio/Interface/JAISeq.h"
|
||||
#include "JSystem/JAudio/System/JASAudioThread.h"
|
||||
#include "JSystem/JAudio/System/JASDvd.h"
|
||||
#include "JSystem/JAudio/System/JASDriver.h"
|
||||
#include "JSystem/JAudio/System/JASMemPool.h"
|
||||
#include "JSystem/JAudio/System/JASWaveArcLoader.h"
|
||||
#include "JSystem/JKernel/JKRAram.h"
|
||||
#include "JSystem/JUtility/JUTDbg.h"
|
||||
|
||||
|
||||
#include "JSystem/JAudio/JASFakeMatch11.h"
|
||||
|
||||
JAU_JASInitializer::JAU_JASInitializer()
|
||||
{
|
||||
@ -11,31 +22,88 @@ JAU_JASInitializer::JAU_JASInitializer()
|
||||
mHeapSize = 0x1000;
|
||||
mDvdThreadPrio = 3;
|
||||
mAudioThreadPrio = 2;
|
||||
mTrackPools = 128;
|
||||
mTrackPoolCount = 128;
|
||||
mDSPLevel = 1.0f;
|
||||
mBlockSize = 0x2760;
|
||||
mChannelMax = 2;
|
||||
mChannelPools = 0;
|
||||
mDir = nullptr;
|
||||
mChannelPoolCount = 0;
|
||||
mDir = NULL;
|
||||
}
|
||||
|
||||
void JAU_JASInitializer::initJASystem(JKRSolidHeap *heap) {
|
||||
if (JASAudioThread::getThreadPointer() != nullptr) {
|
||||
void JAU_JASInitializer::initJASystem(JKRSolidHeap *heap)
|
||||
{
|
||||
if (JASAudioThread::getThreadPointer() != NULL)
|
||||
{
|
||||
#line 48
|
||||
JUT_CRITICAL_WARNING_F("%s", "Though initialized JASAudioThread, called JAU_JASInitializer::initJASystem()\n");
|
||||
JUT_WARNING_F2("%s", "Though initialized JASAudioThread, called JAU_JASInitializer::initJASystem()\n");
|
||||
}
|
||||
else {
|
||||
if (JASDvd::getThreadPointer() != nullptr) {
|
||||
JUT_CRITICAL_WARNING_F("%s", "Though initialized JASAudioThread, called JAU_JASInitializer::initJASystem()\n");
|
||||
}
|
||||
else {
|
||||
JASKernel::setupRootHeap(heap, mHeapSize);
|
||||
if(mAudioMemory == 0) {
|
||||
mAudioMemory = JKRAram::getManager()->getAudioMemory();
|
||||
}
|
||||
if(mAudioMemSize == 0) {
|
||||
mAudioMemSize = JKRAram::getManager()->getAudioMemSize();
|
||||
}
|
||||
JASKernel::setupAramHeap(mAudioMemory, mAudioMemSize);
|
||||
}
|
||||
else if (JASDvd::getThreadPointer() != NULL)
|
||||
{
|
||||
JUT_WARNING_F2("%s", "Though initialized JASDvd, called JAU_JASInitializer::initJASystem()\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
JASKernel::setupRootHeap(heap, mHeapSize);
|
||||
if (mAudioMemory == 0)
|
||||
{
|
||||
mAudioMemory = JKRAram::getManager()->getAudioMemory();
|
||||
}
|
||||
if (mAudioMemSize == 0)
|
||||
{
|
||||
mAudioMemSize = JKRAram::getManager()->getAudioMemSize();
|
||||
}
|
||||
JASKernel::setupAramHeap(mAudioMemory, mAudioMemSize);
|
||||
|
||||
JASPoolAllocObject_MultiThreaded<JASTrack>::newMemPool(mTrackPoolCount);
|
||||
if(mChannelPoolCount > 0) {
|
||||
JASPoolAllocObject_MultiThreaded<JASTrack::TChannelMgr>::newMemPool(mChannelPoolCount);
|
||||
}
|
||||
JASDvd::createThread(mDvdThreadPrio, 0x80, 0x1000);
|
||||
JASAudioThread::create(mAudioThreadPrio);
|
||||
|
||||
JKRThreadSwitch *threadSwitch = JKRThreadSwitch::getManager();
|
||||
if (threadSwitch)
|
||||
{
|
||||
if(mDvdThreadID >= 0) {
|
||||
threadSwitch->enter(JASDvd::getThreadPointer(), mDvdThreadID);
|
||||
}
|
||||
if (mAudioThreadID >= 0)
|
||||
{
|
||||
threadSwitch->enter(JASAudioThread::getThreadPointer(), mAudioThreadID);
|
||||
}
|
||||
}
|
||||
JASDriver::setDSPLevel(mDSPLevel);
|
||||
JASAramStream::initSystem(mBlockSize, mChannelMax);
|
||||
}
|
||||
|
||||
if(mDir) {
|
||||
JASWaveArcLoader::setCurrentDir(mDir);
|
||||
}
|
||||
//JASDriver::setOutputMode(1);
|
||||
}
|
||||
|
||||
JAU_JAIInitializer::JAU_JAIInitializer()
|
||||
{
|
||||
mSeCount = 100;
|
||||
mSeqCount = 4;
|
||||
mStreamCount = 2;
|
||||
mChildCount = 16;
|
||||
}
|
||||
|
||||
void JAU_JAIInitializer::initJAInterface()
|
||||
{
|
||||
int oldSize = JASDram->getFreeSize();
|
||||
JASPoolAllocObject<JAIStream>::newMemPool(mStreamCount);
|
||||
JASPoolAllocObject<JAISeq>::newMemPool(mSeqCount);
|
||||
JASPoolAllocObject<JAISe>::newMemPool(mSeCount);
|
||||
JASPoolAllocObject<JAISoundChild>::newMemPool(mChildCount);
|
||||
int newSize = JASDram->getFreeSize();
|
||||
JUT_REPORT_MSG("JAU_JAIInitializer uses %d bytes\n", oldSize - newSize);
|
||||
}
|
||||
|
||||
void JAUReportPoolCount()
|
||||
{
|
||||
// something something cur/Count
|
||||
JUT_REPORT_MSG("JASTrack %d/%d : JASTrack::TChannelMgr %d/%d\n");
|
||||
JUT_REPORT_MSG("JAISe %d/%d : JAISeq %d/%d : JAIStream %d/%d : JAISoundChild %d/%d\n");
|
||||
}
|
Loading…
Reference in New Issue
Block a user