freemyipod r848 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r847‎ | r848 | r849 >
Date:00:29, 27 December 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE boot menu: Remove bogus "Dropped into emCORE console" message when the fallback bootmenu passes control to a theme on the data partition
Modified paths:
  • /apps/bootmenu-ipodclassic/main.c (modified) (history)
  • /apps/bootmenu-ipodnano2g/main.c (modified) (history)

Diff [purge]

Index: apps/bootmenu-ipodclassic/main.c
@@ -73,76 +73,72 @@
7474 }
7575 close(fd);
7676 }
77 - if (success && execimage(buffer, false, 1, &theme_arg) != NULL)
78 - bootinfo.valid = true;
 77+ if (success && execimage(buffer, false, 1, &theme_arg) != NULL) return;
7978 }
8079
 80+ settings_init();
 81+
 82+ struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
 83+ LIBBOOT_API_VERSION, "libboot ");
 84+ boot = (struct libboot_api*)libboot->api;
 85+
 86+ if (!buttons)
 87+ switch (settings.fastboot_item)
 88+ {
 89+ case 1:
 90+ fastboot_rockbox();
 91+ break;
 92+
 93+ case 2:
 94+ fastboot_umsboot();
 95+ break;
 96+
 97+ case 3:
 98+ bootinfo.valid = true;
 99+ break;
 100+ }
 101+
81102 if (!bootinfo.valid)
82103 {
83 - settings_init();
 104+ struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER,
 105+ LIBPNG_API_VERSION, "libpng ");
 106+ struct libpng_api* png = (struct libpng_api*)libpng->api;
 107+ bg = loadpng(png, background_png, background_png_size,
 108+ (void* (*)(struct png_info*))(png->png_decode_rgb));
 109+ icons = loadpng(png, icons_png, icons_png_size,
 110+ (void* (*)(struct png_info*))(png->png_decode_rgba));
 111+ rbxlogo = loadpng(png, rockbox_png, rockbox_png_size,
 112+ (void* (*)(struct png_info*))(png->png_decode_rgb));
 113+ release_library(libpng);
 114+ library_unload(libpng);
84115
85 - struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
86 - LIBBOOT_API_VERSION, "libboot ");
87 - boot = (struct libboot_api*)libboot->api;
 116+ struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER,
 117+ LIBUI_API_VERSION, "libui ");
 118+ ui = (struct libui_api*)libui->api;
88119
89 - if (!buttons)
90 - switch (settings.fastboot_item)
91 - {
92 - case 1:
93 - fastboot_rockbox();
94 - break;
95 -
96 - case 2:
97 - fastboot_umsboot();
98 - break;
99 -
100 - case 3:
101 - bootinfo.valid = true;
102 - break;
103 - }
 120+ framebuf = malloc(320 * 240 * 3);
 121+ if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
 122+ framebuf2 = malloc(320 * 240 * 3);
 123+ if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
104124
105 - if (!bootinfo.valid)
106 - {
107 - struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER,
108 - LIBPNG_API_VERSION, "libpng ");
109 - struct libpng_api* png = (struct libpng_api*)libpng->api;
110 - bg = loadpng(png, background_png, background_png_size,
111 - (void* (*)(struct png_info*))(png->png_decode_rgb));
112 - icons = loadpng(png, icons_png, icons_png_size,
113 - (void* (*)(struct png_info*))(png->png_decode_rgba));
114 - rbxlogo = loadpng(png, rockbox_png, rockbox_png_size,
115 - (void* (*)(struct png_info*))(png->png_decode_rgb));
116 - release_library(libpng);
117 - library_unload(libpng);
118 -
119 - struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER,
120 - LIBUI_API_VERSION, "libui ");
121 - ui = (struct libui_api*)libui->api;
122 -
123 - framebuf = malloc(320 * 240 * 3);
124 - if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
125 - framebuf2 = malloc(320 * 240 * 3);
126 - if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
 125+ mainchooser_init();
 126+ toolchooser_init();
 127+ settingchooser_init();
 128+ confirmchooser_init();
 129+
 130+ run_mainchooser();
 131+
 132+ free(framebuf2);
 133+ free(framebuf);
 134+ free(rbxlogo);
 135+ free(icons);
 136+ free(bg);
 137+ release_library(libui);
 138+ library_unload(libui);
 139+ }
127140
128 - mainchooser_init();
129 - toolchooser_init();
130 - settingchooser_init();
131 - confirmchooser_init();
132 -
133 - run_mainchooser();
134 -
135 - free(framebuf2);
136 - free(framebuf);
137 - free(rbxlogo);
138 - free(icons);
139 - free(bg);
140 - release_library(libui);
141 - library_unload(libui);
142 - }
143 -
144 - release_library(libboot);
145 - library_unload(libboot);
146 - }
 141+ release_library(libboot);
 142+ library_unload(libboot);
