From 3f3c236bb927e4065a74545626a25445175579dd Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 22 Jan 2023 16:22:36 +0100 Subject: [PATCH] Support the reserved bit of the Pro Controller in button mapping, map it to a unused bit of the Gamepad --- src/utils/WUPSConfigItemButtonCombo.cpp | 5 ++++- src/utils/input.cpp | 6 ++++++ src/utils/input.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/utils/WUPSConfigItemButtonCombo.cpp b/src/utils/WUPSConfigItemButtonCombo.cpp index 0481cbf..01e063b 100644 --- a/src/utils/WUPSConfigItemButtonCombo.cpp +++ b/src/utils/WUPSConfigItemButtonCombo.cpp @@ -64,6 +64,9 @@ const char *getButtonChar(VPADButtons value) { if (value & VPAD_BUTTON_TV) { return "\ue089"; } + if (value & VPAD_BUTTON_RESERVED_BIT) { + return "\ue01E"; + } return ""; } @@ -111,7 +114,7 @@ void checkForHold(ConfigItemButtonCombo *item) { auto mask = VPAD_BUTTON_A | VPAD_BUTTON_B | VPAD_BUTTON_X | VPAD_BUTTON_Y | VPAD_BUTTON_L | VPAD_BUTTON_R | VPAD_BUTTON_ZL | VPAD_BUTTON_ZR | VPAD_BUTTON_UP | VPAD_BUTTON_DOWN | VPAD_BUTTON_LEFT | VPAD_BUTTON_RIGHT | - VPAD_BUTTON_STICK_L | VPAD_BUTTON_STICK_R | VPAD_BUTTON_PLUS | VPAD_BUTTON_MINUS | VPAD_BUTTON_TV; + VPAD_BUTTON_STICK_L | VPAD_BUTTON_STICK_R | VPAD_BUTTON_PLUS | VPAD_BUTTON_MINUS | VPAD_BUTTON_TV | VPAD_BUTTON_RESERVED_BIT; KPADStatus kpad_data{}; KPADError kpad_error; diff --git a/src/utils/input.cpp b/src/utils/input.cpp index 2200729..503d977 100644 --- a/src/utils/input.cpp +++ b/src/utils/input.cpp @@ -121,6 +121,9 @@ uint32_t remapVPADtoPro(uint32_t buttons) { if (buttons & VPAD_BUTTON_MINUS) { conv_buttons |= WPAD_PRO_BUTTON_MINUS; } + if (buttons & VPAD_BUTTON_RESERVED_BIT) { + conv_buttons |= WPAD_PRO_RESERVED; + } return conv_buttons; } @@ -270,5 +273,8 @@ uint32_t remapProButtons(uint32_t buttons) { if (buttons & WPAD_PRO_BUTTON_STICK_R) { conv_buttons |= VPAD_BUTTON_STICK_R; } + if (buttons & WPAD_PRO_RESERVED) { + conv_buttons |= VPAD_BUTTON_RESERVED_BIT; + } return conv_buttons; } \ No newline at end of file diff --git a/src/utils/input.h b/src/utils/input.h index 77c6ce1..9dba431 100644 --- a/src/utils/input.h +++ b/src/utils/input.h @@ -4,6 +4,7 @@ #include #include +#define VPAD_BUTTON_RESERVED_BIT 0x80000 uint32_t remapVPADtoWiimote(uint32_t buttons); uint32_t remapVPADtoClassic(uint32_t buttons);