From 402bde3028b3f133a3c2c9412609ec775b13244c Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 3 Jan 2025 09:34:48 +0100 Subject: [PATCH 1/4] Fix button mapping for button combo detection --- source/plugin/ButtonComboManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/plugin/ButtonComboManager.cpp b/source/plugin/ButtonComboManager.cpp index 969cf94..86053e9 100644 --- a/source/plugin/ButtonComboManager.cpp +++ b/source/plugin/ButtonComboManager.cpp @@ -168,10 +168,10 @@ namespace { res |= WUPS_BUTTON_COMBO_BUTTON_B; } if (other & BCMPAD_BUTTON_X) { - res |= WUPS_BUTTON_COMBO_BUTTON_B; + res |= WUPS_BUTTON_COMBO_BUTTON_X; } if (other & BCMPAD_BUTTON_Y) { - res |= WUPS_BUTTON_COMBO_BUTTON_B; + res |= WUPS_BUTTON_COMBO_BUTTON_Y; } if (other & BCMPAD_BUTTON_LEFT) { res |= WUPS_BUTTON_COMBO_BUTTON_LEFT; From dedbd8b4f403e93c6508b757a0c9c80e4a56a777 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 3 Jan 2025 09:36:19 +0100 Subject: [PATCH 2/4] Simplify trampoline reset, flush cache --- source/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/main.cpp b/source/main.cpp index d121a63..368fb95 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -28,6 +28,7 @@ #include #include +#include #include WUMS_MODULE_EXPORT_NAME("homebrew_wupsbackend"); @@ -309,9 +310,12 @@ void CleanupPlugins(std::vector &&pluginsToDeinit) { if (!pluginContainer.isLinkedAndLoaded() || cur.id != pluginContainer.getPluginLinkInformation().getTrampolineId()) { continue; } - cur.status = RELOC_TRAMP_FREE; + cur = {}; } } + DCFlushRange((void *) gTrampData.data(), gTrampData.size() * sizeof(relocation_trampoline_entry_t)); + ICInvalidateRange((void *) gTrampData.data(), gTrampData.size() * sizeof(relocation_trampoline_entry_t)); + OSMemoryBarrier(); } void CheckCleanupCallbackUsage(const std::vector &plugins) { auto *curThread = OSGetCurrentThread(); From 495960dd133727712864c26ecf1b8e2815701d67 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 3 Jan 2025 09:36:47 +0100 Subject: [PATCH 3/4] Fix logging button combo hook --- source/hooks.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/hooks.cpp b/source/hooks.cpp index d4e8720..765a1b2 100644 --- a/source/hooks.cpp +++ b/source/hooks.cpp @@ -43,7 +43,9 @@ static const char **hook_names = (const char *[]){ "WUPS_LOADER_HOOK_APPLICATION_REQUESTS_EXIT", "WUPS_LOADER_HOOK_APPLICATION_ENDS", "WUPS_LOADER_HOOK_INIT_STORAGE", - "WUPS_LOADER_HOOK_INIT_CONFIG"}; + "WUPS_LOADER_HOOK_INIT_CONFIG", + "WUPS_LOADER_HOOK_INIT_BUTTON_COMBO", +}; void CallHook(const std::vector &plugins, const wups_loader_hook_type_t hook_type) { CallHook(plugins, hook_type, [](const auto &) { return true; }); From ce9c4683eb1b44c953b64bb8442940e46e97a8ce Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 3 Jan 2025 09:37:02 +0100 Subject: [PATCH 4/4] Add button combo module depedency --- source/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/main.cpp b/source/main.cpp index 368fb95..3581bf1 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -36,6 +36,7 @@ WUMS_USE_WUT_DEVOPTAB(); WUMS_DEPENDS_ON(homebrew_functionpatcher); WUMS_DEPENDS_ON(homebrew_memorymapping); WUMS_DEPENDS_ON(homebrew_notifications); +WUMS_DEPENDS_ON(homebrew_buttoncombo); using namespace std::chrono_literals;