mc.mitm: check vendor/product id when identifying official switch controllers before falling back to checking the name

This commit is contained in:
ndeadly 2023-08-24 10:18:37 +02:00
parent 9306dbe0d3
commit 913c89baf6

View file

@ -47,6 +47,13 @@ namespace ams::controller {
ControllerType Identify(const bluetooth::DevicesSettings *device) {
for (auto hwId : SwitchController::hardware_ids) {
if ( (device->vid == hwId.vid) && (device->pid == hwId.pid) ) {
return ControllerType_Switch;
}
}
// Additionally check controller name against known official Nintendo controllers, as some controllers (eg. JoyCons paired via rails) don't report the correct vid/pid
if (IsOfficialSwitchControllerName(hos::GetVersion() < hos::Version_13_0_0 ? device->name.name : device->name2))
return ControllerType_Switch;