diff options
| author | 2021-05-25 13:02:20 -0700 | |
|---|---|---|
| committer | 2021-05-25 13:02:20 -0700 | |
| commit | 4bf53eb935fcffb1aa86d26ef61df99107e4cf2d (patch) | |
| tree | 3dd0e8be18de786b841ddb7ddbc69d2c18bfb869 /src | |
| parent | Merge pull request #6358 from Morph1984/k_map_region (diff) | |
| parent | settings: Forbid docked mode on handheld (diff) | |
| download | yuzu-4bf53eb935fcffb1aa86d26ef61df99107e4cf2d.tar.gz yuzu-4bf53eb935fcffb1aa86d26ef61df99107e4cf2d.tar.xz yuzu-4bf53eb935fcffb1aa86d26ef61df99107e4cf2d.zip | |
Merge pull request #6353 from german77/handheld_docked
settings: Forbid docked mode on handheld
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 7 | ||||
| -rw-r--r-- | src/yuzu/debugger/controller.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 20 |
3 files changed, 24 insertions, 4 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 125feb86b..21d1dc174 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -514,6 +514,13 @@ void Config::ReadControlValues() { | |||
| 514 | ReadSetting(QStringLiteral("mouse_panning_sensitivity"), 1).toFloat(); | 514 | ReadSetting(QStringLiteral("mouse_panning_sensitivity"), 1).toFloat(); |
| 515 | 515 | ||
| 516 | ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), true); | 516 | ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), true); |
| 517 | |||
| 518 | // Disable docked mode if handheld is selected | ||
| 519 | const auto controller_type = Settings::values.players.GetValue()[0].controller_type; | ||
| 520 | if (controller_type == Settings::ControllerType::Handheld) { | ||
| 521 | Settings::values.use_docked_mode.SetValue(false); | ||
| 522 | } | ||
| 523 | |||
| 517 | ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"), | 524 | ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"), |
| 518 | true); | 525 | true); |
| 519 | ReadSettingGlobal(Settings::values.enable_accurate_vibrations, | 526 | ReadSettingGlobal(Settings::values.enable_accurate_vibrations, |
diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp index 7186eac76..d85408ac6 100644 --- a/src/yuzu/debugger/controller.cpp +++ b/src/yuzu/debugger/controller.cpp | |||
| @@ -38,6 +38,7 @@ void ControllerDialog::refreshConfiguration() { | |||
| 38 | widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs); | 38 | widget->SetPlayerInputRaw(player, players[player].buttons, players[player].analogs); |
| 39 | widget->SetConnectedStatus(players[player].connected); | 39 | widget->SetConnectedStatus(players[player].connected); |
| 40 | widget->SetControllerType(players[player].controller_type); | 40 | widget->SetControllerType(players[player].controller_type); |
| 41 | widget->repaint(); | ||
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | QAction* ControllerDialog::toggleViewAction() { | 44 | QAction* ControllerDialog::toggleViewAction() { |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 9275cba53..bc97f9d53 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -773,10 +773,22 @@ void GMainWindow::InitializeWidgets() { | |||
| 773 | dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); | 773 | dock_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); |
| 774 | dock_status_button->setFocusPolicy(Qt::NoFocus); | 774 | dock_status_button->setFocusPolicy(Qt::NoFocus); |
| 775 | connect(dock_status_button, &QPushButton::clicked, [&] { | 775 | connect(dock_status_button, &QPushButton::clicked, [&] { |
| 776 | Settings::values.use_docked_mode.SetValue(!Settings::values.use_docked_mode.GetValue()); | 776 | const bool is_docked = Settings::values.use_docked_mode.GetValue(); |
| 777 | dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); | 777 | auto& controller_type = Settings::values.players.GetValue()[0].controller_type; |
| 778 | OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(), | 778 | |
| 779 | Settings::values.use_docked_mode.GetValue()); | 779 | if (!is_docked && controller_type == Settings::ControllerType::Handheld) { |
| 780 | QMessageBox::warning(this, tr("Invalid config detected"), | ||
| 781 | tr("Handheld controller can't be used on docked mode. Pro " | ||
| 782 | "controller will be selected.")); | ||
| 783 | controller_type = Settings::ControllerType::ProController; | ||
| 784 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); | ||
| 785 | configure_dialog.ApplyConfiguration(); | ||
| 786 | controller_dialog->refreshConfiguration(); | ||
| 787 | } | ||
| 788 | |||
| 789 | Settings::values.use_docked_mode.SetValue(!is_docked); | ||
| 790 | dock_status_button->setChecked(!is_docked); | ||
| 791 | OnDockedModeChanged(is_docked, !is_docked); | ||
| 780 | }); | 792 | }); |
| 781 | dock_status_button->setText(tr("DOCK")); | 793 | dock_status_button->setText(tr("DOCK")); |
| 782 | dock_status_button->setCheckable(true); | 794 | dock_status_button->setCheckable(true); |