Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
JASGadget.h
Go to the documentation of this file.
1#ifndef JASGADGET_H
2#define JASGADGET_H
3
5#include "string.h"
6
11template<class T>
13public:
15 sInstance = inst;
16 }
17
18 JASGlobalInstance(bool param_1) {
19 if (param_1) {
20 JUT_ASSERT(186, sInstance == 0);
21 sInstance = (T*)this;
22 }
23 }
24
26 if (sInstance == (T*)this) {
27 sInstance = NULL;
28 }
29 }
30
31 static T* getInstance() { return sInstance; }
32
33 static T* sInstance;
34};
35
40template<class T>
42public:
43 JASPtrTable(T** param_0, u32 size) {
44 mTable = param_0;
45 mSize = size;
46 memset(mTable, 0, size * 4);
47 }
49 if (index >= mSize) {
50 return NULL;
51 }
52 return mTable[index];
53 }
54 T* get(u32 index) const {
55 if (index >= mSize) {
56 return NULL;
57 }
58 return mTable[index];
59 }
60 void set(u32 index, T* value) {
61 JUT_ASSERT(229, index < mSize);
62 mTable[index] = value;
63 }
64
65private:
66 /* 0x00 */ T** mTable;
67 /* 0x04 */ u32 mSize;
68};
69
74template<class T, size_t N>
75class JASPtrArray : public JASPtrTable<T> {
76public:
78
79private:
80 /* 0x08 */ T* mArray[N];
81};
82
83#endif /* JASGADGET_H */
static u8 index[20][3]
Definition GXDraw.c:434
unsigned int size
Definition __os.h:106
Definition JASGadget.h:12
static T * getInstance()
Definition JASGadget.h:31
static T * sInstance
Definition JASGadget.h:33
JASGlobalInstance(bool param_1)
Definition JASGadget.h:18
~JASGlobalInstance()
Definition JASGadget.h:25
JASGlobalInstance(T *inst)
Definition JASGadget.h:14
Definition JASGadget.h:75
T * mArray[N]
Definition JASGadget.h:80
JASPtrArray()
Definition JASGadget.h:77
Definition JASGadget.h:41
u32 mSize
Definition JASGadget.h:67
T * get(u32 index) const
Definition JASGadget.h:54
T ** mTable
Definition JASGadget.h:66
JASPtrTable(T **param_0, u32 size)
Definition JASGadget.h:43
void set(u32 index, T *value)
Definition JASGadget.h:60
T * get(u32 index)
Definition JASGadget.h:48
void * memset(void *dst, int val, size_t n)
Definition __mem.c:85
unsigned long u32
Definition types.h:9