From 3474faa4a291e9a9dfd0869e7708062691c39cb2 Mon Sep 17 00:00:00 2001 From: Aurora Date: Sat, 12 Nov 2016 01:49:52 +0100 Subject: [PATCH] Added support for dev units sysupdater FIRM (untested but should work) --- source/crypto.c | 2 +- source/fs.c | 3 ++- source/main.c | 23 +++++++++++++++++------ source/types.h | 1 + 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/source/crypto.c b/source/crypto.c index ba8f96c..373fbea 100755 --- a/source/crypto.c +++ b/source/crypto.c @@ -545,7 +545,7 @@ void computePinHash(u8 *outbuf, const u8 *inbuf) cipherText[AES_BLOCK_SIZE]; sdmmc_get_cid(1, (u32 *)cid); - aes_use_keyslot(4); //Console-unique keyslot whose keys are set by the ARM9 bootROM + aes_use_keyslot(0x04); //Console-unique keyslot whose keys are set by the ARM9 bootROM aes(cipherText, inbuf, 1, cid, AES_CBC_ENCRYPT_MODE, AES_INPUT_BE | AES_INPUT_NORMAL); sha(outbuf, cipherText, sizeof(cipherText), SHA_256_MODE); } diff --git a/source/fs.c b/source/fs.c index b97b614..e1f8b58 100644 --- a/source/fs.c +++ b/source/fs.c @@ -185,7 +185,8 @@ u32 firmRead(void *dest, u32 firmType) const char *firmFolders[][2] = {{ "00000002", "20000002" }, { "00000102", "20000102" }, { "00000202", "20000202" }, - { "00000003", "20000003" }}; + { "00000003", "20000003" }, + { "00000001", "20000001" }}; char path[48] = "1:/title/00040138/"; concatenateStrings(path, firmFolders[firmType][ISN3DS ? 1 : 0]); diff --git a/source/main.c b/source/main.c index 92ddd73..8e34806 100644 --- a/source/main.c +++ b/source/main.c @@ -62,8 +62,18 @@ void main(void) { if(needConfig == CREATE_CONFIGURATION) mcuPowerOff(); - //'0' = NATIVE_FIRM, '1' = TWL_FIRM, '2' = AGB_FIRM - firmType = launchedFirmTidLow[7] == u'3' ? SAFE_FIRM : (FirmwareType)(launchedFirmTidLow[5] - u'0'); + switch(launchedFirmTidLow[7]) + { + case u'2': + firmType = (FirmwareType)(launchedFirmTidLow[5] - u'0'); + break; + case u'3': + firmType = SAFE_FIRM; + break; + case u'1': + firmType = SYSUPDATER_FIRM; + break; + } nandType = (FirmwareSource)BOOTCFG_NAND; firmSource = (FirmwareSource)BOOTCFG_FIRM; @@ -238,16 +248,17 @@ void main(void) case NATIVE_FIRM: res = patchNativeFirm(firmVersion, nandType, emuHeader, isA9lhInstalled, isSafeMode, devMode); break; - case SAFE_FIRM: - case NATIVE_FIRM1X2X: - res = isA9lhInstalled ? patch1x2xNativeAndSafeFirm(devMode) : 0; - break; case TWL_FIRM: res = patchTwlFirm(firmVersion, devMode); break; case AGB_FIRM: res = patchAgbFirm(devMode); break; + case SAFE_FIRM: + case SYSUPDATER_FIRM: + case NATIVE_FIRM1X2X: + res = isA9lhInstalled ? patch1x2xNativeAndSafeFirm(devMode) : 0; + break; } if(res != 0) diff --git a/source/types.h b/source/types.h index 54a3f47..4b22de8 100644 --- a/source/types.h +++ b/source/types.h @@ -97,6 +97,7 @@ typedef enum FirmwareType TWL_FIRM, AGB_FIRM, SAFE_FIRM, + SYSUPDATER_FIRM, NATIVE_FIRM1X2X } FirmwareType;