|
|
@ -720,92 +720,4 @@ bool Controller_NPad::IsControllerSupported(NPadControllerType controller) const
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Controller_NPad::NPadControllerType Controller_NPad::DecideBestController(
|
|
|
|
|
|
|
|
NPadControllerType priority) const {
|
|
|
|
|
|
|
|
if (IsControllerSupported(priority)) {
|
|
|
|
|
|
|
|
return priority;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto is_docked = Settings::values.use_docked_mode;
|
|
|
|
|
|
|
|
if (is_docked && priority == NPadControllerType::Handheld) {
|
|
|
|
|
|
|
|
priority = NPadControllerType::JoyDual;
|
|
|
|
|
|
|
|
if (IsControllerSupported(priority)) {
|
|
|
|
|
|
|
|
return priority;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<NPadControllerType> priority_list;
|
|
|
|
|
|
|
|
switch (priority) {
|
|
|
|
|
|
|
|
case NPadControllerType::ProController:
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyDual);
|
|
|
|
|
|
|
|
if (!is_docked) {
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Handheld);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyLeft);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyRight);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Pokeball);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NPadControllerType::Handheld:
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyDual);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::ProController);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyLeft);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyRight);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Pokeball);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NPadControllerType::JoyDual:
|
|
|
|
|
|
|
|
if (!is_docked) {
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Handheld);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::ProController);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyLeft);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyRight);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Pokeball);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NPadControllerType::JoyLeft:
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyRight);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyDual);
|
|
|
|
|
|
|
|
if (!is_docked) {
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Handheld);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::ProController);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Pokeball);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NPadControllerType::JoyRight:
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyLeft);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyDual);
|
|
|
|
|
|
|
|
if (!is_docked) {
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Handheld);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::ProController);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Pokeball);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NPadControllerType::Pokeball:
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyLeft);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyRight);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyDual);
|
|
|
|
|
|
|
|
if (!is_docked) {
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Handheld);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::ProController);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyDual);
|
|
|
|
|
|
|
|
if (!is_docked) {
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::Handheld);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::ProController);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyLeft);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyRight);
|
|
|
|
|
|
|
|
priority_list.push_back(NPadControllerType::JoyDual);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const auto iter = std::find_if(priority_list.begin(), priority_list.end(),
|
|
|
|
|
|
|
|
[this](auto type) { return IsControllerSupported(type); });
|
|
|
|
|
|
|
|
if (iter == priority_list.end()) {
|
|
|
|
|
|
|
|
UNIMPLEMENTED_MSG("Could not find supported controller!");
|
|
|
|
|
|
|
|
return priority;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return *iter;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Service::HID
|
|
|
|
} // namespace Service::HID
|
|
|
|