Support the reserved bit of the Pro Controller in button mapping, map it to a unused bit of the Gamepad

This commit is contained in:
Maschell 2023-01-22 16:22:36 +01:00
parent 9032d67c17
commit 3f3c236bb9
3 changed files with 11 additions and 1 deletions

View File

@ -64,6 +64,9 @@ const char *getButtonChar(VPADButtons value) {
if (value & VPAD_BUTTON_TV) { if (value & VPAD_BUTTON_TV) {
return "\ue089"; return "\ue089";
} }
if (value & VPAD_BUTTON_RESERVED_BIT) {
return "\ue01E";
}
return ""; 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 | 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_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{}; KPADStatus kpad_data{};
KPADError kpad_error; KPADError kpad_error;

View File

@ -121,6 +121,9 @@ uint32_t remapVPADtoPro(uint32_t buttons) {
if (buttons & VPAD_BUTTON_MINUS) { if (buttons & VPAD_BUTTON_MINUS) {
conv_buttons |= WPAD_PRO_BUTTON_MINUS; conv_buttons |= WPAD_PRO_BUTTON_MINUS;
} }
if (buttons & VPAD_BUTTON_RESERVED_BIT) {
conv_buttons |= WPAD_PRO_RESERVED;
}
return conv_buttons; return conv_buttons;
} }
@ -270,5 +273,8 @@ uint32_t remapProButtons(uint32_t buttons) {
if (buttons & WPAD_PRO_BUTTON_STICK_R) { if (buttons & WPAD_PRO_BUTTON_STICK_R) {
conv_buttons |= VPAD_BUTTON_STICK_R; conv_buttons |= VPAD_BUTTON_STICK_R;
} }
if (buttons & WPAD_PRO_RESERVED) {
conv_buttons |= VPAD_BUTTON_RESERVED_BIT;
}
return conv_buttons; return conv_buttons;
} }

View File

@ -4,6 +4,7 @@
#include <padscore/kpad.h> #include <padscore/kpad.h>
#include <vpad/input.h> #include <vpad/input.h>
#define VPAD_BUTTON_RESERVED_BIT 0x80000
uint32_t remapVPADtoWiimote(uint32_t buttons); uint32_t remapVPADtoWiimote(uint32_t buttons);
uint32_t remapVPADtoClassic(uint32_t buttons); uint32_t remapVPADtoClassic(uint32_t buttons);