Merge branch 'master' into developer
This commit is contained in:
commit
4a4de608ec
@ -7,7 +7,7 @@
|
||||
|
||||
static u32 loadPayload(const char *pattern)
|
||||
{
|
||||
char path[30] = "/luma/payloads";
|
||||
char path[29] = "/luma/payloads";
|
||||
|
||||
DIR dir;
|
||||
FILINFO info;
|
||||
@ -26,10 +26,10 @@ static u32 loadPayload(const char *pattern)
|
||||
path[15 + i] = '\0';
|
||||
|
||||
FIL payload;
|
||||
unsigned int br;
|
||||
unsigned int read;
|
||||
|
||||
f_open(&payload, path, FA_READ);
|
||||
f_read(&payload, (void *)PAYLOAD_ADDRESS, f_size(&payload), &br);
|
||||
f_read(&payload, (void *)PAYLOAD_ADDRESS, f_size(&payload), &read);
|
||||
f_close(&payload);
|
||||
|
||||
return 1;
|
||||
|
@ -40,8 +40,8 @@ void loadSplash(void)
|
||||
initScreens();
|
||||
|
||||
//Don't delay boot if no splash image is on the SD
|
||||
if(fileRead(fb->top_left, "/luma/splash.bin", 0x46500) +
|
||||
fileRead(fb->bottom, "/luma/splashbottom.bin", 0x38400))
|
||||
if(!(fileRead(fb->top_left, "/luma/splash.bin", 0x46500) +
|
||||
fileRead(fb->bottom, "/luma/splashbottom.bin", 0x38400)))
|
||||
{
|
||||
u64 i = 0x1400000;
|
||||
while(i--) __asm("mov r0, r0"); //Less Ghetto sleep func
|
||||
|
@ -44,7 +44,7 @@ void main(void)
|
||||
|
||||
//Attempt to read the configuration file
|
||||
const char configPath[] = "/luma/config.bin";
|
||||
if(fileRead(&config, configPath, 4)) needConfig = 1;
|
||||
if(!fileRead(&config, configPath, 4)) needConfig = 1;
|
||||
else
|
||||
{
|
||||
config = 0;
|
||||
@ -198,10 +198,12 @@ static inline void loadFirm(u32 firmType, u32 externalFirm)
|
||||
{
|
||||
section = firm->section;
|
||||
|
||||
u32 externalFirmLoaded = externalFirm && !fileRead(firm, "/luma/firmware.bin", 0) &&
|
||||
(((u32)section[2].address >> 8) & 0xFF) != (console ? 0x60 : 0x68);
|
||||
|
||||
/* If the conditions to load the external FIRM aren't met, or reading fails, or the FIRM
|
||||
doesn't match the console, load it from CTRNAND */
|
||||
if(!externalFirm || !fileRead(firm, "/luma/firmware.bin", 0) ||
|
||||
(((u32)section[2].address >> 8) & 0xFF) != (console ? 0x60 : 0x68))
|
||||
doesn't match the console, load FIRM from CTRNAND */
|
||||
if(!externalFirmLoaded)
|
||||
{
|
||||
const char *firmFolders[3][2] = {{ "00000002", "20000002" },
|
||||
{ "00000102", "20000102" },
|
||||
|
35
source/fs.c
35
source/fs.c
@ -19,34 +19,37 @@ u32 mountFs(void)
|
||||
|
||||
u32 fileRead(void *dest, const char *path, u32 size)
|
||||
{
|
||||
FRESULT fr;
|
||||
FIL fp;
|
||||
unsigned int br = 0;
|
||||
FRESULT result;
|
||||
FIL file;
|
||||
|
||||
fr = f_open(&fp, path, FA_READ);
|
||||
if(fr == FR_OK)
|
||||
result = f_open(&file, path, FA_READ);
|
||||
if(result == FR_OK)
|
||||
{
|
||||
if(!size) size = f_size(&fp);
|
||||
fr = f_read(&fp, dest, size, &br);
|
||||
unsigned int read;
|
||||
if(!size) size = f_size(&file);
|
||||
result = f_read(&file, dest, size, &read);
|
||||
}
|
||||
|
||||
f_close(&fp);
|
||||
f_close(&file);
|
||||
|
||||
return fr ? 0 : 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
u32 fileWrite(const void *buffer, const char *path, u32 size)
|
||||
{
|
||||
FRESULT fr;
|
||||
FIL fp;
|
||||
unsigned int br = 0;
|
||||
FRESULT result;
|
||||
FIL file;
|
||||
|
||||
fr = f_open(&fp, path, FA_WRITE | FA_OPEN_ALWAYS);
|
||||
if(fr == FR_OK) fr = f_write(&fp, buffer, size, &br);
|
||||
result = f_open(&file, path, FA_WRITE | FA_OPEN_ALWAYS);
|
||||
if(result == FR_OK)
|
||||
{
|
||||
unsigned int read;
|
||||
result = f_write(&file, buffer, size, &read);
|
||||
}
|
||||
|
||||
f_close(&fp);
|
||||
f_close(&file);
|
||||
|
||||
return fr ? 0 : 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
u32 defPayloadExists(void)
|
||||
|
Reference in New Issue
Block a user