From 2af656494337e7148ae84356dd193f7cb228b781 Mon Sep 17 00:00:00 2001 From: gitman123323 <129234866+gitman123323@users.noreply.github.com> Date: Mon, 23 Mar 2026 00:37:17 -0400 Subject: [PATCH 1/3] Add WPAD_HasMotionPlus function to check MotionPlus --- wiiuse/wpad.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wiiuse/wpad.c b/wiiuse/wpad.c index 1d310051c..d4f9b8885 100644 --- a/wiiuse/wpad.c +++ b/wiiuse/wpad.c @@ -89,7 +89,7 @@ static vs32 __wpads_bonded = 0; static u32 __wpad_idletimeout = 300; static vu32 __wpads_active = 0; static vu32 __wpads_used = 0; -static wiimote **__wpads = NULL; +wiimote **__wpads = NULL; static wiimote_listen __wpads_listen[WPAD_MAX_DEVICES] = {0}; static WPADData wpaddata[WPAD_MAX_DEVICES] = {0}; static struct _wpad_cb __wpdcb[WPAD_MAX_DEVICES] = {0}; @@ -2046,3 +2046,10 @@ bool WPAD_IsBatteryCritical(int chan) if(chan<0 || chan>=WPAD_MAX_DEVICES) return false; return WIIMOTE_IS_SET(__wpads[chan],WIIMOTE_STATE_BATTERY_CRITICAL); } + +int WPAD_HasMotionPlus(s32 chan) { + if (__wpads && __wpads[chan]) __wpads[chan]->state &= ~0x000020; + if (__wpads == NULL) return 0; + if (__wpads[chan] == NULL) return 0; + return (__wpads[chan]->state & 0x100000) ? 1 : 0; +} From 5ecf16ae546826d0af9f1b7ed181642b748ce609 Mon Sep 17 00:00:00 2001 From: gitman123323 <129234866+gitman123323@users.noreply.github.com> Date: Mon, 23 Mar 2026 00:38:01 -0400 Subject: [PATCH 2/3] Update motion_plus.c --- wiiuse/motion_plus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wiiuse/motion_plus.c b/wiiuse/motion_plus.c index b38f452b6..20a61a542 100644 --- a/wiiuse/motion_plus.c +++ b/wiiuse/motion_plus.c @@ -30,7 +30,7 @@ static void wiiuse_probe_motion_plus_check2(struct wiimote_t *wm, ubyte *data, u static void wiiuse_probe_motion_plus_check1(struct wiimote_t *wm, ubyte *data, uword len) { - if (data[1] != 0x05) + if (data[5] != 0x05) { WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_MPLUS_PRESENT); WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP_HANDSHAKE); @@ -45,7 +45,7 @@ static void wiiuse_probe_motion_plus_check1(struct wiimote_t *wm, ubyte *data, u void wiiuse_probe_motion_plus(struct wiimote_t *wm) { ubyte *buf = __lwp_wkspace_allocate(MAX_PAYLOAD); - wiiuse_read_data(wm, buf, WM_EXP_MOTION_PLUS_MODE, 2, wiiuse_probe_motion_plus_check1); + wiiuse_read_data(wm, buf, WM_EXP_ID, 6, wiiuse_probe_motion_plus_check1); } void wiiuse_motion_plus_check(struct wiimote_t *wm,ubyte *data,uword len) From f3313c703e75b998c4d169574608ada8bde1e6bf Mon Sep 17 00:00:00 2001 From: gitman123323 <129234866+gitman123323@users.noreply.github.com> Date: Mon, 23 Mar 2026 00:48:59 -0400 Subject: [PATCH 3/3] Add MotionPlus support to wpad.h --- gc/wiiuse/wpad.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gc/wiiuse/wpad.h b/gc/wiiuse/wpad.h index 8fb317510..272599715 100644 --- a/gc/wiiuse/wpad.h +++ b/gc/wiiuse/wpad.h @@ -228,6 +228,9 @@ void WPAD_Expansion(int chan, struct expansion_t *exp); void WPAD_PadStatus(int chan); bool WPAD_IsBatteryCritical(int chan); +s32 WPAD_HasMotionPlus(s32 chan); +#define WPAD_EXP_MOTION_PLUS 5 + #ifdef __cplusplus } #endif /* __cplusplus */