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