Loading [MathJax]/extensions/tex2jax.js
Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
JAUSoundTable.h
Go to the documentation of this file.
1#ifndef JAUSOUNDTABLE_H
2#define JAUSOUNDTABLE_H
3
6
18
23template<typename Root, typename Section, typename Group, typename Typename_0>
26 field_0x0 = NULL;
27 field_0x4 = 0;
28 }
29
30 void reset() {
31 field_0x0 = NULL;
32 field_0x4 = NULL;
33 }
34
35 void init(const void* param_0) {
36 field_0x0 = param_0;
37 // magic number is not in debug rom. I'm not sure what this comparison is (maybe some sort of '' number?)
38 // I also do not know how it is different between JAUSoundTable and JAUSoundNameTable
39 if (*(u32*)field_0x0 + 0xbdad0000 != Root::magicNumber()) {
40 field_0x0 = NULL;
41 } else {
42 field_0x4 = (Root*)((u8*)field_0x0 + *((u32*)field_0x0 + 3));
43 }
44 }
45
46 Section* getSection(int index) const {
47 if (index < 0) {
48 return NULL;
49 }
50 if ((u32)index >= field_0x4->mSectionNumber) {
51 return NULL;
52 }
53 u32 offset = field_0x4->mSectionOffsets[index];
54 if (offset == 0) {
55 return NULL;
56 }
57 return (Section*)((u8*)field_0x0 + offset);
58 }
59
60 Group* getGroup(Section* param_1, int index) const {
61 int iVar1;
62
63 if (index < 0) {
64 return NULL;
65 }
66 if ((u32)index >= param_1->mNumGroups) {
67 return NULL;
68 }
69 u32 offset = param_1->getGroupOffset(index);
70 if (offset == 0) {
71 return NULL;
72 }
73 return (Group*)((u8*)field_0x0 + offset);
74 }
75
76 const void* field_0x0;
77 Root* field_0x4;
78};
79
85 static inline u32 magicNumber() { return 0x5420; }
88};
89
95 int getGroupOffset(int index) const {
96 if (index < 0) {
97 return 0;
98 }
99 if (index >= mNumGroups) {
100 return 0;
101 }
102 return mGroupOffsets[index];
103 }
104
107};
108
114 u8 getTypeID(int index) const {
115 if (index < 0) {
116 return 0;
117 }
118 if (index >= mNumItems) {
119 return 0xff;
120 }
121 return mTypeIds[index * 4];
122 }
123
125 if (index < 0) {
126 return 0;
127 }
128 if (index >= mNumItems) {
129 return 0;
130 }
131 return *(u32*)(mTypeIds + index * 4) & 0xffffff;
132 }
133
137};
138
143struct JAUSoundTable : public JASGlobalInstance<JAUSoundTable> {
145 }
147
148 /* 802A7114 */ void init(void const*);
149 /* 802A7160 */ u8 getTypeID(JAISoundID) const;
150 /* 802A728C */ JAUSoundTableItem* getData(JAISoundID) const;
151
153 u32 offset = group->getItemOffset(index);
154 if (offset == 0) {
155 return NULL;
156 }
157 return (JAUSoundTableItem*)((u8*)field_0x0.field_0x0 + offset);
158 }
159
160 const void* getResource() { return field_0x0.field_0x0; }
161
163};
164
170 static inline u32 magicNumber() { return 0x544e; }
173};
179
185
198
199#endif /* JAUSOUNDTABLE_H */
static u8 index[20][3]
Definition GXDraw.c:434
Definition JAISound.h:12
Definition JASGadget.h:12
static initFunc init[]
Definition d_menu_collect.cpp:42
Definition JAUSoundTable.h:184
Definition JAUSoundTable.h:169
u32 mSectionNumber
Definition JAUSoundTable.h:171
static u32 magicNumber()
Definition JAUSoundTable.h:170
u32 mSectionOffsets[0]
Definition JAUSoundTable.h:172
Definition JAUSoundTable.h:178
Definition JAUSoundTable.h:190
JAUSoundNameTable(bool param_0)
Definition JAUSoundTable.h:191
JAUSoundTable_< JAUSoundNameTableRoot, JAUSoundNameTableSection, JAUSoundNameTableGroup, void > field_0x0
Definition JAUSoundTable.h:196
~JAUSoundNameTable()
Definition JAUSoundTable.h:193
Definition JAUSoundTable.h:113
u8 getTypeID(int index) const
Definition JAUSoundTable.h:114
u32 mNumItems
Definition JAUSoundTable.h:134
u32 getItemOffset(int index) const
Definition JAUSoundTable.h:124
u8 mTypeIds[0]
Definition JAUSoundTable.h:136
u32 field_0x4
Definition JAUSoundTable.h:135
Definition JAUSoundTable.h:11
u16 mResourceId
Definition JAUSoundTable.h:14
f32 field_0x8
Definition JAUSoundTable.h:16
u8 mPriority
Definition JAUSoundTable.h:12
u32 field_0x4
Definition JAUSoundTable.h:15
u8 field_0x1
Definition JAUSoundTable.h:13
Definition JAUSoundTable.h:84
static u32 magicNumber()
Definition JAUSoundTable.h:85
u32 mSectionOffsets[0]
Definition JAUSoundTable.h:87
u32 mSectionNumber
Definition JAUSoundTable.h:86
Definition JAUSoundTable.h:94
u32 mNumGroups
Definition JAUSoundTable.h:105
u32 mGroupOffsets[0]
Definition JAUSoundTable.h:106
int getGroupOffset(int index) const
Definition JAUSoundTable.h:95
Definition JAUSoundTable.h:24
JAUSoundTable_()
Definition JAUSoundTable.h:25
Section * getSection(int index) const
Definition JAUSoundTable.h:46
Root * field_0x4
Definition JAUSoundTable.h:77
void reset()
Definition JAUSoundTable.h:30
void init(const void *param_0)
Definition JAUSoundTable.h:35
const void * field_0x0
Definition JAUSoundTable.h:76
Group * getGroup(Section *param_1, int index) const
Definition JAUSoundTable.h:60
Definition JAUSoundTable.h:143
JAUSoundTable_< JAUSoundTableRoot, JAUSoundTableSection, JAUSoundTableGroup, void > field_0x0
Definition JAUSoundTable.h:162
u8 getTypeID(JAISoundID) const
Definition JAUSoundTable.cpp:18
const void * getResource()
Definition JAUSoundTable.h:160
JAUSoundTableItem * getData(JAISoundID) const
Definition JAUSoundTable.cpp:34
JAUSoundTableItem * getItem(JAUSoundTableGroup *group, int index) const
Definition JAUSoundTable.h:152
~JAUSoundTable()
Definition JAUSoundTable.h:146
JAUSoundTable(bool param_0)
Definition JAUSoundTable.h:144
unsigned long u32
Definition types.h:9
float f32
Definition types.h:22
unsigned short int u16
Definition types.h:7
unsigned char u8
Definition types.h:5