mirror of
https://github.com/ndeadly/MissionControl
synced 2024-11-22 20:33:07 +00:00
btdrv-mitm: remove IsJoycon function and always check all official controller names instead
This commit is contained in:
parent
9f44f747f4
commit
41861b9d29
2 changed files with 5 additions and 11 deletions
|
@ -39,6 +39,7 @@ namespace ams::controller {
|
|||
}
|
||||
|
||||
ControllerType Identify(const BluetoothDevicesSettings *device) {
|
||||
|
||||
for (auto hwId : SwitchController::hardware_ids) {
|
||||
if ( (device->vid == hwId.vid) && (device->pid == hwId.pid) ) {
|
||||
return ControllerType_Switch;
|
||||
|
@ -92,11 +93,10 @@ namespace ams::controller {
|
|||
return ControllerType_Xiaomi;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the case where joycons have been assigned random hardware ids when paired via rails
|
||||
if (IsJoyCon(device->name)) {
|
||||
return ControllerType_Switch;;
|
||||
}
|
||||
|
||||
// Check for third party switch controllers or official switch controllers that have been assigned garbage IDs
|
||||
if (IsOfficialSwitchControllerName(device->name))
|
||||
return ControllerType_Switch;
|
||||
|
||||
return ControllerType_Unknown;
|
||||
}
|
||||
|
@ -106,11 +106,6 @@ namespace ams::controller {
|
|||
(((cod->cod[2] & 0x0f) == cod_minor_gamepad) || ((cod->cod[2] & 0x0f) == cod_minor_joystick));
|
||||
}
|
||||
|
||||
bool IsJoyCon(const char *name) {
|
||||
return std::strncmp(name, "Joy-Con (L)", sizeof(BluetoothName)) == 0 ||
|
||||
std::strncmp(name, "Joy-Con (R)", sizeof(BluetoothName)) == 0;
|
||||
}
|
||||
|
||||
bool IsOfficialSwitchControllerName(const char *name) {
|
||||
return std::strncmp(name, "Joy-Con (L)", sizeof(BluetoothName)) == 0 ||
|
||||
std::strncmp(name, "Joy-Con (R)", sizeof(BluetoothName)) == 0 ||
|
||||
|
|
|
@ -46,7 +46,6 @@ namespace ams::controller {
|
|||
|
||||
ControllerType Identify(const BluetoothDevicesSettings *device);
|
||||
bool IsGamepad(const bluetooth::DeviceClass *cod);
|
||||
bool IsJoyCon(const char *name);
|
||||
bool IsOfficialSwitchControllerName(const char *name);
|
||||
|
||||
void AttachHandler(const bluetooth::Address *address);
|
||||
|
|
Loading…
Reference in a new issue