sys_usbd: don't passthrough a real device when its emulation is enabled (macOS)

On macOS libusb cannot claim HID interfaces, so passing through a real
controller that also has an emulated implementation yields a non-functional
device that silently overrides the user's emulated-device setting (the
emulated setup only fills slots not already passed through). The game then
binds the dead passthrough device and reports no controller. On macOS, skip
passthrough for a device when the user has enabled its emulation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Alain Williams 2026-06-28 18:45:57 +02:00
parent 400989c3a6
commit 47cc5e1782

View File

@ -391,6 +391,17 @@ void usb_handler_thread::perform_scan()
&& desc.idProduct >= entry.id_product_min
&& desc.idProduct <= entry.id_product_max)
{
#ifdef __APPLE__
// On macOS, libusb cannot claim HID interfaces, so passing through a real
// controller that also has an emulated implementation yields a non-functional
// device and silently overrides the user's emulated-device setting (the emulated
// setup below only fills slots not already passed through). Prefer the emulated
// implementation whenever the user has enabled it. (e.g. DJ Hero Turntable)
if (entry.make_instance && entry.max_device_count && entry.max_device_count() > 0)
{
continue;
}
#endif
sys_usbd.success("Found device: %s", std::basic_string(entry.device_name));
libusb_ref_device(dev);
std::shared_ptr<usb_device_passthrough> usb_dev = std::make_shared<usb_device_passthrough>(dev, desc, get_new_location());