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
33#define DEFINE_GEN_CHECKBOX(T, kind) \
34 void genCheckBox(const char* label, T* pSrc, T mask, u32 style = 0, \
35 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
36 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
37 genCheckBoxSub(kind, label, (uintptr_t)pSrc, style, *pSrc, mask, pListener, posX, posY, \
38 width, height); \
39 }
40
41#define DEFINE_GEN_CHECKBOX_ID(T, kind) \
42 void genCheckBoxID(const char* label, u32 id, T mask, T initValue, u32 style = 0, \
43 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
44 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
45 genCheckBoxSub(kind, label, id, style, initValue, mask, pListener, posX, posY, width, \
46 height); \
47 }
48
49#define DEFINE_GEN_SLIDER(T, kind) \
50 void genSlider(const char* label, T* pSrc, T rangeMin, T rangeMax, u32 style = 0, \
51 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
52 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
53 genSliderSub(kind, label, (uintptr_t)pSrc, style, *pSrc, rangeMin, rangeMax, pListener, \
54 posX, posY, width, height); \
55 }
56
57#define DEFINE_GEN_SLIDER_ID(T, kind) \
58 void genSliderID(const char* label, u32 id, T data, T rangeMin, T rangeMax, u32 style = 0, \
59 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
60 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
61 genSliderSub(kind, label, id, style, data, rangeMin, rangeMax, pListener, posX, posY, \
62 width, height); \
63 }
64
65#define DEFINE_START_COMBO_BOX(T, kind) \
66 void startComboBox(const char* label, T* pSrc, u32 style = 0, \
67 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
68 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
69 startSelectorSub('CMBX', kind, label, (uintptr_t)pSrc, style, *pSrc, pListener, posX, \
70 posY, width, height); \
71 }
72
73#define DEFINE_START_COMBO_BOX_ID(T, kind) \
74 void startComboBoxID(const char* label, u32 id, T data, u32 style = 0, \
75 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \
76 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \
77 startSelectorSub('CMBX', kind, label, id, style, data, pListener, posX, posY, width, \
78 height); \
79 }
80
81#define DEFINE_UPDATE_COMBO_BOX(T) \
82 void updateComboBox(u32 mode, T* pSrc, u32 param_2) { \
83 updateSelectorSub(mode, (uintptr_t)pSrc, *pSrc, param_2); \
84 }
85
86#define DEFINE_UPDATE_SLIDER(T) \
87 void updateSlider(u32 mode, T* pSrc, T rangeMin, T rangeMax, u32 param_5) { \
88 updateSliderSub(mode, (uintptr_t)pSrc, *pSrc, rangeMin, rangeMax, param_5); \
89 }
90
91#define DEFINE_UPDATE_SLIDER_ID(T) \
92 void updateSliderID(u32 mode, u32 id, T value, T rangeMin, T rangeMax, u32 param_5) { \
93 updateSliderSub(mode, id, value, rangeMin, rangeMax, param_5); \
94 }
95
96#define DEFINE_START_RADIO_BUTTON(T, kind) \
97 void startRadioButton(const char* label, T* pSrc, u32 style, JOREventListener* pListener, \
98 u16 posX, u16 posY, u16 width, u16 height) { \
99 startSelectorSub('RBTN', kind, label, (uintptr_t)pSrc, style, *pSrc, pListener, posX, \
100 posY, width, height); \
101 }
102
103namespace jhostio {
104enum EKind {
105 EKind_8B = 0x08,
106 EKind_16B = 0x10,
107 EKind_32B = 0x20,
108};
109
110inline u32 GetEKindSize(u32 param_0) {
111 return param_0 & 0xFF;
112}
113} // namespace jhostio
114
115class JORReflexible;
116class JORFile;
117class JOREventListener;
118class JORHostInfo;
119
121public:
122 JORMContext() : mOutputStream(this, 0x10000) {}
123
125 void putMsgID(u32 msgID) { mOutputStream << msgID; }
127 u8* msgPtr() { return mBuffer; }
128
129 void openFile(JORFile* pFile, u32 flags, const char* path, const char* extMask, u32 maskSize,
130 const char* defaultExt, const char* param_6, const char* fileSuffix);
131 void closeFile(JORFile* pFile);
132 void readBegin(JORFile* pFile, s32 size);
133 void readData(JORFile* pFile);
134 void writeBegin(JORFile* pFile, u16 flags, u32 size);
135 void writeData(JORFile* pFile, const void* pBuffer, s32 size, u32 position);
136 void writeDone(JORFile* pFile, u32 size);
137 void sendShellExecuteRequest(void*, const char*, const char*, const char*, const char*, int);
138 void sendHostInfoRequest(u32 requestType, JORHostInfo* pHostInfo);
139 void endNode();
140
141 void genRootNode(const char* label, JORReflexible* obj, u32 param_2, u32 param_3) {
142 genNodeSub(label, obj, param_2, param_3);
143 }
144
145 void genNode(const char* label, JORReflexible* obj, u32 param_2, u32 param_3) {
146 mOutputStream << MCTX_COMMAND_GEN_NODE;
147 genNodeSub(label, obj, param_2, param_3);
148 }
149
150 void genNode(JORReflexible* parentObj, u32 param_1, const char* label, JORReflexible* obj,
151 u32 param_4, u32 param_5) {
152 ASSERTMSGLINE(97, parentObj != NULL,
153 "JORMContext: genNode must specify strict( not null node ) parent object\n");
154
155 mOutputStream << MCTX_COMMAND_GEN_NODE;
156 mOutputStream << param_1;
157 putNode(parentObj);
158 genNodeSub(label, obj, param_4, param_5);
159 }
160
161 void startNode(JORReflexible* parentObj, u32 param_1, const char* label, JORReflexible* obj,
162 u32 param_4, u32 param_5) {
163 ASSERTMSGLINE(
164 113, parentObj != NULL,
165 "JORMContext: startNode must specify strict( not null node ) parent object\n");
166
167 mOutputStream << MCTX_COMMAND_START_NODE;
168 mOutputStream << param_1;
169 putNode(parentObj);
170 genNodeSub(label, obj, param_4, param_5);
171 }
172
173 void startNode(const char* label, JORReflexible* obj, u32 param_2, u32 param_3) {
174 mOutputStream << MCTX_COMMAND_START_NODE;
175 genNodeSub(label, obj, param_2, param_3);
176 }
177
179 // empty function
180 }
181
183
184 void genNodeSub(const char* label, JORReflexible* i_node, u32, u32);
186 void invalidNode(JORReflexible* i_node, u32);
187
188 void genControl(u32 type, u32 kind, const char* label, u32 style, u32 id,
189 JOREventListener* pListener, u32 initValue);
190
191 void genSliderSub(u32 kind, const char* label, u32 id, u32 style, s32 initValue, s32 rangeMin,
192 s32 rangeMax, JOREventListener* pListener, u16 posX, u16 posY, u16 width,
193 u16 height);
194
195 void genCheckBoxSub(u32 kind, const char* label, u32 id, u32 style, u16 initValue, u16 mask,
196 JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height);
197
198 void startSelectorSub(u32 type, u32 kind, const char* label, u32 id, u32 style, s32 initValue,
199 JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height);
200
201 void endSelectorSub();
202
203 void genSelectorItemSub(const char* label, s32 itemNo, u32 param_2, u16 posX, u16 posY,
204 u16 width, u16 height);
205
206 void genButton(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL,
207 u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH,
208 u16 height = JORM_DEFAULT_HEIGHT);
209
210 void genLabel(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL,
211 u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH,
212 u16 height = JORM_DEFAULT_HEIGHT);
213
214 void genGroupBox(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL,
215 u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH,
216 u16 height = JORM_DEFAULT_HEIGHT);
217
218 void genEditBoxID(const char* label, u32 id, const char* string, u16 length, u32 style = 0,
219 JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1,
220 u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT);
221
227
229
233 DEFINE_GEN_SLIDER(u8, 0x100 | jhostio::EKind_8B)
235 DEFINE_GEN_SLIDER(f32, JORPropertyEvent::EKind_FloatValue | jhostio::EKind_32B)
237
238 DEFINE_GEN_SLIDER_ID(f64, JORPropertyEvent::EKind_ValueID | JORPropertyEvent::EKind_FloatValue)
240
241 DEFINE_UPDATE_SLIDER(u8)
242 DEFINE_UPDATE_SLIDER(s16)
243 DEFINE_UPDATE_SLIDER(f32)
244 DEFINE_UPDATE_SLIDER(s32)
245
246 DEFINE_UPDATE_SLIDER_ID(f64)
247 DEFINE_UPDATE_SLIDER_ID(int)
248
252 DEFINE_START_COMBO_BOX(u8, 0x100 | jhostio::EKind_8B)
255
257
258 DEFINE_UPDATE_COMBO_BOX(u8)
259
260 void endComboBox() { endSelectorSub(); }
261
262 void genComboBoxItem(const char* label, s32 itemNo) {
263 genSelectorItemSub(label, itemNo, 0, 0, 0, 0, 0);
264 }
265
272
273 void endRadioButton() { endSelectorSub(); }
274
275 void genRadioButtonItem(const char* label, s32 itemNo, u32 param_2, u16 posX, u16 posY,
276 u16 width, u16 height) {
277 genSelectorItemSub(label, itemNo, param_2, posX, posY, width, height);
278 }
279
280 void updateControl(u32 mode, u32 id, u32 param_2);
281 void updateControl(u32 mode, u32 id, const char* param_2);
282 void updateLabel(u32 mode, u32 id, const char* param_2) { updateControl(mode, id, param_2); }
283 void updateSliderSub(u32 mode, u32 id, s32 value, s32 rangeMin, s32 rangeMax, u32 param_5);
284 void updateCheckBoxSub(u32 mode, u32 id, u16 value, u16 mask, u32 param_4);
285 void updateSelectorSub(u32 mode, u32 id, s32 value, u32 param_3);
286 void updateEditBoxID(u32 mode, u32 id, const char* string, u32 param_3, u16 length);
287
288 void updateCheckBox(u32 mode, u8* pSrc, u8 mask, u32 param_4) {
289 updateCheckBoxSub(mode, (uintptr_t)pSrc, *pSrc, mask, param_4);
290 }
291
292 void updateCheckBoxID(u32 mode, u32 id, u8 value, u8 mask, u32 param_4) {
293 updateCheckBoxSub(mode, id, value, mask, param_4);
294 }
295
296 void editComboBoxItem(u32 param_0, u32 param_1, const char* param_2, s32 param_3, u32 param_4);
297
298 void openMessageBox(void* param_0, u32 style, const char* message, const char* title);
299
300 /* 0x00000 */ u8 mBuffer[0x10000];
302};
303
306
307#endif /* JORMCONTEXT_H */
void releaseJORMContext(JORMContext *)
JORMContext * attachJORMContext(u32)
@ JSUStreamSeekFrom_SET
Definition JSUIosBase.h:7
Definition JORReflexible.h:36
Definition JORFile.h:24
Definition JORHostInfo.h:10
Definition JORMContext.h:120
void updateCheckBoxID(u32 mode, u32 id, u8 value, u8 mask, u32 param_4)
Definition JORMContext.h:292
void startUpdateNode(JORReflexible *obj)
Definition JORMContext.h:182
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(int, JORPropertyEvent::EKind_ValueID) DEFINE_UPDATE_COMBO_BOX(u8) void endComboBox()
Definition JORMContext.h:256
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)
void updateCheckBox(u32 mode, u8 *pSrc, u8 mask, u32 param_4)
Definition JORMContext.h:288
u8 * msgPtr()
Definition JORMContext.h:127
void bufInit()
Definition JORMContext.h:124
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:126
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:300
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:178
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:262
void genRadioButtonItem(const char *label, s32 itemNo, u32 param_2, u16 posX, u16 posY, u16 width, u16 height)
Definition JORMContext.h:275
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:145
void genRootNode(const char *label, JORReflexible *obj, u32 param_2, u32 param_3)
Definition JORMContext.h:141
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:282
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:150
DEFINE_START_RADIO_BUTTON(u8, 0x100|jhostio::EKind_8B) DEFINE_START_RADIO_BUTTON(s16
JORMContext()
Definition JORMContext.h:122
void putMsgID(u32 msgID)
Definition JORMContext.h:125
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:301
void startNode(JORReflexible *parentObj, u32 param_1, const char *label, JORReflexible *obj, u32 param_4, u32 param_5)
Definition JORMContext.h:161
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:173
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:43
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:2183
static u8 const itemNo[4]
Definition d_a_obj_poFire.cpp:78
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:103
EKind
Definition JORMContext.h:104
@ EKind_32B
Definition JORMContext.h:107
@ EKind_16B
Definition JORMContext.h:106
@ EKind_8B
Definition JORMContext.h:105
u32 GetEKindSize(u32 param_0)
Definition JORMContext.h:110
Definition JORReflexible.h:10
Definition d_a_npc_ks.cpp:47