Subversion Repositories freemyipod

Rev

Rev 145 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 145 Rev 150
Line -... Line 1...
-
 
1
//
-
 
2
//
-
 
3
//    Copyright 2010 TheSeven
-
 
4
//
-
 
5
//
-
 
6
//    This file is part of emBIOS.
-
 
7
//
-
 
8
//    emBIOS 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
//    emBIOS 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 emBIOS.  If not, see <http://www.gnu.org/licenses/>.
-
 
20
//
-
 
21
//
-
 
22
 
-
 
23
 
1
#include "embiosapp.h"
24
#include "embiosapp.h"
2
 
25
 
3
 
26
 
4
void main();
27
void main();
5
EMBIOS_APP_HEADER("Uninstaller thread", 0x1000, main, 127)
28
EMBIOS_APP_HEADER("Uninstaller thread", 0x1000, main, 127)
Line 69... Line 92...
69
            return 0;
92
            return 0;
70
        }
93
        }
71
    return freeret(2, buffer);
94
    return freeret(2, buffer);
72
}
95
}
73
 
96
 
74
uint32_t readfwptr(const char* filename, void* address, uint32_t* size)
-
 
75
{
-
 
76
    uint32_t sector;
-
 
77
    uint32_t rc = getfw(filename, &sector, size);
-
 
78
    if (rc) return rc;
-
 
79
    if (storage_read_sectors_md(0, sector, ((*size + 0x7FF) >> 11), address) != 0) return 1;
-
 
80
    *size = decryptfw(address, 0x800);
-
 
81
    return 0;
-
 
82
}
-
 
83
 
-
 
84
uint32_t readfw(const char* filename, void** address, uint32_t* size)
97
uint32_t readfw(const char* filename, void** address, uint32_t* size)
85
{
98
{
86
    uint32_t sector;
99
    uint32_t sector;
87
    uint32_t rc = getfw(filename, &sector, size);
100
    uint32_t rc = getfw(filename, &sector, size);
88
    if (rc) return rc;
101
    if (rc) return rc;
89
    *address = tlsf_memalign(mallocpool, 0x10, *size);
102
    *address = tlsf_memalign(mallocpool, 0x10, *size);
90
    if (storage_read_sectors_md(0, sector, ((*size + 0x7FF) >> 11), *address) != 0)
103
    if (storage_read_sectors_md(0, sector, ((*size + 0x7FF) >> 11), *address) != 0)
91
        return freeret(1, *address);
104
        return freeret(1, *address);
92
    *size = decryptfw(*address, 0x800);
105
    *size = decryptfw(*address, 0x800);
93
    tlsf_realloc(mallocpool, *address, *size);
106
    *address = tlsf_realloc(mallocpool, *address, *size);
94
    return 0;
107
    return 0;
95
}
108
}
96
 
109
 
97
void main(void)
110
void main(void)
98
{
111
{