Merge changes from master
This commit is contained in:
commit
e2596a0a61
@ -37,8 +37,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") +
|
||||||
fileRead(fb->bottom, "/luma/splashbottom.bin", 0x38400)))
|
fileRead(fb->bottom, "/luma/splashbottom.bin"))
|
||||||
{
|
{
|
||||||
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
|
||||||
|
@ -38,9 +38,9 @@ void detectAndProcessExceptionDumps(void)
|
|||||||
|
|
||||||
initScreens();
|
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);
|
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);
|
drawString("Press any button to shutdown", 10, posY + 2 * SPACING_Y, COLOR_WHITE);
|
||||||
|
|
||||||
waitInput();
|
waitInput();
|
||||||
|
@ -44,7 +44,7 @@ void main(void)
|
|||||||
const char configPath[] = "/luma/config.bin";
|
const char configPath[] = "/luma/config.bin";
|
||||||
|
|
||||||
//Attempt to read the configuration file
|
//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
|
//Determine if this is a firmlaunch boot
|
||||||
if(*(vu8 *)0x23F00005)
|
if(*(vu8 *)0x23F00005)
|
||||||
@ -59,7 +59,7 @@ void main(void)
|
|||||||
nandType = BOOTCONFIG(0, 3);
|
nandType = BOOTCONFIG(0, 3);
|
||||||
firmSource = BOOTCONFIG(2, 1);
|
firmSource = BOOTCONFIG(2, 1);
|
||||||
a9lhMode = BOOTCONFIG(3, 1);
|
a9lhMode = BOOTCONFIG(3, 1);
|
||||||
updatedSys = (a9lhMode && CONFIG(1)) ? 1 : 0;
|
updatedSys = a9lhMode && CONFIG(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -214,7 +214,7 @@ static inline void loadFirm(u32 firmType, u32 externalFirm)
|
|||||||
section = firm->section;
|
section = firm->section;
|
||||||
|
|
||||||
u32 externalFirmLoaded = externalFirm &&
|
u32 externalFirmLoaded = externalFirm &&
|
||||||
!fileRead(firm, "/luma/firmware.bin", 0) &&
|
fileRead(firm, "/luma/firmware.bin") &&
|
||||||
(((u32)section[2].address >> 8) & 0xFF) == (console ? 0x60 : 0x68);
|
(((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
|
||||||
@ -240,7 +240,7 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhMode)
|
|||||||
if(console)
|
if(console)
|
||||||
{
|
{
|
||||||
//Determine if we're booting the 9.0 FIRM
|
//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
|
//Decrypt ARM9Bin and patch ARM9 entrypoint to skip arm9loader
|
||||||
arm9Loader(arm9Section, nativeFirmType);
|
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
|
//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};
|
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)
|
if(nativeFirmType || nandType || a9lhMode == 2)
|
||||||
|
46
source/fs.c
46
source/fs.c
@ -21,39 +21,33 @@ u32 mountFs(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 fileRead(void *dest, const char *path, u32 size)
|
u32 fileRead(void *dest, const char *path)
|
||||||
{
|
{
|
||||||
FRESULT result;
|
|
||||||
FIL file;
|
FIL file;
|
||||||
|
u32 size;
|
||||||
|
|
||||||
result = f_open(&file, path, FA_READ);
|
if(f_open(&file, path, FA_READ) == FR_OK)
|
||||||
if(result == FR_OK)
|
|
||||||
{
|
{
|
||||||
unsigned int read;
|
unsigned int read;
|
||||||
if(!size) size = f_size(&file);
|
size = f_size(&file);
|
||||||
result = f_read(&file, dest, size, &read);
|
f_read(&file, dest, size, &read);
|
||||||
|
f_close(&file);
|
||||||
}
|
}
|
||||||
|
else size = 0;
|
||||||
|
|
||||||
f_close(&file);
|
return size;
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 fileWrite(const void *buffer, const char *path, u32 size)
|
void fileWrite(const void *buffer, const char *path, u32 size)
|
||||||
{
|
{
|
||||||
FRESULT result;
|
|
||||||
FIL file;
|
FIL file;
|
||||||
|
|
||||||
result = f_open(&file, path, FA_WRITE | FA_OPEN_ALWAYS);
|
if(f_open(&file, path, FA_WRITE | FA_OPEN_ALWAYS) == FR_OK)
|
||||||
if(result == FR_OK)
|
|
||||||
{
|
{
|
||||||
unsigned int read;
|
unsigned int written;
|
||||||
result = f_write(&file, buffer, size, &read);
|
f_write(&file, buffer, size, &written);
|
||||||
|
f_close(&file);
|
||||||
}
|
}
|
||||||
|
|
||||||
f_close(&file);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadPayload(u32 pressed, u32 devMode)
|
void loadPayload(u32 pressed, u32 devMode)
|
||||||
@ -94,17 +88,7 @@ void loadPayload(u32 pressed, u32 devMode)
|
|||||||
path[14] = '/';
|
path[14] = '/';
|
||||||
memcpy(&path[15], info.altname, 13);
|
memcpy(&path[15], info.altname, 13);
|
||||||
|
|
||||||
FIL payload;
|
loaderAddress[1] = fileRead((void *)0x24F00000, path);
|
||||||
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;
|
|
||||||
|
|
||||||
((void (*)())loaderAddress)();
|
((void (*)())loaderAddress)();
|
||||||
}
|
}
|
||||||
@ -177,5 +161,5 @@ void firmRead(void *dest, const char *firmFolder)
|
|||||||
id >>= 4;
|
id >>= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileRead(dest, path, 0);
|
fileRead(dest, path);
|
||||||
}
|
}
|
@ -9,8 +9,8 @@
|
|||||||
#define PATTERN(a) a "_*.bin"
|
#define PATTERN(a) a "_*.bin"
|
||||||
|
|
||||||
u32 mountFs(void);
|
u32 mountFs(void);
|
||||||
u32 fileRead(void *dest, const char *path, u32 size);
|
u32 fileRead(void *dest, const char *path);
|
||||||
u32 fileWrite(const void *buffer, const char *path, u32 size);
|
void fileWrite(const void *buffer, const char *path, u32 size);
|
||||||
void findDumpFile(const char *path, char *fileName);
|
void findDumpFile(const char *path, char *fileName);
|
||||||
void loadPayload(u32 pressed, u32 devMode);
|
void loadPayload(u32 pressed, u32 devMode);
|
||||||
void firmRead(void *dest, const char *firmFolder);
|
void firmRead(void *dest, const char *firmFolder);
|
Reference in New Issue
Block a user