Subversion Repositories freemyipod

Rev

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

Rev 651 Rev 672
Line 25... Line 25...
25
#include "libpng.h"
25
#include "libpng.h"
26
#include "libui.h"
26
#include "libui.h"
27
 
27
 
28
 
28
 
29
#define STRINGIFY(x) #x
29
#define STRINGIFY(x) #x
-
 
30
#define STR(x) STRINGIFY(x)
30
#define BOOTNOTE_FILENAME "/Notes/" STRINGIFY(BASENAME) ".bootnote"
31
#define BOOTNOTE_FILENAME "/Notes/" STR(BASENAME) ".bootnote"
31
 
32
 
32
 
33
 
33
void main();
34
void main();
34
EMCORE_APP_HEADER("emCORE installer", main, 127)
35
EMCORE_APP_HEADER("emCORE installer", main, 127)
35
 
36
 
Line 281... Line 282...
281
    buf1[9] = fatsectors;
282
    buf1[9] = fatsectors;
282
    buf1[0xb] = fat32_rootdirclus + clusoffset;
283
    buf1[0xb] = fat32_rootdirclus + clusoffset;
283
    ((uint16_t*)buf1)[0x18] = 1;
284
    ((uint16_t*)buf1)[0x18] = 1;
284
    ((uint8_t*)buf1)[0x40] = 0x80;
285
    ((uint8_t*)buf1)[0x40] = 0x80;
285
    ((uint8_t*)buf1)[0x42] = 0x29;
286
    ((uint8_t*)buf1)[0x42] = 0x29;
286
    if (!fat32_ok) memcpy(&((uint8_t*)buf1)[0x43], "\0\0\0\0iPod Nano  ", 0xf);
287
    if (!fat32_ok) memcpy(&((uint8_t*)buf1)[0x43], "\0\0\0\0iPod Nano2G", 0xf);
287
    else memcpy(&((uint8_t*)buf1)[0x43], &((uint8_t*)buf2)[0x43], 0xf);
288
    else memcpy(&((uint8_t*)buf1)[0x43], &((uint8_t*)buf2)[0x43], 0xf);
288
    memcpy(&((uint8_t*)buf1)[0x52], "FAT32   ", 8);
289
    memcpy(&((uint8_t*)buf1)[0x52], "FAT32   ", 8);
289
    ((uint16_t*)buf1)[0xff] = 0xaa55;
290
    ((uint16_t*)buf1)[0xff] = 0xaa55;
290
    if (storage_write_sectors_md(0, 0, 1, buf1))
291
    if (storage_write_sectors_md(0, 0, 1, buf1))
