From d40722af5367c0410477cd7ad26a1dffb0c7d100 Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 26 Apr 2016 13:52:30 +0200 Subject: [PATCH] Apply the eShop update skipping patch only if the updated NAND was not booted (depends on the "Use SysNAND FIRM as default" option) --- injector/source/patcher.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/injector/source/patcher.c b/injector/source/patcher.c index 2316ec2..b45a3e2 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -336,12 +336,6 @@ void patchCode(u64 progId, u8 *code, u32 size) static const u8 blockAutoUpdatesPatch[] = { 0xE3, 0xA0 }; - static const u8 skipEshopUpdateCheckPattern[] = { - 0x30, 0xB5, 0xF1, 0xB0 - }; - static const u8 skipEshopUpdateCheckPatch[] = { - 0x00, 0x20, 0x08, 0x60, 0x70, 0x47 - }; //Block silent auto-updates patchMemory(code, size, @@ -351,13 +345,24 @@ void patchCode(u64 progId, u8 *code, u32 size) sizeof(blockAutoUpdatesPatch), 1 ); - //Skip update checks to access the EShop - patchMemory(code, size, - skipEshopUpdateCheckPattern, - sizeof(skipEshopUpdateCheckPattern), 0, - skipEshopUpdateCheckPatch, - sizeof(skipEshopUpdateCheckPatch), 1 - ); + //Apply only if the updated NAND hasn't been booted + if((BOOTCONFIG(0, 3) != 0) == (BOOTCONFIG(3, 1) && CONFIG(1))) + { + static const u8 skipEshopUpdateCheckPattern[] = { + 0x30, 0xB5, 0xF1, 0xB0 + }; + static const u8 skipEshopUpdateCheckPatch[] = { + 0x00, 0x20, 0x08, 0x60, 0x70, 0x47 + }; + + //Skip update checks to access the EShop + patchMemory(code, size, + skipEshopUpdateCheckPattern, + sizeof(skipEshopUpdateCheckPattern), 0, + skipEshopUpdateCheckPatch, + sizeof(skipEshopUpdateCheckPatch), 1 + ); + } break; }