WUPSButtonComboAPI: Add support for GetControllerTypeStr

This commit is contained in:
Maschell 2025-01-05 13:36:38 +01:00
parent 08f7741696
commit 51a5bbd674
3 changed files with 40 additions and 0 deletions

View File

@ -18,6 +18,16 @@ extern "C" {
**/
const char *WUPSButtonComboAPI_GetStatusStr(WUPSButtonCombo_Error status);
/**
* @brief Get a string representation of the specified controller type.
*
* This function returns a string representation of the provided controller type.
*
* @param controller The controller to get the string representation for.
* @return A pointer to a string describing the provided controller.
**/
const char *WUPSButtonComboAPI_GetControllerTypeStr(WUPSButtonCombo_ControllerTypes controller);
/**
* @brief Adds a button combo which triggers a callback if a certain button combination is pressed on any controller.
*
@ -162,6 +172,7 @@ WUPSButtonCombo_Error WUPSButtonComboAPI_DetectButtonCombo_Blocking(const WUPSBu
namespace WUPSButtonComboAPI {
std::string_view GetStatusStr(WUPSButtonCombo_Error status);
std::string_view GetControllerTypeStr(WUPSButtonCombo_ControllerTypes controller);
std::optional<ButtonCombo> CreateComboPressDownEx(std::string_view label,
WUPSButtonCombo_ControllerTypes controllerMask,

View File

@ -66,6 +66,31 @@ const char *WUPSButtonComboAPI_GetStatusStr(const WUPSButtonCombo_Error status)
return "WUPS_BUTTON_COMBO_ERROR_UNKNOWN_ERROR";
}
const char *WUPSButtonComboAPI_GetControllerTypeStr(const WUPSButtonCombo_ControllerTypes controller) {
switch (controller) {
case WUPS_BUTTON_COMBO_CONTROLLER_VPAD_0:
return "WUPS_BUTTON_COMBO_CONTROLLER_VPAD_0";
case WUPS_BUTTON_COMBO_CONTROLLER_VPAD_1:
return "WUPS_BUTTON_COMBO_CONTROLLER_VPAD_1";
case WUPS_BUTTON_COMBO_CONTROLLER_WPAD_0:
return "WUPS_BUTTON_COMBO_CONTROLLER_WPAD_0";
case WUPS_BUTTON_COMBO_CONTROLLER_WPAD_1:
return "WUPS_BUTTON_COMBO_CONTROLLER_WPAD_1";
case WUPS_BUTTON_COMBO_CONTROLLER_WPAD_2:
return "WUPS_BUTTON_COMBO_CONTROLLER_WPAD_2";
case WUPS_BUTTON_COMBO_CONTROLLER_WPAD_3:
return "WUPS_BUTTON_COMBO_CONTROLLER_WPAD_3";
case WUPS_BUTTON_COMBO_CONTROLLER_WPAD_4:
return "WUPS_BUTTON_COMBO_CONTROLLER_WPAD_4";
case WUPS_BUTTON_COMBO_CONTROLLER_WPAD_5:
return "WUPS_BUTTON_COMBO_CONTROLLER_WPAD_5";
case WUPS_BUTTON_COMBO_CONTROLLER_WPAD_6:
return "WUPS_BUTTON_COMBO_CONTROLLER_WPAD_6";
default:;
}
return "<UNKNOWN OR MORE THAN ONE CONTROLLER>";
}
static WUPSButtonCombo_Error WUPSButtonComboAPI_AddButtonComboPressEx(const char *label,
const WUPSButtonCombo_Buttons combo,
const WUPSButtonCombo_ComboCallback callback,

View File

@ -7,6 +7,10 @@ namespace WUPSButtonComboAPI {
return WUPSButtonComboAPI_GetStatusStr(status);
}
std::string_view GetControllerTypeStr(const WUPSButtonCombo_ControllerTypes controller) {
return WUPSButtonComboAPI_GetControllerTypeStr(controller);
}
std::optional<ButtonCombo> CreateComboPressDownEx(const std::string_view label,
const WUPSButtonCombo_ControllerTypes controllerMask,
const WUPSButtonCombo_Buttons combo,