From ea249b382744d99da6dc40caae0b4032f6f88276 Mon Sep 17 00:00:00 2001 From: Nathan Strong Date: Wed, 6 Oct 2021 23:09:13 -0700 Subject: [PATCH] Get the WIIU GCA working on Mac OSX == DETAILS The GCA uses a weird HID class that our current filters don't catch, so we add it. Needed to do a small amount of tweaking on the GCA driver to account for iohidmanager weirdness. --- input/connect/connect_wiiugca.c | 8 ++++++++ input/drivers_hid/iohidmanager_hid.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/input/connect/connect_wiiugca.c b/input/connect/connect_wiiugca.c index 20120c6fb4..5f314a0b76 100644 --- a/input/connect/connect_wiiugca.c +++ b/input/connect/connect_wiiugca.c @@ -215,6 +215,14 @@ static void hidpad_wiiugca_packet_handler(void *device_data, uint8_t *packet, ui if (!device) return; +/* Mac OSX reads a 39-byte packet which has both a leading and trailing byte from + * the actual packet data. + */ +#if defined(__APPLE__) && defined(HAVE_IOHIDMANAGER) + packet++; + size = 37; +#endif + memcpy(device->data, packet, size); for (i = 1; i < 37; i += 9) diff --git a/input/drivers_hid/iohidmanager_hid.c b/input/drivers_hid/iohidmanager_hid.c index fb312f6e7c..78f68d651e 100644 --- a/input/drivers_hid/iohidmanager_hid.c +++ b/input/drivers_hid/iohidmanager_hid.c @@ -1021,6 +1021,8 @@ static int iohidmanager_hid_manager_set_device_matching( iohidmanager_hid_append_matching_dictionary(matcher, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad); + /* The GameCube Adapter reports usage id 0x00 */ + iohidmanager_hid_append_matching_dictionary(matcher, kHIDPage_Game, 0x00); IOHIDManagerSetDeviceMatchingMultiple(hid->ptr, matcher); IOHIDManagerRegisterDeviceMatchingCallback(hid->ptr,iohidmanager_hid_device_matched, 0);