Subversion Repositories freemyipod

Rev

Rev 838 | 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
 
29
void run_powerdown(void** firmware, void** app, int* size)
30
{
31
    shutdown(true);
32
    power_off();
33
}
34
 
35
void fastboot_crapple(void** firmware, void** app, int* size)
36
{
37
    boot->load_from_file(firmware, size, false, "/.boot/appleos.ucl", 0x800000);
38
    if (!*firmware) boot->load_from_file(firmware, size, false, "/.boot/appleos.bin", 0);
39
}
40
 
41
void run_crapple(void** firmware, void** app, int* size)
42
{
43
    int i;
44
    for (i = 23; i <= 115; i += 23)
45
    {
46
        if (i < 115)
47
            ui->blend(176, 132, 50, framebuf, 0, 0, 176,
48
                      framebuf, 0, 0, 176, bg, 0, 0, 176);
49
        else memcpy(framebuf, bg, 176 * 132 * 3);
50
        memcpy(framebuf2, framebuf, 176 * 132 * 3);
51
        ui->blenda(111, i, 255, framebuf2, 32, 0, 176,
52
                   framebuf2, 32, 0, 176, crapple, 0, 115 - i, 111);
53
        displaylcd(0, 0, 176, 132, framebuf2, 0, 0, 176);
54
    }
55
    fastboot_crapple(firmware, app, size);
56
    if (!*firmware) message(7, "Loading appleos.bin failed!", "  Returning to main menu.  ");
57
}
58
 
59
void fastboot_rockbox(void** firmware, void** app, int* size)
60
{
61
    boot->load_from_file(firmware, size, true, "/.rockbox/rockbox.ipod", 0);
62
}
63
 
64
void run_rockbox_fallback(void** firmware, void** app, int* size)
65
{
66
    boot->load_from_flash(firmware, size, true, "rockbox ", 0x100000);
67
    if (!*firmware)
68
    {
69
        memcpy(framebuf, bg, 176 * 132 * 3);
70
        message(19, "Loading Rockbox failed!", "Returning to main menu.");
71
    }
72
}
73
 
74
void run_rockbox(void** firmware, void** app, int* size)
75
{
76
    int i;
77
    for (i = 2; i <= 52; i += 10)
78
    {
79
        if (i < 52)
80
            ui->blend(176, 132, 50, framebuf, 0, 0, 176,
81
                      framebuf, 0, 0, 176, bg, 0, 0, 176);
82
        else memcpy(framebuf, bg, 176 * 132 * 3);
83
        ui->blit(154, MIN(47, i), 3, framebuf, 11, MAX(0, i - 47), 176,
84
                 rbxlogo, 0, MAX(0, 47 - i), 154);
85
        displaylcd(0, 0, 176, 132, framebuf, 0, 0, 176);
86
    }
87
    fastboot_rockbox(firmware, app, size);
88
    if (!*firmware)
89
    {
90
        message(4, "Loading rockbox.ipod failed!", "  Trying fallback image...  ");
91
        run_rockbox_fallback(firmware, app, size);
92
    }
93
}
94
 
95
void fastboot_diskmode(void** firmware, void** app, int* size)
96
{
97
    boot->load_from_flash(firmware, size, false, "diskmode", 0x100000);
98
}
99
 
100
void run_diskmode(void** firmware, void** app, int* size)
101
{
102
    fastboot_diskmode(firmware, app, size);
103
    if (!*firmware)
104
    {
105
        memcpy(framebuf, bg, 176 * 132 * 3);
106
        message(13, "Loading disk mode failed!", " Returning to main menu. ");
107
    }
108
}
109
 
110
void run_diagmode(void** firmware, void** app, int* size)
111
{
112
    boot->load_from_flash(firmware, size, false, "diagmode", 0x100000);
113
    if (!*firmware)
114
    {
115
        memcpy(framebuf, bg, 176 * 132 * 3);
116
        message(16, "Loading diag mode failed!", " Returning to main menu. ");
117
    }
118
}
119
 
120
void fastboot_umsboot(void** firmware, void** app, int* size)
121
{
122
    boot->load_from_flash(firmware, size, false, "umsboot ", 0x10000);
123
}
124
 
125
void run_umsboot(void** firmware, void** app, int* size)
126
{
127
    fastboot_umsboot(firmware, app, size);
128
    if (!*firmware)
129
    {
130
        memcpy(framebuf, bg, 176 * 132 * 3);
131
        message(19, "Loading UMSboot failed!", "Returning to main menu.");
132
    }
133
}
134
 
135
void run_uninstaller(void** firmware, void** app, int* size)
136
{
137
    boot->load_from_flash(app, size, false, "uninst  ", 0);
138
    if (!*app)
139
    {
140
        memcpy(framebuf, bg, 176 * 132 * 3);
141
        message(7, "Loading uninstaller failed!", "  Returning to main menu.  ");
142
    }
143
}