Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions gc/wiiuse/wpad.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions wiiuse/motion_plus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion wiiuse/wpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
}
Loading