diff --git a/source/firm.c b/source/firm.c index e106ac9..2303ae2 100755 --- a/source/firm.c +++ b/source/firm.c @@ -312,16 +312,19 @@ static inline u32 loadFirm(FirmwareType *firmType, FirmwareSource firmSource, bo if(firmSize > 0) { + bool isValidFirm = true; + if(memcmp(firm, "FIRM", 4) != 0) { u8 cetk[0xA50]; if(fileRead(cetk, *firmType == NATIVE_FIRM1X2X ? cetkFiles[0] : cetkFiles[(u32)*firmType], sizeof(cetk)) == sizeof(cetk)) decryptNusFirm(cetk, (u8 *)firm, firmSize); + else isValidFirm = false; } - //Check that the SD FIRM is right for the console from the ARM9 section address - if((section[3].offset ? section[3].address : section[2].address) != (isN3DS ? (u8 *)0x8006000 : (u8 *)0x8006800)) + //Check that the SD FIRM is decrypted and is right for the console from the ARM9 section address + if(isValidFirm && (section[3].offset ? section[3].address : section[2].address) != (isN3DS ? (u8 *)0x8006000 : (u8 *)0x8006800)) { if(isFirmlaunch) mcuReboot(); error("The firmware.bin in /luma is not valid for your\nconsole, or corrupted");