Subversion Repositories freemyipod

Rev

Rev 833 | Rev 835 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 833 Rev 834
Line 36... Line 36...
36
void* framebuf;
36
void* framebuf;
37
void* framebuf2;
37
void* framebuf2;
38
void* bg;
38
void* bg;
39
void* icons;
39
void* icons;
40
void* rbxlogo;
40
void* rbxlogo;
-
 
41
struct bootinfo_t bootinfo =
-
 
42
{
-
 
43
    .valid = false,
-
 
44
    .firmware = NULL,
-
 
45
    .size = 0,
-
 
46
    .app = NULL,
-
 
47
    .argc = 0,
-
 
48
    .argv = NULL
-
 
49
};
41
 
50
 
42
 
51
 
43
static void main()
52
static void main()
44
{
53
{
45
    settings_init();
54
    settings_init();
46
    
55
    
47
    struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
56
    struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
48
                                               LIBBOOT_API_VERSION, "libboot ");
57
                                               LIBBOOT_API_VERSION, "libboot ");
49
    boot = (struct libboot_api*)libboot->api;
58
    boot = (struct libboot_api*)libboot->api;
50
 
59
 
51
    bool terminate = false;
-
 
52
    void* firmware = NULL;
-
 
53
    void* app = NULL;
-
 
54
    int size;
-
 
55
 
60
 
56
    if (!(clickwheel_get_state() & 0x1f))
61
    if (!(clickwheel_get_state() & 0x1f))
57
        switch (settings.fastboot_item)
62
        switch (settings.fastboot_item)
58
        {
63
        {
59
            case 1:
64
            case 1:
60
                fastboot_rockbox(&firmware, &app, &size);
65
                fastboot_rockbox();
61
                break;
66
                break;
62
            
67
            
63
            case 2:
68
            case 2:
64
                fastboot_umsboot(&firmware, &app, &size);
69
                fastboot_umsboot();
65
                break;
70
                break;
66
            
71
            
67
            case 3:
72
            case 3:
68
                terminate = true;
73
                bootinfo.valid = true;
69
                break;
74
                break;
70
        }
75
        }
71
 
76
 
72
    if (!firmware && !app && !terminate)
77
    if (!bootinfo.valid)
73
    {
78
    {
74
        struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER, LIBPNG_API_VERSION, "libpng  ");
79
        struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER, LIBPNG_API_VERSION, "libpng  ");
75
        struct libpng_api* png = (struct libpng_api*)libpng->api;
80
        struct libpng_api* png = (struct libpng_api*)libpng->api;
76
        bg = loadpng(png, background_png, background_png_size, (void* (*)(struct png_info*))(png->png_decode_rgb));
81
        bg = loadpng(png, background_png, background_png_size, (void* (*)(struct png_info*))(png->png_decode_rgb));
77
        icons = loadpng(png, icons_png, icons_png_size, (void* (*)(struct png_info*))(png->png_decode_rgba));
82
        icons = loadpng(png, icons_png, icons_png_size, (void* (*)(struct png_info*))(png->png_decode_rgba));
Line 91... Line 96...
91
        toolchooser_init();
96
        toolchooser_init();
92
        settingchooser_init();
97
        settingchooser_init();
93
        confirmchooser_init();
98
        confirmchooser_init();
94
        snow_init();
99
        snow_init();
95
        
100
        
96
        run_mainchooser(&firmware, &app, &size);
101
        run_mainchooser();
97
        
102
        
98
        free(framebuf2);
103
        free(framebuf2);
99
        free(framebuf);
104
        free(framebuf);
100
        free(rbxlogo);
105
        free(rbxlogo);
101
        free(icons);
106
        free(icons);
Line 105... Line 110...
105
    }
110
    }
106
 
111
 
107
    release_library(libboot);
112
    release_library(libboot);
108
    library_unload(libboot);
113
    library_unload(libboot);
109
 
114
 
110
    if (firmware)
115
    if (bootinfo.firmware)
111
    {
116
    {
112
        shutdown(false);
117
        shutdown(false);
113
        execfirmware((void*)0x08000000, firmware, size);
118
        execfirmware((void*)0x08000000, bootinfo.firmware, bootinfo.size);
114
    }
119
    }
115
    else if (app) execimage(app, false);
120
    else if (bootinfo.app) execimage(bootinfo.app, false, bootinfo.argc, bootinfo.argv);
116
    else cputs(3, "Dropped into emCORE console.\n");
121
    else cputs(3, "Dropped into emCORE console.\n");
117
}
122
}
118
 
123
 
119
EMCORE_APP_HEADER("Boot menu", main, 127)
124
EMCORE_APP_HEADER("Boot menu", main, 127)