Subversion Repositories freemyipod

Rev

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

Rev Author Line No. Line
808 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_rockbox(void** firmware, void** app, int* size)
36
{
37
    boot->load_from_file(firmware, size, true, "/.rockbox/rockbox.ipod", 0);
38
}
39
 
40
void run_rockbox_fallback(void** firmware, void** app, int* size)
41
{
42
    boot->load_from_flash(firmware, size, true, "rockbox ", 0x100000);
43
    if (!*firmware)
44
    {
45
        memcpy(framebuf, bg, 320 * 240 * 3);
46
        message(91, "Loading Rockbox failed!", "Returning to main menu.");
47
    }
48
}
49
 
50
void run_rockbox(void** firmware, void** app, int* size)
51
{
52
    int i;
53
    for (i = 1; i <= 96; i += 19)
54
    {
55
        if (i < 96)
56
            ui->blend(320, 240, 50, framebuf, 0, 0, 320,
57
                        framebuf, 0, 0, 320, bg, 0, 0, 320);
58
        else memcpy(framebuf, bg, 320 * 240 * 3);
59
        ui->blit(280, MIN(86, i), 3, framebuf, 20, MAX(0, i - 86), 320,
60
                    rbxlogo, 0, MAX(0, 86 - i), 280);
61
        displaylcd(0, 0, 320, 240, framebuf, 0, 0, 320);
62
    }
63
    fastboot_rockbox(firmware, app, size);
64
    if (!*firmware)
65
    {
66
        message(76, "Loading rockbox.ipod failed!", "  Trying fallback image...  ");
67
        run_rockbox_fallback(firmware, app, size);
68
    }
69
}
70
 
71
void fastboot_umsboot(void** firmware, void** app, int* size)
72
{
73
    boot->load_from_flash(firmware, size, false, "umsboot ", 0x10000);
74
}
75
 
76
void run_umsboot(void** firmware, void** app, int* size)
77
{
78
    fastboot_umsboot(firmware, app, size);
79
    if (!*firmware)
80
    {
81
        memcpy(framebuf, bg, 320 * 240 * 3);
82
        message(91, "Loading UMSboot failed!", "Returning to main menu.");
83
    }
84
}