Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
JORMContext.h
Go to the documentation of this file.
1#ifndef JORMCONTEXT_H
2#define JORMCONTEXT_H
3
4#include <dolphin/dolphin.h>
5#include <stdint.h>
8
9#define MCTX_MSG_RESET 0
10#define MCTX_MSG_GET_ROOT_OBJ 2
11#define MCTX_MSG_GEN_OBJ_INFO 4
12#define MCTX_MSG_INVALID_NODE 5
13#define MCTX_MSG_UPDATE_NODE 8
14#define MCTX_MSG_FIO 9
15#define MCTX_MSG_OPEN_MESSAGE_BOX 10
16#define MCTX_MSG_START_NODE 12
17#define MCTX_MSG_GET_HOST_INFO 14
18#define MCTX_MSG_SHELL_EXEC 15
19
20#define MCTX_COMMAND_START_NODE (u32)0
21#define MCTX_COMMAND_END_NODE (u32)1
22#define MCTX_COMMAND_GEN_CONTROL (u32)2
23#define MCTX_COMMAND_GEN_NODE (u32)3
24#define MCTX_COMMAND_START_SELECTOR (u32)4
25#define MCTX_COMMAND_END_SELECTOR (u32)5
26#define MCTX_COMMAND_SELECTOR_ITEM (u32)6
27#define MCTX_COMMAND_INVALID_NODE (u32)7
28#define MCTX_COMMAND_UPDATE_CONTROL (u32)8
29
30#define JORM_DEFAULT_WIDTH 0x200
31#define JORM_DEFAULT_HEIGHT 0x18
32#define JORM_DEFAULT_COMBOBOX_WIDTH 0x100
33#define JORM_DEFAULT_COMBOBOX_HEIGHT 0x1a
34
35#define DEFINE_GEN_CHECKBOX(T, kind) \
36 void genCheckBox(const char* label, T* pSrc, T mask, u32 style = 0, \
37 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
38 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
39 genCheckBoxSub(kind, label, (uintptr_t)pSrc, style, *pSrc, mask, pListener, posX, posY, \
40 width, height); \
41 }
42
43#define DEFINE_GEN_CHECKBOX_ID(T, kind) \
44 void genCheckBoxID(const char* label, u32 id, T mask, T initValue, u32 style = 0, \
45 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
46 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
47 genCheckBoxSub(kind, label, id, style, initValue, mask, pListener, posX, posY, width, \
48 height); \
49 }
50
51#define DEFINE_GEN_SLIDER(T, kind) \
52 void genSlider(const char* label, T* pSrc, T rangeMin, T rangeMax, u32 style = 0, \
53 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
54 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
55 genSliderSub(kind, label, (uintptr_t)pSrc, style, *pSrc, rangeMin, rangeMax, pListener, \
56 posX, posY, width, height); \
57 }
58
59#define DEFINE_GEN_SLIDER_ID(T, kind) \
60 void genSliderID(const char* label, u32 id, T data, T rangeMin, T rangeMax, u32 style = 0, \
61 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
62 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
63 genSliderSub(kind, label, id, style, data, rangeMin, rangeMax, pListener, posX, posY, \
64 width, height); \
65 }
66
67#define DEFINE_START_COMBO_BOX(T, kind) \
68 void startComboBox(const char* label, T* pSrc, u32 style = 0, \
69 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
70 u16 width = JORM_DEFAULT_COMBOBOX_WIDTH, \
71 u16 height = JORM_DEFAULT_COMBOBOX_HEIGHT) { \
72 startSelectorSub('CMBX', kind, label, (uintptr_t)pSrc, style, *pSrc, pListener, posX, \
73 posY, width, height); \
74 }
75
76#define DEFINE_START_COMBO_BOX_ID(T, kind) \
77 void startComboBoxID(const char* label, u32 id, T data, u32 style = 0, \
78 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
79 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
80 startSelectorSub('CMBX', kind, label, id, style, data, pListener, posX, posY, width, \
81 height); \
82 }
83
84#define DEFINE_UPDATE_COMBO_BOX(T) \
85 void updateComboBox(u32 mode, T* pSrc, u32 param_2) { \
86 updateSelectorSub(mode, (uintptr_t)pSrc, *pSrc, param_2); \
87 }
88
89#define DEFINE_UPDATE_COMBO_BOX_ID(T) \
90 void updateComboBoxID(u32 mode, u32 id, T value, u32 param_4) { \
91 updateSelectorSub(mode, id, value, param_4); \
92 }
93
94#define DEFINE_UPDATE_SLIDER(T) \
95 void updateSlider(u32 mode, T* pSrc, T rangeMin, T rangeMax, u32 param_5) { \
96 updateSliderSub(mode, (uintptr_t)pSrc, *pSrc, rangeMin, rangeMax, param_5); \
97 }
98
99#define DEFINE_UPDATE_SLIDER_ID(T) \
100 void updateSliderID(u32 mode, u32 id, T value, T rangeMin, T rangeMax, u32 param_5) { \
101 updateSliderSub(mode, id, value, rangeMin, rangeMax, param_5); \
102 }
103
104#define DEFINE_START_RADIO_BUTTON(T, kind) \
105 void startRadioButton(const char* label, T* pSrc, u32 style, JOREventListener* pListener, \
106 u16 posX, u16 posY, u16 width, u16 height) { \
107 startSelectorSub('RBTN', kind, label, (uintptr_t)pSrc, style, *pSrc, pListener, posX, \
108 posY, width, height); \
109 }
110
111namespace jhostio {
112enum EKind {
113 EKind_8B = 0x08,
114 EKind_16B = 0x10,
115 EKind_32B = 0x20,
116};
117
118inline u32 GetEKindSize(u32 param_0) {
119 return param_0 & 0xFF;
120}
121} // namespace jhostio
122
123class JORReflexible;
124class JORFile;
125class JOREventListener;
126class JORHostInfo;
127
129public:
130 JORMContext() : mOutputStream(this, 0x10000) {}
131
133 void putMsgID(u32 msgID) { mOutputStream << msgID; }
135 u8* msgPtr() { return mBuffer; }
136
137 void openFile(JORFile* pFile, u32 flags, const char* path, const char* extMask, u32 maskSize,
138 const char* defaultExt, const char* param_6, const char* fileSuffix);
139 void closeFile(JORFile* pFile);
140 void readBegin(JORFile* pFile, s32 size);
141 void readData(JORFile* pFile);
142 void writeBegin(JORFile* pFile, u16 flags, u32 size);
143 void writeData(JORFile* pFile, const void* pBuffer, s32 size, u32 position);
144 void writeDone(JORFile* pFile, u32 size);
145 void sendShellExecuteRequest(void*, const char*, const char*, const char*, const char*, int);
146 void sendHostInfoRequest(u32 requestType, JORHostInfo* pHostInfo);
147 void endNode();
148
149 void genRootNode(const char* label, JORReflexible* obj, u32 param_2, u32 param_3) {
150 genNodeSub(label, obj, param_2, param_3);
151 }
152
153 void genNode(const char* label, JORReflexible* obj, u32 param_2, u32 param_3) {
154 mOutputStream << MCTX_COMMAND_GEN_NODE;
155 genNodeSub(label, obj, param_2, param_3);
156 }
157
158 void genNode(JORReflexible* parentObj, u32 param_1, const char* label, JORReflexible* obj,
159 u32 param_4, u32 param_5) {
160 ASSERTMSGLINE(97, parentObj != NULL,
161 "JORMContext: genNode must specify strict( not null node ) parent object\n");
162
163 mOutputStream << MCTX_COMMAND_GEN_NODE;
164 mOutputStream << param_1;
165 putNode(parentObj);
166 genNodeSub(label, obj, param_4, param_5);
167 }
168
169 void startNode(JORReflexible* parentObj, u32 param_1, const char* label, JORReflexible* obj,
170 u32 param_4, u32 param_5) {
171 ASSERTMSGLINE(
172 113, parentObj != NULL,
173 "JORMContext: startNode must specify strict( not null node ) parent object\n");
174
175 mOutputStream << MCTX_COMMAND_START_NODE;
176 mOutputStream << param_1;
177 putNode(parentObj);
178 genNodeSub(label, obj, param_4, param_5);
179 }
180
181 void startNode(const char* label, JORReflexible* obj, u32 param_2, u32 param_3) {
182 mOutputStream << MCTX_COMMAND_START_NODE;
183 genNodeSub(label, obj, param_2, param_3);
184 }
185
187 // empty function
188 }
189
191
192 void genNodeSub(const char* label, JORReflexible* i_node, u32, u32);
194 mOutputStream << (uintptr_t)obj;
195 }
196 void invalidNode(JORReflexible* i_node, u32);
197
198 void genControl(u32 type, u32 kind, const char* label, u32 style, u32 id,
199 JOREventListener* pListener, u32 initValue);
200
201 void genSliderSub(u32 kind, const char* label, u32 id, u32 style, s32 initValue, s32 rangeMin,
202 s32 rangeMax, JOREventListener* pListener, u16 posX, u16 posY, u16 width,
203 u16 height);
204
205 void genCheckBoxSub(u32 kind, const char* label, u32 id, u32 style, u16 initValue, u16 mask,
206 JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height);
207
208 void startSelectorSub(u32 type, u32 kind, const char* label, u32 id, u32 style, s32 initValue,
209 JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height);
210
211 void endSelectorSub();
212
213 void genSelectorItemSub(const char* label, s32 itemNo, u32 param_2, u16 posX, u16 posY,
214 u16 width, u16 height);
215
216 void genButton(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL,
217 u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH,
218 u16 height = JORM_DEFAULT_HEIGHT);
219
220 void genLabel(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL,
221 u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH,
222 u16 height = JORM_DEFAULT_HEIGHT);
223
224 void genGroupBox(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL,
225 u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH,
226 u16 height = JORM_DEFAULT_HEIGHT);
227
228 void genEditBoxID(const char* label, u32 id, const char* string, u16 length, u32 style = 0,
229 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1,
230 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT);
231
237
239
243 DEFINE_GEN_SLIDER(u8, 0x100 | jhostio::EKind_8B)
245 DEFINE_GEN_SLIDER(f32, JORPropertyEvent::EKind_FloatValue | jhostio::EKind_32B)
247
248 DEFINE_GEN_SLIDER_ID(f64, JORPropertyEvent::EKind_ValueID | JORPropertyEvent::EKind_FloatValue)
250
251 DEFINE_UPDATE_SLIDER(u8)
252 DEFINE_UPDATE_SLIDER(s16)
253 DEFINE_UPDATE_SLIDER(f32)
254 DEFINE_UPDATE_SLIDER(s32)
255
256 DEFINE_UPDATE_SLIDER_ID(f64)
257 DEFINE_UPDATE_SLIDER_ID(int)
258
262 DEFINE_START_COMBO_BOX(u8, 0x100 | jhostio::EKind_8B)
265
267
268 DEFINE_UPDATE_COMBO_BOX(u8)
269
270 DEFINE_UPDATE_COMBO_BOX_ID(s32)
271
272 void endComboBox() { endSelectorSub(); }
273
274 void genComboBoxItem(const char* label, s32 itemNo) {
275 genSelectorItemSub(label, itemNo, 0, 0, 0, 0, 0);
276 }
277
284
285 void endRadioButton() { endSelectorSub(); }
286
287 void genRadioButtonItem(const char* label, s32 itemNo, u32 param_2, u16 posX, u16 posY,
288 u16 width, u16 height) {
289 genSelectorItemSub(label, itemNo, param_2, posX, posY, width, height);
290 }
291
292 void updateControl(u32 mode, u32 id, u32 param_2);
293 void updateControl(u32 mode, u32 id, const char* param_2);
294 void updateLabel(u32 mode, u32 id, const char* param_2) { updateControl(mode, id, param_2); }
295 void updateSliderSub(u32 mode, u32 id, s32 value, s32 rangeMin, s32 rangeMax, u32 param_5);
296 void updateCheckBoxSub(u32 mode, u32 id, u16 value, u16 mask, u32 param_4);
297 void updateSelectorSub(u32 mode, u32 id, s32 value, u32 param_3);
298 void updateEditBoxID(u32 mode, u32 id, const char* string, u32 param_3, u16 length);
299
300 void updateCheckBox(u32 mode, u8* pSrc, u8 mask, u32 param_4) {
301 updateCheckBoxSub(mode, (uintptr_t)pSrc, *pSrc, mask, param_4);
302 }
303
304 void updateCheckBoxID(u32 mode, u32 id, u8 value, u8 mask, u32 param_4) {
305 updateCheckBoxSub(mode, id, value, mask, param_4);
306 }
307
308 void updateRadioButton(u32 mode, s16* pSrc, u32 param_3) {
309 updateSelectorSub(mode, (uintptr_t)pSrc, *pSrc, param_3);
310 }
311
312 void editComboBoxItem(u32 param_0, u32 param_1, const char* param_2, s32 param_3, u32 param_4);
313
314 void openMessageBox(void* param_0, u32 style, const char* message, const char* title);
315
316 /* 0x00000 */ u8 mBuffer[0x10000];
318};
319
320#endif /* JORMCONTEXT_H */
@ JSUStreamSeekFrom_SET
Definition JSUIosBase.h:7
Definition JORReflexible.h:39
Definition JORFile.h:24
Definition JORHostInfo.h:10
Definition JORMContext.h:128
void updateCheckBoxID(u32 mode, u32 id, u8 value, u8 mask, u32 param_4)
Definition JORMContext.h:304
void startUpdateNode(JORReflexible *obj)
Definition JORMContext.h:190
jhostio::EKind_16B jhostio::EKind_8B JORPropertyEvent::EKind_FloatValue jhostio::EKind_32B JORPropertyEvent::EKind_ValueID JORPropertyEvent::EKind_FloatValue jhostio::EKind_8B jhostio::EKind_32B DEFINE_START_COMBO_BOX_ID(s32, JORPropertyEvent::EKind_ValueID) DEFINE_UPDATE_COMBO_BOX(u8) DEFINE_UPDATE_COMBO_BOX_ID(s32) void endComboBox()
Definition JORMContext.h:266
void updateCheckBoxSub(u32 mode, u32 id, u16 value, u16 mask, u32 param_4)
Definition JORServer.cpp:693
void sendHostInfoRequest(u32 requestType, JORHostInfo *pHostInfo)
Definition JORServer.cpp:814
DEFINE_GEN_CHECKBOX(u8, 0x100|jhostio::EKind_8B) DEFINE_GEN_CHECKBOX(u16
jhostio::EKind_16B jhostio::EKind_8B DEFINE_GEN_SLIDER(s16, jhostio::EKind_16B) DEFINE_GEN_SLIDER(f32
void genSelectorItemSub(const char *label, s32 itemNo, u32 param_2, u16 posX, u16 posY, u16 width, u16 height)
Definition JORServer.cpp:603
void genControl(u32 type, u32 kind, const char *label, u32 style, u32 id, JOREventListener *pListener, u32 initValue)
Definition JORServer.cpp:538
void putNode(JORReflexible *obj)
Definition JORMContext.h:193
void updateCheckBox(u32 mode, u8 *pSrc, u8 mask, u32 param_4)
Definition JORMContext.h:300
u8 * msgPtr()
Definition JORMContext.h:135
void bufInit()
Definition JORMContext.h:132
jhostio::EKind_16B DEFINE_GEN_CHECKBOX_ID(u16, JORPropertyEvent::EKind_ValueID|0x100) DEFINE_GEN_SLIDER(u8
void updateEditBoxID(u32 mode, u32 id, const char *string, u32 param_3, u16 length)
Definition JORServer.cpp:713
s32 msgSize()
Definition JORMContext.h:134
void updateRadioButton(u32 mode, s16 *pSrc, u32 param_3)
Definition JORMContext.h:308
void updateSliderSub(u32 mode, u32 id, s32 value, s32 rangeMin, s32 rangeMax, u32 param_5)
Definition JORServer.cpp:681
void genSliderSub(u32 kind, const char *label, u32 id, u32 style, s32 initValue, s32 rangeMin, s32 rangeMax, JOREventListener *pListener, u16 posX, u16 posY, u16 width, u16 height)
Definition JORServer.cpp:556
u8 mBuffer[0x10000]
Definition JORMContext.h:316
void genNodeSub(const char *label, JORReflexible *i_node, u32, u32)
Definition JORServer.cpp:516
void sendShellExecuteRequest(void *, const char *, const char *, const char *, const char *, int)
Definition JORServer.cpp:818
void invalidNode(JORReflexible *i_node, u32)
Definition JORServer.cpp:531
void openFile(JORFile *pFile, u32 flags, const char *path, const char *extMask, u32 maskSize, const char *defaultExt, const char *param_6, const char *fileSuffix)
Definition JORServer.cpp:731
void endNode()
Definition JORServer.cpp:527
void readData(JORFile *pFile)
Definition JORServer.cpp:775
void genLabel(const char *label, u32 id, u32 style=0, JOREventListener *pListener=NULL, u16 posX=-1, u16 posY=-1, u16 width=JORM_DEFAULT_WIDTH, u16 height=JORM_DEFAULT_HEIGHT)
Definition JORServer.cpp:624
void endUpdateNode()
Definition JORMContext.h:186
void startSelectorSub(u32 type, u32 kind, const char *label, u32 id, u32 style, s32 initValue, JOREventListener *pListener, u16 posX, u16 posY, u16 width, u16 height)
Definition JORServer.cpp:585
void genGroupBox(const char *label, u32 id, u32 style=0, JOREventListener *pListener=NULL, u16 posX=-1, u16 posY=-1, u16 width=JORM_DEFAULT_WIDTH, u16 height=JORM_DEFAULT_HEIGHT)
Definition JORServer.cpp:638
void genComboBoxItem(const char *label, s32 itemNo)
Definition JORMContext.h:274
void genRadioButtonItem(const char *label, s32 itemNo, u32 param_2, u16 posX, u16 posY, u16 width, u16 height)
Definition JORMContext.h:287
void writeDone(JORFile *pFile, u32 size)
Definition JORServer.cpp:802
void genNode(const char *label, JORReflexible *obj, u32 param_2, u32 param_3)
Definition JORMContext.h:153
void genRootNode(const char *label, JORReflexible *obj, u32 param_2, u32 param_3)
Definition JORMContext.h:149
void editComboBoxItem(u32 param_0, u32 param_1, const char *param_2, s32 param_3, u32 param_4)
Definition JORServer.cpp:725
void endSelectorSub()
Definition JORServer.cpp:599
void updateLabel(u32 mode, u32 id, const char *param_2)
Definition JORMContext.h:294
void openMessageBox(void *param_0, u32 style, const char *message, const char *title)
Definition JORServer.cpp:810
void genEditBoxID(const char *label, u32 id, const char *string, u16 length, u32 style=0, JOREventListener *pListener=NULL, u16 posX=-1, u16 posY=-1, u16 width=JORM_DEFAULT_WIDTH, u16 height=JORM_DEFAULT_HEIGHT)
Definition JORServer.cpp:652
void readBegin(JORFile *pFile, s32 size)
Definition JORServer.cpp:767
void closeFile(JORFile *pFile)
Definition JORServer.cpp:763
void writeBegin(JORFile *pFile, u16 flags, u32 size)
Definition JORServer.cpp:782
void genNode(JORReflexible *parentObj, u32 param_1, const char *label, JORReflexible *obj, u32 param_4, u32 param_5)
Definition JORMContext.h:158
DEFINE_START_RADIO_BUTTON(u8, 0x100|jhostio::EKind_8B) DEFINE_START_RADIO_BUTTON(s16
JORMContext()
Definition JORMContext.h:130
void putMsgID(u32 msgID)
Definition JORMContext.h:133
jhostio::EKind_16B jhostio::EKind_8B JORPropertyEvent::EKind_FloatValue jhostio::EKind_32B JORPropertyEvent::EKind_ValueID JORPropertyEvent::EKind_FloatValue jhostio::EKind_8B DEFINE_START_COMBO_BOX(s16, jhostio::EKind_16B) DEFINE_START_COMBO_BOX(s32
JSUMemoryOutputStream mOutputStream
Definition JORMContext.h:317
void startNode(JORReflexible *parentObj, u32 param_1, const char *label, JORReflexible *obj, u32 param_4, u32 param_5)
Definition JORMContext.h:169
void genCheckBoxSub(u32 kind, const char *label, u32 id, u32 style, u16 initValue, u16 mask, JOREventListener *pListener, u16 posX, u16 posY, u16 width, u16 height)
Definition JORServer.cpp:571
void writeData(JORFile *pFile, const void *pBuffer, s32 size, u32 position)
Definition JORServer.cpp:791
void genButton(const char *label, u32 id, u32 style=0, JOREventListener *pListener=NULL, u16 posX=-1, u16 posY=-1, u16 width=JORM_DEFAULT_WIDTH, u16 height=JORM_DEFAULT_HEIGHT)
Definition JORServer.cpp:610
void updateControl(u32 mode, u32 id, u32 param_2)
Definition JORServer.cpp:667
void startNode(const char *label, JORReflexible *obj, u32 param_2, u32 param_3)
Definition JORMContext.h:181
jhostio::EKind_16B jhostio::EKind_8B JORPropertyEvent::EKind_FloatValue jhostio::EKind_32B JORPropertyEvent::EKind_ValueID JORPropertyEvent::EKind_FloatValue DEFINE_GEN_SLIDER_ID(int, JORPropertyEvent::EKind_ValueID) DEFINE_UPDATE_SLIDER(u8) DEFINE_UPDATE_SLIDER(s16) DEFINE_UPDATE_SLIDER(f32) DEFINE_UPDATE_SLIDER(s32) DEFINE_UPDATE_SLIDER_ID(f64) DEFINE_UPDATE_SLIDER_ID(int) DEFINE_START_COMBO_BOX(u8
void updateSelectorSub(u32 mode, u32 id, s32 value, u32 param_3)
Definition JORServer.cpp:705
Definition JORReflexible.h:47
Definition JSUMemoryStream.h:32
virtual s32 seek(s32, JSUStreamSeekFrom)
virtual s32 getPosition() const
static void message(do_class *i_this)
Definition d_a_do.cpp:2182
static u8 const itemNo[4]
Definition d_a_obj_poFire.cpp:76
u32 mode
Definition GXTev.c:56
unsigned int size
Definition __os.h:106
unsigned long u32
Definition types.h:12
signed short int s16
Definition types.h:9
float f32
Definition types.h:25
double f64
Definition types.h:26
unsigned short int u16
Definition types.h:10
signed long s32
Definition types.h:11
unsigned char u8
Definition types.h:8
Definition JORMContext.h:111
EKind
Definition JORMContext.h:112
@ EKind_32B
Definition JORMContext.h:115
@ EKind_16B
Definition JORMContext.h:114
@ EKind_8B
Definition JORMContext.h:113
u32 GetEKindSize(u32 param_0)
Definition JORMContext.h:118
Definition JORReflexible.h:10
Definition d_a_npc_ks.cpp:47