Index: apps/bootmenu-ipodclassic/tools.c |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | #include "confirmchooser.h"
|
31 | 31 |
|
32 | 32 |
|
33 | | -void run_clearcfg(void** firmware, void** app, int* size)
|
| 33 | +void run_clearcfg()
|
34 | 34 | {
|
35 | 35 | if (!run_confirmchooser("Really clear Rockbox config?")) return;
|
36 | 36 | remove("/.rockbox/config.cfg");
|
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | message(97, "Rockbox configuration", " has been cleared. ");
|
39 | 39 | }
|
40 | 40 |
|
41 | | -void run_cleardb(void** firmware, void** app, int* size)
|
| 41 | +void run_cleardb()
|
42 | 42 | {
|
43 | 43 | if (!run_confirmchooser("Really clear Rockbox database?")) return;
|
44 | 44 | remove("/.rockbox/database_0.tcd");
|
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | progressbar_setpos((struct progressbar_state*)user, current, false);
|
71 | 71 | }
|
72 | 72 |
|
73 | | -void run_reformat(void** firmware, void** app, int* size)
|
| 73 | +void run_reformat()
|
74 | 74 | {
|
75 | 75 | if (!run_confirmchooser("Really reformat data partition?")) return;
|
76 | 76 | memcpy(framebuf, bg, 320 * 240 * 3);
|
Index: apps/bootmenu-ipodclassic/toolchooser.c |
— | — | @@ -249,15 +249,13 @@ |
250 | 250 | }
|
251 | 251 | };
|
252 | 252 |
|
253 | | -void run_toolchooser(void** firmware, void** app, int* size)
|
| 253 | +void run_toolchooser()
|
254 | 254 | {
|
255 | | - while (!*firmware && !*app)
|
| 255 | + while (!bootinfo.valid)
|
256 | 256 | {
|
257 | 257 | const struct chooser_item* result = ui->chooser_run(&toolchooser);
|
258 | 258 | if (!result || !result->user) return;
|
259 | | - void (*selected_function)(void** firmware, void** app, int* size);
|
260 | | - selected_function = (void(*)(void** firmware, void** app, int* size))(result->user);
|
261 | | - selected_function(firmware, app, size);
|
| 259 | + ((void(*)())(result->user))();
|
262 | 260 | }
|
263 | 261 | }
|
264 | 262 |
|
Index: apps/bootmenu-ipodclassic/settingchooser.c |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | }
|
201 | 201 | };
|
202 | 202 |
|
203 | | -void run_settingchooser(void** firmware, void** app, int* size)
|
| 203 | +void run_settingchooser()
|
204 | 204 | {
|
205 | 205 | bool changes = ui->settingchooser_run(&settingchooser);
|
206 | 206 | if (changes)
|
Index: apps/bootmenu-ipodclassic/boot.c |
— | — | @@ -26,21 +26,23 @@ |
27 | 27 | #include "main.h"
|
28 | 28 |
|
29 | 29 |
|
30 | | -void run_powerdown(void** firmware, void** app, int* size)
|
| 30 | +void run_powerdown()
|
31 | 31 | {
|
32 | 32 | shutdown(true);
|
33 | 33 | power_off();
|
34 | 34 | }
|
35 | 35 |
|
36 | | -void fastboot_rockbox(void** firmware, void** app, int* size)
|
| 36 | +void fastboot_rockbox()
|
37 | 37 | {
|
38 | | - boot->load_from_file(firmware, size, true, "/.rockbox/rockbox.ipod", 0);
|
| 38 | + boot->load_from_file(&bootinfo.firmware, &bootinfo.size, true, "/.rockbox/rockbox.ipod", 0);
|
| 39 | + if (bootinfo.firmware) bootinfo.valid = true;
|
39 | 40 | }
|
40 | 41 |
|
41 | | -void run_rockbox_fallback(void** firmware, void** app, int* size)
|
| 42 | +void run_rockbox_fallback()
|
42 | 43 | {
|
43 | | - boot->load_from_flash(firmware, size, true, "rockbox ", 0x100000);
|
44 | | - if (!*firmware)
|
| 44 | + boot->load_from_flash(&bootinfo.firmware, &bootinfo.size, true, "rockbox ", 0x100000);
|
| 45 | + if (bootinfo.firmware) bootinfo.valid = true;
|
| 46 | + else
|
45 | 47 | {
|
46 | 48 | memcpy(framebuf, bg, 320 * 240 * 3);
|
47 | 49 | message(91, "Loading Rockbox failed!", "Returning to main menu.");
|
— | — | @@ -47,7 +49,7 @@ |
48 | 50 | }
|
49 | 51 | }
|
50 | 52 |
|
51 | | -void run_rockbox(void** firmware, void** app, int* size)
|
| 53 | +void run_rockbox()
|
52 | 54 | {
|
53 | 55 | int i;
|
54 | 56 | for (i = 1; i <= 96; i += 19)
|
— | — | @@ -60,23 +62,24 @@ |
61 | 63 | rbxlogo, 0, MAX(0, 86 - i), 280);
|
62 | 64 | displaylcd(0, 0, 320, 240, framebuf, 0, 0, 320);
|
63 | 65 | }
|
64 | | - fastboot_rockbox(firmware, app, size);
|
65 | | - if (!*firmware)
|
| 66 | + fastboot_rockbox();
|
| 67 | + if (!bootinfo.valid)
|
66 | 68 | {
|
67 | 69 | message(76, "Loading rockbox.ipod failed!", " Trying fallback image... ");
|
68 | | - run_rockbox_fallback(firmware, app, size);
|
| 70 | + run_rockbox_fallback();
|
69 | 71 | }
|
70 | 72 | }
|
71 | 73 |
|
72 | | -void fastboot_umsboot(void** firmware, void** app, int* size)
|
| 74 | +void fastboot_umsboot()
|
73 | 75 | {
|
74 | | - boot->load_from_flash(firmware, size, false, "umsboot ", 0x10000);
|
| 76 | + boot->load_from_flash(&bootinfo.firmware, &bootinfo.size, false, "umsboot ", 0x10000);
|
| 77 | + if (bootinfo.firmware) bootinfo.valid = true;
|
75 | 78 | }
|
76 | 79 |
|
77 | | -void run_umsboot(void** firmware, void** app, int* size)
|
| 80 | +void run_umsboot()
|
78 | 81 | {
|
79 | | - fastboot_umsboot(firmware, app, size);
|
80 | | - if (!*firmware)
|
| 82 | + fastboot_umsboot();
|
| 83 | + if (!bootinfo.valid)
|
81 | 84 | {
|
82 | 85 | memcpy(framebuf, bg, 320 * 240 * 3);
|
83 | 86 | message(91, "Loading UMSboot failed!", "Returning to main menu.");
|
Index: apps/bootmenu-ipodclassic/tools.h |
— | — | @@ -28,9 +28,9 @@ |
29 | 29 | #include "emcoreapp.h"
|
30 | 30 |
|
31 | 31 |
|
32 | | -extern void run_clearcfg(void** firmware, void** app, int* size);
|
33 | | -extern void run_cleardb(void** firmware, void** app, int* size);
|
34 | | -extern void run_reformat(void** firmware, void** app, int* size);
|
| 32 | +extern void run_clearcfg();
|
| 33 | +extern void run_cleardb();
|
| 34 | +extern void run_reformat();
|
35 | 35 |
|
36 | 36 |
|
37 | 37 | #endif
|
Index: apps/bootmenu-ipodclassic/toolchooser.h |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | #include "emcoreapp.h"
|
30 | 30 |
|
31 | 31 |
|
32 | | -extern void run_toolchooser(void** firmware, void** app, int* size);
|
| 32 | +extern void run_toolchooser();
|
33 | 33 | extern void toolchooser_init();
|
34 | 34 | extern void toolchooser_apply_settings();
|
35 | 35 |
|
Index: apps/bootmenu-ipodclassic/settingchooser.h |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | #include "emcoreapp.h"
|
30 | 30 |
|
31 | 31 |
|
32 | | -extern void run_settingchooser(void** firmware, void** app, int* size);
|
| 32 | +extern void run_settingchooser();
|
33 | 33 | extern void settingchooser_init();
|
34 | 34 | extern void settingchooser_apply_settings();
|
35 | 35 |
|
Index: apps/bootmenu-ipodclassic/mainchooser.c |
— | — | @@ -171,9 +171,9 @@ |
172 | 172 | }
|
173 | 173 | };
|
174 | 174 |
|
175 | | -void run_mainchooser(void** firmware, void** app, int* size)
|
| 175 | +void run_mainchooser()
|
176 | 176 | {
|
177 | | - while (!*firmware && !*app)
|
| 177 | + while (!bootinfo.valid)
|
178 | 178 | {
|
179 | 179 | const struct chooser_item* result = ui->chooser_run(&mainchooser);
|
180 | 180 | if (!result)
|
— | — | @@ -180,15 +180,15 @@ |
181 | 181 | switch(settings.timeout_item)
|
182 | 182 | {
|
183 | 183 | case 0:
|
184 | | - run_powerdown(firmware, app, size);
|
| 184 | + run_powerdown();
|
185 | 185 | break;
|
186 | 186 |
|
187 | 187 | case 1:
|
188 | | - run_rockbox(firmware, app, size);
|
| 188 | + run_rockbox();
|
189 | 189 | break;
|
190 | 190 |
|
191 | 191 | case 2:
|
192 | | - run_umsboot(firmware, app, size);
|
| 192 | + run_umsboot();
|
193 | 193 | break;
|
194 | 194 |
|
195 | 195 | case 3:
|
— | — | @@ -195,9 +195,7 @@ |
196 | 196 | return;
|
197 | 197 | }
|
198 | 198 | if (!result->user) return;
|
199 | | - void (*selected_function)(void** firmware, void** app, int* size);
|
200 | | - selected_function = (void(*)(void** firmware, void** app, int* size))(result->user);
|
201 | | - selected_function(firmware, app, size);
|
| 199 | + ((void(*)())(result->user))();
|
202 | 200 | }
|
203 | 201 | }
|
204 | 202 |
|
Index: apps/bootmenu-ipodclassic/boot.h |
— | — | @@ -28,12 +28,12 @@ |
29 | 29 | #include "emcoreapp.h"
|
30 | 30 |
|
31 | 31 |
|
32 | | -extern void run_powerdown(void** firmware, void** app, int* size);
|
33 | | -extern void fastboot_rockbox(void** firmware, void** app, int* size);
|
34 | | -extern void run_rockbox_fallback(void** firmware, void** app, int* size);
|
35 | | -extern void run_rockbox(void** firmware, void** app, int* size);
|
36 | | -extern void fastboot_umsboot(void** firmware, void** app, int* size);
|
37 | | -extern void run_umsboot(void** firmware, void** app, int* size);
|
| 32 | +extern void run_powerdown();
|
| 33 | +extern void fastboot_rockbox();
|
| 34 | +extern void run_rockbox_fallback();
|
| 35 | +extern void run_rockbox();
|
| 36 | +extern void fastboot_umsboot();
|
| 37 | +extern void run_umsboot();
|
38 | 38 |
|
39 | 39 |
|
40 | 40 | #endif
|
Index: apps/bootmenu-ipodclassic/mainchooser.h |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | #include "emcoreapp.h"
|
30 | 30 |
|
31 | 31 |
|
32 | | -extern void run_mainchooser(void** firmware, void** app, int* size);
|
| 32 | +extern void run_mainchooser();
|
33 | 33 | extern void mainchooser_init();
|
34 | 34 | extern void mainchooser_apply_settings();
|
35 | 35 |
|
Index: apps/bootmenu-ipodclassic/main.c |
— | — | @@ -38,6 +38,15 @@ |
39 | 39 | void* bg;
|
40 | 40 | void* icons;
|
41 | 41 | void* rbxlogo;
|
| 42 | +struct bootinfo_t bootinfo =
|
| 43 | +{
|
| 44 | + .valid = false,
|
| 45 | + .firmware = NULL,
|
| 46 | + .size = 0,
|
| 47 | + .app = NULL,
|
| 48 | + .argc = 0,
|
| 49 | + .argv = NULL
|
| 50 | +};
|
42 | 51 |
|
43 | 52 |
|
44 | 53 | static void main()
|
— | — | @@ -48,28 +57,24 @@ |
49 | 58 | LIBBOOT_API_VERSION, "libboot ");
|
50 | 59 | boot = (struct libboot_api*)libboot->api;
|
51 | 60 |
|
52 | | - bool terminate = false;
|
53 | | - void* firmware = NULL;
|
54 | | - void* app = NULL;
|
55 | | - int size;
|
56 | 61 |
|
57 | 62 | if (!(clickwheel_get_state() & 0x1f))
|
58 | 63 | switch (settings.fastboot_item)
|
59 | 64 | {
|
60 | 65 | case 1:
|
61 | | - fastboot_rockbox(&firmware, &app, &size);
|
| 66 | + fastboot_rockbox();
|
62 | 67 | break;
|
63 | 68 |
|
64 | 69 | case 2:
|
65 | | - fastboot_umsboot(&firmware, &app, &size);
|
| 70 | + fastboot_umsboot();
|
66 | 71 | break;
|
67 | 72 |
|
68 | 73 | case 3:
|
69 | | - terminate = true;
|
| 74 | + bootinfo.valid = true;
|
70 | 75 | break;
|
71 | 76 | }
|
72 | 77 |
|
73 | | - if (!firmware && !app && !terminate)
|
| 78 | + if (!bootinfo.valid)
|
74 | 79 | {
|
75 | 80 | struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER, LIBPNG_API_VERSION, "libpng ");
|
76 | 81 | struct libpng_api* png = (struct libpng_api*)libpng->api;
|
— | — | @@ -93,7 +98,7 @@ |
94 | 99 | confirmchooser_init();
|
95 | 100 | snow_init();
|
96 | 101 |
|
97 | | - run_mainchooser(&firmware, &app, &size);
|
| 102 | + run_mainchooser();
|
98 | 103 |
|
99 | 104 | free(framebuf2);
|
100 | 105 | free(framebuf);
|
— | — | @@ -107,12 +112,12 @@ |
108 | 113 | release_library(libboot);
|
109 | 114 | library_unload(libboot);
|
110 | 115 |
|
111 | | - if (firmware)
|
| 116 | + if (bootinfo.firmware)
|
112 | 117 | {
|
113 | 118 | shutdown(false);
|
114 | | - execfirmware((void*)0x08000000, firmware, size);
|
| 119 | + execfirmware((void*)0x08000000, bootinfo.firmware, bootinfo.size);
|
115 | 120 | }
|
116 | | - else if (app) execimage(app, false);
|
| 121 | + else if (bootinfo.app) execimage(bootinfo.app, false, bootinfo.argc, bootinfo.argv);
|
117 | 122 | else cputs(3, "Dropped into emCORE console.\n");
|
118 | 123 | }
|
119 | 124 |
|
Index: apps/bootmenu-ipodclassic/main.h |
— | — | @@ -31,6 +31,18 @@ |
32 | 32 | #include "libui.h"
|
33 | 33 |
|
34 | 34 |
|
| 35 | +struct bootinfo_t
|
| 36 | +{
|
| 37 | + bool valid;
|
| 38 | + void* firmware;
|
| 39 | + int size;
|
| 40 | + void* app;
|
| 41 | + int argc;
|
| 42 | + const char** argv;
|
| 43 | +};
|
| 44 | +
|
| 45 | +
|
| 46 | +extern struct bootinfo_t bootinfo;
|
35 | 47 | extern struct libpng_api* png;
|
36 | 48 | extern struct libboot_api* boot;
|
37 | 49 | extern struct libui_api* ui;
|