Fix compatibility with 2DS.

Adds a check to determine if the NAND size is greater than the size of
an Old 3DS Toshiba NAND.
This commit is contained in:
Pablo Curiel 2016-09-07 11:25:20 -04:00
parent 5b6318ee3a
commit 99654bd5b2

View File

@ -25,6 +25,8 @@
#include "fatfs/sdmmc/sdmmc.h" #include "fatfs/sdmmc/sdmmc.h"
#include "../build/emunandpatch.h" #include "../build/emunandpatch.h"
#define O3DS_TOSHIBA_NAND 0x1DD000
#define O3DS_LEGACY_FAT 0x200000 #define O3DS_LEGACY_FAT 0x200000
#define O3DS_DEFAULT_FAT 0x1DE000 #define O3DS_DEFAULT_FAT 0x1DE000
#define O3DS_MINIMUM_FAT 0x1D8000 #define O3DS_MINIMUM_FAT 0x1D8000
@ -50,7 +52,7 @@ void locateEmuNand(u32 *off, u32 *head, FirmwareSource *emuNand)
if (i > 0 && *emuNand != FIRMWARE_EMUNAND2) break; if (i > 0 && *emuNand != FIRMWARE_EMUNAND2) break;
// Check for 'Legacy', 'Default' and 'Minimum' partition layouts when checking for the 2nd EmuNAND // Check for 'Legacy', 'Default' and 'Minimum' partition layouts when checking for the 2nd EmuNAND
nandOffset = (*emuNand == FIRMWARE_EMUNAND ? 0 : (isN3DS ? nandLayoutN3DS[i] : nandLayoutO3DS[i])); nandOffset = (*emuNand == FIRMWARE_EMUNAND ? 0 : ((isN3DS || nandSize > O3DS_TOSHIBA_NAND) ? nandLayoutN3DS[i] : nandLayoutO3DS[i]));
//Check for RedNAND //Check for RedNAND
if(!sdmmc_sdcard_readsectors(nandOffset + 1, 1, temp) && *(u32 *)(temp + 0x100) == NCSD_MAGIC) if(!sdmmc_sdcard_readsectors(nandOffset + 1, 1, temp) && *(u32 *)(temp + 0x100) == NCSD_MAGIC)