From 42866ffbac0d45b6d7c72772688f6a103b734af2 Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 3 Jun 2020 19:33:09 +0200 Subject: [PATCH] Don't clear the .bss section anymore, call the wut init functions only once, except the devop one --- source/PluginManagement.cpp | 8 ++++---- source/main.cpp | 2 +- source/patcher/hooks_patcher_static.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/PluginManagement.cpp b/source/PluginManagement.cpp index 5665411..8b98831 100644 --- a/source/PluginManagement.cpp +++ b/source/PluginManagement.cpp @@ -157,6 +157,9 @@ void PluginManagement::callInitHooks(plugin_information_t *pluginInformation) { CallHook(pluginInformation, WUPS_LOADER_HOOK_INIT_KERNEL); CallHook(pluginInformation, WUPS_LOADER_HOOK_INIT_OVERLAY); CallHook(pluginInformation, WUPS_LOADER_HOOK_INIT_PLUGIN); + CallHook(pluginInformation, WUPS_LOADER_HOOK_INIT_WUT_MALLOC); + CallHook(pluginInformation, WUPS_LOADER_HOOK_INIT_WUT_NEWLIB); + CallHook(pluginInformation, WUPS_LOADER_HOOK_INIT_WUT_STDCPP); DEBUG_FUNCTION_LINE("Done calling init hooks"); } @@ -168,11 +171,8 @@ void PluginManagement::PatchFunctionsAndCallHooks(plugin_information_t *gPluginI DCFlushRange((void *) 0x00800000, 0x00800000); ICInvalidateRange((void *) 0x00800000, 0x00800000); + CallHook(gPluginInformation, WUPS_LOADER_HOOK_INIT_WUT_DEVOPTAB); for (int32_t plugin_index = 0; plugin_index < gPluginInformation->number_used_plugins; plugin_index++) { - CallHookEx(gPluginInformation, WUPS_LOADER_HOOK_INIT_WUT_MALLOC, plugin_index); - CallHookEx(gPluginInformation, WUPS_LOADER_HOOK_INIT_WUT_NEWLIB, plugin_index); - CallHookEx(gPluginInformation, WUPS_LOADER_HOOK_INIT_WUT_STDCPP, plugin_index); - CallHookEx(gPluginInformation, WUPS_LOADER_HOOK_INIT_WUT_DEVOPTAB, plugin_index); CallHookEx(gPluginInformation, WUPS_LOADER_HOOK_APPLICATION_START, plugin_index); new_PatchInvidualMethodHooks(&(gPluginInformation->plugin_data[plugin_index].info)); CallHookEx(gPluginInformation, WUPS_LOADER_HOOK_FUNCTIONS_PATCHED, plugin_index); diff --git a/source/main.cpp b/source/main.cpp index a7912a3..074366c 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -140,7 +140,7 @@ WUMS_APPLICATION_STARTS() { if (pluginDataHeap != NULL) { std::vector plugins = PluginContainerPersistence::loadPlugins(gPluginInformation); PluginManagement::doRelocations(plugins, gPluginInformation->trampolines, DYN_LINK_TRAMPOLIN_LIST_LENGTH); - PluginManagement::memsetBSS(plugins); + // PluginManagement::memsetBSS(plugins); DCFlushRange((void *) 0x00800000, 0x00800000); ICInvalidateRange((void *) 0x00800000, 0x00800000); diff --git a/source/patcher/hooks_patcher_static.cpp b/source/patcher/hooks_patcher_static.cpp index b27bdb9..2be8455 100644 --- a/source/patcher/hooks_patcher_static.cpp +++ b/source/patcher/hooks_patcher_static.cpp @@ -266,7 +266,7 @@ DECL(uint32_t, OSReceiveMessage, OSMessageQueue *queue, OSMessage *message, uint CallHook(gPluginInformation, WUPS_LOADER_HOOK_ACQUIRED_FOREGROUND); } else if (message->args[0] == 0xD1E0D1E0) { CallHook(gPluginInformation, WUPS_LOADER_HOOK_APPLICATION_END); - //CallHook(gPluginInformation, WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB); + CallHook(gPluginInformation, WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB); //gInBackground = false; //DCFlushRange(&gInBackground,4); //unmount_sd_fat("sd");