Subversion Repositories freemyipod

Rev

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

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