Index: apps/installer-classic/main.c |
— | — | @@ -231,7 +231,7 @@ |
232 | 232 | memset(lcdbuffer, 0xff, 0x25800);
|
233 | 233 | ucl_decompress(bitmapdata[BMPIDX_SIDEPANE], bitmapsize[BMPIDX_SIDEPANE], bmpbuffer, &dummy);
|
234 | 234 | renderbmp(&lcdbuffer[195], bmpbuffer, 320);
|
235 | | - int updating = mkdir("/iLoader");
|
| 235 | + bool updating = mkdir("/iLoader") == -4;
|
236 | 236 | if (!updating)
|
237 | 237 | {
|
238 | 238 | ucl_decompress(bitmapdata[BMPIDX_WARNING], bitmapsize[BMPIDX_WARNING], bmpbuffer, &dummy);
|
— | — | @@ -249,10 +249,10 @@ |
250 | 250 | backlight_on(true);
|
251 | 251 |
|
252 | 252 |
|
| 253 | + norbuf = memalign(0x100000, 0x10);
|
253 | 254 | oldnor = memalign(0x100000, 0x10);
|
254 | | - norbuf = memalign(0x100000, 0x10);
|
| 255 | + memset(norbuf, 0xff, 0x100000);
|
255 | 256 | bootflash_readraw(oldnor, 0, 0x100000);
|
256 | | - memset(norbuf, 0xff, 0x100000);
|
257 | 257 | if (oldnorword[0x400] == 0x53436667) appleflash = false;
|
258 | 258 | else
|
259 | 259 | {
|
— | — | @@ -260,8 +260,7 @@ |
261 | 261 | else panic(PANIC_KILLTHREAD, "Boot flash contents are damaged! "
|
262 | 262 | "(No SYSCFG found)\n\nPlease ask for help.\n");
|
263 | 263 | }
|
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);
|
266 | 265 | uint32_t sp = 0;
|
267 | 266 | uint32_t beginptr = 0x2000;
|
268 | 267 | uint32_t endptr = 0x100000;
|
— | — | @@ -346,7 +345,7 @@ |
347 | 346 | if (button == 2) break;
|
348 | 347 | else if (button == 4)
|
349 | 348 | {
|
350 | | - shutdown(true);
|
| 349 | + shutdown(false);
|
351 | 350 | reset();
|
352 | 351 | }
|
353 | 352 | button = 0;
|
— | — | @@ -397,7 +396,7 @@ |
398 | 397 | data = oldnor;
|
399 | 398 | script[sp + 3] = 0x100000;
|
400 | 399 | }
|
401 | | - else script[sp + 3] = 0;
|
| 400 | + else if (script[sp + 2] == 0xfffffffe) script[sp + 3] = 0;
|
402 | 401 | if (!script[sp + 3])
|
403 | 402 | {
|
404 | 403 | sp += 4;
|
— | — | @@ -427,7 +426,6 @@ |
428 | 427 | status += script[sp++];
|
429 | 428 | progressbar_setpos(&progressbar, status, false);
|
430 | 429 | }
|
431 | | -
|
432 | 430 | ucl_decompress(bitmapdata[BMPIDX_FLASHING], bitmapsize[BMPIDX_FLASHING], bmpbuffer, &dummy);
|
433 | 431 | renderbmp(&lcdbuffer[320 * 108], bmpbuffer, 320);
|
434 | 432 | displaylcd(0, 319, 0, 239, lcdbuffer, 0);
|
— | — | @@ -438,6 +436,6 @@ |
439 | 437 | progressbar_setpos(&progressbar, i, false);
|
440 | 438 | }
|
441 | 439 |
|
442 | | - shutdown(true);
|
| 440 | + shutdown(false);
|
443 | 441 | reset();
|
444 | 442 | }
|