Subversion Repositories freemyipod

Rev

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

Rev 858 Rev 875
Line 25... Line 25...
25
#include "libpng.h"
25
#include "libpng.h"
26
#include "libui.h"
26
#include "libui.h"
27
#include "libmkfat32.h"
27
#include "libmkfat32.h"
28
 
28
 
29
 
29
 
30
void main(int argc, const char** argv);
30
static void main(int argc, const char** argv);
31
EMCORE_APP_HEADER("emCORE installer", main, 127)
31
EMCORE_APP_HEADER("emCORE installer", main, 127)
32
 
32
 
33
 
33
 
34
extern char background_png[];
34
extern char background_png[];
35
extern uint32_t background_png_size;
35
extern uint32_t background_png_size;
Line 47... Line 47...
47
extern uint32_t firstinstscript[];
47
extern uint32_t firstinstscript[];
48
extern uint32_t commoncost;
48
extern uint32_t commoncost;
49
extern uint32_t commonscript[];
49
extern uint32_t commonscript[];
50
 
50
 
51
 
51
 
52
struct wakeup eventwakeup;
52
static struct wakeup eventwakeup;
53
volatile int button;
53
static volatile int button;
54
volatile int scrollpos;
54
static volatile int scrollpos;
55
 
55
 
56
 
56
 
57
#define SHA1CONFIG    (*((volatile uint32_t*)(0x38000000)))
57
#define SHA1CONFIG    (*((volatile uint32_t*)(0x38000000)))
58
#define SHA1RESET     (*((volatile uint32_t*)(0x38000004)))
58
#define SHA1RESET     (*((volatile uint32_t*)(0x38000004)))
59
#define SHA1RESULT      ((volatile uint32_t*)(0x38000020))
59
#define SHA1RESULT      ((volatile uint32_t*)(0x38000020))
60
#define SHA1DATAIN      ((volatile uint32_t*)(0x38000040))
60
#define SHA1DATAIN      ((volatile uint32_t*)(0x38000040))
61
 
61
 
62
void sha1(void* data, uint32_t size, void* hash)
62
static void sha1(void* data, uint32_t size, void* hash)
63
{
63
{
64
    int i, space;
64
    int i, space;
65
    bool done = false;
65
    bool done = false;
66
    uint32_t tmp32[16];
66
    uint32_t tmp32[16];
67
    uint8_t* tmp8 = (uint8_t*)tmp32;
67
    uint8_t* tmp8 = (uint8_t*)tmp32;
Line 103... Line 103...
103
    for (i = 0; i < 5; i++) hashbuf[i] = SHA1RESULT[i];
103
    for (i = 0; i < 5; i++) hashbuf[i] = SHA1RESULT[i];
104
    clockgate_enable(0, false);
104
    clockgate_enable(0, false);
105
}
105
}
106
 
106
 
107
 
107
 
108
void handler(void* user, enum button_event eventtype, int which, int value)
108
static void handler(void* user, enum button_event eventtype, int which, int value)
109
{
109
{
110
    if (eventtype == BUTTON_PRESS) button |= 1 << which;
110
    if (eventtype == BUTTON_PRESS) button |= 1 << which;
111
    if (eventtype == BUTTON_RELEASE) button &= ~(1 << which);
111
    if (eventtype == BUTTON_RELEASE) button &= ~(1 << which);
112
    if (eventtype == WHEEL_MOVED_ACCEL)
112
    if (eventtype == WHEEL_MOVED_ACCEL)
113
        scrollpos = MAX(0, MIN(295, scrollpos + value / 8));
113
        scrollpos = MAX(0, MIN(295, scrollpos + value / 8));
114
    wakeup_signal(&eventwakeup);
114
    wakeup_signal(&eventwakeup);
115
}
115
}
116
 
116
 
117
void fat32_progressbar_init(void* user, int max)
117
static void fat32_progressbar_init(void* user, int max)
118
{
118
{
119
    progressbar_init((struct progressbar_state*)user,
119
    progressbar_init((struct progressbar_state*)user,
120
                     15, 304, 135, 159, 0x77ff, 0xe8, 0x125f, 0, max);
120
                     15, 304, 135, 159, 0x77ff, 0xe8, 0x125f, 0, max);
121
}
121
}
122
 
122
 
123
void fat32_progressbar_update(void* user, int current)
123
static void fat32_progressbar_update(void* user, int current)
124
{
124
{
125
    progressbar_setpos((struct progressbar_state*)user, current, false);
125
    progressbar_setpos((struct progressbar_state*)user, current, false);
126
}
126
}
127
 
127
 
128
void main(int argc, const char** argv)
128
static void main(int argc, const char** argv)
129
{
129
{
130
    uint32_t i, j, k, rc;
130
    uint32_t i, j, k, rc;
131
    uint32_t dummy;
131
    uint32_t dummy;
132
    struct progressbar_state progressbar;
132
    struct progressbar_state progressbar;
133
    bool appleflash = false;
133
    bool appleflash = false;