Subversion Repositories freemyipod

Rev

Rev 843 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 843 Rev 848
Line 72... Line 72...
72
                    else free(buffer);
72
                    else free(buffer);
73
                }
73
                }
74
            }
74
            }
75
            close(fd);
75
            close(fd);
76
        }
76
        }
77
        if (success && execimage(buffer, false, 1, &theme_arg) != NULL)
77
        if (success && execimage(buffer, false, 1, &theme_arg) != NULL) return;
78
            bootinfo.valid = true;
-
 
79
    }
78
    }
80
 
79
 
81
    if (!bootinfo.valid)
-
 
82
    {
-
 
83
        settings_init();
80
    settings_init();
84
        
81
        
85
        struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
82
    struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
86
                                                   LIBBOOT_API_VERSION, "libboot ");
83
                                               LIBBOOT_API_VERSION, "libboot ");
87
        boot = (struct libboot_api*)libboot->api;
84
    boot = (struct libboot_api*)libboot->api;
88
        
85
        
89
        if (!buttons)
86
    if (!buttons)
90
            switch (settings.fastboot_item)
87
        switch (settings.fastboot_item)
91
            {
88
        {
92
                case 1:
89
            case 1:
93
                    fastboot_crapple();
90
                fastboot_crapple();
94
                    break;
91
                break;
95
            
92
            
96
                case 2:
93
            case 2:
97
                    fastboot_rockbox();
94
                fastboot_rockbox();
98
                    break;
95
                break;
99
                
96
                
100
                case 3:
97
            case 3:
101
                    fastboot_diskmode();
98
                fastboot_diskmode();
102
                    break;
99
                break;
103
            
100
            
104
                case 4:
101
            case 4:
105
                    fastboot_umsboot();
102
                fastboot_umsboot();
106
                    break;
103
                break;
107
                
104
                
108
                case 5:
105
            case 5:
109
                    bootinfo.valid = true;
106
                bootinfo.valid = true;
110
                    break;
107
                break;
111
            }
-
 
112
 
-
 
113
        if (!bootinfo.valid)
-
 
114
        {
-
 
115
            struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER,
-
 
116
                                                      LIBPNG_API_VERSION, "libpng  ");
-
 
117
            struct libpng_api* png = (struct libpng_api*)libpng->api;
-
 
118
            bg = loadpng(png, background_png, background_png_size,
-
 
119
                         (void* (*)(struct png_info*))(png->png_decode_rgb));
-
 
120
            icons = loadpng(png, icons_png, icons_png_size,
-
 
121
                            (void* (*)(struct png_info*))(png->png_decode_rgba));
-
 
122
            rbxlogo = loadpng(png, rockbox_png, rockbox_png_size,
-
 
123
                              (void* (*)(struct png_info*))(png->png_decode_rgb));
-
 
124
            crapple = loadpng(png, crapple_png, crapple_png_size,
-
 
125
                              (void* (*)(struct png_info*))(png->png_decode_rgba));
-
 
126
            release_library(libpng);
-
 
127
            library_unload(libpng);
-
 
128
            
-
 
129
            struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER,
-
 
130
                                                     LIBUI_API_VERSION, "libui   ");
-
 
131
            ui = (struct libui_api*)libui->api;
-
 
132
            
-
 
133
            framebuf = malloc(176 * 132 * 3);
-
 
134
            if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
-
 
135
            framebuf2 = malloc(176 * 132 * 3);
-
 
136
            if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
-
 
137
 
-
 
138
            mainchooser_init();
-
 
139
            toolchooser_init();
-
 
140
            settingchooser_init();
-
 
141
            confirmchooser_init();
-
 
142
            
-
 
143
            run_mainchooser();
-
 
144
            
-
 
145
            free(framebuf2);
-
 
146
            free(framebuf);
-
 
147
            free(rbxlogo);
-
 
148
            free(icons);
-
 
149
            free(bg);
-
 
150
            release_library(libui);
-
 
151
            library_unload(libui);
-
 
152
        }
108
        }
153
 
109
 
-
 
110
    if (!bootinfo.valid)
-
 
111
    {
-
 
112
        struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER,
-
 
113
                                                  LIBPNG_API_VERSION, "libpng  ");
-
 
114
        struct libpng_api* png = (struct libpng_api*)libpng->api;
-
 
115
        bg = loadpng(png, background_png, background_png_size,
-
 
116
                     (void* (*)(struct png_info*))(png->png_decode_rgb));
-
 
117
        icons = loadpng(png, icons_png, icons_png_size,
-
 
118
                        (void* (*)(struct png_info*))(png->png_decode_rgba));
-
 
119
        rbxlogo = loadpng(png, rockbox_png, rockbox_png_size,
-
 
120
                          (void* (*)(struct png_info*))(png->png_decode_rgb));
-
 
121
        crapple = loadpng(png, crapple_png, crapple_png_size,
-
 
122
                          (void* (*)(struct png_info*))(png->png_decode_rgba));
154
        release_library(libboot);
123
        release_library(libpng);
155
        library_unload(libboot);
124
        library_unload(libpng);
-
 
125
            
-
 
126
        struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER,
-
 
127
                                                 LIBUI_API_VERSION, "libui   ");
-
 
128
        ui = (struct libui_api*)libui->api;
-
 
129
            
-
 
130
        framebuf = malloc(176 * 132 * 3);
-
 
131
        if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
-
 
132
        framebuf2 = malloc(176 * 132 * 3);
-
 
133
        if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
-
 
134
 
-
 
135
        mainchooser_init();
-
 
136
        toolchooser_init();
-
 
137
        settingchooser_init();
-
 
138
        confirmchooser_init();
-
 
139
            
-
 
140
        run_mainchooser();
-
 
141
            
-
 
142
        free(framebuf2);
-
 
143
        free(framebuf);
-
 
144
        free(rbxlogo);
-
 
145
        free(icons);
-
 
146
        free(bg);
-
 
147
        release_library(libui);
-
 
148
        library_unload(libui);
156
    }
149
    }
-
 
150
 
-
 
151
    release_library(libboot);
-
 
152
    library_unload(libboot);
157
    
153
    
158
    if (bootinfo.firmware)
154
    if (bootinfo.firmware)
159
    {
155
    {
160
        shutdown(false);
156
        shutdown(false);
161
        execfirmware((void*)0x08000000, bootinfo.firmware, bootinfo.size);
157
        execfirmware((void*)0x08000000, bootinfo.firmware, bootinfo.size);