diff --git a/source/ButtonComboInfo.cpp b/source/ButtonComboInfo.cpp index 809aecd..04f00f4 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 == 0 || mCombo == 0) { + 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 3952437..f9368da 100644 --- a/source/ButtonComboManager.cpp +++ b/source/ButtonComboManager.cpp @@ -289,11 +289,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; @@ -303,7 +298,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; @@ -320,7 +315,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, @@ -744,7 +739,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; 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();