From ac73a96ce20bb0fd09cb20e580448a6754b578b0 Mon Sep 17 00:00:00 2001 From: Aurora Wright Date: Fri, 22 Sep 2017 18:05:03 +0200 Subject: [PATCH] Set default firmSource for CTRNAND mounting in crypto.c, move CTRNAND mounting for SD mode to firm.c --- source/crypto.c | 2 +- source/firm.c | 2 ++ source/main.c | 3 --- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/source/crypto.c b/source/crypto.c index 3c9c0fb..60958d3 100755 --- a/source/crypto.c +++ b/source/crypto.c @@ -327,7 +327,7 @@ __attribute__((aligned(4))) static u8 nandCtr[AES_BLOCK_SIZE]; static u8 nandSlot; static u32 fatStart = 0; -FirmwareSource firmSource; +FirmwareSource firmSource = FIRMWARE_SYSNAND; __attribute__((aligned(4))) static const u8 key1s[2][AES_BLOCK_SIZE] = { {0x07, 0x29, 0x44, 0x38, 0xF8, 0xC9, 0x75, 0x93, 0xAA, 0x0E, 0x4A, 0xB4, 0xAE, 0x84, 0xC1, 0xD8}, diff --git a/source/firm.c b/source/firm.c index 1ed58ff..22c55e7 100755 --- a/source/firm.c +++ b/source/firm.c @@ -152,6 +152,8 @@ static inline u32 loadFirmFromStorage(FirmwareType firmType) u32 loadNintendoFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStorage, bool isSafeMode) { + if(isSdMode && !mountFs(false, false)) error("Failed to mount CTRNAND."); + //Load FIRM from CTRNAND u32 firmVersion = firmRead(firm, (u32)*firmType); diff --git a/source/main.c b/source/main.c index 16eedee..c351065 100644 --- a/source/main.c +++ b/source/main.c @@ -112,7 +112,6 @@ void main(int argc, char **argv, u32 magicWord) } else if(memcmp(launchedPath, u"nand", 8) == 0) { - firmSource = FIRMWARE_SYSNAND; if(!mountFs(false, true)) error("Failed to mount CTRNAND."); isSdMode = false; } @@ -321,8 +320,6 @@ boot: writeConfig(false); } - if(isSdMode && !mountFs(false, false)) error("Failed to mount CTRNAND."); - bool loadFromStorage = CONFIG(LOADEXTFIRMSANDMODULES); u32 firmVersion = loadNintendoFirm(&firmType, firmSource, loadFromStorage, isSafeMode);