Subversion Repositories freemyipod

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
828 theseven 1
//
2
//
3
//    Copyright 2011 TheSeven
4
//
5
//
6
//    This file is part of emCORE.
7
//
8
//    emCORE is free software: you can redistribute it and/or
9
//    modify it under the terms of the GNU General Public License as
10
//    published by the Free Software Foundation, either version 2 of the
11
//    License, or (at your option) any later version.
12
//
13
//    emCORE is distributed in the hope that it will be useful,
14
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
//    See the GNU General Public License for more details.
17
//
18
//    You should have received a copy of the GNU General Public License along
19
//    with emCORE.  If not, see <http://www.gnu.org/licenses/>.
20
//
21
//
22
 
23
 
24
#include "emcoreapp.h"
25
#include "boot.h"
26
#include "main.h"
27
 
28
 
838 theseven 29
void run_powerdown()
828 theseven 30
{
31
    shutdown(true);
32
    power_off();
33
}
34
 
838 theseven 35
void fastboot_crapple()
828 theseven 36
{
838 theseven 37
    boot->load_from_file(&bootinfo.firmware, &bootinfo.size, false, "/.boot/appleos.ucl", 0x800000);
38
    if (!&bootinfo.firmware)
39
        boot->load_from_file(&bootinfo.firmware, &bootinfo.size, false, "/.boot/appleos.bin", 0);
40
    if (bootinfo.firmware) bootinfo.valid = true;
828 theseven 41
}
42
 
838 theseven 43
void run_crapple()
828 theseven 44
{
45
    int i;
46
    for (i = 23; i <= 115; i += 23)
47
    {
48
        if (i < 115)
49
            ui->blend(176, 132, 50, framebuf, 0, 0, 176,
50
                      framebuf, 0, 0, 176, bg, 0, 0, 176);
51
        else memcpy(framebuf, bg, 176 * 132 * 3);
52
        memcpy(framebuf2, framebuf, 176 * 132 * 3);
53
        ui->blenda(111, i, 255, framebuf2, 32, 0, 176,
54
                   framebuf2, 32, 0, 176, crapple, 0, 115 - i, 111);
55
        displaylcd(0, 0, 176, 132, framebuf2, 0, 0, 176);
56
    }
838 theseven 57
    fastboot_crapple();
58
    if (!bootinfo.valid) message(7, "Loading appleos.bin failed!", "  Returning to main menu.  ");
828 theseven 59
}
60
 
838 theseven 61
void fastboot_rockbox()
828 theseven 62
{
838 theseven 63
    boot->load_from_file(&bootinfo.firmware, &bootinfo.size, true, "/.rockbox/rockbox.ipod", 0);
64
    if (bootinfo.firmware) bootinfo.valid = true;
828 theseven 65
}
66
 
838 theseven 67
void run_rockbox_fallback()
828 theseven 68
{
838 theseven 69
    boot->load_from_flash(&bootinfo.firmware, &bootinfo.size, true, "rockbox ", 0x100000);
70
    if (bootinfo.firmware) bootinfo.valid = true;
71
    else
828 theseven 72
    {
73
        memcpy(framebuf, bg, 176 * 132 * 3);
74
        message(19, "Loading Rockbox failed!", "Returning to main menu.");
75
    }
76
}
77
 
838 theseven 78
void run_rockbox()
828 theseven 79
{
80
    int i;
81
    for (i = 2; i <= 52; i += 10)
82
    {
83
        if (i < 52)
84
            ui->blend(176, 132, 50, framebuf, 0, 0, 176,
85
                      framebuf, 0, 0, 176, bg, 0, 0, 176);
86
        else memcpy(framebuf, bg, 176 * 132 * 3);
87
        ui->blit(154, MIN(47, i), 3, framebuf, 11, MAX(0, i - 47), 176,
88
                 rbxlogo, 0, MAX(0, 47 - i), 154);
89
        displaylcd(0, 0, 176, 132, framebuf, 0, 0, 176);
90
    }
838 theseven 91
    fastboot_rockbox();
92
    if (!bootinfo.valid)
828 theseven 93
    {
94
        message(4, "Loading rockbox.ipod failed!", "  Trying fallback image...  ");
838 theseven 95
        run_rockbox_fallback();
828 theseven 96
    }
97
}
98
 
838 theseven 99
void fastboot_diskmode()
828 theseven 100
{
838 theseven 101
    boot->load_from_flash(&bootinfo.firmware, &bootinfo.size, false, "diskmode", 0x100000);
102
    if (bootinfo.firmware) bootinfo.valid = true;
828 theseven 103
}
104
 
838 theseven 105
void run_diskmode()
828 theseven 106
{
838 theseven 107
    fastboot_diskmode();
108
    if (!bootinfo.valid)
828 theseven 109
    {
110
        memcpy(framebuf, bg, 176 * 132 * 3);
111
        message(13, "Loading disk mode failed!", " Returning to main menu. ");
112
    }
113
}
114
 
838 theseven 115
void run_diagmode()
828 theseven 116
{
838 theseven 117
    boot->load_from_flash(&bootinfo.firmware, &bootinfo.size, false, "diagmode", 0x100000);
118
    if (bootinfo.firmware) bootinfo.valid = true;
119
    else
828 theseven 120
    {
121
        memcpy(framebuf, bg, 176 * 132 * 3);
122
        message(16, "Loading diag mode failed!", " Returning to main menu. ");
123
    }
124
}
125
 
838 theseven 126
void fastboot_umsboot()
828 theseven 127
{
838 theseven 128
    boot->load_from_flash(&bootinfo.firmware, &bootinfo.size, false, "umsboot ", 0x10000);
129
    if (bootinfo.firmware) bootinfo.valid = true;
828 theseven 130
}
131
 
838 theseven 132
void run_umsboot()
828 theseven 133
{
838 theseven 134
    fastboot_umsboot();
135
    if (!bootinfo.valid)
828 theseven 136
    {
137
        memcpy(framebuf, bg, 176 * 132 * 3);
138
        message(19, "Loading UMSboot failed!", "Returning to main menu.");
139
    }
140
}
141
 
838 theseven 142
void run_uninstaller()
828 theseven 143
{
838 theseven 144
    boot->load_from_flash(&bootinfo.app, &bootinfo.size, false, "uninst  ", 0);
145
    if (bootinfo.app) bootinfo.valid = true;
146
    else
828 theseven 147
    {
148
        memcpy(framebuf, bg, 176 * 132 * 3);
149
        message(7, "Loading uninstaller failed!", "  Returning to main menu.  ");
150
    }
151
}