From 99654bd5b24adaf4d30057b7687038ded87aab65 Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Wed, 7 Sep 2016 11:25:20 -0400 Subject: [PATCH] Fix compatibility with 2DS. Adds a check to determine if the NAND size is greater than the size of an Old 3DS Toshiba NAND. --- source/emunand.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/emunand.c b/source/emunand.c index ace1d299..c2db014f 100644 --- a/source/emunand.c +++ b/source/emunand.c @@ -25,6 +25,8 @@ #include "fatfs/sdmmc/sdmmc.h" #include "../build/emunandpatch.h" +#define O3DS_TOSHIBA_NAND 0x1DD000 + #define O3DS_LEGACY_FAT 0x200000 #define O3DS_DEFAULT_FAT 0x1DE000 #define O3DS_MINIMUM_FAT 0x1D8000 @@ -50,7 +52,7 @@ void locateEmuNand(u32 *off, u32 *head, FirmwareSource *emuNand) if (i > 0 && *emuNand != FIRMWARE_EMUNAND2) break; // 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 if(!sdmmc_sdcard_readsectors(nandOffset + 1, 1, temp) && *(u32 *)(temp + 0x100) == NCSD_MAGIC)