From 7633e2eed9ff0d0caae72dd449baafe83309dba5 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 25 Sep 2022 00:31:30 +0200 Subject: [PATCH] Fix button combo detection for WPAD controller --- src/function_patcher.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/function_patcher.cpp b/src/function_patcher.cpp index 1e71c08..727eb96 100644 --- a/src/function_patcher.cpp +++ b/src/function_patcher.cpp @@ -42,17 +42,18 @@ DECL_FUNCTION(void, WPADRead, WPADChan chan, WPADStatusProController *data) { if (data[0].extensionType == WPAD_EXT_CORE || data[0].extensionType == WPAD_EXT_NUNCHUK) { auto buttonCombo = remapVPADtoWiimote(gButtonCombo); // button data is in the first 2 bytes for wiimotes - if (((uint16_t *) data)[0] == buttonCombo) { + if (buttonCombo != 0 && ((uint16_t *) data)[0] == buttonCombo) { takeScreenshot = true; } } else if (data[0].extensionType == WPAD_EXT_CLASSIC) { auto buttonCombo = remapVPADtoClassic(gButtonCombo); - if ((((uint32_t *) data)[10] & 0xFFFF) == buttonCombo) { + if (buttonCombo != 0 && (((uint32_t *) data)[10] & 0xFFFF) == buttonCombo) { takeScreenshot = true; } } else if (data[0].extensionType == WPAD_EXT_PRO_CONTROLLER) { - auto buttonCombo = remapVPADtoClassic(gButtonCombo); - if (data[0].buttons == buttonCombo) { + auto buttonCombo = remapVPADtoPro(gButtonCombo); + + if (buttonCombo != 0 && data[0].buttons == buttonCombo) { takeScreenshot = true; } }