Merge changes from master
This commit is contained in:
commit
e2596a0a61
@ -37,8 +37,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") +
|
||||
fileRead(fb->bottom, "/luma/splashbottom.bin"))
|
||||
{
|
||||
u64 i = 0x1400000;
|
||||
while(i--) __asm("mov r0, r0"); //Less Ghetto sleep func
|
||||
|
@ -38,9 +38,9 @@ void detectAndProcessExceptionDumps(void)
|
||||
|
||||
initScreens();
|
||||
|
||||
drawString("An ARM9 exception occured", 10, 10, COLOR_RED);
|
||||
drawString("An ARM9 exception occurred", 10, 10, COLOR_RED);
|
||||
int posY = drawString("You can find a dump in the following file:", 10, 30, COLOR_WHITE);
|
||||
posY = drawString(path, posY + SPACING_Y, 30, COLOR_WHITE);
|
||||
posY = drawString(path, 10, posY + SPACING_Y, COLOR_WHITE);
|
||||
drawString("Press any button to shutdown", 10, posY + 2 * SPACING_Y, COLOR_WHITE);
|
||||
|
||||
waitInput();
|
||||
|
@ -44,7 +44,7 @@ void main(void)
|
||||
const char configPath[] = "/luma/config.bin";
|
||||
|
||||
//Attempt to read the configuration file
|
||||
needConfig = !fileRead(&config, configPath, 4) ? 1 : 2;
|
||||
needConfig = fileRead(&config, configPath) ? 1 : 2;
|
||||
|
||||
//Determine if this is a firmlaunch boot
|
||||
if(*(vu8 *)0x23F00005)
|
||||
@ -59,7 +59,7 @@ void main(void)
|
||||
nandType = BOOTCONFIG(0, 3);
|
||||
firmSource = BOOTCONFIG(2, 1);
|
||||
a9lhMode = BOOTCONFIG(3, 1);
|
||||
updatedSys = (a9lhMode && CONFIG(1)) ? 1 : 0;
|
||||
updatedSys = a9lhMode && CONFIG(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -214,7 +214,7 @@ static inline void loadFirm(u32 firmType, u32 externalFirm)
|
||||
section = firm->section;
|
||||
|
||||
u32 externalFirmLoaded = externalFirm &&
|
||||
!fileRead(firm, "/luma/firmware.bin", 0) &&
|
||||
fileRead(firm, "/luma/firmware.bin") &&
|
||||
(((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
|
||||
@ -240,7 +240,7 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhMode)
|
||||
if(console)
|
||||
{
|
||||
//Determine if we're booting the 9.0 FIRM
|
||||
nativeFirmType = (arm9Section[0x51] == 0xFF) ? 0 : 1;
|
||||
nativeFirmType = arm9Section[0x51] != 0xFF;
|
||||
|
||||
//Decrypt ARM9Bin and patch ARM9 entrypoint to skip arm9loader
|
||||
arm9Loader(arm9Section, nativeFirmType);
|
||||
@ -250,7 +250,7 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhMode)
|
||||
{
|
||||
//Determine if we're booting the 9.0 FIRM
|
||||
u8 firm90Hash[0x10] = {0x27, 0x2D, 0xFE, 0xEB, 0xAF, 0x3F, 0x6B, 0x3B, 0xF5, 0xDE, 0x4C, 0x41, 0xDE, 0x95, 0x27, 0x6A};
|
||||
nativeFirmType = (memcmp(section[2].hash, firm90Hash, 0x10) == 0) ? 0 : 1;
|
||||
nativeFirmType = memcmp(section[2].hash, firm90Hash, 0x10) != 0;
|
||||
}
|
||||
|
||||
if(nativeFirmType || nandType || a9lhMode == 2)
|
||||
|
46
source/fs.c
46
source/fs.c
@ -21,39 +21,33 @@ u32 mountFs(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
u32 fileRead(void *dest, const char *path, u32 size)
|
||||
u32 fileRead(void *dest, const char *path)
|
||||
{
|
||||
FRESULT result;
|
||||
FIL file;
|
||||
u32 size;
|
||||
|
||||
result = f_open(&file, path, FA_READ);
|
||||
if(result == FR_OK)
|
||||
if(f_open(&file, path, FA_READ) == FR_OK)
|
||||
{
|
||||
unsigned int read;
|
||||
if(!size) size = f_size(&file);
|
||||
result = f_read(&file, dest, size, &read);
|
||||
}
|
||||
|
||||
size = f_size(&file);
|
||||
f_read(&file, dest, size, &read);
|
||||
f_close(&file);
|
||||
}
|
||||
else size = 0;
|
||||
|
||||
return result;
|
||||
return size;
|
||||
}
|
||||
|
||||
u32 fileWrite(const void *buffer, const char *path, u32 size)
|
||||
void fileWrite(const void *buffer, const char *path, u32 size)
|
||||
{
|
||||
FRESULT result;
|
||||
FIL file;
|
||||
|
||||
result = f_open(&file, path, FA_WRITE | FA_OPEN_ALWAYS);
|
||||
if(result == FR_OK)
|
||||
if(f_open(&file, path, FA_WRITE | FA_OPEN_ALWAYS) == FR_OK)
|
||||
{
|
||||
unsigned int read;
|
||||
result = f_write(&file, buffer, size, &read);
|
||||
}
|
||||
|
||||
unsigned int written;
|
||||
f_write(&file, buffer, size, &written);
|
||||
f_close(&file);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
void loadPayload(u32 pressed, u32 devMode)
|
||||
@ -94,17 +88,7 @@ void loadPayload(u32 pressed, u32 devMode)
|
||||
path[14] = '/';
|
||||
memcpy(&path[15], info.altname, 13);
|
||||
|
||||
FIL payload;
|
||||
unsigned int read;
|
||||
|
||||
f_open(&payload, path, FA_READ);
|
||||
u32 size = f_size(&payload);
|
||||
f_read(&payload, (void *)0x24F00000, size, &read);
|
||||
f_close(&payload);
|
||||
|
||||
if(pattern[0] == 'n') f_unlink(path);
|
||||
|
||||
loaderAddress[1] = size;
|
||||
loaderAddress[1] = fileRead((void *)0x24F00000, path);
|
||||
|
||||
((void (*)())loaderAddress)();
|
||||
}
|
||||
@ -177,5 +161,5 @@ void firmRead(void *dest, const char *firmFolder)
|
||||
id >>= 4;
|
||||
}
|
||||
|
||||
fileRead(dest, path, 0);
|
||||
fileRead(dest, path);
|
||||
}
|
@ -9,8 +9,8 @@
|
||||
#define PATTERN(a) a "_*.bin"
|
||||
|
||||
u32 mountFs(void);
|
||||
u32 fileRead(void *dest, const char *path, u32 size);
|
||||
u32 fileWrite(const void *buffer, const char *path, u32 size);
|
||||
u32 fileRead(void *dest, const char *path);
|
||||
void fileWrite(const void *buffer, const char *path, u32 size);
|
||||
void findDumpFile(const char *path, char *fileName);
|
||||
void loadPayload(u32 pressed, u32 devMode);
|
||||
void firmRead(void *dest, const char *firmFolder);
|
Reference in New Issue
Block a user