From b49f561430b1b877dff2caf620d73707ed5f0899 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 23 Jan 2022 21:16:38 +0100 Subject: [PATCH] WUPS 0.7.0 support --- source/hooks.cpp | 5 +++++ source/main.cpp | 5 ++++- source/plugin/PluginMetaInformationFactory.cpp | 2 +- source/utils/logger.h | 7 +------ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/hooks.cpp b/source/hooks.cpp index e43468b..930a700 100644 --- a/source/hooks.cpp +++ b/source/hooks.cpp @@ -32,6 +32,9 @@ static const char **hook_names = (const char *[]) { "WUPS_LOADER_HOOK_INIT_WUT_SOCKETS", "WUPS_LOADER_HOOK_FINI_WUT_SOCKETS", + "WUPS_LOADER_HOOK_INIT_WRAPPER", + "WUPS_LOADER_HOOK_FINI_WRAPPER", + "WUPS_LOADER_HOOK_GET_CONFIG", "WUPS_LOADER_HOOK_CONFIG_CLOSED", @@ -79,6 +82,8 @@ void CallHookEx(plugin_information_t *pluginInformation, wups_loader_hook_type_t hook_type == WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB || hook_type == WUPS_LOADER_HOOK_INIT_WUT_SOCKETS || hook_type == WUPS_LOADER_HOOK_FINI_WUT_SOCKETS || + hook_type == WUPS_LOADER_HOOK_INIT_WRAPPER || + hook_type == WUPS_LOADER_HOOK_FINI_WRAPPER || hook_type == WUPS_LOADER_HOOK_GET_CONFIG || hook_type == WUPS_LOADER_HOOK_CONFIG_CLOSED || hook_type == WUPS_LOADER_HOOK_RELEASE_FOREGROUND || diff --git a/source/main.cpp b/source/main.cpp index 1c7e428..0313200 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -42,6 +42,7 @@ WUMS_APPLICATION_REQUESTS_EXIT() { WUMS_APPLICATION_ENDS() { CallHook(gPluginInformation, WUPS_LOADER_HOOK_APPLICATION_ENDS); + CallHook(gPluginInformation, WUPS_LOADER_HOOK_FINI_WRAPPER); CallHook(gPluginInformation, WUPS_LOADER_HOOK_FINI_WUT_SOCKETS); CallHook(gPluginInformation, WUPS_LOADER_HOOK_FINI_WUT_DEVOPTAB); CallHook(gPluginInformation, WUPS_LOADER_HOOK_FINI_WUT_STDCPP); @@ -191,7 +192,7 @@ WUMS_APPLICATION_STARTS() { } if (gPluginDataHeap != nullptr) { - auto plugins = PluginContainerPersistence::loadPlugins(gPluginInformation); + auto plugins = PluginContainerPersistence::loadPlugins(gPluginInformation); PluginManagement::doRelocations(plugins, gTrampolineData, DYN_LINK_TRAMPOLIN_LIST_LENGTH); // PluginManagement::memsetBSS(plugins); @@ -206,6 +207,8 @@ WUMS_APPLICATION_STARTS() { CallHook(gPluginInformation, WUPS_LOADER_HOOK_INIT_WUT_DEVOPTAB); CallHook(gPluginInformation, WUPS_LOADER_HOOK_INIT_WUT_SOCKETS); + CallHook(gPluginInformation, WUPS_LOADER_HOOK_INIT_WRAPPER); + if (initNeeded) { PluginManagement::callInitHooks(gPluginInformation); } diff --git a/source/plugin/PluginMetaInformationFactory.cpp b/source/plugin/PluginMetaInformationFactory.cpp index 38d9884..5d0d327 100644 --- a/source/plugin/PluginMetaInformationFactory.cpp +++ b/source/plugin/PluginMetaInformationFactory.cpp @@ -110,7 +110,7 @@ std::optional> PluginMetaInformationFacto } else if (key == "storage_id") { pluginInfo->setStorageId(value); } else if (key == "wups") { - if (value != "0.6.1") { + if (value != "0.7.0") { DEBUG_FUNCTION_LINE("Warning: Ignoring plugin - Unsupported WUPS version: %s.", value.c_str()); return std::nullopt; } diff --git a/source/utils/logger.h b/source/utils/logger.h index 4e0263c..03824ef 100644 --- a/source/utils/logger.h +++ b/source/utils/logger.h @@ -9,13 +9,8 @@ extern "C" { #define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__) -#define OSFATAL_FUNCTION_LINE(FMT, ARGS...)do { \ - OSFatal_printf("[%s]%s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \ - } while (0) +#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while(0) -#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) do { \ - WHBLogPrintf("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \ - } while (0) #define DEBUG_FUNCTION_LINE(FMT, ARGS...)do { \ WHBLogPrintf("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \ } while (0)