From 87bb3c521ffebb4a1d23753d1da51e92ef08943d Mon Sep 17 00:00:00 2001 From: Andrew <117602754+Andrew1Hawes@users.noreply.github.com> Date: Mon, 13 May 2024 00:33:07 +0100 Subject: [PATCH] Explicit support for Motion Plus controllers --- source/patcher/hooks_patcher_static.cpp | 7 ++++--- source/utils/input/WPADInput.h | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/patcher/hooks_patcher_static.cpp b/source/patcher/hooks_patcher_static.cpp index 8435faa..08f2236 100644 --- a/source/patcher/hooks_patcher_static.cpp +++ b/source/patcher/hooks_patcher_static.cpp @@ -111,12 +111,13 @@ DECL_FUNCTION(void, WPADRead, WPADChan chan, WPADStatusProController *data) { if (!sConfigMenuOpened && data && data[0].err == 0) { if (data[0].extensionType != 0xFF) { - if (data[0].extensionType == WPAD_EXT_CORE || data[0].extensionType == WPAD_EXT_NUNCHUK) { + if (data[0].extensionType == WPAD_EXT_CORE || data[0].extensionType == WPAD_EXT_NUNCHUK || + data[0].extensionType == WPAD_EXT_MPLUS || data[0].extensionType == WPAD_EXT_MPLUS_NUNCHUK) { // button data is in the first 2 bytes for wiimotes if (((uint16_t *) data)[0] == (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_MINUS)) { sWantsToOpenConfigMenu = true; } - } else if (data[0].extensionType == WPAD_EXT_CLASSIC) { + } else if (data[0].extensionType == WPAD_EXT_CLASSIC || data[0].extensionType == WPAD_EXT_MPLUS_CLASSIC) { // TODO: figure out the real struct.. if ((((uint32_t *) data)[10] & 0xFFFF) == (WPAD_CLASSIC_BUTTON_L | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_MINUS)) { sWantsToOpenConfigMenu = true; @@ -223,4 +224,4 @@ function_replacement_data_t method_hooks_static[] __attribute__((section(".data" }; -uint32_t method_hooks_static_size __attribute__((section(".data"))) = sizeof(method_hooks_static) / sizeof(function_replacement_data_t); \ No newline at end of file +uint32_t method_hooks_static_size __attribute__((section(".data"))) = sizeof(method_hooks_static) / sizeof(function_replacement_data_t); diff --git a/source/utils/input/WPADInput.h b/source/utils/input/WPADInput.h index e509ca9..5c478a4 100644 --- a/source/utils/input/WPADInput.h +++ b/source/utils/input/WPADInput.h @@ -144,7 +144,8 @@ public: return false; } - if (kpad.extensionType == WPAD_EXT_CORE || kpad.extensionType == WPAD_EXT_NUNCHUK) { + if (kpad.extensionType == WPAD_EXT_CORE || kpad.extensionType == WPAD_EXT_NUNCHUK || + kpad.extensionType == WPAD_EXT_MPLUS || kpad.extensionType == WPAD_EXT_MPLUS_NUNCHUK) { data.buttons_r = remapWiiMoteButtons(kpad.release); data.buttons_h = remapWiiMoteButtons(kpad.hold); data.buttons_d = remapWiiMoteButtons(kpad.trigger); @@ -184,4 +185,4 @@ public: KPADStatus kpad = {}; KPADError kpadError = KPAD_ERROR_UNINITIALIZED; KPADChan channel; -}; \ No newline at end of file +};