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