Subversion Repositories freemyipod

Rev

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

Rev 835 Rev 838
Line 37... Line 37...
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
void* crapple;
41
void* crapple;
-
 
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
static void main(int argc, const char** argv)
53
static void main(int argc, const char** argv)
45
{
54
{
46
    settings_init();
55
    settings_init();
47
    
56
    
48
    struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
57
    struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
49
                                               LIBBOOT_API_VERSION, "libboot ");
58
                                               LIBBOOT_API_VERSION, "libboot ");
50
    boot = (struct libboot_api*)libboot->api;
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
 
-
 
57
    if (!(clickwheel_get_state() & 0x1f))
61
    if (!(clickwheel_get_state() & 0x1f))
58
        switch (settings.fastboot_item)
62
        switch (settings.fastboot_item)
59
        {
63
        {
60
            case 1:
64
            case 1:
61
                fastboot_crapple(&firmware, &app, &size);
65
                fastboot_crapple();
62
                break;
66
                break;
63
            
67
            
64
            case 2:
68
            case 2:
65
                fastboot_rockbox(&firmware, &app, &size);
69
                fastboot_rockbox();
66
                break;
70
                break;
67
            
71
            
68
            case 3:
72
            case 3:
69
                fastboot_diskmode(&firmware, &app, &size);
73
                fastboot_diskmode();
70
                break;
74
                break;
71
            
75
            
72
            case 4:
76
            case 4:
73
                fastboot_umsboot(&firmware, &app, &size);
77
                fastboot_umsboot();
74
                break;
78
                break;
75
            
79
            
76
            case 5:
80
            case 5:
77
                terminate = true;
81
                bootinfo.valid = true;
78
                break;
82
                break;
79
        }
83
        }
80
 
84
 
81
    if (!firmware && !app && !terminate)
85
    if (!bootinfo.valid)
82
    {
86
    {
83
        struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER, LIBPNG_API_VERSION, "libpng  ");
87
        struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER, LIBPNG_API_VERSION, "libpng  ");
84
        struct libpng_api* png = (struct libpng_api*)libpng->api;
88
        struct libpng_api* png = (struct libpng_api*)libpng->api;
85
        bg = loadpng(png, background_png, background_png_size, (void* (*)(struct png_info*))(png->png_decode_rgb));
89
        bg = loadpng(png, background_png, background_png_size, (void* (*)(struct png_info*))(png->png_decode_rgb));
86
        icons = loadpng(png, icons_png, icons_png_size, (void* (*)(struct png_info*))(png->png_decode_rgba));
90
        icons = loadpng(png, icons_png, icons_png_size, (void* (*)(struct png_info*))(png->png_decode_rgba));
Line 98... Line 102...
98
        if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
102
        if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
99
 
103
 
100
        mainchooser_init();
104
        mainchooser_init();
101
        toolchooser_init();
105
        toolchooser_init();
102
        settingchooser_init();
106
        settingchooser_init();
-
 
107
        confirmchooser_init();
-
 
108
        snow_init();
103
        
109
        
104
        run_mainchooser(&firmware, &app, &size);
110
        run_mainchooser();
105
        
111
        
106
        free(framebuf2);
112
        free(framebuf2);
107
        free(framebuf);
113
        free(framebuf);
108
        free(rbxlogo);
114
        free(rbxlogo);
109
        free(icons);
115
        free(icons);
Line 113... Line 119...
113
    }
119
    }
114
 
120
 
115
    release_library(libboot);
121
    release_library(libboot);
116
    library_unload(libboot);
122
    library_unload(libboot);
117
 
123
 
118
    if (firmware)
124
    if (bootinfo.firmware)
119
    {
125
    {
120
        shutdown(false);
126
        shutdown(false);
121
        execfirmware((void*)0x08000000, firmware, size);
127
        execfirmware((void*)0x08000000, bootinfo.firmware, bootinfo.size);
122
    }
128
    }
123
    else if (app) execimage(app, false);
129
    else if (bootinfo.app) execimage(bootinfo.app, false, bootinfo.argc, bootinfo.argv);
124
    else cputs(3, "Dropped into emCORE console.\n");
130
    else cputs(3, "Dropped into emCORE console.\n");
125
}
131
}
126
 
132
 
127
EMCORE_APP_HEADER("Boot menu", main, 127)
133
EMCORE_APP_HEADER("Boot menu", main, 127)