(OSX) Fix support for gamepads that aren’t a WiiMote or DualShock 3.
This commit is contained in:
parent
ea897f4e46
commit
0073bef980
|
@ -130,10 +130,15 @@ static void hid_manager_device_attached(void* context, IOReturn result, void* se
|
|||
CFStringGetCString(device_name, buffer, 1024, kCFStringEncodingUTF8);
|
||||
|
||||
connection->slot = apple_joypad_connect(buffer, connection);
|
||||
IOHIDDeviceRegisterInputReportCallback(device, connection->data + 1, sizeof(connection->data) - 1, hid_device_report, connection);
|
||||
|
||||
if (apple_joypad_has_interface(connection->slot))
|
||||
{
|
||||
IOHIDDeviceRegisterInputReportCallback(device, connection->data + 1, sizeof(connection->data) - 1, hid_device_report, connection);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
IOHIDDeviceRegisterInputValueCallback(device, hid_device_input_callback, connection);
|
||||
|
||||
IOHIDDeviceRegisterInputValueCallback(device, hid_device_input_callback, connection);
|
||||
}
|
||||
|
||||
static void append_matching_dictionary(CFMutableArrayRef array, uint32_t page, uint32_t use)
|
||||
|
|
|
@ -58,6 +58,9 @@ int32_t apple_joypad_connect(const char* name, struct apple_pad_connection* conn
|
|||
void apple_joypad_disconnect(uint32_t slot);
|
||||
void apple_joypad_packet(uint32_t slot, uint8_t* data, uint32_t length);
|
||||
|
||||
// Determine if connected joypad is a hidpad backed device; if false apple_joypad_packet cannot be used
|
||||
bool apple_joypad_has_interface(uint32_t slot);
|
||||
|
||||
// This is implemented in the platform specific portions of the input code
|
||||
void apple_joypad_send_hid_control(struct apple_pad_connection* connection, uint8_t* data, size_t size);
|
||||
|
||||
|
|
|
@ -41,7 +41,10 @@ static int32_t find_empty_slot()
|
|||
{
|
||||
for (int i = 0; i != MAX_PLAYERS; i ++)
|
||||
if (!slots[i].used)
|
||||
{
|
||||
memset(&slots[i], 0, sizeof(slots[0]));
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -94,6 +97,12 @@ void apple_joypad_packet(uint32_t slot, uint8_t* data, uint32_t length)
|
|||
}
|
||||
}
|
||||
|
||||
bool apple_joypad_has_interface(uint32_t slot)
|
||||
{
|
||||
if (slot < MAX_PLAYERS && slots[slot].used)
|
||||
return slots[slot].iface ? true : false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// RetroArch joypad driver:
|
||||
static bool apple_joypad_init(void)
|
||||
|
|
Loading…
Reference in New Issue