147143
148144 if (bootinfo.firmware)
149145 {
Index: apps/bootmenu-ipodnano2g/main.c
@@ -74,86 +74,82 @@
7575 }
7676 close(fd);
7777 }
78 - if (success && execimage(buffer, false, 1, &theme_arg) != NULL)
79 - bootinfo.valid = true;
 78+ if (success && execimage(buffer, false, 1, &theme_arg) != NULL) return;
8079 }
8180
82 - if (!bootinfo.valid)
83 - {
84 - settings_init();
 81+ settings_init();
8582
86 - struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
87 - LIBBOOT_API_VERSION, "libboot ");
88 - boot = (struct libboot_api*)libboot->api;
 83+ struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
 84+ LIBBOOT_API_VERSION, "libboot ");
 85+ boot = (struct libboot_api*)libboot->api;
8986
90 - if (!buttons)
91 - switch (settings.fastboot_item)
92 - {
93 - case 1:
94 - fastboot_crapple();
95 - break;
 87+ if (!buttons)
 88+ switch (settings.fastboot_item)
 89+ {
 90+ case 1:
 91+ fastboot_crapple();
 92+ break;
9693
97 - case 2:
98 - fastboot_rockbox();
99 - break;
 94+ case 2:
 95+ fastboot_rockbox();
 96+ break;
10097
101 - case 3:
102 - fastboot_diskmode();
103 - break;
 98+ case 3:
 99+ fastboot_diskmode();
 100+ break;
104101
105 - case 4:
106 - fastboot_umsboot();
107 - break;
 102+ case 4:
 103+ fastboot_umsboot();
 104+ break;
108105
109 - case 5:
110 - bootinfo.valid = true;
111 - break;
112 - }
 106+ case 5:
 107+ bootinfo.valid = true;
 108+ break;
 109+ }
113110
114 - if (!bootinfo.valid)
115 - {
116 - struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER,
117 - LIBPNG_API_VERSION, "libpng ");
118 - struct libpng_api* png = (struct libpng_api*)libpng->api;
119 - bg = loadpng(png, background_png, background_png_size,
120 - (void* (*)(struct png_info*))(png->png_decode_rgb));
121 - icons = loadpng(png, icons_png, icons_png_size,
122 - (void* (*)(struct png_info*))(png->png_decode_rgba));
123 - rbxlogo = loadpng(png, rockbox_png, rockbox_png_size,
124 - (void* (*)(struct png_info*))(png->png_decode_rgb));
125 - crapple = loadpng(png, crapple_png, crapple_png_size,
126 - (void* (*)(struct png_info*))(png->png_decode_rgba));
127 - release_library(libpng);
128 - library_unload(libpng);
 111+ if (!bootinfo.valid)
 112+ {
 113+ struct emcorelib_header* libpng = loadlib(LIBPNG_IDENTIFIER,
 114+ LIBPNG_API_VERSION, "libpng ");
 115+ struct libpng_api* png = (struct libpng_api*)libpng->api;
 116+ bg = loadpng(png, background_png, background_png_size,
 117+ (void* (*)(struct png_info*))(png->png_decode_rgb));
 118+ icons = loadpng(png, icons_png, icons_png_size,
 119+ (void* (*)(struct png_info*))(png->png_decode_rgba));
 120+ rbxlogo = loadpng(png, rockbox_png, rockbox_png_size,
 121+ (void* (*)(struct png_info*))(png->png_decode_rgb));
 122+ crapple = loadpng(png, crapple_png, crapple_png_size,
 123+ (void* (*)(struct png_info*))(png->png_decode_rgba));
 124+ release_library(libpng);
 125+ library_unload(libpng);
129126
130 - struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER,
131 - LIBUI_API_VERSION, "libui ");
132 - ui = (struct libui_api*)libui->api;
 127+ struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER,
 128+ LIBUI_API_VERSION, "libui ");
 129+ ui = (struct libui_api*)libui->api;
133130
134 - framebuf = malloc(176 * 132 * 3);
135 - if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
136 - framebuf2 = malloc(176 * 132 * 3);
137 - if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
 131+ framebuf = malloc(176 * 132 * 3);
 132+ if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
 133+ framebuf2 = malloc(176 * 132 * 3);
 134+ if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
138135
139 - mainchooser_init();
140 - toolchooser_init();
141 - settingchooser_init();
142 - confirmchooser_init();
 136+ mainchooser_init();
 137+ toolchooser_init();
 138+ settingchooser_init();
 139+ confirmchooser_init();
143140
144 - run_mainchooser();
 141+ run_mainchooser();
145142
146 - free(framebuf2);
147 - free(framebuf);
148 - free(rbxlogo);
149 - free(icons);
150 - free(bg);
151 - release_library(libui);
152 - library_unload(libui);
153 - }
 143+ free(framebuf2);
 144+ free(framebuf);
 145+ free(rbxlogo);
 146+ free(icons);
 147+ free(bg);
 148+ release_library(libui);
 149+ library_unload(libui);
 150+ }
154151
155 - release_library(libboot);
156 - library_unload(libboot);
157 - }
 152+ release_library(libboot);
 153+ library_unload(libboot);
158154
159155 if (bootinfo.firmware)
160156 {