freemyipod r781 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r780‎ | r781 | r782 >
Date:01:12, 13 November 2011
Author:user890104
Status:new
Tags:
Comment:
New app: bootmenu-ipodnano4g
It is completely unusable due to the lack of clickwheel/NAND drivers, but I'm adding it just in case.
Modified paths:
  • /apps/bootmenu-ipodnano4g (added) (history)
  • /apps/bootmenu-ipodnano4g/Makefile (added) (history)
  • /apps/bootmenu-ipodnano4g/SOURCES (added) (history)
  • /apps/bootmenu-ipodnano4g/images (added) (history)
  • /apps/bootmenu-ipodnano4g/images/background.png (added) (history)
  • /apps/bootmenu-ipodnano4g/images/background.psd (added) (history)
  • /apps/bootmenu-ipodnano4g/images/crapple.png (added) (history)
  • /apps/bootmenu-ipodnano4g/images/crapple.psd (added) (history)
  • /apps/bootmenu-ipodnano4g/images/icons.png (added) (history)
  • /apps/bootmenu-ipodnano4g/images/icons.psd (added) (history)
  • /apps/bootmenu-ipodnano4g/images/rockbox.png (added) (history)
  • /apps/bootmenu-ipodnano4g/images/rockbox.psd (added) (history)
  • /apps/bootmenu-ipodnano4g/ls.x (added) (history)
  • /apps/bootmenu-ipodnano4g/main.c (added) (history)
  • /apps/bootmenu-ipodnano4g/resources.S (added) (history)
  • /apps/bootmenu-ipodnano4g/version.h (added) (history)

Diff [purge]

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

Image changes

Index: /apps/bootmenu-ipodnano4g/images/background.png
added
Index: /apps/bootmenu-ipodnano4g/images/crapple.png
added
Index: /apps/bootmenu-ipodnano4g/images/icons.png
added
Index: /apps/bootmenu-ipodnano4g/images/rockbox.png
added