| 781 |
user890104 |
1 |
//
|
|
|
2 |
//
|
|
|
3 |
// Copyright 2011 TheSeven, user890104
|
|
|
4 |
//
|
|
|
5 |
//
|
|
|
6 |
// This file is part of emCORE.
|
|
|
7 |
//
|
|
|
8 |
// emCORE is free software: you can redistribute it and/or
|
|
|
9 |
// modify it under the terms of the GNU General Public License as
|
|
|
10 |
// published by the Free Software Foundation, either version 2 of the
|
|
|
11 |
// License, or (at your option) any later version.
|
|
|
12 |
//
|
|
|
13 |
// emCORE is distributed in the hope that it will be useful,
|
|
|
14 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
15 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
16 |
// See the GNU General Public License for more details.
|
|
|
17 |
//
|
|
|
18 |
// You should have received a copy of the GNU General Public License along
|
|
|
19 |
// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20 |
//
|
|
|
21 |
//
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
#include "emcoreapp.h"
|
|
|
25 |
#include "libboot.h"
|
|
|
26 |
#include "libpng.h"
|
|
|
27 |
#include "libui.h"
|
|
|
28 |
#include "libmkfat32.h"
|
|
|
29 |
|
|
|
30 |
extern char background_png[];
|
|
|
31 |
extern uint32_t background_png_size;
|
|
|
32 |
extern char icons_png[];
|
|
|
33 |
extern uint32_t icons_png_size;
|
|
|
34 |
extern char rockbox_png[];
|
|
|
35 |
extern uint32_t rockbox_png_size;
|
|
|
36 |
extern char crapple_png[];
|
|
|
37 |
extern uint32_t crapple_png_size;
|
|
|
38 |
|
|
|
39 |
struct libpng_api* png;
|
|
|
40 |
struct libboot_api* boot;
|
|
|
41 |
struct libui_api* ui;
|
|
|
42 |
void* framebuf;
|
|
|
43 |
void* framebuf2;
|
|
|
44 |
void* bg;
|
|
|
45 |
void* icons;
|
|
|
46 |
//void* rbxlogo;
|
|
|
47 |
//void* crapple;
|
|
|
48 |
|
|
|
49 |
static struct emcorelib_header* loadlib(uint32_t identifier, uint32_t version, char* filename)
|
|
|
50 |
{
|
|
|
51 |
struct emcorelib_header* lib = get_library(identifier, version, LIBSOURCE_BOOTFLASH, filename);
|
|
|
52 |
if (!lib) panicf(PANIC_KILLTHREAD, "Could not load %s", filename);
|
|
|
53 |
return lib;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
static void* loadpng(const char* buf, const uint32_t size, void* (*decoder)(struct png_info* handle))
|
|
|
57 |
{
|
|
|
58 |
if (size == 0) panicf(PANIC_KILLTHREAD, "Could not load PNG at 0x%08X", buf);
|
|
|
59 |
struct png_info* handle = png->png_open(buf, size);
|
|
|
60 |
if (!handle) panicf(PANIC_KILLTHREAD, "Could not parse PNG at 0x%08X", buf);
|
|
|
61 |
void* out = decoder(handle);
|
|
|
62 |
if (!out) panicf(PANIC_KILLTHREAD, "Could not decode PNG at 0x%08X", buf);
|
|
|
63 |
png->png_destroy(handle);
|
|
|
64 |
return out;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
static void message(int x, const char* line1, const char* line2)
|
|
|
68 |
{
|
|
|
69 |
rendertext(framebuf, x, 73, 240, 0xff3333ff, 0xa0000000, line1);
|
|
|
70 |
rendertext(framebuf, x, 81, 240, 0xff3333ff, 0xa0000000, line2);
|
|
|
71 |
displaylcd(0, 0, 240, 320, framebuf, 0, 0, 240);
|
|
|
72 |
sleep(5000000);
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
struct chooser_renderer_list_itemdata toolchooser_rparams_mainchooser =
|
|
|
76 |
{
|
|
|
77 |
.size = LIBUI_POINT(224, 10),
|
|
|
78 |
.fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(224, 10)),
|
|
|
79 |
.fill_color = 0xa0000000,
|
|
|
80 |
.fill_color_selected = 0x60ffffff,
|
|
|
81 |
.icon_pos = LIBUI_POINT(0, 0),
|
|
|
82 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
83 |
LIBUI_POINT(0, 0)),
|
|
|
84 |
.icon_opacity = 0,
|
|
|
85 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
86 |
LIBUI_POINT(0, 0)),
|
|
|
87 |
.icon_selected_opacity = 0,
|
|
|
88 |
.text = "Return to main menu",
|
|
|
89 |
.text_pos = LIBUI_POINT(1, 1),
|
|
|
90 |
.text_color = 0xffffffff,
|
|
|
91 |
.text_color_selected = 0xff7fffff
|
|
|
92 |
};
|
|
|
93 |
|
|
|
94 |
struct chooser_renderer_list_itemdata toolchooser_rparams_umsboot =
|
|
|
95 |
{
|
|
|
96 |
.size = LIBUI_POINT(224, 10),
|
|
|
97 |
.fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(224, 10)),
|
|
|
98 |
.fill_color = 0xa0000000,
|
|
|
99 |
.fill_color_selected = 0x60ffffff,
|
|
|
100 |
.icon_pos = LIBUI_POINT(0, 0),
|
|
|
101 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
102 |
LIBUI_POINT(0, 0)),
|
|
|
103 |
.icon_opacity = 0,
|
|
|
104 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
105 |
LIBUI_POINT(0, 0)),
|
|
|
106 |
.icon_selected_opacity = 0,
|
|
|
107 |
.text = "Run UMSboot",
|
|
|
108 |
.text_pos = LIBUI_POINT(1, 1),
|
|
|
109 |
.text_color = 0xffffffff,
|
|
|
110 |
.text_color_selected = 0xff7fffff
|
|
|
111 |
};
|
|
|
112 |
|
|
|
113 |
void run_umsboot(void** firmware, void** app, int* size)
|
|
|
114 |
{
|
|
|
115 |
boot->load_from_flash(firmware, size, false, "umsboot ", 0x10000);
|
|
|
116 |
if (!*firmware)
|
|
|
117 |
{
|
|
|
118 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
119 |
message(19, "Loading UMSboot failed!", "Returning to main menu.");
|
|
|
120 |
}
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
struct chooser_renderer_list_itemdata toolchooser_rparams_diagmode =
|
|
|
124 |
{
|
|
|
125 |
.size = LIBUI_POINT(224, 10),
|
|
|
126 |
.fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(224, 10)),
|
|
|
127 |
.fill_color = 0xa0000000,
|
|
|
128 |
.fill_color_selected = 0x60ffffff,
|
|
|
129 |
.icon_pos = LIBUI_POINT(0, 0),
|
|
|
130 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
131 |
LIBUI_POINT(0, 0)),
|
|
|
132 |
.icon_opacity = 0,
|
|
|
133 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
134 |
LIBUI_POINT(0, 0)),
|
|
|
135 |
.icon_selected_opacity = 0,
|
|
|
136 |
.text = "Run diagnostics mode",
|
|
|
137 |
.text_pos = LIBUI_POINT(1, 1),
|
|
|
138 |
.text_color = 0xffffffff,
|
|
|
139 |
.text_color_selected = 0xff7fffff
|
|
|
140 |
};
|
|
|
141 |
|
|
|
142 |
void run_diagmode(void** firmware, void** app, int* size)
|
|
|
143 |
{
|
|
|
144 |
boot->load_from_flash(firmware, size, false, "diagmode", 0x100000);
|
|
|
145 |
if (!*firmware)
|
|
|
146 |
{
|
|
|
147 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
148 |
message(16, "Loading diag mode failed!", " Returning to main menu. ");
|
|
|
149 |
}
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
struct chooser_renderer_list_itemdata toolchooser_rparams_rockbox_fallback =
|
|
|
153 |
{
|
|
|
154 |
.size = LIBUI_POINT(224, 10),
|
|
|
155 |
.fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(224, 10)),
|
|
|
156 |
.fill_color = 0xa0000000,
|
|
|
157 |
.fill_color_selected = 0x60ffffff,
|
|
|
158 |
.icon_pos = LIBUI_POINT(0, 0),
|
|
|
159 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
160 |
LIBUI_POINT(0, 0)),
|
|
|
161 |
.icon_opacity = 0,
|
|
|
162 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
163 |
LIBUI_POINT(0, 0)),
|
|
|
164 |
.icon_selected_opacity = 0,
|
|
|
165 |
.text = "Run Rockbox fallback image",
|
|
|
166 |
.text_pos = LIBUI_POINT(1, 1),
|
|
|
167 |
.text_color = 0xffffffff,
|
|
|
168 |
.text_color_selected = 0xff7fffff
|
|
|
169 |
};
|
|
|
170 |
|
|
|
171 |
void run_rockbox_fallback(void** firmware, void** app, int* size)
|
|
|
172 |
{
|
|
|
173 |
boot->load_from_flash(firmware, size, true, "rockbox ", 0x100000);
|
|
|
174 |
if (!*firmware)
|
|
|
175 |
{
|
|
|
176 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
177 |
message(19, "Loading Rockbox failed!", "Returning to main menu.");
|
|
|
178 |
}
|
|
|
179 |
}
|
|
|
180 |
|
|
|
181 |
struct chooser_renderer_list_itemdata toolchooser_rparams_clearcfg =
|
|
|
182 |
{
|
|
|
183 |
.size = LIBUI_POINT(224, 10),
|
|
|
184 |
.fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(224, 10)),
|
|
|
185 |
.fill_color = 0xa0000000,
|
|
|
186 |
.fill_color_selected = 0x60ffffff,
|
|
|
187 |
.icon_pos = LIBUI_POINT(0, 0),
|
|
|
188 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
189 |
LIBUI_POINT(0, 0)),
|
|
|
190 |
.icon_opacity = 0,
|
|
|
191 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
192 |
LIBUI_POINT(0, 0)),
|
|
|
193 |
.icon_selected_opacity = 0,
|
|
|
194 |
.text = "Clear Rockbox configuration",
|
|
|
195 |
.text_pos = LIBUI_POINT(1, 1),
|
|
|
196 |
.text_color = 0xffffffff,
|
|
|
197 |
.text_color_selected = 0xff7fffff
|
|
|
198 |
};
|
|
|
199 |
|
|
|
200 |
void run_clearcfg(void** firmware, void** app, int* size)
|
|
|
201 |
{
|
|
|
202 |
remove("/.rockbox/config.cfg");
|
|
|
203 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
204 |
message(25, "Rockbox configuration", " has been cleared. ");
|
|
|
205 |
}
|
|
|
206 |
|
|
|
207 |
struct chooser_renderer_list_itemdata toolchooser_rparams_cleardb =
|
|
|
208 |
{
|
|
|
209 |
.size = LIBUI_POINT(224, 10),
|
|
|
210 |
.fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(224, 10)),
|
|
|
211 |
.fill_color = 0xa0000000,
|
|
|
212 |
.fill_color_selected = 0x60ffffff,
|
|
|
213 |
.icon_pos = LIBUI_POINT(0, 0),
|
|
|
214 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
215 |
LIBUI_POINT(0, 0)),
|
|
|
216 |
.icon_opacity = 0,
|
|
|
217 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
218 |
LIBUI_POINT(0, 0)),
|
|
|
219 |
.icon_selected_opacity = 0,
|
|
|
220 |
.text = "Clear Rockbox database",
|
|
|
221 |
.text_pos = LIBUI_POINT(1, 1),
|
|
|
222 |
.text_color = 0xffffffff,
|
|
|
223 |
.text_color_selected = 0xff7fffff
|
|
|
224 |
};
|
|
|
225 |
|
|
|
226 |
void run_cleardb(void** firmware, void** app, int* size)
|
|
|
227 |
{
|
|
|
228 |
remove("/.rockbox/database_0.tcd");
|
|
|
229 |
remove("/.rockbox/database_1.tcd");
|
|
|
230 |
remove("/.rockbox/database_2.tcd");
|
|
|
231 |
remove("/.rockbox/database_3.tcd");
|
|
|
232 |
remove("/.rockbox/database_4.tcd");
|
|
|
233 |
remove("/.rockbox/database_5.tcd");
|
|
|
234 |
remove("/.rockbox/database_6.tcd");
|
|
|
235 |
remove("/.rockbox/database_7.tcd");
|
|
|
236 |
remove("/.rockbox/database_8.tcd");
|
|
|
237 |
remove("/.rockbox/database_9.tcd");
|
|
|
238 |
remove("/.rockbox/database_idx.tcd");
|
|
|
239 |
remove("/.rockbox/database_tmp.tcd");
|
|
|
240 |
remove("/.rockbox/database_state.tcd");
|
|
|
241 |
remove("/.rockbox/database_changelog.txt");
|
|
|
242 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
243 |
message(37, "Rockbox database", "has been cleared.");
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
struct chooser_renderer_list_itemdata toolchooser_rparams_reformat =
|
|
|
247 |
{
|
|
|
248 |
.size = LIBUI_POINT(224, 10),
|
|
|
249 |
.fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(224, 10)),
|
|
|
250 |
.fill_color = 0xa0000000,
|
|
|
251 |
.fill_color_selected = 0x60ffffff,
|
|
|
252 |
.icon_pos = LIBUI_POINT(0, 0),
|
|
|
253 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
254 |
LIBUI_POINT(0, 0)),
|
|
|
255 |
.icon_opacity = 0,
|
|
|
256 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
257 |
LIBUI_POINT(0, 0)),
|
|
|
258 |
.icon_selected_opacity = 0,
|
|
|
259 |
.text = "Reformat data partition",
|
|
|
260 |
.text_pos = LIBUI_POINT(1, 1),
|
|
|
261 |
.text_color = 0xffffffff,
|
|
|
262 |
.text_color_selected = 0xff7fffff
|
|
|
263 |
};
|
|
|
264 |
|
|
|
265 |
void fat32_progressbar_init(void* user, int max)
|
|
|
266 |
{
|
|
|
267 |
progressbar_init((struct progressbar_state*)user,
|
|
|
268 |
10, 165, 74, 83, 0x77ff, 0xe8, 0x125f, 0, max);
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
void fat32_progressbar_update(void* user, int current)
|
|
|
272 |
{
|
|
|
273 |
progressbar_setpos((struct progressbar_state*)user, current, false);
|
|
|
274 |
}
|
|
|
275 |
|
|
|
276 |
void run_reformat(void** firmware, void** app, int* size)
|
|
|
277 |
{
|
|
|
278 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
279 |
rendertext(framebuf, 7, 65, 240, 0xff7fffff, 0, "Reformatting data partition");
|
|
|
280 |
displaylcd(0, 0, 240, 320, framebuf, 0, 0, 240);
|
|
|
281 |
struct emcorelib_header* libmkfat32 = loadlib(LIBMKFAT32_IDENTIFIER,
|
|
|
282 |
LIBMKFAT32_API_VERSION, "libmkf32");
|
|
|
283 |
struct libmkfat32_api* mf32 = (struct libmkfat32_api*)libmkfat32->api;
|
|
|
284 |
struct storage_info storageinfo;
|
|
|
285 |
storage_get_info(0, &storageinfo);
|
|
|
286 |
struct progressbar_state progressbar;
|
|
|
287 |
int rc = mf32->mkfat32(0, 0, storageinfo.num_sectors, 2048, 1, "iPod Nano2G",
|
|
|
288 |
&progressbar, fat32_progressbar_init, fat32_progressbar_update);
|
|
|
289 |
if (rc < 0) panicf(PANIC_KILLTHREAD, "Error formatting data partition: %08X", rc);
|
|
|
290 |
release_library(libmkfat32);
|
|
|
291 |
library_unload(libmkfat32);
|
|
|
292 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
293 |
message(34, "Data partition has", "been reformatted.");
|
|
|
294 |
}
|
|
|
295 |
|
|
|
296 |
struct chooser_renderer_list_itemdata toolchooser_rparams_uninstaller =
|
|
|
297 |
{
|
|
|
298 |
.size = LIBUI_POINT(224, 10),
|
|
|
299 |
.fill_box = LIBUI_BOX(LIBUI_POINT(0, 0), LIBUI_POINT(224, 10)),
|
|
|
300 |
.fill_color = 0xa0000000,
|
|
|
301 |
.fill_color_selected = 0x60ffffff,
|
|
|
302 |
.icon_pos = LIBUI_POINT(0, 0),
|
|
|
303 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
304 |
LIBUI_POINT(0, 0)),
|
|
|
305 |
.icon_opacity = 0,
|
|
|
306 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
307 |
LIBUI_POINT(0, 0)),
|
|
|
308 |
.icon_selected_opacity = 0,
|
|
|
309 |
.text = "Uninstall emCORE",
|
|
|
310 |
.text_pos = LIBUI_POINT(1, 1),
|
|
|
311 |
.text_color = 0xffffffff,
|
|
|
312 |
.text_color_selected = 0xff7fffff
|
|
|
313 |
};
|
|
|
314 |
|
|
|
315 |
void run_uninstaller(void** firmware, void** app, int* size)
|
|
|
316 |
{
|
|
|
317 |
boot->load_from_flash(app, size, false, "uninst ", 0);
|
|
|
318 |
if (!*app)
|
|
|
319 |
{
|
|
|
320 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
321 |
message(7, "Loading uninstaller failed!", " Returning to main menu. ");
|
|
|
322 |
}
|
|
|
323 |
}
|
|
|
324 |
|
|
|
325 |
bool update_display(struct chooser_data* data)
|
|
|
326 |
{
|
|
|
327 |
char buf[6];
|
|
|
328 |
struct rtc_datetime dt;
|
|
|
329 |
//rtc_read_datetime(&dt);
|
|
|
330 |
dt.hour = 13; dt.minute = 37; // Leet :)
|
|
|
331 |
snprintf(buf, sizeof(buf), "%02d:%02d", dt.hour, dt.minute);
|
|
|
332 |
// clock
|
|
|
333 |
rendertext(framebuf, 207, 4, 240, 0xffffcccc, 0, buf);
|
|
|
334 |
unsigned int batt_level = 11; // set level to 50%
|
|
|
335 |
// unsigned int batt_level = 22 * read_battery_mwh_current(0) / read_battery_mwh_full(0);
|
|
|
336 |
// remaining battery level
|
|
|
337 |
ui->blendcolor(batt_level, 6, 0xc0ffcccc, framebuf, 5, 5, 240, framebuf, 5, 5, 240);
|
|
|
338 |
// background of the rest space
|
|
|
339 |
ui->blendcolor(22 - batt_level, 6, 0x40000000, framebuf, 5 + batt_level, 5, 240, framebuf, 5 + batt_level, 5, 240);
|
|
|
340 |
return false;
|
|
|
341 |
}
|
|
|
342 |
|
|
|
343 |
struct chooser_renderer_list_params toolchooser_rparams =
|
|
|
344 |
{
|
|
|
345 |
.version = CHOOSER_RENDERER_LIST_PARAMS_VERSION,
|
|
|
346 |
.copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 240), LIBUI_POINT(0, 0)),
|
|
|
347 |
.copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 240), LIBUI_POINT(0, 0)),
|
|
|
348 |
LIBUI_POINT(240, 320)),
|
|
|
349 |
.bg_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
350 |
.bg_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
351 |
LIBUI_POINT(0, 0)),
|
|
|
352 |
.bg_opacity = 0,
|
|
|
353 |
.fill_dest = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
354 |
LIBUI_POINT(0, 0)),
|
|
|
355 |
.fill_color = 0,
|
|
|
356 |
.viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 240), LIBUI_POINT(7, 30)),
|
|
|
357 |
LIBUI_POINT(226, 80)),
|
|
|
358 |
.blit_dest = LIBUI_POINT(0, 0),
|
|
|
359 |
.blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 240), LIBUI_POINT(0, 0)),
|
|
|
360 |
LIBUI_POINT(240, 320)),
|
|
|
361 |
.preblit = update_display,
|
|
|
362 |
.postblit = NULL
|
|
|
363 |
};
|
|
|
364 |
|
|
|
365 |
struct chooser_action_handler_wheel_params toolchooser_aparams =
|
|
|
366 |
{
|
|
|
367 |
.version = CHOOSER_ACTION_HANDLER_WHEEL_PARAMS_VERSION,
|
|
|
368 |
.stepsperitem = 128,
|
|
|
369 |
.eventfilter = NULL,
|
|
|
370 |
.timeout_initial = TIMEOUT_BLOCK,
|
|
|
371 |
.timeout_idle = TIMEOUT_BLOCK,
|
|
|
372 |
.timeout_item = 0,
|
|
|
373 |
.tick_force_redraw = false,
|
|
|
374 |
.buttoncount = 5,
|
|
|
375 |
.buttonmap =
|
|
|
376 |
{
|
|
|
377 |
CHOOSER_ACTION_HANDLER_WHEEL_ACTION_SELECT,
|
|
|
378 |
CHOOSER_ACTION_HANDLER_WHEEL_ACTION_NEXT,
|
|
|
379 |
CHOOSER_ACTION_HANDLER_WHEEL_ACTION_PREV,
|
|
|
380 |
CHOOSER_ACTION_HANDLER_WHEEL_ACTION_NEXT,
|
|
|
381 |
CHOOSER_ACTION_HANDLER_WHEEL_ACTION_PREV
|
|
|
382 |
}
|
|
|
383 |
};
|
|
|
384 |
|
|
|
385 |
struct chooser_info toolchooser =
|
|
|
386 |
{
|
|
|
387 |
.version = CHOOSER_INFO_VERSION,
|
|
|
388 |
.actionhandler = NULL,
|
|
|
389 |
.actionhandlerparams = &toolchooser_aparams,
|
|
|
390 |
.renderer = NULL,
|
|
|
391 |
.rendererparams = &toolchooser_rparams,
|
|
|
392 |
.userparams = NULL,
|
|
|
393 |
.tickinterval = 10000000,
|
|
|
394 |
.itemcount = 8,
|
|
|
395 |
.defaultitem = 0,
|
|
|
396 |
.items =
|
|
|
397 |
{
|
|
|
398 |
{
|
|
|
399 |
.user = NULL,
|
|
|
400 |
.actionparams = NULL,
|
|
|
401 |
.renderparams = &toolchooser_rparams_mainchooser
|
|
|
402 |
},
|
|
|
403 |
{
|
|
|
404 |
.user = run_umsboot,
|
|
|
405 |
.actionparams = NULL,
|
|
|
406 |
.renderparams = &toolchooser_rparams_umsboot
|
|
|
407 |
},
|
|
|
408 |
{
|
|
|
409 |
.user = run_diagmode,
|
|
|
410 |
.actionparams = NULL,
|
|
|
411 |
.renderparams = &toolchooser_rparams_diagmode
|
|
|
412 |
},
|
|
|
413 |
{
|
|
|
414 |
.user = run_rockbox_fallback,
|
|
|
415 |
.actionparams = NULL,
|
|
|
416 |
.renderparams = &toolchooser_rparams_rockbox_fallback
|
|
|
417 |
},
|
|
|
418 |
{
|
|
|
419 |
.user = run_clearcfg,
|
|
|
420 |
.actionparams = NULL,
|
|
|
421 |
.renderparams = &toolchooser_rparams_clearcfg
|
|
|
422 |
},
|
|
|
423 |
{
|
|
|
424 |
.user = run_cleardb,
|
|
|
425 |
.actionparams = NULL,
|
|
|
426 |
.renderparams = &toolchooser_rparams_cleardb
|
|
|
427 |
},
|
|
|
428 |
{
|
|
|
429 |
.user = run_reformat,
|
|
|
430 |
.actionparams = NULL,
|
|
|
431 |
.renderparams = &toolchooser_rparams_reformat
|
|
|
432 |
},
|
|
|
433 |
{
|
|
|
434 |
.user = run_uninstaller,
|
|
|
435 |
.actionparams = NULL,
|
|
|
436 |
.renderparams = &toolchooser_rparams_uninstaller
|
|
|
437 |
}
|
|
|
438 |
}
|
|
|
439 |
};
|
|
|
440 |
|
|
|
441 |
bool mainchooser_preblit(struct chooser_data* data)
|
|
|
442 |
{
|
|
|
443 |
char buf[4];
|
|
|
444 |
struct chooser_action_handler_wheel_data* adata;
|
|
|
445 |
adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
|
|
|
446 |
snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
|
|
|
447 |
rendertext(framebuf, 219, 309, 240, 0xffffcccc, 0, buf);
|
|
|
448 |
update_display(data);
|
|
|
449 |
return false;
|
|
|
450 |
}
|
|
|
451 |
|
|
|
452 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_powerdown =
|
|
|
453 |
{
|
|
|
454 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 0)),
|
|
|
455 |
LIBUI_POINT(80, 80)),
|
|
|
456 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 0)),
|
|
|
457 |
LIBUI_POINT(80, 80)),
|
|
|
458 |
.text = "Power off",
|
|
|
459 |
.text_color = 0xffffcccc,
|
|
|
460 |
};
|
|
|
461 |
|
|
|
462 |
void run_powerdown(void** firmware, void** app, int* size)
|
|
|
463 |
{
|
|
|
464 |
shutdown(true);
|
|
|
465 |
power_off();
|
|
|
466 |
}
|
|
|
467 |
/*
|
|
|
468 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_crapple =
|
|
|
469 |
{
|
|
|
470 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 44), LIBUI_POINT(0, 123)),
|
|
|
471 |
LIBUI_POINT(44, 43)),
|
|
|
472 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 44), LIBUI_POINT(0, 123)),
|
|
|
473 |
LIBUI_POINT(44, 43)),
|
|
|
474 |
.text = "Original firmware",
|
|
|
475 |
.text_color = 0xffffcccc,
|
|
|
476 |
};
|
|
|
477 |
|
|
|
478 |
void run_crapple(void** firmware, void** app, int* size)
|
|
|
479 |
{
|
|
|
480 |
int i;
|
|
|
481 |
for (i = 23; i <= 115; i += 23)
|
|
|
482 |
{
|
|
|
483 |
if (i < 115)
|
|
|
484 |
ui->blend(240, 320, 50, framebuf, 0, 0, 240,
|
|
|
485 |
framebuf, 0, 0, 240, bg, 0, 0, 240);
|
|
|
486 |
else memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
487 |
memcpy(framebuf2, framebuf, 240 * 320 * 3);
|
|
|
488 |
ui->blenda(111, i, 255, framebuf2, 32, 0, 240,
|
|
|
489 |
framebuf2, 32, 0, 240, crapple, 0, 115 - i, 111);
|
|
|
490 |
displaylcd(0, 0, 240, 320, framebuf2, 0, 0, 240);
|
|
|
491 |
}
|
|
|
492 |
boot->load_from_file(firmware, size, false, "/.boot/appleos.ucl", 0x800000);
|
|
|
493 |
if (!*firmware) boot->load_from_file(firmware, size, false, "/.boot/appleos.bin", 0);
|
|
|
494 |
if (!*firmware) message(7, "Loading appleos.bin failed!", " Returning to main menu. ");
|
|
|
495 |
}
|
|
|
496 |
*/
|
|
|
497 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_rockbox =
|
|
|
498 |
{
|
|
|
499 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 80)),
|
|
|
500 |
LIBUI_POINT(80, 80)),
|
|
|
501 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 80)),
|
|
|
502 |
LIBUI_POINT(80, 80)),
|
|
|
503 |
.text = "Rockbox",
|
|
|
504 |
.text_color = 0xffffcccc,
|
|
|
505 |
};
|
|
|
506 |
|
|
|
507 |
void run_rockbox(void** firmware, void** app, int* size)
|
|
|
508 |
{
|
|
|
509 |
/*
|
|
|
510 |
int i;
|
|
|
511 |
for (i = 2; i <= 52; i += 10)
|
|
|
512 |
{
|
|
|
513 |
if (i < 52)
|
|
|
514 |
ui->blend(240, 320, 50, framebuf, 0, 0, 240,
|
|
|
515 |
framebuf, 0, 0, 240, bg, 0, 0, 240);
|
|
|
516 |
else memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
517 |
ui->blit(154, MIN(47, i), 3, framebuf, 11, MAX(0, i - 47), 240,
|
|
|
518 |
rbxlogo, 0, MAX(0, 47 - i), 154);
|
|
|
519 |
displaylcd(0, 0, 240, 320, framebuf, 0, 0, 240);
|
|
|
520 |
}
|
|
|
521 |
*/
|
|
|
522 |
boot->load_from_file(firmware, size, true, "/.rockbox/rockbox.ipod", 0);
|
|
|
523 |
if (!*firmware)
|
|
|
524 |
{
|
|
|
525 |
message(4, "Loading rockbox.ipod failed!", " Trying fallback image... ");
|
|
|
526 |
boot->load_from_flash(firmware, size, true, "rockbox ", 0x100000);
|
|
|
527 |
}
|
|
|
528 |
if (!*firmware)
|
|
|
529 |
{
|
|
|
530 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
531 |
message(19, "Loading Rockbox failed!", "Returning to main menu.");
|
|
|
532 |
}
|
|
|
533 |
}
|
|
|
534 |
|
|
|
535 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_console =
|
|
|
536 |
{
|
|
|
537 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 160)),
|
|
|
538 |
LIBUI_POINT(80, 80)),
|
|
|
539 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 160)),
|
|
|
540 |
LIBUI_POINT(80, 80)),
|
|
|
541 |
.text = "emCORE console",
|
|
|
542 |
.text_color = 0xffffcccc,
|
|
|
543 |
};
|
|
|
544 |
/*
|
|
|
545 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_diskmode =
|
|
|
546 |
{
|
|
|
547 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 44), LIBUI_POINT(0, 166)),
|
|
|
548 |
LIBUI_POINT(44, 31)),
|
|
|
549 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 44), LIBUI_POINT(0, 166)),
|
|
|
550 |
LIBUI_POINT(44, 31)),
|
|
|
551 |
.text = "Disk mode",
|
|
|
552 |
.text_color = 0xffffcccc,
|
|
|
553 |
};
|
|
|
554 |
|
|
|
555 |
void run_diskmode(void** firmware, void** app, int* size)
|
|
|
556 |
{
|
|
|
557 |
boot->load_from_flash(firmware, size, false, "diskmode", 0x100000);
|
|
|
558 |
if (!*firmware)
|
|
|
559 |
{
|
|
|
560 |
memcpy(framebuf, bg, 240 * 320 * 3);
|
|
|
561 |
message(13, "Loading disk mode failed!", " Returning to main menu. ");
|
|
|
562 |
}
|
|
|
563 |
}
|
|
|
564 |
*/
|
|
|
565 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_toolchooser =
|
|
|
566 |
{
|
|
|
567 |
.icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 240)),
|
|
|
568 |
LIBUI_POINT(80, 80)),
|
|
|
569 |
.icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 240)),
|
|
|
570 |
LIBUI_POINT(80, 80)),
|
|
|
571 |
.text = "Tools",
|
|
|
572 |
.text_color = 0xffffcccc,
|
|
|
573 |
};
|
|
|
574 |
|
|
|
575 |
static void run_toolchooser(void** firmware, void** app, int* size)
|
|
|
576 |
{
|
|
|
577 |
const struct chooser_item* result = ui->chooser_run(&toolchooser);
|
|
|
578 |
if (!result->user) return;
|
|
|
579 |
void (*selected_function)(void** firmware, void** app, int* size);
|
|
|
580 |
selected_function = (void(*)(void** firmware, void** app, int* size))(result->user);
|
|
|
581 |
selected_function(firmware, app, size);
|
|
|
582 |
}
|
|
|
583 |
|
|
|
584 |
struct chooser_renderer_iconflow_params mainchooser_rparams =
|
|
|
585 |
{
|
|
|
586 |
.version = CHOOSER_RENDERER_ICONFLOW_PARAMS_VERSION,
|
|
|
587 |
.copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 240), LIBUI_POINT(0, 0)),
|
|
|
588 |
.copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 240), LIBUI_POINT(0, 0)),
|
|
|
589 |
LIBUI_POINT(240, 320)),
|
|
|
590 |
.bg_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
591 |
.bg_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
592 |
LIBUI_POINT(0, 0)),
|
|
|
593 |
.bg_opacity = 0,
|
|
|
594 |
.fill_dest = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
|
|
595 |
LIBUI_POINT(0, 0)),
|
|
|
596 |
.fill_color = 0,
|
|
|
597 |
.viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 240), LIBUI_POINT(0, 66)),
|
|
|
598 |
LIBUI_POINT(240, 160)),
|
|
|
599 |
.text_pos = LIBUI_POINT(120, 306),
|
|
|
600 |
.blit_dest = LIBUI_POINT(0, 0),
|
|
|
601 |
.blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 240), LIBUI_POINT(0, 0)),
|
|
|
602 |
LIBUI_POINT(240, 320)),
|
|
|
603 |
.smoothness = 500000,
|
|
|
604 |
.startposition = -3,
|
|
|
605 |
.iconsinview = 4,
|
|
|
606 |
.preblit = mainchooser_preblit,
|
|
|
607 |
.postblit = NULL
|
|
|
608 |
};
|
|
|
609 |
|
|
|
610 |
struct chooser_action_handler_wheel_params mainchooser_aparams =
|
|
|
611 |
{
|
|
|
612 |
.version = CHOOSER_ACTION_HANDLER_WHEEL_PARAMS_VERSION,
|
|
|
613 |
.stepsperitem = 512,
|
|
|
614 |
.eventfilter = NULL,
|
|
|
615 |
.timeout_initial = 30500000,
|
|
|
616 |
.timeout_idle = 300500000,
|
|
|
617 |
.timeout_item = 0,
|
|
|
618 |
.tick_force_redraw = true,
|
|
|
619 |
.buttoncount = 3,
|
|
|
620 |
.buttonmap =
|
|
|
621 |
{
|
|
|
622 |
CHOOSER_ACTION_HANDLER_WHEEL_ACTION_SELECT,
|
|
|
623 |
CHOOSER_ACTION_HANDLER_WHEEL_ACTION_NEXT,
|
|
|
624 |
CHOOSER_ACTION_HANDLER_WHEEL_ACTION_PREV
|
|
|
625 |
}
|
|
|
626 |
};
|
|
|
627 |
|
|
|
628 |
struct chooser_info mainchooser =
|
|
|
629 |
{
|
|
|
630 |
.version = CHOOSER_INFO_VERSION,
|
|
|
631 |
.actionhandler = NULL,
|
|
|
632 |
.actionhandlerparams = &mainchooser_aparams,
|
|
|
633 |
.renderer = NULL,
|
|
|
634 |
.rendererparams = &mainchooser_rparams,
|
|
|
635 |
.userparams = NULL,
|
|
|
636 |
.tickinterval = 990000,
|
|
|
637 |
.itemcount = 4,
|
|
|
638 |
.defaultitem = 1,
|
|
|
639 |
.items =
|
|
|
640 |
{
|
|
|
641 |
{
|
|
|
642 |
.user = run_powerdown,
|
|
|
643 |
.actionparams = NULL,
|
|
|
644 |
.renderparams = &mainchooser_rparams_powerdown
|
|
|
645 |
},
|
|
|
646 |
{
|
|
|
647 |
.user = run_rockbox,
|
|
|
648 |
.actionparams = NULL,
|
|
|
649 |
.renderparams = &mainchooser_rparams_rockbox
|
|
|
650 |
},
|
|
|
651 |
{
|
|
|
652 |
.user = NULL,
|
|
|
653 |
.actionparams = NULL,
|
|
|
654 |
.renderparams = &mainchooser_rparams_console
|
|
|
655 |
},
|
|
|
656 |
{
|
|
|
657 |
.user = run_toolchooser,
|
|
|
658 |
.actionparams = NULL,
|
|
|
659 |
.renderparams = &mainchooser_rparams_toolchooser
|
|
|
660 |
}
|
|
|
661 |
}
|
|
|
662 |
};
|
|
|
663 |
|
|
|
664 |
static void run_mainchooser(void** firmware, void** app, int* size)
|
|
|
665 |
{
|
|
|
666 |
while (!*firmware && !*app)
|
|
|
667 |
{
|
|
|
668 |
const struct chooser_item* result = ui->chooser_run(&mainchooser);
|
|
|
669 |
if (!result->user) return;
|
|
|
670 |
void (*selected_function)(void** firmware, void** app, int* size);
|
|
|
671 |
selected_function = (void(*)(void** firmware, void** app, int* size))(result->user);
|
|
|
672 |
selected_function(firmware, app, size);
|
|
|
673 |
}
|
|
|
674 |
}
|
|
|
675 |
|
|
|
676 |
static void main()
|
|
|
677 |
{
|
|
|
678 |
struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER, LIBPNG_API_VERSION, "libpng ");
|
|
|
679 |
png = (struct libpng_api*)libpng->api;
|
|
|
680 |
bg = loadpng(background_png, background_png_size, (void* (*)(struct png_info*))(png->png_decode_rgb));
|
|
|
681 |
icons = loadpng(icons_png, icons_png_size, (void* (*)(struct png_info*))(png->png_decode_rgba));
|
|
|
682 |
//rbxlogo = loadpng(rockbox_png, rockbox_png_size, (void* (*)(struct png_info*))(png->png_decode_rgb));
|
|
|
683 |
//crapple = loadpng(crapple_png, crapple_png_size, (void* (*)(struct png_info*))(png->png_decode_rgba));
|
|
|
684 |
release_library(libpng);
|
|
|
685 |
library_unload(libpng);
|
|
|
686 |
struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
|
|
|
687 |
LIBBOOT_API_VERSION, "libboot ");
|
|
|
688 |
boot = (struct libboot_api*)libboot->api;
|
|
|
689 |
struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER, LIBUI_API_VERSION, "libui ");
|
|
|
690 |
ui = (struct libui_api*)libui->api;
|
|
|
691 |
// draw the battery meter box
|
|
|
692 |
// top line
|
|
|
693 |
ui->blendcolor(24, 1, 0xffffcccc, bg, 4, 4, 240, bg, 4, 4, 240);
|
|
|
694 |
// bottom line
|
|
|
695 |
ui->blendcolor(24, 1, 0xffffcccc, bg, 4, 11, 240, bg, 4, 11, 240);
|
|
|
696 |
// left line
|
|
|
697 |
ui->blendcolor(1, 6, 0xffffcccc, bg, 4, 5, 240, bg, 4, 5, 240);
|
|
|
698 |
// right line
|
|
|
699 |
ui->blendcolor(1, 6, 0xffffcccc, bg, 27, 5, 240, bg, 27, 5, 240);
|
|
|
700 |
// tip - right
|
|
|
701 |
ui->blendcolor(1, 4, 0xffffcccc, bg, 28, 6, 240, bg, 28, 6, 240);
|
|
|
702 |
framebuf = malloc(240 * 320 * 3);
|
|
|
703 |
if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
|
|
|
704 |
framebuf2 = malloc(240 * 320 * 3);
|
|
|
705 |
if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
|
|
|
706 |
mainchooser.actionhandler = ui->chooser_action_handler_wheel;
|
|
|
707 |
mainchooser.renderer = ui->chooser_renderer_iconflow;
|
|
|
708 |
mainchooser_rparams.copy_dest.buf.addr = framebuf;
|
|
|
709 |
mainchooser_rparams.copy_src.loc.buf.addr = bg;
|
|
|
710 |
mainchooser_rparams.viewport.loc.buf.addr = framebuf;
|
|
|
711 |
mainchooser_rparams.blit_src.loc.buf.addr = framebuf;
|
|
|
712 |
mainchooser_rparams_powerdown.icon.loc.buf.addr = icons;
|
|
|
713 |
mainchooser_rparams_powerdown.icon_selected.loc.buf.addr = icons;
|
|
|
714 |
//mainchooser_rparams_crapple.icon.loc.buf.addr = icons;
|
|
|
715 |
//mainchooser_rparams_crapple.icon_selected.loc.buf.addr = icons;
|
|
|
716 |
mainchooser_rparams_rockbox.icon.loc.buf.addr = icons;
|
|
|
717 |
mainchooser_rparams_rockbox.icon_selected.loc.buf.addr = icons;
|
|
|
718 |
mainchooser_rparams_console.icon.loc.buf.addr = icons;
|
|
|
719 |
mainchooser_rparams_console.icon_selected.loc.buf.addr = icons;
|
|
|
720 |
//mainchooser_rparams_diskmode.icon.loc.buf.addr = icons;
|
|
|
721 |
//mainchooser_rparams_diskmode.icon_selected.loc.buf.addr = icons;
|
|
|
722 |
mainchooser_rparams_toolchooser.icon.loc.buf.addr = icons;
|
|
|
723 |
mainchooser_rparams_toolchooser.icon_selected.loc.buf.addr = icons;
|
|
|
724 |
|
|
|
725 |
toolchooser.actionhandler = ui->chooser_action_handler_wheel;
|
|
|
726 |
toolchooser.renderer = ui->chooser_renderer_list;
|
|
|
727 |
toolchooser_rparams.copy_dest.buf.addr = framebuf;
|
|
|
728 |
toolchooser_rparams.copy_src.loc.buf.addr = bg;
|
|
|
729 |
toolchooser_rparams.viewport.loc.buf.addr = framebuf;
|
|
|
730 |
toolchooser_rparams.blit_src.loc.buf.addr = framebuf;
|
|
|
731 |
|
|
|
732 |
backlight_set_brightness(177);
|
|
|
733 |
void* firmware = NULL;
|
|
|
734 |
void* app = NULL;
|
|
|
735 |
int size;
|
|
|
736 |
run_mainchooser(&firmware, &app, &size);
|
|
|
737 |
|
|
|
738 |
free(framebuf2);
|
|
|
739 |
free(framebuf);
|
|
|
740 |
//free(crapple);
|
|
|
741 |
//free(rbxlogo);
|
|
|
742 |
free(icons);
|
|
|
743 |
free(bg);
|
|
|
744 |
release_library(libui);
|
|
|
745 |
release_library(libboot);
|
|
|
746 |
library_unload(libui);
|
|
|
747 |
library_unload(libboot);
|
|
|
748 |
|
|
|
749 |
if (firmware)
|
|
|
750 |
{
|
|
|
751 |
shutdown(false);
|
|
|
752 |
execfirmware((void*)0x08000000, firmware, size);
|
|
|
753 |
}
|
|
|
754 |
else if (app) execimage(app, false);
|
|
|
755 |
else cputs(3, "Dropped into emCORE console.\n");
|
|
|
756 |
}
|
|
|
757 |
|
|
|
758 |
|
|
|
759 |
EMCORE_APP_HEADER("Boot menu", main, 127)
|