Add support for launching >= 6.x/7.x emuNANDs properly when the sysNAND is on a lower firmware version
To launch 3.x - 4.x emuNANDs, you'll need to use an external firmware file (10.x or so should do the trick)
This commit is contained in:
parent
72caad86cc
commit
a0e8bc1de3
@ -347,6 +347,16 @@ u32 ctrNandRead(u32 sector, u32 sectorCount, u8 *outbuf)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Sets the 7.x NCCH KeyX and the 6.x gamecard save data KeyY
|
||||||
|
void setRSAMod0DerivedKeys(void)
|
||||||
|
{
|
||||||
|
const u8 keyX0x25[0x10] = {0xCE, 0xE7, 0xD8, 0xAB, 0x30, 0xC0, 0x0D, 0xAE, 0x85, 0x0E, 0xF5, 0xE3, 0x82, 0xAC, 0x5A, 0xF3};
|
||||||
|
const u8 keyY0x2F[0x10] = {0xC3, 0x69, 0xBA, 0xA2, 0x1E, 0x18, 0x8A, 0x88, 0xA9, 0xAA, 0x94, 0xE5, 0x50, 0x6A, 0x9F, 0x16};
|
||||||
|
|
||||||
|
aes_setkey(0x25, keyX0x25, AES_KEYX, AES_INPUT_BE | AES_INPUT_NORMAL);
|
||||||
|
aes_setkey(0x2F, keyY0x2F, AES_KEYY, AES_INPUT_BE | AES_INPUT_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
//Decrypt a FIRM ExeFS
|
//Decrypt a FIRM ExeFS
|
||||||
void decryptExeFs(u8 *inbuf)
|
void decryptExeFs(u8 *inbuf)
|
||||||
{
|
{
|
||||||
|
@ -105,5 +105,6 @@ extern FirmwareSource firmSource;
|
|||||||
|
|
||||||
void ctrNandInit(void);
|
void ctrNandInit(void);
|
||||||
u32 ctrNandRead(u32 sector, u32 sectorCount, u8 *outbuf);
|
u32 ctrNandRead(u32 sector, u32 sectorCount, u8 *outbuf);
|
||||||
|
void setRSAMod0DerivedKeys(void);
|
||||||
void decryptExeFs(u8 *inbuf);
|
void decryptExeFs(u8 *inbuf);
|
||||||
void arm9Loader(u8 *arm9Section, u32 mode);
|
void arm9Loader(u8 *arm9Section, u32 mode);
|
@ -305,6 +305,10 @@ static inline void patchNativeFirm(FirmwareSource nandType, u32 emuHeader, A9LHM
|
|||||||
is90Firm = memcmp(section[2].hash, firm90Hash, 0x10) == 0;
|
is90Firm = memcmp(section[2].hash, firm90Hash, 0x10) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Sets the 7.x NCCH KeyX and the 6.x gamecard save data KeyY
|
||||||
|
if(a9lhMode == NO_A9LH)
|
||||||
|
setRSAMod0DerivedKeys();
|
||||||
|
|
||||||
//Find the Process9 .code location, size and memory address
|
//Find the Process9 .code location, size and memory address
|
||||||
u32 process9Size,
|
u32 process9Size,
|
||||||
process9MemAddr;
|
process9MemAddr;
|
||||||
|
Reference in New Issue
Block a user