Added multi redNAND support (thanks to @Desterly for the original commit)

This commit is contained in:
Aurora 2016-03-26 17:47:33 +01:00
parent b3d25ce64a
commit feff28a4fe
2 changed files with 14 additions and 10 deletions

View File

@ -15,17 +15,21 @@ void getEmunandSect(u32 *off, u32 *head, u32 emuNAND){
u32 nandOffset = emuNAND == 1 ? 0 :
(nandSize > 0x200000 ? 0x400000 : 0x200000);
//Check for Gateway emuNAND
if(sdmmc_sdcard_readsectors(nandOffset + nandSize, 1, temp) == 0){
if(*(u32 *)(temp + 0x100) == NCSD_MAGIC){
*off = nandOffset;
*head = nandOffset + nandSize;
}
//Check for RedNAND
else if(sdmmc_sdcard_readsectors(nandOffset + 1, 1, temp) == 0){
if(*(u32 *)(temp + 0x100) == NCSD_MAGIC){
*off = nandOffset + 1;
*head = nandOffset + 1;
}
//Fallback to the first emuNAND if there's no second one
else if(emuNAND == 2) getEmunandSect(off, head, 1);
//Check if a RedNAND is present
else if(sdmmc_sdcard_readsectors(1, 1, temp) == 0)
if(*(u32 *)(temp + 0x100) != NCSD_MAGIC)
*head = 0;
}
}
}

View File

@ -165,8 +165,8 @@ void loadFirm(void){
//NAND redirection
static void loadEmu(u8 *proc9Offset){
u32 emuOffset = 1,
emuHeader = 1,
u32 emuOffset,
emuHeader = 0,
emuRead,
emuWrite;