Don't make any assumption regarding version when loading an external firmware file.

This commit is contained in:
TuxSH 2016-08-04 00:05:01 +02:00
parent 389a169443
commit 18b5cdcddf
2 changed files with 10 additions and 7 deletions

View File

@ -273,8 +273,8 @@ static inline u32 loadFirm(FirmwareType firmType)
if(!fileRead(firm, "/luma/firmware.bin") || (((u32)section[2].address >> 8) & 0xFF) != 0x68) if(!fileRead(firm, "/luma/firmware.bin") || (((u32)section[2].address >> 8) & 0xFF) != 0x68)
error("An old unsupported FIRM has been detected.\nCopy firmware.bin in /luma to boot"); error("An old unsupported FIRM has been detected.\nCopy firmware.bin in /luma to boot");
//9.6 O3DS FIRM //No assumption regarding FIRM version
firmVersion = 0x49; firmVersion = 0xffffffff;
} }
else decryptExeFs((u8 *)firm); else decryptExeFs((u8 *)firm);

View File

@ -119,12 +119,15 @@ void reimplementSvcBackdoor(u8 *pos, u32 size)
u32 *svcTable = (u32 *)(pos + *(u32 *)(pos + 0xFFFF0008 - svcOffset - 0xFFF00000 + 8) - 0xFFF00000); //SVC handler address u32 *svcTable = (u32 *)(pos + *(u32 *)(pos + 0xFFFF0008 - svcOffset - 0xFFF00000 + 8) - 0xFFF00000); //SVC handler address
while(*svcTable) svcTable++; //Look for SVC0 (NULL) while(*svcTable) svcTable++; //Look for SVC0 (NULL)
if(svcTable[0x7B] == 0)
{
u32 *freeSpace; u32 *freeSpace;
for(freeSpace = exceptionsPage; *freeSpace != 0xFFFFFFFF; freeSpace++); for(freeSpace = exceptionsPage; *freeSpace != 0xFFFFFFFF; freeSpace++);
memcpy(freeSpace, svcBackdoor, 40); memcpy(freeSpace, svcBackdoor, 40);
svcTable[0x7B] = 0xFFFF0000 + ((u8 *)freeSpace - (u8 *)exceptionsPage); svcTable[0x7B] = 0xFFFF0000 + ((u8 *)freeSpace - (u8 *)exceptionsPage);
}
} }
void patchTitleInstallMinVersionCheck(u8 *pos, u32 size) void patchTitleInstallMinVersionCheck(u8 *pos, u32 size)
@ -133,7 +136,7 @@ void patchTitleInstallMinVersionCheck(u8 *pos, u32 size)
u8 *off = memsearch(pos, pattern, size, 4); u8 *off = memsearch(pos, pattern, size, 4);
off[4] = 0xE0; if(off != NULL) off[4] = 0xE0;
} }
void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType) void applyLegacyFirmPatches(u8 *pos, FirmwareType firmType)