mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Allow controllers with no/empty names to work.
This commit is contained in:
parent
e2e9d0fbb6
commit
5c58c6969e
@ -159,10 +159,12 @@ int32_t pad_connection_pad_init(joypad_connection_t *joyconn,
|
|||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
const bool has_name = !string_is_empty(name);
|
||||||
|
|
||||||
for (i = 0; name && pad_map[i].name; i++)
|
for (i = 0; name && pad_map[i].name; i++)
|
||||||
{
|
{
|
||||||
const char *name_match = strstr(pad_map[i].name, name);
|
const char *name_match = has_name ? strstr(pad_map[i].name, name) : NULL;
|
||||||
|
|
||||||
/* Never change, Nintendo. */
|
/* Never change, Nintendo. */
|
||||||
if(pad_map[i].vid == 1406 && pad_map[i].pid == 816)
|
if(pad_map[i].vid == 1406 && pad_map[i].pid == 816)
|
||||||
|
@ -684,6 +684,10 @@ static void iohidmanager_hid_device_add_device(
|
|||||||
if (adapter->slot == -1)
|
if (adapter->slot == -1)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (string_is_empty(adapter->name)) {
|
||||||
|
strcpy(adapter->name, "Unknown Controller With No Name");
|
||||||
|
}
|
||||||
|
|
||||||
if (pad_connection_has_interface(hid->slots, adapter->slot))
|
if (pad_connection_has_interface(hid->slots, adapter->slot))
|
||||||
IOHIDDeviceRegisterInputReportCallback(device,
|
IOHIDDeviceRegisterInputReportCallback(device,
|
||||||
adapter->data + 1, sizeof(adapter->data) - 1,
|
adapter->data + 1, sizeof(adapter->data) - 1,
|
||||||
@ -692,9 +696,6 @@ static void iohidmanager_hid_device_add_device(
|
|||||||
IOHIDDeviceRegisterInputValueCallback(device,
|
IOHIDDeviceRegisterInputValueCallback(device,
|
||||||
iohidmanager_hid_device_input_callback, adapter);
|
iohidmanager_hid_device_input_callback, adapter);
|
||||||
|
|
||||||
if (string_is_empty(adapter->name))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
/* scan for buttons, axis, hats */
|
/* scan for buttons, axis, hats */
|
||||||
elements_raw = IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
|
elements_raw = IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
|
||||||
count = (int)CFArrayGetCount(elements_raw);
|
count = (int)CFArrayGetCount(elements_raw);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user