Wiiuse:Backport some changes from the libogc version of wiiuse.

Still got a lot to back port :(.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4307 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
death2droid
2009-09-20 13:31:32 +00:00
parent 194d44d08e
commit 0e3baaa6ab
10 changed files with 167 additions and 113 deletions

View File

@ -111,6 +111,16 @@ int nunchuk_handshake(struct wiimote_t* wm, struct nunchuk_t* nc, byte* data, un
/* handshake done */
wm->exp.type = EXP_NUNCHUK;
/* if min and max are reported as 0, initialize them to usable values based on center, and fine tune in nunchuck_event() */
if (nc->js.center.x) {
if (nc->js.min.x == 0) nc->js.min.y = nc->js.center.y - 80;
if (nc->js.max.x == 0) nc->js.max.x = nc->js.center.y + 80;
}
if (nc->js.center.y) {
if (nc->js.min.y == 0) nc->js.min.x = nc->js.center.x - 80;
if (nc->js.max.y == 0) nc->js.max.x = nc->js.center.x + 80;
}
#ifdef WIN32
wm->timeout = WIIMOTE_DEFAULT_TIMEOUT;
#endif
@ -149,6 +159,16 @@ void nunchuk_event(struct nunchuk_t* nc, byte* msg) {
/* calculate joystick state */
calc_joystick_state(&nc->js, msg[0], msg[1]);
/* if min and max are reported as 0, initialize them to usable values based on center, and fine tune in nunchuck_event() */
if (nc->js.center.x) {
if (nc->js.min.x == 0) nc->js.min.y = nc->js.center.y - 80;
if (nc->js.max.x == 0) nc->js.max.x = nc->js.center.y + 80;
}
if (nc->js.center.y) {
if (nc->js.min.y == 0) nc->js.min.x = nc->js.center.x - 80;
if (nc->js.max.y == 0) nc->js.max.x = nc->js.center.x + 80;
}
/* calculate orientation */
nc->accel.x = msg[2];
nc->accel.y = msg[3];