forked from reticulatedpines/magiclantern_hg_02
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdialog.h
292 lines (254 loc) · 6.34 KB
/
dialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/** \file
* DryOS dialog/window interface.
*/
/*
* Copyright (C) 2009 Trammell Hudson <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _dryos_dialog_h_
#define _dryos_dialog_h_
#include "arm-mcr.h"
#include "gui.h"
/** Windowing system elements */
struct winsys_struct
{
void * vram_instance; // off 0x00
struct vram_object * vram_object; // off 0x04
uint32_t off_0x08;
uint32_t off_0x0c;
uint32_t off_0x10;
uint32_t off_0x14;
uint32_t off_0x18;
uint32_t off_0x1c;
uint32_t off_0x20;
struct semaphore * sem; // off 0x24
uint32_t off_0x28;
uint32_t off_0x2c;
uint32_t flag_0x30;
uint32_t flag_0x34;
uint32_t off_0x38;
uint32_t off_0x3c;
uint32_t off_0x40;
uint32_t off_0x44; // used for collapsed vram?
uint32_t off_0x48;
uint32_t off_0x4c;
};
SIZE_CHECK_STRUCT( winsys_struct, 0x50 );
extern struct winsys_struct winsys_struct;
typedef int (*window_callback)( void * );
/** Returned by window_create_maybe() at 0xFFA6BC00 */
struct window
{
const char * type; // "Window Instance" at 0x14920
uint32_t off_0x04; // initial=0
uint32_t off_0x08; // initial=0
uint32_t off_0x0c; // initial=0
uint32_t x; // off_0x10;
uint32_t y; // off_0x14;
uint32_t width; // off_0x18; r5
uint32_t height; // off_0x1c; r6
window_callback callback; // off 0x20
void * arg; // off_0x24;
uint32_t wx_maybe; // off_0x28;
uint32_t wy_maybe; // off_0x2c;
};
SIZE_CHECK_STRUCT( window, 0x30 );
extern struct window *
window_create(
uint32_t x,
uint32_t y,
uint32_t w,
uint32_t h,
window_callback callback,
void * arg
);
struct dialog;
struct dialog_list;
struct dialog_item;
/** Returns 0 if it handled the message, 1 if it did not? */
typedef int (*dialog_handler_t)(
struct dialog * self,
void * arg,
gui_event_t event
);
/** These are chock-full of callbacks. I don't know what most of them do. */
struct dialog_item
{
const char * type; // "DIALOGITEM" at 0xFFCA7B1c
struct dialog_list * next; // maybe parent? 0x04
struct dialog_list * prev; // maybe 0x08
struct dialog_callbacks * callbacks; // maybe object? 0x0c
uint32_t off_0x10;
uint32_t off_0x14;
uint32_t off_0x18;
uint32_t off_0x1c;
uint32_t off_0x20;
uint32_t off_0x24;
uint32_t off_0x28;
void (*move_callback)( struct dialog *, int x, int y ); // off_0x2c;
uint32_t off_0x30;
uint32_t off_0x34;
uint32_t off_0x38;
uint32_t off_0x3c;
};
SIZE_CHECK_STRUCT( dialog_item, 0x40 );
/** Dialog children? Maybe? */
struct dialog_list
{
uint16_t index; // off 0x00
uint16_t off_0x02;
struct dialog_item * item; // off 0x04 maybe
uint32_t arg1; // off 0x08, passed to creat
uint32_t arg2; // off_0x0c, passed to creat
uint32_t off_0x10;
uint32_t off_0x14;
uint32_t off_0x18;
struct dialog_list * next; // off 0x1c
};
/** Dialog box gui elements */
struct dialog
{
const char * type; // "DIALOG" at 0x147F8
struct window * window; // off 0x04
void * arg0; // off 0x08
struct langcon * langcon; // off 0x0c
struct dispsw_control * disp_sw_controller; // off 0x10
struct publisher * publisher; // off 0x14
uint32_t off_0x18;
uint32_t off_0x1c;
uint32_t off_0x20; // initial=0
uint32_t off_0x24; // initial=0
uint32_t off_0x28; // initial=2
uint32_t off_0x2c; // initial=0
uint32_t off_0x30; // initial=0
uint32_t flag_0x34; // initial=0, set to 1 by
uint32_t off_0x38; // initial=0
struct task * gui_task; // off 0x3c
uint32_t off_0x40; // pointed to by 0x08
uint32_t off_0x44; // initial=0
uint32_t off_0x48;
uint32_t off_0x4c;
uint32_t off_0x50;
uint32_t off_0x54;
uint32_t off_0x58;
void * child_list_maybe; // off_0x5c;
dialog_handler_t handler; // off 0x60
uint32_t handler_arg; // off_0x64;
uint32_t off_0x68; // initial=0
uint16_t off_0x6c; // initial=0
uint16_t off_0x6e; // initial=0
uint16_t off_0x70;
uint16_t off_0x72; // initial=0
uint32_t off_0x74; // initial=1
uint32_t off_0x78; // initial=0
uint32_t off_0x7c; // initial=0
struct publisher * publisher_callback; // off_0x80;
uint32_t off_0x84;
uint32_t const_40000000_0; // off_0x88;
uint32_t off_0x8c; // initial=0xA
uint32_t off_0x90; // initial=0xA
uint32_t id; // off_0x94;
uint32_t level_maybe; // off_0x98;
uint32_t const_40000000_1; // off_0x9c;
uint16_t off_0xa0; // initial=0
uint16_t off_0xa2;
uint32_t off_0xa4;
uint32_t off_0xa8; // initial=0
uint32_t off_0xac; // initial=0
};
SIZE_CHECK_STRUCT( dialog, 0xB0 );
extern struct dialog *
dialog_create(
int id, // must be unique?
int level_maybe,
dialog_handler_t handler,
void * arg1,
void * arg2
);
extern void
dialog_delete(
struct dialog * dialog
);
extern void
dialog_draw(
struct dialog * dialog
);
extern void
dialog_window_draw(
struct dialog * dialog
);
extern void
dialog_window_prepare(
struct dialog * dialog,
void * unused
);
extern void
dialog_post_event(
unsigned event,
unsigned arg,
struct dialog * dialog
);
extern void
dialog_set_focus(
struct dialog * dialog
);
/** type 0 == 720, 1 == 960? */
extern void
dialog_set_origin_type(
struct dialog * dialog,
int type
);
extern void
dialog_resize(
struct dialog * dialog,
int w,
int h,
int unknown
);
extern void
dialog_window_resize(
struct dialog * dialog,
int w,
int h,
int unknown
);
extern void
dialog_move(
struct dialog * dialog,
int x,
int y
);
extern void
dialog_move_item(
struct dialog * dialog,
int x,
int y,
int index
);
extern void
dialog_label_item(
struct dialog * dialog,
uint32_t id,
const char * label,
int len_maybe,
int unknown
);
/** Top level dialog handler (gui_task) */
extern void
dialog_handler( void );
#endif