usb_device: present wii instruments as PS3 instruments (#18796)

The instruments work exactly the same but the IDs are different, so
doing this allows them to work in games
This commit is contained in:
Sanjay Govind 2026-06-06 03:08:46 +08:00 committed by GitHub
parent 8d9abd396b
commit 546f3082a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 40 additions and 0 deletions

View File

@ -75,6 +75,42 @@ usb_device_passthrough::usb_device_passthrough(libusb_device* _device, libusb_de
{
device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor{desc.bcdUSB, desc.bDeviceClass, desc.bDeviceSubClass, desc.bDeviceProtocol, desc.bMaxPacketSize0, desc.idVendor, desc.idProduct,
desc.bcdDevice, desc.iManufacturer, desc.iProduct, desc.iSerialNumber, desc.bNumConfigurations});
patch_descriptors();
}
void usb_device_passthrough::patch_descriptors()
{
// Patch Wii vids and pids so they are presented to the console as PS3 instruments
if (device._device.idVendor == 0x1BAD) // Harmonix
{
switch (device._device.idProduct)
{
case 0x0004: // Harmonix RB1 Guitar - Wii
case 0x3010: // Harmonix RB2 Guitar - Wii
device._device.idVendor = 0x12BA; // SCEA
device._device.idProduct = 0x0200; // Harmonix Guitar
break;
case 0x0005: // Harmonix RB1 Drums - Wii
case 0x3110: // Harmonix RB2 Drums - Wii
device._device.idVendor = 0x12BA; // SCEA
device._device.idProduct = 0x0210; // Harmonix Drums
break;
case 0x3330: // Harmonix Keyboard - Wii
device._device.idVendor = 0x12BA; // SCEA
device._device.idProduct = 0x2330; // Harmonix Keyboard
break;
case 0x3430: // Harmonix Button Guitar - Wii
device._device.idVendor = 0x12BA; // SCEA
device._device.idProduct = 0x2430; // Harmonix Button Guitar
break;
case 0x3530: // Harmonix Real Guitar - Wii
device._device.idVendor = 0x12BA; // SCEA
device._device.idProduct = 0x2530; // Harmonix Real Guitar
break;
default:
break;
}
}
}
usb_device_passthrough::~usb_device_passthrough()
@ -153,6 +189,7 @@ void usb_device_passthrough::read_descriptors()
index += buf[index];
}
}
patch_descriptors();
}
u32 usb_device_passthrough::get_configuration(u8* buf)

View File

@ -277,6 +277,9 @@ protected:
protected:
libusb_device* lusb_device = nullptr;
libusb_device_handle* lusb_handle = nullptr;
private:
void patch_descriptors();
};
class usb_device_emulated : public usb_device