mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-14 10:21:21 +00:00
sys_usbd: Fix emulated devices not being created without a physical device (#16608)
This commit is contained in:
parent
bd1ebb7a10
commit
f1f85335a7
@ -508,7 +508,7 @@ usb_handler_thread::usb_handler_thread()
|
||||
perform_scan();
|
||||
|
||||
// Set up emulated devices for any devices that are not already being passed through
|
||||
std::map<usb_allow_list_entry, int> emulate_device_check;
|
||||
std::map<usb_allow_list_entry, int> passthrough_usb_device_counts;
|
||||
for (const auto& dev : usb_devices)
|
||||
{
|
||||
for (const auto& entry : device_allow_list)
|
||||
@ -517,18 +517,19 @@ usb_handler_thread::usb_handler_thread()
|
||||
const u16 idProduct = dev->device._device.idProduct;
|
||||
if (entry.max_device_count != nullptr && (idVendor == entry.id_vendor && idProduct >= entry.id_product_min && idProduct <= entry.id_product_max))
|
||||
{
|
||||
emulate_device_check[entry]++;
|
||||
passthrough_usb_device_counts[entry]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [entry, count] : emulate_device_check)
|
||||
for (const auto& entry : device_allow_list)
|
||||
{
|
||||
if (entry.max_device_count && entry.make_instance)
|
||||
{
|
||||
const int count = passthrough_usb_device_counts[entry];
|
||||
for (int i = count; i < entry.max_device_count(); i++)
|
||||
{
|
||||
sys_usbd.success("Emulating device: %s (%d)", std::basic_string(entry.device_name), i);
|
||||
sys_usbd.success("Emulating device: %s (%d)", std::basic_string(entry.device_name), i + 1);
|
||||
auto usb_dev = entry.make_instance(i, get_new_location());
|
||||
connect_usb_device(usb_dev, true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user