diff --git a/injector/source/patcher.c b/injector/source/patcher.c index 69c3293..cdcd986 100644 --- a/injector/source/patcher.c +++ b/injector/source/patcher.c @@ -291,9 +291,10 @@ static u32 findFunctionStart(u8* code, u32 pos) static bool findLayeredFsSymbols(u8* code, u32 size, u32 *fsMountArchive, u32 *fsRegisterArchive, u32 *fsTryOpenFile, u32 *fsOpenFileDirectly, u32 *throwFatalError) { + bool found = false; u32 svcConnectToPort = 0xFFFFFFFF; - for(u32 addr = 0; addr <= size - 4; addr += 4) + for(u32 addr = 0; !found && addr <= size - 4; addr += 4) { if(*fsMountArchive == 0xFFFFFFFF) { @@ -322,9 +323,11 @@ static bool findLayeredFsSymbols(u8* code, u32 size, u32 *fsMountArchive, u32 *f if(addr >= 4 && svcConnectToPort == 0xFFFFFFFF && *(u32 *)(code + addr) == 0xEF00002D) svcConnectToPort = addr - 4; + + if(svcConnectToPort != 0xFFFFFFFF && *fsMountArchive != 0xFFFFFFFF && *fsRegisterArchive != 0xFFFFFFFF && *fsTryOpenFile != 0xFFFFFFFF && *fsOpenFileDirectly != 0xFFFFFFFF) found = true; } - if(svcConnectToPort != 0xFFFFFFFF && *fsMountArchive != 0xFFFFFFFF && *fsRegisterArchive != 0xFFFFFFFF && *fsTryOpenFile != 0xFFFFFFFF && *fsOpenFileDirectly != 0xFFFFFFFF) + if(found) { u32 func = 0xFFFFFFFF; diff --git a/source/crypto.c b/source/crypto.c index bb8d488..08a1526 100755 --- a/source/crypto.c +++ b/source/crypto.c @@ -564,17 +564,16 @@ void kernel9Loader(Arm9Bin *arm9Section) aes_setkey(slot, decKey, AES_KEYX, AES_INPUT_BE | AES_INPUT_NORMAL); } - if(ISSIGHAX) - { - twlConsoleInfoInit(); + if(!ISSIGHAX) return; - if(k9lVersion == 2) - { - aes_setkey(0x11, key1s[ISDEVUNIT ? 1 : 0], AES_KEYNORMAL, AES_INPUT_BE | AES_INPUT_NORMAL); - aes_use_keyslot(0x11); - aes(decKey, keyBlocks[0], 1, NULL, AES_ECB_DECRYPT_MODE, 0); - aes_setkey(0x18, decKey, AES_KEYX, AES_INPUT_BE | AES_INPUT_NORMAL); - } + twlConsoleInfoInit(); + + if(k9lVersion == 2) + { + aes_setkey(0x11, key1s[ISDEVUNIT ? 1 : 0], AES_KEYNORMAL, AES_INPUT_BE | AES_INPUT_NORMAL); + aes_use_keyslot(0x11); + aes(decKey, keyBlocks[0], 1, NULL, AES_ECB_DECRYPT_MODE, 0); + aes_setkey(0x18, decKey, AES_KEYX, AES_INPUT_BE | AES_INPUT_NORMAL); } }