mirror of
https://github.com/zeldaret/tp
synced 2026-07-10 23:22:01 -04:00
Various JSystem work (#2383)
* JKernel and JStudio cleanup * JMessage cleanup * JAudio cleanup * JASBNKParser work * functionvalue work * fvb work * J2D and J3D cleanup * steal from tww * J2DPictureEx mostly done * fix build
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define JASBNKPARSER_H
|
||||
|
||||
#include "JSystem/JAudio2/JASOscillator.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
class JASBank;
|
||||
class JASBasicBank;
|
||||
@@ -53,24 +54,85 @@ namespace JASBNKParser {
|
||||
/* 0xC */ u32 mOffsets[0];
|
||||
};
|
||||
|
||||
/* 80299600 */ static TChunk* findChunk(void const*, u32);
|
||||
/* 8029963C */ static JASBasicBank* createBasicBank(void const*, JKRHeap*);
|
||||
/* 80299600 */ TChunk* findChunk(void const*, u32);
|
||||
/* 8029963C */ JASBasicBank* createBasicBank(void const*, JKRHeap*);
|
||||
};
|
||||
|
||||
namespace Ver0 {
|
||||
struct THeader {};
|
||||
template<typename T>
|
||||
struct TOffset {
|
||||
/* 0x0 */ u32 offset;
|
||||
T* ptr(void const* stream) const { return JSUConvertOffsetToPtr<T>(stream, offset); }
|
||||
};
|
||||
|
||||
struct TOsc {};
|
||||
struct TOsc {
|
||||
/* 0x00 */ u8 mTarget;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ TOffset<JASOscillator::Point> mPointOffset;
|
||||
/* 0x0C */ TOffset<JASOscillator::Point> field_0xc;
|
||||
/* 0x10 */ f32 mScale;
|
||||
/* 0x14 */ f32 field_0x14;
|
||||
};
|
||||
|
||||
/* 80299A3C */ static JASBasicBank* createBasicBank(void const*, JKRHeap*);
|
||||
/* 80299E68 */ static void findOscPtr(JASBasicBank*, THeader const*, TOsc const*);
|
||||
/* 80299F8C */ static void getOscTableEndPtr(JASOscillator::Point const*);
|
||||
struct TVmap {
|
||||
/* 0x00 */ u8 field_0x0[4];
|
||||
/* 0x04 */ u32 field_0x4;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
/* 0x0C */ f32 field_0xc;
|
||||
};
|
||||
|
||||
struct TKeymap {
|
||||
/* 0x00 */ u8 mHighKey;
|
||||
/* 0x01 */ u8 field_0x1[7];
|
||||
/* 0x08 */ TOffset<TVmap> mVmapOffset;
|
||||
};
|
||||
|
||||
struct TInst {
|
||||
/* 0x00 */ u8 field_0x0[8];
|
||||
/* 0x08 */ f32 mVolume;
|
||||
/* 0x0C */ f32 mPitch;
|
||||
/* 0x10 */ TOffset<TOsc> mOscOffset[2];
|
||||
/* 0x18 */ u8 field_0x18[0x10];
|
||||
/* 0x28 */ u32 mKeyRegionCount;
|
||||
/* 0x2C */ TOffset<TKeymap> mKeymapOffset[0];
|
||||
};
|
||||
|
||||
struct TPmap {
|
||||
/* 0x00 */ f32 mVolume;
|
||||
/* 0x04 */ f32 mPitch;
|
||||
/* 0x08 */ u8 field_0x8[0xc];
|
||||
/* 0x14 */ TOffset<TVmap> mVmapOffset;
|
||||
};
|
||||
|
||||
struct TPerc {
|
||||
/* 0x000 */ u32 mMagic;
|
||||
/* 0x000 */ u8 field_0x0[0x84];
|
||||
/* 0x088 */ TOffset<TPmap> mPmapOffset[0x80];
|
||||
/* 0x288 */ s8 mPan[0x80];
|
||||
/* 0x308 */ u16 mRelease[0x80];
|
||||
};
|
||||
|
||||
struct TOffsetData {
|
||||
/* 0x000 */ u8 field_0x20[4];
|
||||
/* 0x004 */ TOffset<TInst> mInstOffset[0x80];
|
||||
/* 0x204 */ u8 field_0x204[0x190];
|
||||
/* 0x394 */ TOffset<TPerc> mPercOffset[12];
|
||||
};
|
||||
|
||||
struct THeader {
|
||||
/* 0x00 */ u8 field_0x0[0x20];
|
||||
/* 0x20 */ TOffsetData mOffsets;
|
||||
};
|
||||
|
||||
/* 80299A3C */ JASBasicBank* createBasicBank(void const*, JKRHeap*);
|
||||
/* 80299E68 */ JASOscillator::Data* findOscPtr(JASBasicBank*, THeader const*, TOsc const*);
|
||||
/* 80299F8C */ JASOscillator::Point const* getOscTableEndPtr(JASOscillator::Point const*);
|
||||
};
|
||||
|
||||
/* 80299538 */ static JASBank* createBank(void const*, JKRHeap*);
|
||||
/* 80299558 */ static JASBasicBank* createBasicBank(void const*, JKRHeap*);
|
||||
/* 80299538 */ JASBank* createBank(void const*, JKRHeap*);
|
||||
/* 80299558 */ JASBasicBank* createBasicBank(void const*, JKRHeap*);
|
||||
|
||||
inline static u32 getBankNumber(const void* param_0) { return ((u32*)param_0)[2]; }
|
||||
inline u32 getBankNumber(const void* param_0) { return ((u32*)param_0)[2]; }
|
||||
|
||||
extern u32 sUsedHeapSize;
|
||||
};
|
||||
|
||||
@@ -68,13 +68,11 @@ namespace JASThreadingModel {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <typename A0>
|
||||
struct ObjectLevelLockable {
|
||||
// Should be templated on the chunk memory but couldn't initialize it inside the class itself
|
||||
//template <typename A0>
|
||||
struct Lock {
|
||||
Lock(OSMutex* mutex) {
|
||||
mMutex = mutex;
|
||||
Lock(A0 const& mutex) {
|
||||
mMutex = (A0*)&mutex;
|
||||
OSLockMutex(mMutex);
|
||||
}
|
||||
|
||||
@@ -82,7 +80,7 @@ namespace JASThreadingModel {
|
||||
OSUnlockMutex(mMutex);
|
||||
}
|
||||
|
||||
OSMutex* mMutex;
|
||||
A0* mMutex;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -105,8 +103,8 @@ namespace JASKernel { JKRHeap* getSystemHeap(); };
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template<u32 ChunkSize, typename T>
|
||||
class JASMemChunkPool {
|
||||
template<u32 ChunkSize, template<typename> class T>
|
||||
class JASMemChunkPool : public OSMutex {
|
||||
struct MemoryChunk {
|
||||
MemoryChunk(MemoryChunk* nextChunk) {
|
||||
mNextChunk = nextChunk;
|
||||
@@ -156,7 +154,7 @@ class JASMemChunkPool {
|
||||
};
|
||||
public:
|
||||
JASMemChunkPool() {
|
||||
OSInitMutex(&mMutex);
|
||||
OSInitMutex(this);
|
||||
field_0x18 = NULL;
|
||||
createNewChunk();
|
||||
}
|
||||
@@ -185,7 +183,7 @@ public:
|
||||
}
|
||||
|
||||
void* alloc(u32 size) {
|
||||
typename T::Lock lock(&mMutex);
|
||||
typename T<JASMemChunkPool<ChunkSize, T> >::Lock lock(*this);
|
||||
if (field_0x18->getFreeSize() < size) {
|
||||
if (ChunkSize < size) {
|
||||
return NULL;
|
||||
@@ -198,7 +196,7 @@ public:
|
||||
}
|
||||
|
||||
void free(void* ptr) {
|
||||
typename T::Lock lock(&mMutex);
|
||||
typename T<JASMemChunkPool<ChunkSize, T> >::Lock lock(*this);
|
||||
MemoryChunk* chunk = field_0x18;
|
||||
MemoryChunk* prevChunk = NULL;
|
||||
while (chunk != NULL) {
|
||||
@@ -216,7 +214,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/* 0x00 */ OSMutex mMutex;
|
||||
/* 0x18 */ MemoryChunk* field_0x18;
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "JSystem/JAudio2/JASSeqCtrl.h"
|
||||
#include "JSystem/JAudio2/JASTrackPort.h"
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "global.h"
|
||||
|
||||
struct JASSoundParams;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user