Overhaul of OS X real Wiimote support.

Fixes a number of problems, including unreliable connection setup, 
frequent disconnections, busy-waiting and shutdown deadlocks.

Motion Plus and nunchuk hot swapping now work and Wiiuse does a small
amount of queueing to prevent occasional dropped packets. The OS X 
bluetooth stack has no internal input buffering and while a worker  
thread can easily keep up with data coming from the Wiimote, the rest
of Dolphin can easily get behind if it is blocked by disk I/O or 
similar. Mostly the Wiimote protocol recovers from dropped packets,   
but sometimes the Wiimote would get out of sync and send a disconnect.
I wonder if the other platforms might benefit from a bit of queueing
at this layer as well.
 
Still doesn't support multiple devices, as I kept changing my mind 
about how best to do it. I only have one Wiimote anyway..
 
One improvement to the Wiimote plugin that would be really nice would
be for the scan for new devices to operate continuously or periodically
like on a real Wii rather than just for 5 seconds at startup..   


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5640 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang
2010-06-09 19:36:08 +00:00
parent 9d792d4673
commit e648c6d68b
9 changed files with 287 additions and 348 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ int classic_ctrl_handshake(struct wiimote_t* wm, struct classic_ctrl_t* cc, byte
cc->rjs.center.y = data[11 + offset] / 8;
/* handshake done */
wm->exp.type = EXP_CLASSIC;
wm->expansion.type = EXP_CLASSIC;
wm->timeout = WIIMOTE_DEFAULT_TIMEOUT;
+52 -52
View File
@@ -514,18 +514,18 @@ static void event_status(struct wiimote_t* wm, byte* msg) {
* @param msg The message specified in the event packet for the expansion.
*/
static void handle_expansion(struct wiimote_t* wm, byte* msg) {
switch (wm->exp.type) {
switch (wm->expansion.type) {
case EXP_NUNCHUK:
nunchuk_event(&wm->exp.nunchuk, msg);
nunchuk_event(&wm->expansion.nunchuk, msg);
break;
case EXP_CLASSIC:
classic_ctrl_event(&wm->exp.classic, msg);
classic_ctrl_event(&wm->expansion.classic, msg);
break;
case EXP_GUITAR_HERO_3:
guitar_hero_3_event(&wm->exp.gh3, msg);
guitar_hero_3_event(&wm->expansion.gh3, msg);
break;
case EXP_WII_BOARD:
wii_board_event(&wm->exp.wb, msg);
wii_board_event(&wm->expansion.wb, msg);
break;
default:
break;
@@ -578,25 +578,25 @@ void handshake_expansion(struct wiimote_t* wm, byte* data, unsigned short len) {
switch (wid) {
case EXP_ID_CODE_NUNCHUK:
{
if (nunchuk_handshake(wm, &wm->exp.nunchuk, data, len))
if (nunchuk_handshake(wm, &wm->expansion.nunchuk, data, len))
wm->event = WIIUSE_NUNCHUK_INSERTED;
break;
}
case EXP_ID_CODE_CLASSIC_CONTROLLER:
{
if (classic_ctrl_handshake(wm, &wm->exp.classic, data, len))
if (classic_ctrl_handshake(wm, &wm->expansion.classic, data, len))
wm->event = WIIUSE_CLASSIC_CTRL_INSERTED;
break;
}
case EXP_ID_CODE_GUITAR:
{
if (guitar_hero_3_handshake(wm, &wm->exp.gh3, data, len))
if (guitar_hero_3_handshake(wm, &wm->expansion.gh3, data, len))
wm->event = WIIUSE_GUITAR_HERO_3_CTRL_INSERTED;
break;
}
case EXP_ID_CODE_WII_BOARD:
{
if (wii_board_handshake(wm, &wm->exp.wb, data, len))
if (wii_board_handshake(wm, &wm->expansion.wb, data, len))
wm->event = WIIUSE_WII_BOARD_CTRL_INSERTED;
break;
}
@@ -627,21 +627,21 @@ void disable_expansion(struct wiimote_t* wm) {
return;
/* tell the assoicated module the expansion was removed */
switch (wm->exp.type) {
switch (wm->expansion.type) {
case EXP_NUNCHUK:
nunchuk_disconnected(&wm->exp.nunchuk);
nunchuk_disconnected(&wm->expansion.nunchuk);
wm->event = WIIUSE_NUNCHUK_REMOVED;
break;
case EXP_CLASSIC:
classic_ctrl_disconnected(&wm->exp.classic);
classic_ctrl_disconnected(&wm->expansion.classic);
wm->event = WIIUSE_CLASSIC_CTRL_REMOVED;
break;
case EXP_GUITAR_HERO_3:
guitar_hero_3_disconnected(&wm->exp.gh3);
guitar_hero_3_disconnected(&wm->expansion.gh3);
wm->event = WIIUSE_GUITAR_HERO_3_CTRL_REMOVED;
break;
case EXP_WII_BOARD:
wii_board_disconnected(&wm->exp.wb);
wii_board_disconnected(&wm->expansion.wb);
wm->event = WIIUSE_WII_BOARD_CTRL_REMOVED;
break;
default:
@@ -649,7 +649,7 @@ void disable_expansion(struct wiimote_t* wm) {
}
WIIMOTE_DISABLE_STATE(wm, WIIMOTE_STATE_EXP);
wm->exp.type = EXP_NONE;
wm->expansion.type = EXP_NONE;
}
@@ -671,29 +671,29 @@ static void save_state(struct wiimote_t* wm) {
}
/* expansion */
switch (wm->exp.type) {
switch (wm->expansion.type) {
case EXP_NUNCHUK:
wm->lstate.exp_ljs_ang = wm->exp.nunchuk.js.ang;
wm->lstate.exp_ljs_mag = wm->exp.nunchuk.js.mag;
wm->lstate.exp_btns = wm->exp.nunchuk.btns;
wm->lstate.exp_accel = wm->exp.nunchuk.accel;
wm->lstate.exp_ljs_ang = wm->expansion.nunchuk.js.ang;
wm->lstate.exp_ljs_mag = wm->expansion.nunchuk.js.mag;
wm->lstate.exp_btns = wm->expansion.nunchuk.btns;
wm->lstate.exp_accel = wm->expansion.nunchuk.accel;
break;
case EXP_CLASSIC:
wm->lstate.exp_ljs_ang = wm->exp.classic.ljs.ang;
wm->lstate.exp_ljs_mag = wm->exp.classic.ljs.mag;
wm->lstate.exp_rjs_ang = wm->exp.classic.rjs.ang;
wm->lstate.exp_rjs_mag = wm->exp.classic.rjs.mag;
wm->lstate.exp_r_shoulder = wm->exp.classic.r_shoulder;
wm->lstate.exp_l_shoulder = wm->exp.classic.l_shoulder;
wm->lstate.exp_btns = wm->exp.classic.btns;
wm->lstate.exp_ljs_ang = wm->expansion.classic.ljs.ang;
wm->lstate.exp_ljs_mag = wm->expansion.classic.ljs.mag;
wm->lstate.exp_rjs_ang = wm->expansion.classic.rjs.ang;
wm->lstate.exp_rjs_mag = wm->expansion.classic.rjs.mag;
wm->lstate.exp_r_shoulder = wm->expansion.classic.r_shoulder;
wm->lstate.exp_l_shoulder = wm->expansion.classic.l_shoulder;
wm->lstate.exp_btns = wm->expansion.classic.btns;
break;
case EXP_GUITAR_HERO_3:
wm->lstate.exp_ljs_ang = wm->exp.gh3.js.ang;
wm->lstate.exp_ljs_mag = wm->exp.gh3.js.mag;
wm->lstate.exp_r_shoulder = wm->exp.gh3.whammy_bar;
wm->lstate.exp_btns = wm->exp.gh3.btns;
wm->lstate.exp_ljs_ang = wm->expansion.gh3.js.ang;
wm->lstate.exp_ljs_mag = wm->expansion.gh3.js.mag;
wm->lstate.exp_r_shoulder = wm->expansion.gh3.whammy_bar;
wm->lstate.exp_btns = wm->expansion.gh3.btns;
break;
case EXP_NONE:
break;
@@ -760,42 +760,42 @@ static int state_changed(struct wiimote_t* wm) {
}
/* expansion */
switch (wm->exp.type) {
switch (wm->expansion.type) {
case EXP_NUNCHUK:
{
STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.nunchuk.js.ang);
STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.nunchuk.js.mag);
STATE_CHANGED(wm->lstate.exp_btns, wm->exp.nunchuk.btns);
STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->expansion.nunchuk.js.ang);
STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->expansion.nunchuk.js.mag);
STATE_CHANGED(wm->lstate.exp_btns, wm->expansion.nunchuk.btns);
CROSS_THRESH(wm->lstate.exp_orient, wm->exp.nunchuk.orient, wm->exp.nunchuk.orient_threshold);
CROSS_THRESH_XYZ(wm->lstate.exp_accel, wm->exp.nunchuk.accel, wm->exp.nunchuk.accel_threshold);
CROSS_THRESH(wm->lstate.exp_orient, wm->expansion.nunchuk.orient, wm->expansion.nunchuk.orient_threshold);
CROSS_THRESH_XYZ(wm->lstate.exp_accel, wm->expansion.nunchuk.accel, wm->expansion.nunchuk.accel_threshold);
break;
}
case EXP_CLASSIC:
{
STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.classic.ljs.ang);
STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.classic.ljs.mag);
STATE_CHANGED(wm->lstate.exp_rjs_ang, wm->exp.classic.rjs.ang);
STATE_CHANGED(wm->lstate.exp_rjs_mag, wm->exp.classic.rjs.mag);
STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->exp.classic.r_shoulder);
STATE_CHANGED(wm->lstate.exp_l_shoulder, wm->exp.classic.l_shoulder);
STATE_CHANGED(wm->lstate.exp_btns, wm->exp.classic.btns);
STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->expansion.classic.ljs.ang);
STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->expansion.classic.ljs.mag);
STATE_CHANGED(wm->lstate.exp_rjs_ang, wm->expansion.classic.rjs.ang);
STATE_CHANGED(wm->lstate.exp_rjs_mag, wm->expansion.classic.rjs.mag);
STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->expansion.classic.r_shoulder);
STATE_CHANGED(wm->lstate.exp_l_shoulder, wm->expansion.classic.l_shoulder);
STATE_CHANGED(wm->lstate.exp_btns, wm->expansion.classic.btns);
break;
}
case EXP_GUITAR_HERO_3:
{
STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->exp.gh3.js.ang);
STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->exp.gh3.js.mag);
STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->exp.gh3.whammy_bar);
STATE_CHANGED(wm->lstate.exp_btns, wm->exp.gh3.btns);
STATE_CHANGED(wm->lstate.exp_ljs_ang, wm->expansion.gh3.js.ang);
STATE_CHANGED(wm->lstate.exp_ljs_mag, wm->expansion.gh3.js.mag);
STATE_CHANGED(wm->lstate.exp_r_shoulder, wm->expansion.gh3.whammy_bar);
STATE_CHANGED(wm->lstate.exp_btns, wm->expansion.gh3.btns);
break;
}
case EXP_WII_BOARD:
{
STATE_CHANGED(wm->exp.wb.ltr,wm->exp.wb.tr);
STATE_CHANGED(wm->exp.wb.ltl,wm->exp.wb.tl);
STATE_CHANGED(wm->exp.wb.lbr,wm->exp.wb.br);
STATE_CHANGED(wm->exp.wb.lbl,wm->exp.wb.bl);
STATE_CHANGED(wm->expansion.wb.ltr,wm->expansion.wb.tr);
STATE_CHANGED(wm->expansion.wb.ltl,wm->expansion.wb.tl);
STATE_CHANGED(wm->expansion.wb.lbr,wm->expansion.wb.br);
STATE_CHANGED(wm->expansion.wb.lbl,wm->expansion.wb.bl);
break;
}
case EXP_NONE:
+1 -1
View File
@@ -81,7 +81,7 @@ int guitar_hero_3_handshake(struct wiimote_t* wm, struct guitar_hero_3_t* gh3, b
/* handshake done */
wm->event = WIIUSE_GUITAR_HERO_3_CTRL_INSERTED;
wm->exp.type = EXP_GUITAR_HERO_3;
wm->expansion.type = EXP_GUITAR_HERO_3;
wm->timeout = WIIMOTE_DEFAULT_TIMEOUT;
+172 -231
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -109,7 +109,7 @@ int nunchuk_handshake(struct wiimote_t* wm, struct nunchuk_t* nc, byte* data, un
nc->accel_threshold = wm->accel_threshold;
/* handshake done */
wm->exp.type = EXP_NUNCHUK;
wm->expansion.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) {
@@ -212,7 +212,7 @@ static void nunchuk_pressed_buttons(struct nunchuk_t* nc, byte now) {
void wiiuse_set_nunchuk_orient_threshold(struct wiimote_t* wm, float threshold) {
if (!wm) return;
wm->exp.nunchuk.orient_threshold = threshold;
wm->expansion.nunchuk.orient_threshold = threshold;
}
@@ -227,5 +227,5 @@ void wiiuse_set_nunchuk_orient_threshold(struct wiimote_t* wm, float threshold)
void wiiuse_set_nunchuk_accel_threshold(struct wiimote_t* wm, int threshold) {
if (!wm) return;
wm->exp.nunchuk.accel_threshold = threshold;
wm->expansion.nunchuk.accel_threshold = threshold;
}
+1 -1
View File
@@ -84,7 +84,7 @@ int wii_board_handshake(struct wiimote_t* wm, struct wii_board_t* wb, byte* data
/* handshake done */
wm->event = WIIUSE_WII_BOARD_CTRL_INSERTED;
wm->exp.type = EXP_WII_BOARD;
wm->expansion.type = EXP_WII_BOARD;
return 1;
}
+17 -19
View File
@@ -127,12 +127,10 @@ struct wiimote_t** wiiuse_init(int wiimotes) {
wm[i]->bdaddr = *BDADDR_ANY;
wm[i]->out_sock = -1;
wm[i]->in_sock = -1;
#else
#if !defined(__APPLE__)
#elif defined(_WIN32)
wm[i]->dev_handle = 0;
wm[i]->stack = WIIUSE_STACK_UNKNOWN;
#endif
#endif
wm[i]->normal_timeout = WIIMOTE_DEFAULT_TIMEOUT;
wm[i]->exp_timeout = WIIMOTE_EXP_TIMEOUT;
@@ -143,7 +141,7 @@ struct wiimote_t** wiiuse_init(int wiimotes) {
wm[i]->event = WIIUSE_NONE;
wm[i]->exp.type = EXP_NONE;
wm[i]->expansion.type = EXP_NONE;
wiiuse_set_aspect_ratio(wm[i], WIIUSE_ASPECT_4_3);
wiiuse_set_ir_position(wm[i], WIIUSE_IR_ABOVE);
@@ -181,10 +179,10 @@ void wiiuse_disconnected(struct wiimote_t* wm) {
wm->btns_released = 0;
memset(wm->event_buf, 0, sizeof(wm->event_buf));
#ifndef WIN32
#ifdef __linux__
wm->out_sock = -1;
wm->in_sock = -1;
#else
#elif defined(_WIN32)
CloseHandle(wm->dev_handle);
wm->dev_handle = 0;
#endif
@@ -298,7 +296,7 @@ void wiiuse_motion_sensing(struct wiimote_t* wm, int status) {
*/
int wiiuse_set_report_type(struct wiimote_t* wm) {
byte buf[2];
int motion, exp, ir;
int motion, expansion, ir;
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
return 0;
@@ -311,23 +309,23 @@ int wiiuse_set_report_type(struct wiimote_t* wm) {
buf[0] |= 0x01;
motion = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_ACC);
exp = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP);
expansion = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP);
ir = WIIMOTE_IS_SET(wm, WIIMOTE_STATE_IR);
if (motion && ir && exp) buf[1] = WM_RPT_BTN_ACC_IR_EXP;
else if (motion && exp) buf[1] = WM_RPT_BTN_ACC_EXP;
else if (motion && ir) buf[1] = WM_RPT_BTN_ACC_IR;
else if (ir && exp) buf[1] = WM_RPT_BTN_IR_EXP;
if (motion && ir && expansion) buf[1] = WM_RPT_BTN_ACC_IR_EXP;
else if (motion && expansion) buf[1] = WM_RPT_BTN_ACC_EXP;
else if (motion && ir) buf[1] = WM_RPT_BTN_ACC_IR;
else if (ir && expansion) buf[1] = WM_RPT_BTN_IR_EXP;
else if (ir) buf[1] = WM_RPT_BTN_ACC_IR;
else if (exp) buf[1] = WM_RPT_BTN_EXP;
else if (expansion) buf[1] = WM_RPT_BTN_EXP;
else if (motion) buf[1] = WM_RPT_BTN_ACC;
else buf[1] = WM_RPT_BTN;
else buf[1] = WM_RPT_BTN;
WIIUSE_DEBUG("Setting report type: 0x%x", buf[1]);
exp = wiiuse_send(wm, WM_CMD_REPORT_TYPE, buf, 2);
if (exp <= 0)
return exp;
expansion = wiiuse_send(wm, WM_CMD_REPORT_TYPE, buf, 2);
if (expansion <= 0)
return expansion;
return buf[1];
}
@@ -663,8 +661,8 @@ float wiiuse_set_smooth_alpha(struct wiimote_t* wm, float alpha) {
wm->accel_calib.st_alpha = alpha;
/* if there is a nunchuk set that too */
if (wm->exp.type == EXP_NUNCHUK)
wm->exp.nunchuk.accel_calib.st_alpha = alpha;
if (wm->expansion.type == EXP_NUNCHUK)
wm->expansion.nunchuk.accel_calib.st_alpha = alpha;
return old;
}
+34 -34
View File
@@ -42,12 +42,12 @@
//#define WITH_WIIUSE_DEBUG
#ifdef _WIN32
/* windows */
#include <windows.h>
#elif defined(__APPLE__)
#include <CoreFoundation/CoreFoundation.h>
#include <IOBluetooth/IOBluetoothUserLib.h>
#include <string.h>
#else
/* nix */
#elif defined(__linux__)
#include <bluetooth/bluetooth.h>
#endif
@@ -575,55 +575,55 @@ typedef enum WIIUSE_EVENT_TYPE {
* @brief Wiimote structure.
*/
typedef struct wiimote_t {
WCONST int unid; /**< user specified id */
WCONST int unid; /**< user specified id */
#ifndef WIN32
#if defined(__APPLE__)
WCONST char bdaddr[10]; /**< bt address on osx addr are string */
#else
WCONST bdaddr_t bdaddr; /**< bt address (linux) */
WCONST IOBluetoothDeviceRef *device;
WCONST char bdaddr_str[18];
#elif defined(__linux__)
WCONST bdaddr_t bdaddr; /**< bt address (linux) */
WCONST char bdaddr_str[18]; /**< readable bt address */
WCONST int out_sock; /**< output socket */
WCONST int in_sock; /**< input socket */
#elif defined(_WIN32)
WCONST HANDLE dev_handle; /**< HID handle */
WCONST OVERLAPPED hid_overlap; /**< overlap handle */
WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */
#endif
WCONST char bdaddr_str[18]; /**< readable bt address */
WCONST int out_sock; /**< output socket */
WCONST int in_sock; /**< input socket */
#else
WCONST HANDLE dev_handle; /**< HID handle */
WCONST OVERLAPPED hid_overlap; /**< overlap handle */
WCONST enum win_bt_stack_t stack; /**< type of bluetooth stack to use */
#endif
WCONST int timeout; /**< read timeout */
WCONST byte normal_timeout; /**< normal timeout */
WCONST byte exp_timeout; /**< timeout for expansion handshake */
WCONST int state; /**< various state flags */
WCONST byte leds; /**< currently lit leds */
WCONST float battery_level; /**< battery level */
WCONST int timeout; /**< read timeout */
WCONST byte normal_timeout; /**< normal timeout */
WCONST byte exp_timeout; /**< timeout for expansion handshake */
WCONST int flags; /**< options flag */
WCONST int state; /**< various state flags */
WCONST byte leds; /**< currently lit leds */
WCONST float battery_level; /**< battery level */
WCONST int flags; /**< options flag */
WCONST byte handshake_state; /**< the state of the connection handshake */
WCONST struct read_req_t* read_req; /**< list of data read requests */
WCONST struct read_req_t* read_req; /**< list of data read requests */
WCONST struct accel_t accel_calib; /**< wiimote accelerometer calibration */
WCONST struct expansion_t exp; /**< wiimote expansion device */
WCONST struct expansion_t expansion; /**< wiimote expansion device */
WCONST struct vec3b_t accel; /**< current raw acceleration data */
WCONST struct vec3b_t accel; /**< current raw acceleration data */
WCONST struct orient_t orient; /**< current orientation on each axis */
WCONST struct gforce_t gforce; /**< current gravity forces on each axis */
WCONST struct ir_t ir; /**< IR data */
WCONST struct ir_t ir; /**< IR data */
WCONST unsigned short btns; /**< what buttons have just been pressed */
WCONST unsigned short btns; /**< what buttons have just been pressed */
WCONST unsigned short btns_held; /**< what buttons are being held down */
WCONST unsigned short btns_released; /**< what buttons were just released this */
WCONST unsigned short btns_released; /**< what buttons were just released this */
WCONST float orient_threshold; /**< threshold for orient to generate an event */
WCONST int accel_threshold; /**< threshold for accel to generate an event */
WCONST float orient_threshold; /**< threshold for orient to generate an event */
WCONST int accel_threshold; /**< threshold for accel to generate an event */
WCONST struct wiimote_state_t lstate; /**< last saved state */
WCONST struct wiimote_state_t lstate; /**< last saved state */
WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occured */
WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */
WCONST WIIUSE_EVENT_TYPE event; /**< type of event that occured */
WCONST byte event_buf[MAX_PAYLOAD]; /**< event buffer */
} wiimote;
@@ -49,7 +49,7 @@ void handle_ctrl_status(struct wiimote_t* wm)
{
DEBUG_LOG(WIIMOTE, "--- CONTROLLER STATUS [wiimote id %i] ---", wm->unid);
DEBUG_LOG(WIIMOTE, "attachment: %i", wm->exp.type);
DEBUG_LOG(WIIMOTE, "attachment: %i", wm->expansion.type);
DEBUG_LOG(WIIMOTE, "speaker: %i", WIIUSE_USING_SPEAKER(wm));
DEBUG_LOG(WIIMOTE, "ir: %i", WIIUSE_USING_IR(wm));
DEBUG_LOG(WIIMOTE, "leds: %i %i %i %i", WIIUSE_IS_LED_SET(wm, 1), WIIUSE_IS_LED_SET(wm, 2), WIIUSE_IS_LED_SET(wm, 3), WIIUSE_IS_LED_SET(wm, 4));
@@ -89,9 +89,9 @@ void handle_event(struct wiimote_t* wm)
struct nunchuk_t* nc = NULL;
if (wm->exp.type == EXP_NUNCHUK) {
if (wm->expansion.type == EXP_NUNCHUK) {
nc = (nunchuk_t*)&wm->exp.nunchuk;
nc = (nunchuk_t*)&wm->expansion.nunchuk;
if (IS_PRESSED(nc, NUNCHUK_BUTTON_C))
DEBUG_LOG(WIIMOTE, "C pressed");
if (IS_PRESSED(nc, NUNCHUK_BUTTON_Z))
@@ -160,7 +160,7 @@ void handle_event(struct wiimote_t* wm)
Tmp += StringFromFormat("IR cursor: (%u, %u)\n", wm->ir.x, wm->ir.y);
Tmp += StringFromFormat("IR z distance: %f\n", wm->ir.z);
if(wm->exp.type == EXP_NUNCHUK)
if(wm->expansion.type == EXP_NUNCHUK)
{
Tmp += "\n";
Tmp += StringFromFormat("Nunchuck accel x, y, z: %03i %03i %03i\n", nc->accel.x, nc->accel.y, nc->accel.z);
@@ -202,7 +202,7 @@ void handle_event(struct wiimote_t* wm)
int GNCx, GNCy, GNCz;
if(wm->exp.type == EXP_NUNCHUK) // Updating Nunchuck Gauges
if(wm->expansion.type == EXP_NUNCHUK) // Updating Nunchuck Gauges
{
m_RecordingConfigFrame->m_GaugeGForceNunchuk[0]->SetValue((int)floor((nc->gforce.x * 300) + 100.5));
m_RecordingConfigFrame->m_GaugeGForceNunchuk[1]->SetValue((int)floor((nc->gforce.y * 300) + 100.5));
@@ -231,7 +231,7 @@ void handle_event(struct wiimote_t* wm)
// wxT("Current: %03u %03u %03u"), Gx, Gy, Gz));
if(m_RecordingConfigFrame->m_bRecording) {
if(wm->exp.type != EXP_NUNCHUK) {
if(wm->expansion.type != EXP_NUNCHUK) {
DEBUG_LOG(WIIMOTE, "Wiiuse Recorded accel x, y, z: %03i %03i %03i", Gx, Gy, Gz);
}
else {