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:
25
src/events.c
25
src/events.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user