mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
controllers/npad: Connect a controller on init if none are connected
This commit is contained in:
parent
5cafa70d3b
commit
c0c4ed0d3b
2 changed files with 15 additions and 1 deletions
|
@ -224,6 +224,19 @@ void Controller_NPad::OnInit() {
|
||||||
player.connected};
|
player.connected};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Connect the Player 1 or Handheld controller if none are connected.
|
||||||
|
if (std::none_of(connected_controllers.begin(), connected_controllers.end(),
|
||||||
|
[](const ControllerHolder& controller) { return controller.is_connected; })) {
|
||||||
|
const auto controller = MapSettingsTypeToNPad(Settings::values.players[0].controller_type);
|
||||||
|
if (controller == NPadControllerType::Handheld) {
|
||||||
|
Settings::values.players[HANDHELD_INDEX].connected = true;
|
||||||
|
connected_controllers[HANDHELD_INDEX] = {controller, true};
|
||||||
|
} else {
|
||||||
|
Settings::values.players[0].connected = true;
|
||||||
|
connected_controllers[0] = {controller, true};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Account for handheld
|
// Account for handheld
|
||||||
if (connected_controllers[HANDHELD_INDEX].is_connected) {
|
if (connected_controllers[HANDHELD_INDEX].is_connected) {
|
||||||
connected_controllers[HANDHELD_INDEX].type = NPadControllerType::Handheld;
|
connected_controllers[HANDHELD_INDEX].type = NPadControllerType::Handheld;
|
||||||
|
|
|
@ -280,7 +280,8 @@ void Config::ReadPlayerValue(std::size_t player_index) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.connected =
|
player.connected =
|
||||||
ReadSetting(QStringLiteral("%1connected").arg(player_prefix), false).toBool();
|
ReadSetting(QStringLiteral("%1connected").arg(player_prefix), player_index == 0)
|
||||||
|
.toBool();
|
||||||
|
|
||||||
player.controller_type = static_cast<Settings::ControllerType>(
|
player.controller_type = static_cast<Settings::ControllerType>(
|
||||||
qt_config
|
qt_config
|
||||||
|
|
Loading…
Reference in a new issue