mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-27 23:45:55 -04:00
ef14b2b932
Stubbing out all OS* functions to stubs.cpp, these will likely have to be replaced with the operating system's primitives for locking/heaps/threads/etc. Moved some generic globals into globals.cpp, not sure where they're actually to be used. Stub DSP functions Stub JSUMemoryOutputStream, JORServer, Z2Audio mDoExt stubs add memcpy add some more stubs, add extras c++ mangled functions add extras.cpp AR/AQ stubbing stub DVD stub CARD more stubs, more extras add missing mtx functions to dusk file finish mtx stub GX KPAD and LC, also do pragma marks for better visualization finish mtx, add a few more stubs gf/wpad/vi translate some matrix math from ppc to C jorserver/debugpad/fap/dmsgobject add m_Do_ext functions from debug block to separate file make small janges to JSystem, does this need upstreaming reorg DVD stubs reorganize stubs by mark
89 lines
1.5 KiB
C++
89 lines
1.5 KiB
C++
#ifndef JASGADGET_H
|
|
#define JASGADGET_H
|
|
|
|
#include "JSystem/JUtility/JUTAssert.h"
|
|
#include <string>
|
|
|
|
/**
|
|
* @ingroup jsystem-jaudio
|
|
*
|
|
*/
|
|
template<class T>
|
|
class JASGlobalInstance {
|
|
public:
|
|
JASGlobalInstance(T* inst) {
|
|
sInstance = inst;
|
|
}
|
|
|
|
JASGlobalInstance(bool setInstance) {
|
|
if (setInstance) {
|
|
JUT_ASSERT(186, sInstance == NULL);
|
|
sInstance = (T*)this;
|
|
}
|
|
}
|
|
|
|
~JASGlobalInstance() {
|
|
if (sInstance == (T*)this) {
|
|
sInstance = NULL;
|
|
}
|
|
}
|
|
|
|
static T* getInstance() { return sInstance; }
|
|
|
|
static T* sInstance;
|
|
};
|
|
|
|
#ifndef __MWERKS__
|
|
template<class T>
|
|
T* JASGlobalInstance<T>::sInstance;
|
|
#endif
|
|
|
|
/**
|
|
* @ingroup jsystem-jaudio
|
|
*
|
|
*/
|
|
template<class T>
|
|
class JASPtrTable {
|
|
public:
|
|
JASPtrTable(T** param_0, u32 size) {
|
|
mTable = param_0;
|
|
mSize = size;
|
|
memset(mTable, 0, size * 4);
|
|
}
|
|
T* get(u32 index) {
|
|
if (index >= mSize) {
|
|
return NULL;
|
|
}
|
|
return mTable[index];
|
|
}
|
|
T* get(u32 index) const {
|
|
if (index >= mSize) {
|
|
return NULL;
|
|
}
|
|
return mTable[index];
|
|
}
|
|
void set(u32 index, T* value) {
|
|
JUT_ASSERT(229, index < mSize);
|
|
mTable[index] = value;
|
|
}
|
|
|
|
private:
|
|
/* 0x00 */ T** mTable;
|
|
/* 0x04 */ u32 mSize;
|
|
};
|
|
|
|
/**
|
|
* @ingroup jsystem-jaudio
|
|
*
|
|
*/
|
|
template<class T, size_t N>
|
|
class JASPtrArray : public JASPtrTable<T> {
|
|
public:
|
|
JASPtrArray() : JASPtrTable<T>(mArray, N) {}
|
|
|
|
private:
|
|
/* 0x08 */ T* mArray[N];
|
|
};
|
|
|
|
#endif /* JASGADGET_H */
|