From 38e045e41d56f7e28da37acc031e5dd543a46c25 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 11 Feb 2018 18:52:11 +0100 Subject: [PATCH] [Loader] Fixed returning to the HBL if multiple plugin override the same function - They need to be restored in the reversed order! - Disabled verbose function patching logging. --- loader/src/main.cpp | 15 ++++++--------- loader/src/patcher/function_patcher.cpp | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/loader/src/main.cpp b/loader/src/main.cpp index 9ef9d93..09aef6b 100644 --- a/loader/src/main.cpp +++ b/loader/src/main.cpp @@ -67,23 +67,19 @@ extern "C" int Menu_Main(int argc, char **argv){ return EXIT_SUCCESS; } - - CallHook(WUPS_LOADER_HOOK_INIT_FUNCTION); - - DEBUG_FUNCTION_LINE("Apply patches.\n"); - ApplyPatches(); - - //Reset everything when were going back to the Mii Maker if(!isFirstBoot && isInMiiMakerHBL()){ DEBUG_FUNCTION_LINE("Returing to the Homebrew Launcher!\n"); isFirstBoot = 0; RestorePatches(); return EXIT_SUCCESS; + } else { + DEBUG_FUNCTION_LINE("Apply patches.\n"); + ApplyPatches(); } if(!isInMiiMakerHBL()){ //Starting the application - + CallHook(WUPS_LOADER_HOOK_INIT_FUNCTION); return EXIT_RELAUNCH_ON_LOAD; } @@ -131,7 +127,8 @@ void CallHook(wups_loader_hook_type_t hook_type){ } void RestorePatches(){ - for(int module_index=0;module_index=0;module_index--){ + DEBUG_FUNCTION_LINE("Restoring function for module: %d\n",module_index); new_RestoreInvidualInstructions(&gbl_replacement_data.module_data[module_index]); } } diff --git a/loader/src/patcher/function_patcher.cpp b/loader/src/patcher/function_patcher.cpp index 4218041..48191bd 100644 --- a/loader/src/patcher/function_patcher.cpp +++ b/loader/src/patcher/function_patcher.cpp @@ -28,7 +28,7 @@ #include #include -#define DEBUG_LOG_DYN 1 +#define DEBUG_LOG_DYN 0 rpl_handling rpl_handles[] __attribute__((section(".data"))) = { {WUPS_LOADER_LIBRARY_AVM, "avm.rpl" ,0},