mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
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:
20
Externals/WiiUseSrc/Src/nunchuk.c
vendored
20
Externals/WiiUseSrc/Src/nunchuk.c
vendored
@ -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];
|
||||
|
Reference in New Issue
Block a user