-
-
Notifications
You must be signed in to change notification settings - Fork 106
Wii Motion Plus Fixed #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't test this very code in libogc, but when I ported it in my wpad2 branch I followed the same logic and it was working fine. Are you sure that the old code is not working? Also, according to the documentation, the old code is correct, because the motion plus, until you activate it, is found at 0xA60000: https://wiibrew.org/wiki/Wiimote/Extension_Controllers/Wii_Motion_Plus
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey, just to make sure we're talking about the same thing — if you mean Motion Plus connectivity, yeah that might be fine. What I'm fixing here is actually reading the gyro data, because right now the values just come back as 0.00 no matter what even when Motion Plus is attached and active. That's the bug I ran into and what this PR addresses. Maybe we were just confused about which problem we were each referring to?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because i mean, could you clarify what you were talking about? because what my new code fixes is the following: wii motion plus can now be detected as wheter it is physically present or not using libogc and it also now allow access to the wii motion plus gyros which weren't accessible at all before because the values returned all zeros and now they actually respond to motion correctly.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi! Let's try to address one issue at a time, since your PR seems to relate to several different issues. With the unmodified libogc, is the motion plus detected correctly? I mean, what is the value of
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the value of WPAD_Data(chan)->exp.type returns nothing because i don't know, somehow it doesn't work right, and also yes directly setting WPAD_SetMotionPlus(chan, true) does do something but it's just forcefully telling the system that there is a motion plus present when there isn't one, not actually detecting wheter it got connected to the wiimote or not. Does that help you?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mmm... Are you calling WPAD_ScanPads() at every frame? This is the function responsible for updating the wiimotes structures.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I am calling The issue seems to be specific to Wii MotionPlus. Before applying my changes, MotionPlus could not be reliably detected or used, even though the rest of the input system behaved normally. From my testing, this appears to be unrelated to how often I really appreciate you taking the time to look into this.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here are some showcase videos demonstrating the fix working in real time: |
||
| } | ||
|
|
||
| void wiiuse_motion_plus_check(struct wiimote_t *wm,ubyte *data,uword len) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused define?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
#define WPAD_EXP_MOTION_PLUS 5is important because it exposes Motion Plus as an official public API constant. Now that Motion Plus actually works, external code needs to know what the value 5 represents. Without it in the header, 5 stays an undocumented magic number. The constant makes Motion Plus a discoverable, documented part of the API.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't add this: we already have
EXP_MOTION_PLUSdefined in a public header, and there's a way of checking if the motion plus is available, using the currently public API: just check theexp.typefield of theWPADDatastructure.If you really want to make it even more convenient, you could add this to the wpad.h header:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi mardy,
Just to clarify what my new code actually does: it ensures that the Wii MotionPlus can be reliably detected as physically present using libogc. Before these changes, detection wasn’t consistent, and the gyroscope values from MotionPlus were all zeros, so motion data wasn’t accessible at all. With my fixes, the MotionPlus now responds correctly to motion, and developers can safely detect and use it.
That’s why I added the new header — it’s directly tied to these fixes and makes the feature work reliably in practice.
Thanks for taking a look.