mirror of
https://github.com/zeldaret/tp
synced 2026-05-23 23:05:36 -04:00
a61e3491f7
* initial freezard actor struct + setActionMode OK * daE_FZ_Draw * setReflectAngle * mBoundSoundset * daE_FZ_Execute & execute * demoDelete * daE_FZ_Delete & _delete * CreateHeap * useHeapInit * cc_set * mtx_set * action WIP * way_gake_check * executeRollMove * executeMove * draw WIP * executeDamage * checkpoint * create * checkpoint * daE_FZ_c::executeWait * checkpoint * daE_FZ_c::damage_check almost done * rm asm * rm headers * setup_profile WIP + doxygen update * fix merge issues * docs fix? * fix2 * doxygen updates * setup g_profile_E_FZ, profile setup script WIP * update github actions * update progress.md
84 lines
1.5 KiB
C++
84 lines
1.5 KiB
C++
#ifndef JASGADGET_H
|
|
#define JASGADGET_H
|
|
|
|
#include "JSystem/JUtility/JUTAssert.h"
|
|
#include "string.h"
|
|
|
|
/**
|
|
* @ingroup jsystem-jaudio
|
|
*
|
|
*/
|
|
template<class T>
|
|
class JASGlobalInstance {
|
|
public:
|
|
JASGlobalInstance(T* inst) {
|
|
sInstance = inst;
|
|
}
|
|
|
|
JASGlobalInstance(bool param_1) {
|
|
if (param_1) {
|
|
JUT_ASSERT(186, sInstance == 0);
|
|
sInstance = (T*)this;
|
|
}
|
|
}
|
|
|
|
~JASGlobalInstance() {
|
|
if (sInstance == (T*)this) {
|
|
sInstance = NULL;
|
|
}
|
|
}
|
|
|
|
static T* getInstance() { return sInstance; }
|
|
|
|
static T* sInstance;
|
|
};
|
|
|
|
/**
|
|
* @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 */
|