Add io_mac files from wiic, update wiiuse definitions

-Used io_mac.h/.m from wiic and added them to CMakeLists
-Define WIIUSE_MAC on wiiuse.h and wiiuse_internal.h
-Implemented wiiuse_poll when WIIUSE_MAC is defined
-Added Mac-specific includes to wiiuse.h and wiiuse_internal.h
-Added Mac-specific members to wiimote_t on wiiuse.h
-Added Mac-specific WM_DEV_CLASS definitions to wiiuse_internal.h
-Modified wiiuse_poll for use with Mac
-Added init and cleanup functions to io_mac.m
This commit is contained in:
Juan Sebastian Casallas
2011-11-22 20:37:49 +01:00
parent bc205d42b7
commit 257b94659d
6 changed files with 999 additions and 5 deletions

View File

@@ -168,7 +168,7 @@ int wiiuse_poll(struct wiimote_t** wm, int wiimotes) {
idle_cycle(wm[i]);
}
}
#else
#elif defined(WIIUSE_WIN32)
/*
* Windows
*/
@@ -190,6 +190,29 @@ int wiiuse_poll(struct wiimote_t** wm, int wiimotes) {
idle_cycle(wm[i]);
}
}
#elif defined(WIIUSE_MAC)
/*
* Mac
*/
int i;
if (!wm) return 0;
for (i = 0; i < wiimotes; ++i) {
wm[i]->event = WIIUSE_NONE;
if (wiiuse_io_read(wm[i])) {
/* propagate the event, messages should be read as in linux, starting from the second element */
propagate_event(wm[i], wm[i]->event_buf[1], wm[i]->event_buf+2);
evnt += (wm[i]->event != WIIUSE_NONE);
/* clear out the event buffer */
/*memset(wm[i]->event_buf, 0, sizeof(wm[i]->event_buf));*/
} else {
idle_cycle(wm[i]);
}
}
#endif
return evnt;