Only add real HID devices to HID list.
This commit is contained in:
parent
b372f97675
commit
e805bf6068
|
@ -385,12 +385,12 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
|
||||||
Memory::WriteBigEData((const u8*)&wii_device, OffsetBuffer, Align(wii_device.bLength, 4));
|
Memory::WriteBigEData((const u8*)&wii_device, OffsetBuffer, Align(wii_device.bLength, 4));
|
||||||
OffsetBuffer += Align(wii_device.bLength, 4);
|
OffsetBuffer += Align(wii_device.bLength, 4);
|
||||||
bool deviceValid = true;
|
bool deviceValid = true;
|
||||||
|
bool isHID = false;
|
||||||
|
|
||||||
for (c = 0; deviceValid && c < desc.bNumConfigurations; c++)
|
for (c = 0; deviceValid && c < desc.bNumConfigurations; c++)
|
||||||
{
|
{
|
||||||
struct libusb_config_descriptor *config = NULL;
|
struct libusb_config_descriptor *config = NULL;
|
||||||
int cRet = libusb_get_config_descriptor(device, c, &config);
|
int cRet = libusb_get_config_descriptor(device, c, &config);
|
||||||
|
|
||||||
// do not try to use usb devices with more than one interface, games can crash
|
// do not try to use usb devices with more than one interface, games can crash
|
||||||
if(cRet == 0 && config->bNumInterfaces <= MAX_HID_INTERFACES)
|
if(cRet == 0 && config->bNumInterfaces <= MAX_HID_INTERFACES)
|
||||||
{
|
{
|
||||||
|
@ -402,10 +402,14 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
|
||||||
for (ic = 0; ic < config->bNumInterfaces; ic++)
|
for (ic = 0; ic < config->bNumInterfaces; ic++)
|
||||||
{
|
{
|
||||||
const struct libusb_interface *interfaceContainer = &config->interface[ic];
|
const struct libusb_interface *interfaceContainer = &config->interface[ic];
|
||||||
|
|
||||||
for (i = 0; i < interfaceContainer->num_altsetting; i++)
|
for (i = 0; i < interfaceContainer->num_altsetting; i++)
|
||||||
{
|
{
|
||||||
const struct libusb_interface_descriptor *interface = &interfaceContainer->altsetting[i];
|
const struct libusb_interface_descriptor *interface = &interfaceContainer->altsetting[i];
|
||||||
|
|
||||||
|
if (interface->bInterfaceClass == LIBUSB_CLASS_HID)
|
||||||
|
isHID = true;
|
||||||
|
|
||||||
WiiHIDInterfaceDescriptor wii_interface;
|
WiiHIDInterfaceDescriptor wii_interface;
|
||||||
ConvertInterfaceToWii(&wii_interface, interface);
|
ConvertInterfaceToWii(&wii_interface, interface);
|
||||||
Memory::WriteBigEData((const u8*)&wii_interface, OffsetBuffer, Align(wii_interface.bLength, 4));
|
Memory::WriteBigEData((const u8*)&wii_interface, OffsetBuffer, Align(wii_interface.bLength, 4));
|
||||||
|
@ -435,6 +439,12 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
|
||||||
}
|
}
|
||||||
} // configs
|
} // configs
|
||||||
|
|
||||||
|
if (!isHID)
|
||||||
|
{
|
||||||
|
deviceValid = false;
|
||||||
|
OffsetBuffer = OffsetStart;
|
||||||
|
}
|
||||||
|
|
||||||
if (deviceValid)
|
if (deviceValid)
|
||||||
{
|
{
|
||||||
Memory::Write_U32(OffsetBuffer-OffsetStart, OffsetStart); // fill in length
|
Memory::Write_U32(OffsetBuffer-OffsetStart, OffsetStart); // fill in length
|
||||||
|
|
Loading…
Reference in New Issue