freemyipod r385 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r384‎ | r385 | r386 >
Date:23:35, 23 December 2010
Author:theseven
Status:new
Tags:
Comment:
Installer for iPod Classic: Fix some minor bugs
Modified paths:
  • /apps/installer-classic/main.c (modified) (history)

Diff [purge]

Index: apps/installer-classic/main.c
@@ -231,7 +231,7 @@
232232 memset(lcdbuffer, 0xff, 0x25800);
233233 ucl_decompress(bitmapdata[BMPIDX_SIDEPANE], bitmapsize[BMPIDX_SIDEPANE], bmpbuffer, &dummy);
234234 renderbmp(&lcdbuffer[195], bmpbuffer, 320);
235 - int updating = mkdir("/iLoader");
 235+ bool updating = mkdir("/iLoader") == -4;
236236 if (!updating)
237237 {
238238 ucl_decompress(bitmapdata[BMPIDX_WARNING], bitmapsize[BMPIDX_WARNING], bmpbuffer, &dummy);
@@ -249,10 +249,10 @@
250250 backlight_on(true);
251251
252252
 253+ norbuf = memalign(0x100000, 0x10);
253254 oldnor = memalign(0x100000, 0x10);
254 - norbuf = memalign(0x100000, 0x10);
 255+ memset(norbuf, 0xff, 0x100000);
255256 bootflash_readraw(oldnor, 0, 0x100000);
256 - memset(norbuf, 0xff, 0x100000);
257257 if (oldnorword[0x400] == 0x53436667) appleflash = false;
258258 else
259259 {
@@ -260,8 +260,7 @@
261261 else panic(PANIC_KILLTHREAD, "Boot flash contents are damaged! "
262262 "(No SYSCFG found)\n\nPlease ask for help.\n");
263263 }
264 - if (appleflash) memcpy(&norbuf[0x1000], &oldnor[0], 0x1000);
265 - else memcpy(&norbuf[0x1000], &oldnor[0x1000], 0x1000);
 264+ memcpy(&norbuf[0x1000], &oldnor[appleflash ? 0 : 0x1000], 0x1000);
266265 uint32_t sp = 0;
267266 uint32_t beginptr = 0x2000;
268267 uint32_t endptr = 0x100000;
@@ -346,7 +345,7 @@
347346 if (button == 2) break;
348347 else if (button == 4)
349348 {
350 - shutdown(true);
 349+ shutdown(false);
351350 reset();
352351 }
353352 button = 0;
@@ -397,7 +396,7 @@
398397 data = oldnor;
399398 script[sp + 3] = 0x100000;
400399 }
401 - else script[sp + 3] = 0;
 400+ else if (script[sp + 2] == 0xfffffffe) script[sp + 3] = 0;
402401 if (!script[sp + 3])
403402 {
404403 sp += 4;
@@ -427,7 +426,6 @@
428427 status += script[sp++];
429428 progressbar_setpos(&progressbar, status, false);
430429 }
431 -
432430 ucl_decompress(bitmapdata[BMPIDX_FLASHING], bitmapsize[BMPIDX_FLASHING], bmpbuffer, &dummy);
433431 renderbmp(&lcdbuffer[320 * 108], bmpbuffer, 320);
434432 displaylcd(0, 319, 0, 239, lcdbuffer, 0);
@@ -438,6 +436,6 @@
439437 progressbar_setpos(&progressbar, i, false);
440438 }
441439
442 - shutdown(true);
 440+ shutdown(false);
443441 reset();
444442 }