Wiiuse:Guitar hero remove the use less hand shake check since the controller does not have any handshake data(BACKPORT)

Nunchuck:Fix up mistakes from my last backport.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4312 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
death2droid
2009-09-22 12:50:49 +00:00
parent 8c5285eddf
commit 750ad4fb5d
2 changed files with 15 additions and 40 deletions

View File

@ -113,12 +113,12 @@ int nunchuk_handshake(struct wiimote_t* wm, struct nunchuk_t* nc, byte* data, un
/* 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.min.x == 0) nc->js.min.x = nc->js.center.x - 80;
if (nc->js.max.x == 0) nc->js.max.x = nc->js.center.x + 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;
if (nc->js.min.y == 0) nc->js.min.y = nc->js.center.y - 80;
if (nc->js.max.y == 0) nc->js.max.y = nc->js.center.y + 80;
}
#ifdef WIN32
@ -156,19 +156,22 @@ void nunchuk_event(struct nunchuk_t* nc, byte* msg) {
/* get button states */
nunchuk_pressed_buttons(nc, msg[5]);
/* calculate joystick state */
calc_joystick_state(&nc->js, msg[0], msg[1]);
nc->js.pos.x = msg[0];
nc->js.pos.y = msg[1];
/* if min and max are reported as 0, initialize them to usable values based on center, and fine tune in nunchuck_event() */
/* extend min and max values to physical range of motion */
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.min.x > nc->js.pos.x) nc->js.min.x = nc->js.pos.x;
if (nc->js.max.x < nc->js.pos.x) nc->js.max.x = nc->js.pos.x;
}
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;
if (nc->js.min.y > nc->js.pos.y) nc->js.min.y = nc->js.pos.y;
if (nc->js.max.y < nc->js.pos.y) nc->js.max.y = nc->js.pos.y;
}
/* calculate joystick state */
calc_joystick_state(&nc->js, nc->js.pos.x, nc->js.pos.y);
/* calculate orientation */
nc->accel.x = msg[2];
nc->accel.y = msg[3];