Rev 830 | Rev 834 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
////// Copyright 2011 TheSeven////// This file is part of emCORE.//// emCORE is free software: you can redistribute it and/or// modify it under the terms of the GNU General Public License as// published by the Free Software Foundation, either version 2 of the// License, or (at your option) any later version.//// emCORE is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.// See the GNU General Public License for more details.//// You should have received a copy of the GNU General Public License along// with emCORE. If not, see <http://www.gnu.org/licenses/>.////#include "emcoreapp.h"#include "resources.h"#include "main.h"#include "boot.h"#include "settings.h"#include "mainchooser.h"#include "settingchooser.h"#include "util.h"struct libboot_api* boot;struct libui_api* ui;void* framebuf;void* framebuf2;void* bg;void* icons;void* rbxlogo;static void main(){settings_init();struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,LIBBOOT_API_VERSION, "libboot ");boot = (struct libboot_api*)libboot->api;bool terminate = false;void* firmware = NULL;void* app = NULL;int size;if (!(clickwheel_get_state() & 0x1f))switch (settings.fastboot_item){case 1:fastboot_rockbox(&firmware, &app, &size);break;case 2:fastboot_umsboot(&firmware, &app, &size);break;case 3:terminate = true;break;}if (!firmware && !app && !terminate){struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER, LIBPNG_API_VERSION, "libpng ");struct libpng_api* png = (struct libpng_api*)libpng->api;bg = loadpng(png, background_png, background_png_size, (void* (*)(struct png_info*))(png->png_decode_rgb));icons = loadpng(png, icons_png, icons_png_size, (void* (*)(struct png_info*))(png->png_decode_rgba));rbxlogo = loadpng(png, rockbox_png, rockbox_png_size, (void* (*)(struct png_info*))(png->png_decode_rgb));release_library(libpng);library_unload(libpng);struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER, LIBUI_API_VERSION, "libui ");ui = (struct libui_api*)libui->api;framebuf = malloc(320 * 240 * 3);if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");framebuf2 = malloc(320 * 240 * 3);if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");mainchooser_init();toolchooser_init();settingchooser_init();confirmchooser_init();snow_init();run_mainchooser(&firmware, &app, &size);free(framebuf2);free(framebuf);free(rbxlogo);free(icons);free(bg);release_library(libui);library_unload(libui);}release_library(libboot);library_unload(libboot);if (firmware){shutdown(false);execfirmware((void*)0x08000000, firmware, size);}else if (app) execimage(app, false);else cputs(3, "Dropped into emCORE console.\n");}EMCORE_APP_HEADER("Boot menu", main, 127)