Only allow button mapping for whitelisted buttons

This commit is contained in:
Maschell 2022-09-24 19:55:40 +02:00
parent b1edc121d1
commit b5d5b57dbd

View File

@ -144,6 +144,11 @@ void checkForHold(ConfigItemButtonCombo *item) {
uint32_t holdFor = 0;
uint32_t holdForTarget = item->holdDurationInMs >> 3;
uint32_t holdAbortTarget = item->abortButtonHoldDurationInMs >> 3;
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;
while (true) {
uint32_t buttonsHold = 0;
VPADReadError vpad_error = VPAD_READ_UNINITIALIZED;
@ -153,6 +158,8 @@ void checkForHold(ConfigItemButtonCombo *item) {
buttonsHold = vpad_data.hold;
}
buttonsHold &= mask;
if (buttonsHold == lastHold) {
if (buttonsHold != 0) {
holdFor++;