| Index: apps/bootmenu-ipodclassic/SOURCES |
| — | — | @@ -0,0 +1 @@ |
| | 2 | +main.c
|
| Index: apps/bootmenu-ipodclassic/ls.x |
| — | — | @@ -0,0 +1,42 @@ |
| | 2 | +ENTRY(__emcore_entrypoint)
|
| | 3 | +OUTPUT_FORMAT(elf32-littlearm)
|
| | 4 | +OUTPUT_ARCH(arm)
|
| | 5 | +
|
| | 6 | +MEMORY
|
| | 7 | +{
|
| | 8 | + VIRTUAL : ORIGIN = 0x00000000, LENGTH = 0x10000000
|
| | 9 | +}
|
| | 10 | +
|
| | 11 | +SECTIONS
|
| | 12 | +{
|
| | 13 | + .text :
|
| | 14 | + {
|
| | 15 | + __emcore_app_base = .;
|
| | 16 | + KEEP(.emcoreentrypoint*)
|
| | 17 | + *(.emcoreentrypoint*)
|
| | 18 | + *(.text*)
|
| | 19 | + *(.glue_7)
|
| | 20 | + *(.glue_7t)
|
| | 21 | + . = ALIGN(0x10);
|
| | 22 | + } > VIRTUAL
|
| | 23 | +
|
| | 24 | + .data :
|
| | 25 | + {
|
| | 26 | + *(.rodata*)
|
| | 27 | + . = ALIGN(0x4);
|
| | 28 | + *(.data*)
|
| | 29 | + . = ALIGN(0x4);
|
| | 30 | + } > VIRTUAL
|
| | 31 | +
|
| | 32 | + .bss (NOLOAD) :
|
| | 33 | + {
|
| | 34 | + *(.bss*)
|
| | 35 | + *(COMMON)
|
| | 36 | + } > VIRTUAL
|
| | 37 | +
|
| | 38 | + /DISCARD/ :
|
| | 39 | + {
|
| | 40 | + *(.eh_frame)
|
| | 41 | + }
|
| | 42 | +
|
| | 43 | +}
|
| Index: apps/bootmenu-ipodclassic/images/icons.psd |
| Cannot display: file marked as a binary type. |
| svn:mime-type = application/octet-stream |
| Index: apps/bootmenu-ipodclassic/images/icons.psd |
| Property changes on: apps/bootmenu-ipodclassic/images/icons.psd |
| ___________________________________________________________________ |
| Added: svn:mime-type |
| ## -0,0 +1 ## |
| | 44 | +application/octet-stream |
| \ No newline at end of property |
| Index: apps/bootmenu-ipodclassic/images/background.png |
| Cannot display: file marked as a binary type. |
| svn:mime-type = application/octet-stream |
| Index: apps/bootmenu-ipodclassic/images/background.png |
| Property changes on: apps/bootmenu-ipodclassic/images/background.png |
| ___________________________________________________________________ |
| Added: svn:mime-type |
| ## -0,0 +1 ## |
| | 45 | +application/octet-stream |
| \ No newline at end of property |
| Index: apps/bootmenu-ipodclassic/images/background.psd |
| Cannot display: file marked as a binary type. |
| svn:mime-type = application/octet-stream |
| Index: apps/bootmenu-ipodclassic/images/background.psd |
| Property changes on: apps/bootmenu-ipodclassic/images/background.psd |
| ___________________________________________________________________ |
| Added: svn:mime-type |
| ## -0,0 +1 ## |
| | 46 | +application/octet-stream |
| \ No newline at end of property |
| Index: apps/bootmenu-ipodclassic/images/rockbox.png |
| Cannot display: file marked as a binary type. |
| svn:mime-type = application/octet-stream |
| Index: apps/bootmenu-ipodclassic/images/rockbox.png |
| Property changes on: apps/bootmenu-ipodclassic/images/rockbox.png |
| ___________________________________________________________________ |
| Added: svn:mime-type |
| ## -0,0 +1 ## |
| | 47 | +application/octet-stream |
| \ No newline at end of property |
| Index: apps/bootmenu-ipodclassic/images/rockbox.psd |
| Cannot display: file marked as a binary type. |
| svn:mime-type = application/octet-stream |
| Index: apps/bootmenu-ipodclassic/images/rockbox.psd |
| Property changes on: apps/bootmenu-ipodclassic/images/rockbox.psd |
| ___________________________________________________________________ |
| Added: svn:mime-type |
| ## -0,0 +1 ## |
| | 48 | +application/octet-stream |
| \ No newline at end of property |
| Index: apps/bootmenu-ipodclassic/images/icons.png |
| Cannot display: file marked as a binary type. |
| svn:mime-type = application/octet-stream |
| Index: apps/bootmenu-ipodclassic/images/icons.png |
| Property changes on: apps/bootmenu-ipodclassic/images/icons.png |
| ___________________________________________________________________ |
| Added: svn:mime-type |
| ## -0,0 +1 ## |
| | 49 | +application/octet-stream |
| \ No newline at end of property |
| Index: apps/bootmenu-ipodclassic/main.c |
| — | — | @@ -0,0 +1,358 @@ |
| | 2 | +#include "emcoreapp.h"
|
| | 3 | +#include "libboot.h"
|
| | 4 | +#include "libpng.h"
|
| | 5 | +#include "libui.h"
|
| | 6 | +
|
| | 7 | +
|
| | 8 | +void* framebuf;
|
| | 9 | +
|
| | 10 | +
|
| | 11 | +bool mychooser_preblit(struct chooser_data* data)
|
| | 12 | +{
|
| | 13 | + char buf[4];
|
| | 14 | + struct chooser_action_handler_wheel_data* adata;
|
| | 15 | + adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
|
| | 16 | + snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
|
| | 17 | + rendertext(framebuf, 302, 232, 320, 0xffffcccc, 0, buf);
|
| | 18 | + return false;
|
| | 19 | +}
|
| | 20 | +
|
| | 21 | +
|
| | 22 | +struct chooser_renderer_iconflow_itemdata mychooser_rparams_0 =
|
| | 23 | +{
|
| | 24 | + .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 56)),
|
| | 25 | + LIBUI_POINT(80, 72)),
|
| | 26 | + .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 56)),
|
| | 27 | + LIBUI_POINT(80, 72)),
|
| | 28 | + .text = "Power off",
|
| | 29 | + .text_color = 0xffffcccc,
|
| | 30 | +};
|
| | 31 | +
|
| | 32 | +struct chooser_renderer_iconflow_itemdata mychooser_rparams_1 =
|
| | 33 | +{
|
| | 34 | + .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 0)),
|
| | 35 | + LIBUI_POINT(80, 25)),
|
| | 36 | + .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 0)),
|
| | 37 | + LIBUI_POINT(80, 25)),
|
| | 38 | + .text = "Rockbox",
|
| | 39 | + .text_color = 0xffffcccc,
|
| | 40 | +};
|
| | 41 | +
|
| | 42 | +struct chooser_renderer_iconflow_itemdata mychooser_rparams_2 =
|
| | 43 | +{
|
| | 44 | + .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 25)),
|
| | 45 | + LIBUI_POINT(80, 31)),
|
| | 46 | + .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 25)),
|
| | 47 | + LIBUI_POINT(80, 31)),
|
| | 48 | + .text = "emCORE console",
|
| | 49 | + .text_color = 0xffffcccc,
|
| | 50 | +};
|
| | 51 | +
|
| | 52 | +struct chooser_renderer_iconflow_itemdata mychooser_rparams_3 =
|
| | 53 | +{
|
| | 54 | + .icon = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 130)),
|
| | 55 | + LIBUI_POINT(80, 55)),
|
| | 56 | + .icon_selected = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 80), LIBUI_POINT(0, 130)),
|
| | 57 | + LIBUI_POINT(80, 55)),
|
| | 58 | + .text = "UMSboot",
|
| | 59 | + .text_color = 0xffffcccc,
|
| | 60 | +};
|
| | 61 | +
|
| | 62 | +struct chooser_renderer_iconflow_params mychooser_rparams =
|
| | 63 | +{
|
| | 64 | + .version = CHOOSER_RENDERER_LIST_PARAMS_VERSION,
|
| | 65 | + .copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
| | 66 | + .copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
| | 67 | + LIBUI_POINT(320, 240)),
|
| | 68 | + .bg_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
| | 69 | + .bg_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
| | 70 | + LIBUI_POINT(0, 0)),
|
| | 71 | + .bg_opacity = 0,
|
| | 72 | + .fill_dest = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 0), LIBUI_POINT(0, 0)),
|
| | 73 | + LIBUI_POINT(0, 0)),
|
| | 74 | + .fill_color = 0,
|
| | 75 | + .viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 30)),
|
| | 76 | + LIBUI_POINT(320, 130)),
|
| | 77 | + .text_pos = LIBUI_POINT(160, 215),
|
| | 78 | + .blit_dest = LIBUI_POINT(0, 0),
|
| | 79 | + .blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
| | 80 | + LIBUI_POINT(320, 240)),
|
| | 81 | + .smoothness = 500000,
|
| | 82 | + .startposition = -3,
|
| | 83 | + .iconsinview = 4,
|
| | 84 | + .preblit = mychooser_preblit,
|
| | 85 | + .postblit = NULL
|
| | 86 | +};
|
| | 87 | +
|
| | 88 | +struct chooser_action_handler_wheel_params mychooser_aparams =
|
| | 89 | +{
|
| | 90 | + .version = CHOOSER_ACTION_HANDLER_WHEEL_PARAMS_VERSION,
|
| | 91 | + .stepsperitem = 512,
|
| | 92 | + .eventfilter = NULL,
|
| | 93 | + .timeout_initial = 30500000,
|
| | 94 | + .timeout_idle = 300500000,
|
| | 95 | + .timeout_item = 0,
|
| | 96 | + .tick_force_redraw = true,
|
| | 97 | + .buttoncount = 3,
|
| | 98 | + .buttonmap =
|
| | 99 | + {
|
| | 100 | + CHOOSER_ACTION_HANDLER_WHEEL_ACTION_SELECT,
|
| | 101 | + CHOOSER_ACTION_HANDLER_WHEEL_ACTION_NEXT,
|
| | 102 | + CHOOSER_ACTION_HANDLER_WHEEL_ACTION_PREV
|
| | 103 | + }
|
| | 104 | +};
|
| | 105 | +
|
| | 106 | +struct chooser_info mychooser =
|
| | 107 | +{
|
| | 108 | + .version = CHOOSER_INFO_VERSION,
|
| | 109 | + .actionhandler = NULL,
|
| | 110 | + .actionhandlerparams = &mychooser_aparams,
|
| | 111 | + .renderer = NULL,
|
| | 112 | + .rendererparams = &mychooser_rparams,
|
| | 113 | + .userparams = NULL,
|
| | 114 | + .tickinterval = 990000,
|
| | 115 | + .itemcount = 4,
|
| | 116 | + .defaultitem = 1,
|
| | 117 | + .items =
|
| | 118 | + {
|
| | 119 | + {
|
| | 120 | + .user = (void*)0,
|
| | 121 | + .actionparams = NULL,
|
| | 122 | + .renderparams = &mychooser_rparams_0
|
| | 123 | + },
|
| | 124 | + {
|
| | 125 | + .user = (void*)1,
|
| | 126 | + .actionparams = NULL,
|
| | 127 | + .renderparams = &mychooser_rparams_1
|
| | 128 | + },
|
| | 129 | + {
|
| | 130 | + .user = (void*)2,
|
| | 131 | + .actionparams = NULL,
|
| | 132 | + .renderparams = &mychooser_rparams_2
|
| | 133 | + },
|
| | 134 | + {
|
| | 135 | + .user = (void*)3,
|
| | 136 | + .actionparams = NULL,
|
| | 137 | + .renderparams = &mychooser_rparams_3
|
| | 138 | + }
|
| | 139 | + }
|
| | 140 | +};
|
| | 141 | +
|
| | 142 | +
|
| | 143 | +static void main()
|
| | 144 | +{
|
| | 145 | + struct emcorelib_header* libboot = get_library(0x4c424365, LIBBOOT_API_VERSION, LIBSOURCE_BOOTFLASH, "libboot ");
|
| | 146 | + if (!libboot) panicf(PANIC_KILLTHREAD, "Could not load booting library!");
|
| | 147 | + struct libboot_api* boot = (struct libboot_api*)libboot->api;
|
| | 148 | + struct emcorelib_header* libpng = get_library(0x64474e50, LIBPNG_API_VERSION, LIBSOURCE_BOOTFLASH, "libpng ");
|
| | 149 | + if (!libpng) panicf(PANIC_KILLTHREAD, "Could not load PNG decoder library!");
|
| | 150 | + struct libpng_api* png = (struct libpng_api*)libpng->api;
|
| | 151 | + struct emcorelib_header* libui = get_library(0x49554365, LIBUI_API_VERSION, LIBSOURCE_BOOTFLASH, "libui ");
|
| | 152 | + if (!libui) panicf(PANIC_KILLTHREAD, "Could not load user interface library!");
|
| | 153 | + struct libui_api* ui = (struct libui_api*)libui->api;
|
| | 154 | + int size = bootflash_filesize("backgrnd");
|
| | 155 | + if (size == -1) panicf(PANIC_KILLTHREAD, "Could not find background image!");
|
| | 156 | + void* buf = memalign(0x10, size);
|
| | 157 | + if (!buf) panicf(PANIC_KILLTHREAD, "Could not allocate buffer for background image!");
|
| | 158 | + bootflash_read("backgrnd", buf, 0, size);
|
| | 159 | + struct png_info* handle = png->png_open(buf, size);
|
| | 160 | + if (!handle) panicf(PANIC_KILLTHREAD, "Could not parse background image!");
|
| | 161 | + struct png_rgb* bg = png->png_decode_rgb(handle);
|
| | 162 | + if (!bg) panicf(PANIC_KILLTHREAD, "Could not decode background image!");
|
| | 163 | + png->png_destroy(handle);
|
| | 164 | + free(buf);
|
| | 165 | + size = bootflash_filesize("iconset ");
|
| | 166 | + if (size == -1) panicf(PANIC_KILLTHREAD, "Could not find icon set!");
|
| | 167 | + buf = memalign(0x10, size);
|
| | 168 | + if (!buf) panicf(PANIC_KILLTHREAD, "Could not allocate buffer for icon set!");
|
| | 169 | + bootflash_read("iconset ", buf, 0, size);
|
| | 170 | + handle = png->png_open(buf, size);
|
| | 171 | + if (!handle) panicf(PANIC_KILLTHREAD, "Could not parse icon set!");
|
| | 172 | + struct png_rgba* icons = png->png_decode_rgba(handle);
|
| | 173 | + if (!icons) panicf(PANIC_KILLTHREAD, "Could not decode icon set!");
|
| | 174 | + png->png_destroy(handle);
|
| | 175 | + free(buf);
|
| | 176 | + size = bootflash_filesize("rbxlogo ");
|
| | 177 | + if (size == -1) panicf(PANIC_KILLTHREAD, "Could not find Rockbox logo!");
|
| | 178 | + buf = memalign(0x10, size);
|
| | 179 | + if (!buf) panicf(PANIC_KILLTHREAD, "Could not allocate buffer for Rockbox logo!");
|
| | 180 | + bootflash_read("rbxlogo ", buf, 0, size);
|
| | 181 | + handle = png->png_open(buf, size);
|
| | 182 | + if (!handle) panicf(PANIC_KILLTHREAD, "Could not parse Rockbox logo!");
|
| | 183 | + struct png_rgb* rbxlogo = png->png_decode_rgb(handle);
|
| | 184 | + if (!rbxlogo) panicf(PANIC_KILLTHREAD, "Could not decode Rockbox logo!");
|
| | 185 | + png->png_destroy(handle);
|
| | 186 | + free(buf);
|
| | 187 | + framebuf = malloc(320 * 240 * 3);
|
| | 188 | + if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
|
| | 189 | + mychooser.actionhandler = ui->chooser_action_handler_wheel;
|
| | 190 | + mychooser.renderer = ui->chooser_renderer_iconflow;
|
| | 191 | + mychooser_rparams.copy_dest.buf.addr = framebuf;
|
| | 192 | + mychooser_rparams.copy_src.loc.buf.addr = bg;
|
| | 193 | + mychooser_rparams.viewport.loc.buf.addr = framebuf;
|
| | 194 | + mychooser_rparams.blit_src.loc.buf.addr = framebuf;
|
| | 195 | + mychooser_rparams_0.icon.loc.buf.addr = icons;
|
| | 196 | + mychooser_rparams_0.icon_selected.loc.buf.addr = icons;
|
| | 197 | + mychooser_rparams_1.icon.loc.buf.addr = icons;
|
| | 198 | + mychooser_rparams_1.icon_selected.loc.buf.addr = icons;
|
| | 199 | + mychooser_rparams_2.icon.loc.buf.addr = icons;
|
| | 200 | + mychooser_rparams_2.icon_selected.loc.buf.addr = icons;
|
| | 201 | + mychooser_rparams_3.icon.loc.buf.addr = icons;
|
| | 202 | + mychooser_rparams_3.icon_selected.loc.buf.addr = icons;
|
| | 203 | + void* firmware = NULL;
|
| | 204 | + while (!firmware)
|
| | 205 | + {
|
| | 206 | + const struct chooser_item* result = ui->chooser_run(&mychooser);
|
| | 207 | + switch ((int)(result->user))
|
| | 208 | + {
|
| | 209 | + case 0:
|
| | 210 | + shutdown(true);
|
| | 211 | + power_off();
|
| | 212 | + break;
|
| | 213 | + case 1:
|
| | 214 | + {
|
| | 215 | + int i;
|
| | 216 | + for (i = 0; i <= 300; i += 60)
|
| | 217 | + {
|
| | 218 | + if (i < 300)
|
| | 219 | + ui->blend(320, 240, 50, framebuf, 0, 0, 320,
|
| | 220 | + framebuf, 0, 0, 320, bg, 0, 0, 320);
|
| | 221 | + else memcpy(framebuf, bg, 320 * 240 * 3);
|
| | 222 | + ui->blit(MIN(280, i), 86, 3, framebuf, 320 - i, 10, 320, rbxlogo, 0, 0, 280);
|
| | 223 | + displaylcd(0, 0, 320, 240, framebuf, 0, 0, 320);
|
| | 224 | + }
|
| | 225 | + int fd = file_open("/.rockbox/rockbox.ipod", O_RDONLY);
|
| | 226 | + if (fd > 0)
|
| | 227 | + {
|
| | 228 | + size = filesize(fd);
|
| | 229 | + if (size > 0)
|
| | 230 | + {
|
| | 231 | + void* buf = memalign(0x10, size);
|
| | 232 | + if (buf)
|
| | 233 | + {
|
| | 234 | + if (read(fd, buf, size) == size)
|
| | 235 | + if (!boot->verify_rockbox_checksum(buf, size))
|
| | 236 | + firmware = buf;
|
| | 237 | + if (!firmware) free(buf);
|
| | 238 | + }
|
| | 239 | + }
|
| | 240 | + close(fd);
|
| | 241 | + }
|
| | 242 | + if (!firmware)
|
| | 243 | + {
|
| | 244 | + rendertext(framebuf, 76, 140, 320, 0xff3333ff, 0xa0000000, "Loading rockbox.ipod failed!");
|
| | 245 | + rendertext(framebuf, 76, 148, 320, 0xff3333ff, 0xa0000000, " Trying fallback image... ");
|
| | 246 | + displaylcd(0, 0, 320, 240, framebuf, 0, 0, 320);
|
| | 247 | + sleep(5000000);
|
| | 248 | + size = bootflash_filesize("rockbox ");
|
| | 249 | + if (size > 0)
|
| | 250 | + {
|
| | 251 | + void* buf = memalign(0x10, size);
|
| | 252 | + if (buf)
|
| | 253 | + {
|
| | 254 | + bootflash_read("rockbox ", buf, 0, size);
|
| | 255 | + if (bootflash_attributes("rockbox ") & 0x800)
|
| | 256 | + {
|
| | 257 | + void* buf2 = malloc(0x100000);
|
| | 258 | + if (buf2)
|
| | 259 | + {
|
| | 260 | + if (!ucl_decompress(buf, size, buf2, (uint32_t*)&size))
|
| | 261 | + {
|
| | 262 | + free(buf);
|
| | 263 | + buf = realloc(buf2, size);
|
| | 264 | + if (!buf) buf = buf2;
|
| | 265 | + if (!boot->verify_rockbox_checksum(buf, size))
|
| | 266 | + firmware = buf;
|
| | 267 | + else free(buf);
|
| | 268 | + }
|
| | 269 | + else
|
| | 270 | + {
|
| | 271 | + free(buf2);
|
| | 272 | + free(buf);
|
| | 273 | + }
|
| | 274 | + }
|
| | 275 | + else free(buf);
|
| | 276 | + }
|
| | 277 | + else
|
| | 278 | + {
|
| | 279 | + if (!boot->verify_rockbox_checksum(buf, size)) firmware = buf;
|
| | 280 | + else free(buf);
|
| | 281 | + }
|
| | 282 | + }
|
| | 283 | + }
|
| | 284 | + }
|
| | 285 | + if (!firmware)
|
| | 286 | + {
|
| | 287 | + memcpy(framebuf, bg, 320 * 240 * 3);
|
| | 288 | + rendertext(framebuf, 91, 140, 320, 0xff3333ff, 0xa0000000, "Loading Rockbox failed!");
|
| | 289 | + rendertext(framebuf, 91, 148, 320, 0xff3333ff, 0xa0000000, "Returning to main menu.");
|
| | 290 | + displaylcd(0, 0, 320, 240, framebuf, 0, 0, 320);
|
| | 291 | + sleep(5000000);
|
| | 292 | + }
|
| | 293 | + break;
|
| | 294 | + }
|
| | 295 | + case 2:
|
| | 296 | + goto leave;
|
| | 297 | + case 3:
|
| | 298 | + size = bootflash_filesize("umsboot ");
|
| | 299 | + if (size > 0)
|
| | 300 | + {
|
| | 301 | + void* buf = memalign(0x10, size);
|
| | 302 | + if (buf)
|
| | 303 | + {
|
| | 304 | + bootflash_read("umsboot ", buf, 0, size);
|
| | 305 | + if (bootflash_attributes("umsboot ") & 0x800)
|
| | 306 | + {
|
| | 307 | + void* buf2 = malloc(0x10000);
|
| | 308 | + if (buf2)
|
| | 309 | + {
|
| | 310 | + if (!ucl_decompress(buf, size, buf2, (uint32_t*)&size))
|
| | 311 | + {
|
| | 312 | + free(buf);
|
| | 313 | + buf = realloc(buf2, size);
|
| | 314 | + if (!buf) buf = buf2;
|
| | 315 | + firmware = buf;
|
| | 316 | + }
|
| | 317 | + else
|
| | 318 | + {
|
| | 319 | + free(buf2);
|
| | 320 | + free(buf);
|
| | 321 | + }
|
| | 322 | + }
|
| | 323 | + else free(buf);
|
| | 324 | + }
|
| | 325 | + else firmware = buf;
|
| | 326 | + }
|
| | 327 | + }
|
| | 328 | + if (!firmware)
|
| | 329 | + {
|
| | 330 | + memcpy(framebuf, bg, 320 * 240 * 3);
|
| | 331 | + rendertext(framebuf, 91, 140, 320, 0xff3333ff, 0xa0000000, "Loading UMSboot failed!");
|
| | 332 | + rendertext(framebuf, 91, 148, 320, 0xff3333ff, 0xa0000000, "Returning to main menu.");
|
| | 333 | + displaylcd(0, 0, 320, 240, framebuf, 0, 0, 320);
|
| | 334 | + sleep(5000000);
|
| | 335 | + }
|
| | 336 | + break;
|
| | 337 | + }
|
| | 338 | + }
|
| | 339 | +leave:
|
| | 340 | + free(framebuf);
|
| | 341 | + free(rbxlogo);
|
| | 342 | + free(icons);
|
| | 343 | + free(bg);
|
| | 344 | + release_library(libui);
|
| | 345 | + library_unload(libui);
|
| | 346 | + release_library(libpng);
|
| | 347 | + library_unload(libpng);
|
| | 348 | + release_library(libboot);
|
| | 349 | + library_unload(libboot);
|
| | 350 | + if (firmware)
|
| | 351 | + {
|
| | 352 | + shutdown(false);
|
| | 353 | + execfirmware((void*)0x08000000, firmware, size);
|
| | 354 | + }
|
| | 355 | + else cputs(3, "Dropped into emCORE console.\n");
|
| | 356 | +}
|
| | 357 | +
|
| | 358 | +
|
| | 359 | +EMCORE_APP_HEADER("Boot menu", main, 127)
|
| Index: apps/bootmenu-ipodclassic/version.h |
| — | — | @@ -0,0 +1,36 @@ |
| | 2 | +//
|
| | 3 | +//
|
| | 4 | +// Copyright 2010 TheSeven
|
| | 5 | +//
|
| | 6 | +//
|
| | 7 | +// This file is part of emBIOS.
|
| | 8 | +//
|
| | 9 | +// emBIOS is free software: you can redistribute it and/or
|
| | 10 | +// modify it under the terms of the GNU General Public License as
|
| | 11 | +// published by the Free Software Foundation, either version 2 of the
|
| | 12 | +// License, or (at your option) any later version.
|
| | 13 | +//
|
| | 14 | +// emBIOS is distributed in the hope that it will be useful,
|
| | 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| | 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| | 17 | +// See the GNU General Public License for more details.
|
| | 18 | +//
|
| | 19 | +// You should have received a copy of the GNU General Public License along
|
| | 20 | +// with emBIOS. If not, see <http://www.gnu.org/licenses/>.
|
| | 21 | +//
|
| | 22 | +//
|
| | 23 | +
|
| | 24 | +
|
| | 25 | +#ifndef __VERSION_H__
|
| | 26 | +#define __VERSION_H__
|
| | 27 | +
|
| | 28 | +
|
| | 29 | +#define VERSION "0.0.1pre"
|
| | 30 | +#define VERSION_MAJOR 0
|
| | 31 | +#define VERSION_MINOR 0
|
| | 32 | +#define VERSION_PATCH 1
|
| | 33 | +#define VERSION_SVN "$REVISION$"
|
| | 34 | +#define VERSION_SVN_INT $REVISIONINT$
|
| | 35 | +
|
| | 36 | +
|
| | 37 | +#endif |
| \ No newline at end of file |
| Index: apps/bootmenu-ipodclassic/Makefile |
| — | — | @@ -0,0 +1,123 @@ |
| | 2 | +NAME := bootmenu-ipodclassic
|
| | 3 | +STACKSIZE := 4096
|
| | 4 | +COMPRESS := true
|
| | 5 | +
|
| | 6 | +EMCOREDIR ?= ../../emcore/trunk/
|
| | 7 | +LIBBOOTDIR ?= ../../libs/boot/
|
| | 8 | +LIBPNGDIR ?= ../../libs/png/
|
| | 9 | +LIBUIDIR ?= ../../libs/ui/
|
| | 10 | +
|
| | 11 | +ifeq ($(shell uname),WindowsNT)
|
| | 12 | +CCACHE :=
|
| | 13 | +else
|
| | 14 | +CCACHE := $(shell which ccache)
|
| | 15 | +endif
|
| | 16 | +
|
| | 17 | +CROSS ?= arm-elf-eabi-
|
| | 18 | +CC := $(CCACHE) $(CROSS)gcc
|
| | 19 | +AS := $(CROSS)as
|
| | 20 | +LD := $(CROSS)ld
|
| | 21 | +OBJCOPY := $(CROSS)objcopy
|
| | 22 | +ELF2ECA := $(CROSS)elf2emcoreapp
|
| | 23 | +
|
| | 24 | +LIBINCLUDES := -I$(LIBPNGDIR)/export -I$(LIBUIDIR)/export
|
| | 25 | +
|
| | 26 | +CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export $(LIBINCLUDES) -ffunction-sections -fdata-sections -mcpu=arm940t -DARM_ARCH=4
|
| | 27 | +LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
|
| | 28 | +
|
| | 29 | +preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
|
| | 30 | +preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
|
| | 31 | +
|
| | 32 | +REVISION := $(shell svnversion .)
|
| | 33 | +REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
|
| | 34 | +
|
| | 35 | +HELPERS := build/__emcore_armhelpers.o
|
| | 36 | +
|
| | 37 | +SRC := $(call preprocesspaths,SOURCES,-I. -I..)
|
| | 38 | +OBJ := $(SRC:%.c=build/%.o)
|
| | 39 | +OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
|
| | 40 | +
|
| | 41 | +all: $(NAME)
|
| | 42 | +
|
| | 43 | +-include $(OBJ:%=%.dep)
|
| | 44 | +
|
| | 45 | +$(NAME): build/$(NAME).emcoreapp
|
| | 46 | +
|
| | 47 | +build/$(NAME).emcoreapp: build/$(NAME).elf
|
| | 48 | + @echo [EMCAPP] $<
|
| | 49 | +ifeq ($(COMPRESS),true)
|
| | 50 | + @$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
|
| | 51 | +else
|
| | 52 | + @$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
|
| | 53 | +endif
|
| | 54 | +
|
| | 55 | +build/$(NAME).elf: ls.x $(OBJ)
|
| | 56 | + @echo [LD] $@
|
| | 57 | + @$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
|
| | 58 | +
|
| | 59 | +build/%.o: %.c build/version.h
|
| | 60 | + @echo [CC] $<
|
| | 61 | +ifeq ($(shell uname),WindowsNT)
|
| | 62 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| | 63 | +else
|
| | 64 | + @-mkdir -p $(dir $@)
|
| | 65 | +endif
|
| | 66 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| | 67 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| | 68 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| | 69 | +ifeq ($(shell uname),WindowsNT)
|
| | 70 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| | 71 | +else
|
| | 72 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| | 73 | +endif
|
| | 74 | + @rm -f $@.dep.tmp
|
| | 75 | +
|
| | 76 | +build/%.o: %.S build/version.h
|
| | 77 | + @echo [CC] $<
|
| | 78 | +ifeq ($(shell uname),WindowsNT)
|
| | 79 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| | 80 | +else
|
| | 81 | + @-mkdir -p $(dir $@)
|
| | 82 | +endif
|
| | 83 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| | 84 | + @$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
|
| | 85 | + @sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
|
| | 86 | +ifeq ($(shell uname),WindowsNT)
|
| | 87 | + @sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
|
| | 88 | +else
|
| | 89 | + @sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
|
| | 90 | +endif
|
| | 91 | + @rm -f $@.dep.tmp
|
| | 92 | +
|
| | 93 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.c
|
| | 94 | + @echo [CC] $<
|
| | 95 | +ifeq ($(shell uname),WindowsNT)
|
| | 96 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| | 97 | +else
|
| | 98 | + @-mkdir -p $(dir $@)
|
| | 99 | +endif
|
| | 100 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| | 101 | +
|
| | 102 | +build/__emcore_%.o: $(EMCOREDIR)/export/%.S
|
| | 103 | + @echo [CC] $<
|
| | 104 | +ifeq ($(shell uname),WindowsNT)
|
| | 105 | + @-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
|
| | 106 | +else
|
| | 107 | + @-mkdir -p $(dir $@)
|
| | 108 | +endif
|
| | 109 | + @$(CC) -c $(CFLAGS) -o $@ $<
|
| | 110 | +
|
| | 111 | +build/version.h: version.h .svn/entries
|
| | 112 | + @echo [PP] $<
|
| | 113 | +ifeq ($(shell uname),WindowsNT)
|
| | 114 | + @-if not exist build md build
|
| | 115 | + @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
| | 116 | +else
|
| | 117 | + @-mkdir -p build
|
| | 118 | + @sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
| | 119 | +endif
|
| | 120 | +
|
| | 121 | +clean:
|
| | 122 | + @rm -rf build
|
| | 123 | +
|
| | 124 | +.PHONY: all clean $(NAME)
|
| Index: apps/bootmenu-ipodclassic |
| Property changes on: apps/bootmenu-ipodclassic |
| ___________________________________________________________________ |
| Added: svn:ignore |
| ## -0,0 +1 ## |
| | 125 | +build |