From 444f4fb1548accd2c75da87e2b3efa5ae6c5800a Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Wed, 26 Feb 2025 02:40:01 -0300 Subject: [PATCH 1/4] Allow empty combos. --- source/ButtonComboInfo.cpp | 8 +++++++- source/ButtonComboManager.cpp | 9 ++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/ButtonComboInfo.cpp b/source/ButtonComboInfo.cpp index 305582c..ce16d11 100644 --- a/source/ButtonComboInfo.cpp +++ b/source/ButtonComboInfo.cpp @@ -97,6 +97,12 @@ bool ButtonComboInfoIF::conflictsWith(const ButtonComboModule_ButtonComboOptions if ((mControllerMask & other.controllerMask) == 0) { return false; } + + // No conflicts when either button combo is empty. + if (!other.combo || !mCombo) { + return false; + } + if ((other.combo & mCombo) == mCombo || (other.combo & mCombo) == other.combo) { return true; } @@ -141,4 +147,4 @@ int32_t ButtonComboInfoIF::ControllerTypeToChanIndex(const ButtonComboModule_Con } return -1; -} \ No newline at end of file +} diff --git a/source/ButtonComboManager.cpp b/source/ButtonComboManager.cpp index e451e71..a731568 100644 --- a/source/ButtonComboManager.cpp +++ b/source/ButtonComboManager.cpp @@ -288,11 +288,6 @@ std::optional> ButtonComboManager::CreateComb err = BUTTON_COMBO_MODULE_ERROR_INCOMPATIBLE_OPTIONS_VERSION; return std::nullopt; } - if (options.buttonComboOptions.basicCombo.combo == 0 || - options.buttonComboOptions.basicCombo.controllerMask == BUTTON_COMBO_MODULE_CONTROLLER_NONE) { - err = BUTTON_COMBO_MODULE_ERROR_INVALID_COMBO; - return std::nullopt; - } if (options.callbackOptions.callback == nullptr) { err = BUTTON_COMBO_MODULE_ERROR_INVALID_ARGUMENT; return std::nullopt; @@ -302,7 +297,7 @@ std::optional> ButtonComboManager::CreateComb switch (options.buttonComboOptions.type) { case BUTTON_COMBO_MODULE_COMBO_TYPE_HOLD_OBSERVER: observer = true; - __attribute__((fallthrough)); + [[fallthrough]]; case BUTTON_COMBO_MODULE_COMBO_TYPE_HOLD: { if (options.buttonComboOptions.optionalHoldForXMs == 0) { err = BUTTON_COMBO_MODULE_ERROR_DURATION_MISSING; @@ -319,7 +314,7 @@ std::optional> ButtonComboManager::CreateComb } case BUTTON_COMBO_MODULE_COMBO_TYPE_PRESS_DOWN_OBSERVER: observer = true; - __attribute__((fallthrough)); + [[fallthrough]]; case BUTTON_COMBO_MODULE_COMBO_TYPE_PRESS_DOWN: { err = BUTTON_COMBO_MODULE_ERROR_SUCCESS; return std::make_shared(options.metaOptions.label, From 9284f734fcca3673d5205b0e0e795a67693aa44f Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 22 Apr 2026 16:55:04 +0200 Subject: [PATCH 2/4] Stop logging every button combo detection --- source/ButtonComboManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ButtonComboManager.cpp b/source/ButtonComboManager.cpp index 3952437..cb11a8c 100644 --- a/source/ButtonComboManager.cpp +++ b/source/ButtonComboManager.cpp @@ -744,7 +744,7 @@ ButtonComboModule_Error ButtonComboManager::DetectButtonCombo_Blocking(const But } if (holdFor >= holdForTarget) { - DEBUG_FUNCTION_LINE_INFO("Detected button combo %08X", lastHold); + DEBUG_FUNCTION_LINE("Detected button combo %08X", lastHold); outButtonCombo = static_cast(lastHold); result = BUTTON_COMBO_MODULE_ERROR_SUCCESS; break; From 5c17c4544e6b7c68029a9b9f32276b1d70b071e9 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 3 May 2026 11:59:45 +0200 Subject: [PATCH 3/4] Make check for empty combos more explicit --- source/ButtonComboInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ButtonComboInfo.cpp b/source/ButtonComboInfo.cpp index 05139ae..04f00f4 100644 --- a/source/ButtonComboInfo.cpp +++ b/source/ButtonComboInfo.cpp @@ -99,7 +99,7 @@ bool ButtonComboInfoIF::conflictsWith(const ButtonComboModule_ButtonComboOptions } // No conflicts when either button combo is empty. - if (!other.combo || !mCombo) { + if (other.combo == 0 || mCombo == 0) { return false; } From 851f7433e790395f3244ce4e97daca8aad9491a3 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 3 May 2026 12:00:42 +0200 Subject: [PATCH 4/4] Bump version --- source/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/main.cpp b/source/main.cpp index dd95b31..dca8138 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -14,7 +14,7 @@ WUMS_MODULE_EXPORT_NAME("homebrew_buttoncombo"); WUMS_MODULE_SKIP_INIT_FINI(); WUMS_DEPENDS_ON(homebrew_functionpatcher); -#define MODULE_VERSION "v0.2.0" +#define MODULE_VERSION "v0.2.1" WUMS_INITIALIZE() { initLogging();