From ddbe5fd27ba1e62d70274835eaeff0230201a90b Mon Sep 17 00:00:00 2001 From: Aurora Date: Wed, 7 Sep 2016 22:22:31 +0200 Subject: [PATCH] Round NAND size to 4MB for the default layout --- source/emunand.c | 3 +-- source/emunand.h | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/emunand.c b/source/emunand.c index 3ff5486..93aff58 100644 --- a/source/emunand.c +++ b/source/emunand.c @@ -34,11 +34,10 @@ void locateEmuNand(u32 *emuHeader, FirmwareSource *emuNand) for (u32 i = 0; i < 3 && !found; i++) { u32 nandOffset; - switch(i) { case 1: - nandOffset = nandSize + 1; //"Default" layout + nandOffset = ROUND_TO_4MB(nandSize + 1); //"Default" layout break; case 2: nandOffset = isN3DS ? 0x26E000 : 0x1D8000; //"Minsize" layout diff --git a/source/emunand.h b/source/emunand.h index 9226179..81f8603 100644 --- a/source/emunand.h +++ b/source/emunand.h @@ -24,7 +24,8 @@ #include "types.h" -#define NCSD_MAGIC 0x4453434E +#define NCSD_MAGIC 0x4453434E +#define ROUND_TO_4MB(x) (((x) + 0x2000 - 1) & (~(0x2000 - 1))) extern u32 emuOffset; extern bool isN3DS;