291
    {
292
    {
Line 389... Line 390...
389
    if (!fat32_ok)
390
    if (!fat32_ok)
390
    {
391
    {
391
        for (i = 0; i < fat32_secperclus; i++)
392
        for (i = 0; i < fat32_secperclus; i++)
392
        {
393
        {
393
            memset(buf1, 0, 0x800);
394
            memset(buf1, 0, 0x800);
394
            if (!i) memcpy(buf1, "iPod Nano  \x08", 12);
395
            if (!i) memcpy(buf1, "iPod Nano2G\x08", 12);
395
            if (storage_write_sectors_md(0, database + i, 1, buf1))
396
            if (storage_write_sectors_md(0, database + i, 1, buf1))
396
            {
397
            {
397
                free(buf1);
398
                free(buf1);
398
                free(buf2);
399
                free(buf2);
399
                return 2;
400
                return 2;
Line 746... Line 747...
746
                if (deleterc)
747
                if (deleterc)
747
                {
748
                {
748
                    sleep(500000);
749
                    sleep(500000);
749
                    ui->blenda(160, 60, 255, framebuf, 0, 0, 160,
750
                    ui->blenda(160, 60, 255, framebuf, 0, 0, 160,
750
                               darkened, 8, 27, 176, disclaimer, 0, 550, 160);
751
                               darkened, 8, 27, 176, disclaimer, 0, 550, 160);
751
                    displaylcd(8, 27, 160, 91, framebuf, 0, 0, 160);
752
                    displaylcd(8, 27, 160, 60, framebuf, 0, 0, 160);
-
 
753
                    displaylcd(8, 87, 160, 31, darkened, 8, 87, 176);
752
                    button = 0;
754
                    button = 0;
753
                    while (!button) wakeup_wait(&eventwakeup, TIMEOUT_BLOCK);
755
                    while (!button) wakeup_wait(&eventwakeup, TIMEOUT_BLOCK);
754
                    memcpy((void*)0x2202bf00, "diskmodehotstuff\1\0\0", 20);
756
                    memcpy((void*)0x2202bf00, "diskmodehotstuff\1\0\0", 20);
755
                }
757
                }
756
                shutdown(false);
758
                shutdown(false);
Line 763... Line 765...
763
 
765
 
764
    if (rc)
766
    if (rc)
765
    {
767
    {
766
        ui->blenda(160, 80, 255, framebuf, 0, 0, 160,
768
        ui->blenda(160, 80, 255, framebuf, 0, 0, 160,
767
                   darkened, 8, 27, 176, disclaimer, 0, 470, 160);
769
                   darkened, 8, 27, 176, disclaimer, 0, 470, 160);
768
        displaylcd(8, 27, 160, 91, framebuf, 0, 0, 160);
770
        displaylcd(8, 27, 160, 80, framebuf, 0, 0, 160);
-
 
771
        displaylcd(8, 107, 160, 11, darkened, 8, 107, 176);
769
 
772
 
770
        button = 0;
773
        button = 0;
771
        struct button_hook_entry* hook = button_register_handler(handler, NULL);
774
        struct button_hook_entry* hook = button_register_handler(handler, NULL);
772
        if (!hook) panicf(PANIC_KILLTHREAD, "Could not register button hook!");
775
        if (!hook) panicf(PANIC_KILLTHREAD, "Could not register button hook!");
773
 
776
 
Line 784... Line 787...
784
                if (deleterc)
787
                if (deleterc)
785
                {
788
                {
786
                    sleep(500000);
789
                    sleep(500000);
787
                    ui->blenda(160, 60, 255, framebuf, 0, 0, 160,
790
                    ui->blenda(160, 60, 255, framebuf, 0, 0, 160,
788
                               darkened, 8, 27, 176, disclaimer, 0, 550, 160);
791
                               darkened, 8, 27, 176, disclaimer, 0, 550, 160);
789
                    displaylcd(8, 27, 160, 91, framebuf, 0, 0, 160);
792
                    displaylcd(8, 27, 160, 60, framebuf, 0, 0, 160);
-
 
793
                    displaylcd(8, 87, 160, 31, darkened, 8, 87, 176);
790
                    button = 0;
794
                    button = 0;
791
                    while (!button) wakeup_wait(&eventwakeup, TIMEOUT_BLOCK);
795
                    while (!button) wakeup_wait(&eventwakeup, TIMEOUT_BLOCK);
792
                    memcpy((void*)0x2202bf00, "diskmodehotstuff\1\0\0", 20);
796
                    memcpy((void*)0x2202bf00, "diskmodehotstuff\1\0\0", 20);
793
                }
797
                }
794
                shutdown(false);
798
                shutdown(false);
Line 798... Line 802...
798
		
802
		
799
        button_unregister_handler(hook);
803
        button_unregister_handler(hook);
800
    }
804
    }
801
    else if (fat32_startsector)
805
    else if (fat32_startsector)
802
    {
806
    {
803
        ui->blenda(160, 70, 255, framebuf, 0, 0, 160,
807
        ui->blenda(130, 70, 255, framebuf, 0, 0, 130,
804
                   darkened, 8, 27, 176, disclaimer, 0, 400, 160);
808
                   darkened, 23, 27, 176, disclaimer, 0, 400, 160);
-
 
809
        displaylcd(8, 27, 160, 91, darkened, 8, 27, 176);
805
        displaylcd(8, 27, 160, 91, framebuf, 0, 0, 160);
810
        displaylcd(23, 27, 130, 70, framebuf, 0, 0, 130);
806
 
811
 
807
        button = 0;
812
        button = 0;
808
        struct button_hook_entry* hook = button_register_handler(handler, NULL);
813
        struct button_hook_entry* hook = button_register_handler(handler, NULL);
809
        if (!hook) panicf(PANIC_KILLTHREAD, "Could not register button hook!");
814
        if (!hook) panicf(PANIC_KILLTHREAD, "Could not register button hook!");
810
 
815