diff options
| author | 2018-11-04 10:18:59 -0500 | |
|---|---|---|
| committer | 2018-11-18 23:22:36 -0500 | |
| commit | e58c951a59d7f3851fd3a71ae6f99933fba8cdbb (patch) | |
| tree | c4a90063f114439c9860db718d1fd3d3ad58f55a /src | |
| parent | hid: Use player-defined controller type as PREFERRED_CONTROLLER (diff) | |
| download | yuzu-e58c951a59d7f3851fd3a71ae6f99933fba8cdbb.tar.gz yuzu-e58c951a59d7f3851fd3a71ae6f99933fba8cdbb.tar.xz yuzu-e58c951a59d7f3851fd3a71ae6f99933fba8cdbb.zip | |
configure_input: Make None a controller option instead of checkbox
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_general.cpp | 36 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_general.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_general.ui | 9 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.cpp | 113 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.h | 7 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.ui | 120 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_mouse_advanced.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_mouse_advanced.h | 1 |
11 files changed, 148 insertions, 152 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 652f6a0b7..e24ed5f2b 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <QSettings> | 5 | #include <QSettings> |
| 6 | #include "common/file_util.h" | 6 | #include "common/file_util.h" |
| 7 | #include "core/hle/service/acc/profile_manager.h" | 7 | #include "core/hle/service/acc/profile_manager.h" |
| 8 | #include "core/hle/service/hid/controllers/npad.h" | ||
| 8 | #include "input_common/main.h" | 9 | #include "input_common/main.h" |
| 9 | #include "yuzu/configuration/config.h" | 10 | #include "yuzu/configuration/config.h" |
| 10 | #include "yuzu/ui_settings.h" | 11 | #include "yuzu/ui_settings.h" |
| @@ -262,8 +263,11 @@ void Config::ReadPlayerValues() { | |||
| 262 | } | 263 | } |
| 263 | } | 264 | } |
| 264 | 265 | ||
| 265 | std::stable_partition(Settings::values.players.begin(), Settings::values.players.end(), | 266 | std::stable_partition( |
| 266 | [](const auto& player) { return player.connected; }); | 267 | Settings::values.players.begin(), |
| 268 | Settings::values.players.begin() + | ||
| 269 | Service::HID::Controller_NPad::NPadIdToIndex(Service::HID::NPAD_HANDHELD), | ||
| 270 | [](const auto& player) { return player.connected; }); | ||
| 267 | } | 271 | } |
| 268 | 272 | ||
| 269 | void Config::ReadDebugValues() { | 273 | void Config::ReadDebugValues() { |
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index c22742007..92a441308 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -3,10 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/core.h" | 5 | #include "core/core.h" |
| 6 | #include "core/hle/service/am/am.h" | ||
| 7 | #include "core/hle/service/am/applet_ae.h" | ||
| 8 | #include "core/hle/service/am/applet_oe.h" | ||
| 9 | #include "core/hle/service/sm/sm.h" | ||
| 10 | #include "core/settings.h" | 6 | #include "core/settings.h" |
| 11 | #include "ui_configure_general.h" | 7 | #include "ui_configure_general.h" |
| 12 | #include "yuzu/configuration/configure_general.h" | 8 | #include "yuzu/configuration/configure_general.h" |
| @@ -36,7 +32,6 @@ void ConfigureGeneral::setConfiguration() { | |||
| 36 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); | 32 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); |
| 37 | ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); | 33 | ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); |
| 38 | ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit); | 34 | ui->use_cpu_jit->setChecked(Settings::values.use_cpu_jit); |
| 39 | ui->use_docked_mode->setChecked(Settings::values.use_docked_mode); | ||
| 40 | ui->enable_nfc->setChecked(Settings::values.enable_nfc); | 35 | ui->enable_nfc->setChecked(Settings::values.enable_nfc); |
| 41 | } | 36 | } |
| 42 | 37 | ||
| @@ -44,33 +39,6 @@ void ConfigureGeneral::PopulateHotkeyList(const HotkeyRegistry& registry) { | |||
| 44 | ui->widget->Populate(registry); | 39 | ui->widget->Populate(registry); |
| 45 | } | 40 | } |
| 46 | 41 | ||
| 47 | void ConfigureGeneral::OnDockedModeChanged(bool last_state, bool new_state) { | ||
| 48 | if (last_state == new_state) { | ||
| 49 | return; | ||
| 50 | } | ||
| 51 | |||
| 52 | Core::System& system{Core::System::GetInstance()}; | ||
| 53 | if (!system.IsPoweredOn()) { | ||
| 54 | return; | ||
| 55 | } | ||
| 56 | Service::SM::ServiceManager& sm = system.ServiceManager(); | ||
| 57 | |||
| 58 | // Message queue is shared between these services, we just need to signal an operation | ||
| 59 | // change to one and it will handle both automatically | ||
| 60 | auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); | ||
| 61 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); | ||
| 62 | bool has_signalled = false; | ||
| 63 | |||
| 64 | if (applet_oe != nullptr) { | ||
| 65 | applet_oe->GetMessageQueue()->OperationModeChanged(); | ||
| 66 | has_signalled = true; | ||
| 67 | } | ||
| 68 | |||
| 69 | if (applet_ae != nullptr && !has_signalled) { | ||
| 70 | applet_ae->GetMessageQueue()->OperationModeChanged(); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | void ConfigureGeneral::applyConfiguration() { | 42 | void ConfigureGeneral::applyConfiguration() { |
| 75 | UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked(); | 43 | UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked(); |
| 76 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); | 44 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); |
| @@ -78,9 +46,5 @@ void ConfigureGeneral::applyConfiguration() { | |||
| 78 | ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); | 46 | ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); |
| 79 | 47 | ||
| 80 | Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked(); | 48 | Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked(); |
| 81 | const bool pre_docked_mode = Settings::values.use_docked_mode; | ||
| 82 | Settings::values.use_docked_mode = ui->use_docked_mode->isChecked(); | ||
| 83 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode); | ||
| 84 | |||
| 85 | Settings::values.enable_nfc = ui->enable_nfc->isChecked(); | 49 | Settings::values.enable_nfc = ui->enable_nfc->isChecked(); |
| 86 | } | 50 | } |
diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index 2210d48da..4770034cc 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h | |||
| @@ -25,7 +25,6 @@ public: | |||
| 25 | 25 | ||
| 26 | private: | 26 | private: |
| 27 | void setConfiguration(); | 27 | void setConfiguration(); |
| 28 | void OnDockedModeChanged(bool last_state, bool new_state); | ||
| 29 | 28 | ||
| 30 | std::unique_ptr<Ui::ConfigureGeneral> ui; | 29 | std::unique_ptr<Ui::ConfigureGeneral> ui; |
| 31 | }; | 30 | }; |
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index b82fffde8..bf37446c6 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>300</width> | 9 | <width>300</width> |
| 10 | <height>377</height> | 10 | <height>407</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| @@ -72,13 +72,6 @@ | |||
| 72 | <item> | 72 | <item> |
| 73 | <layout class="QVBoxLayout" name="EmulationVerticalLayout"> | 73 | <layout class="QVBoxLayout" name="EmulationVerticalLayout"> |
| 74 | <item> | 74 | <item> |
| 75 | <widget class="QCheckBox" name="use_docked_mode"> | ||
| 76 | <property name="text"> | ||
| 77 | <string>Enable docked mode</string> | ||
| 78 | </property> | ||
| 79 | </widget> | ||
| 80 | </item> | ||
| 81 | <item> | ||
| 82 | <widget class="QCheckBox" name="enable_nfc"> | 75 | <widget class="QCheckBox" name="enable_nfc"> |
| 83 | <property name="text"> | 76 | <property name="text"> |
| 84 | <string>Enable NFC</string> | 77 | <string>Enable NFC</string> |
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index a52abdd8f..25066d4d9 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp | |||
| @@ -11,7 +11,11 @@ | |||
| 11 | #include "common/param_package.h" | 11 | #include "common/param_package.h" |
| 12 | #include "configuration/configure_touchscreen_advanced.h" | 12 | #include "configuration/configure_touchscreen_advanced.h" |
| 13 | #include "core/core.h" | 13 | #include "core/core.h" |
| 14 | #include "core/hle/service/am/am.h" | ||
| 15 | #include "core/hle/service/am/applet_ae.h" | ||
| 16 | #include "core/hle/service/am/applet_oe.h" | ||
| 14 | #include "core/hle/service/hid/controllers/npad.h" | 17 | #include "core/hle/service/hid/controllers/npad.h" |
| 18 | #include "core/hle/service/sm/sm.h" | ||
| 15 | #include "input_common/main.h" | 19 | #include "input_common/main.h" |
| 16 | #include "ui_configure_input.h" | 20 | #include "ui_configure_input.h" |
| 17 | #include "ui_configure_input_player.h" | 21 | #include "ui_configure_input_player.h" |
| @@ -26,24 +30,19 @@ ConfigureInput::ConfigureInput(QWidget* parent) | |||
| 26 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()) { | 30 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()) { |
| 27 | ui->setupUi(this); | 31 | ui->setupUi(this); |
| 28 | 32 | ||
| 29 | players_enabled = { | 33 | players_controller = { |
| 30 | ui->player1_checkbox, ui->player2_checkbox, ui->player3_checkbox, ui->player4_checkbox, | ||
| 31 | ui->player5_checkbox, ui->player6_checkbox, ui->player7_checkbox, ui->player8_checkbox, | ||
| 32 | }; | ||
| 33 | |||
| 34 | player_controller = { | ||
| 35 | ui->player1_combobox, ui->player2_combobox, ui->player3_combobox, ui->player4_combobox, | 34 | ui->player1_combobox, ui->player2_combobox, ui->player3_combobox, ui->player4_combobox, |
| 36 | ui->player5_combobox, ui->player6_combobox, ui->player7_combobox, ui->player8_combobox, | 35 | ui->player5_combobox, ui->player6_combobox, ui->player7_combobox, ui->player8_combobox, |
| 37 | }; | 36 | }; |
| 38 | 37 | ||
| 39 | player_configure = { | 38 | players_configure = { |
| 40 | ui->player1_configure, ui->player2_configure, ui->player3_configure, ui->player4_configure, | 39 | ui->player1_configure, ui->player2_configure, ui->player3_configure, ui->player4_configure, |
| 41 | ui->player5_configure, ui->player6_configure, ui->player7_configure, ui->player8_configure, | 40 | ui->player5_configure, ui->player6_configure, ui->player7_configure, ui->player8_configure, |
| 42 | }; | 41 | }; |
| 43 | 42 | ||
| 44 | for (auto* controller_box : player_controller) { | 43 | for (auto* controller_box : players_controller) { |
| 45 | controller_box->addItems( | 44 | controller_box->addItems({"None", "Pro Controller", "Dual Joycons", "Single Right Joycon", |
| 46 | {"Pro Controller", "Dual Joycons", "Single Right Joycon", "Single Left Joycon"}); | 45 | "Single Left Joycon"}); |
| 47 | } | 46 | } |
| 48 | 47 | ||
| 49 | this->loadConfiguration(); | 48 | this->loadConfiguration(); |
| @@ -52,8 +51,9 @@ ConfigureInput::ConfigureInput(QWidget* parent) | |||
| 52 | connect(ui->restore_defaults_button, &QPushButton::pressed, this, | 51 | connect(ui->restore_defaults_button, &QPushButton::pressed, this, |
| 53 | &ConfigureInput::restoreDefaults); | 52 | &ConfigureInput::restoreDefaults); |
| 54 | 53 | ||
| 55 | for (auto* enabled : players_enabled) | 54 | for (auto* enabled : players_controller) |
| 56 | connect(enabled, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled); | 55 | connect(enabled, QOverload<int>::of(&QComboBox::currentIndexChanged), this, |
| 56 | &ConfigureInput::updateUIEnabled); | ||
| 57 | connect(ui->use_docked_mode, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled); | 57 | connect(ui->use_docked_mode, &QCheckBox::stateChanged, this, &ConfigureInput::updateUIEnabled); |
| 58 | connect(ui->handheld_connected, &QCheckBox::stateChanged, this, | 58 | connect(ui->handheld_connected, &QCheckBox::stateChanged, this, |
| 59 | &ConfigureInput::updateUIEnabled); | 59 | &ConfigureInput::updateUIEnabled); |
| @@ -63,8 +63,8 @@ ConfigureInput::ConfigureInput(QWidget* parent) | |||
| 63 | connect(ui->touchscreen_enabled, &QCheckBox::stateChanged, this, | 63 | connect(ui->touchscreen_enabled, &QCheckBox::stateChanged, this, |
| 64 | &ConfigureInput::updateUIEnabled); | 64 | &ConfigureInput::updateUIEnabled); |
| 65 | 65 | ||
| 66 | for (std::size_t i = 0; i < player_configure.size(); ++i) { | 66 | for (std::size_t i = 0; i < players_configure.size(); ++i) { |
| 67 | connect(player_configure[i], &QPushButton::pressed, this, | 67 | connect(players_configure[i], &QPushButton::pressed, this, |
| 68 | [this, i]() { CallConfigureDialog<ConfigureInputPlayer>(i, false); }); | 68 | [this, i]() { CallConfigureDialog<ConfigureInputPlayer>(i, false); }); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| @@ -79,8 +79,6 @@ ConfigureInput::ConfigureInput(QWidget* parent) | |||
| 79 | 79 | ||
| 80 | connect(ui->touchscreen_advanced, &QPushButton::pressed, this, | 80 | connect(ui->touchscreen_advanced, &QPushButton::pressed, this, |
| 81 | [this]() { CallConfigureDialog<ConfigureTouchscreenAdvanced>(); }); | 81 | [this]() { CallConfigureDialog<ConfigureTouchscreenAdvanced>(); }); |
| 82 | |||
| 83 | ui->use_docked_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn()); | ||
| 84 | } | 82 | } |
| 85 | 83 | ||
| 86 | template <typename Dialog, typename... Args> | 84 | template <typename Dialog, typename... Args> |
| @@ -94,14 +92,50 @@ void ConfigureInput::CallConfigureDialog(Args&&... args) { | |||
| 94 | } | 92 | } |
| 95 | } | 93 | } |
| 96 | 94 | ||
| 95 | void ConfigureInput::OnDockedModeChanged(bool last_state, bool new_state) { | ||
| 96 | if (last_state == new_state) { | ||
| 97 | return; | ||
| 98 | } | ||
| 99 | |||
| 100 | Core::System& system{Core::System::GetInstance()}; | ||
| 101 | if (!system.IsPoweredOn()) { | ||
| 102 | return; | ||
| 103 | } | ||
| 104 | Service::SM::ServiceManager& sm = system.ServiceManager(); | ||
| 105 | |||
| 106 | // Message queue is shared between these services, we just need to signal an operation | ||
| 107 | // change to one and it will handle both automatically | ||
| 108 | auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); | ||
| 109 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); | ||
| 110 | bool has_signalled = false; | ||
| 111 | |||
| 112 | if (applet_oe != nullptr) { | ||
| 113 | applet_oe->GetMessageQueue()->OperationModeChanged(); | ||
| 114 | has_signalled = true; | ||
| 115 | } | ||
| 116 | |||
| 117 | if (applet_ae != nullptr && !has_signalled) { | ||
| 118 | applet_ae->GetMessageQueue()->OperationModeChanged(); | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 97 | void ConfigureInput::applyConfiguration() { | 122 | void ConfigureInput::applyConfiguration() { |
| 98 | for (std::size_t i = 0; i < players_enabled.size(); ++i) { | 123 | for (std::size_t i = 0; i < players_controller.size(); ++i) { |
| 99 | Settings::values.players[i].connected = players_enabled[i]->isChecked(); | 124 | const auto controller_type_index = players_controller[i]->currentIndex(); |
| 100 | Settings::values.players[i].type = | 125 | |
| 101 | static_cast<Settings::ControllerType>(player_controller[i]->currentIndex()); | 126 | Settings::values.players[i].connected = controller_type_index != 0; |
| 127 | |||
| 128 | if (controller_type_index > 0) { | ||
| 129 | Settings::values.players[i].type = | ||
| 130 | static_cast<Settings::ControllerType>(controller_type_index - 1); | ||
| 131 | } else { | ||
| 132 | Settings::values.players[i].type = Settings::ControllerType::DualJoycon; | ||
| 133 | } | ||
| 102 | } | 134 | } |
| 103 | 135 | ||
| 136 | const bool pre_docked_mode = Settings::values.use_docked_mode; | ||
| 104 | Settings::values.use_docked_mode = ui->use_docked_mode->isChecked(); | 137 | Settings::values.use_docked_mode = ui->use_docked_mode->isChecked(); |
| 138 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode); | ||
| 105 | Settings::values | 139 | Settings::values |
| 106 | .players[Service::HID::Controller_NPad::NPadIdToIndex(Service::HID::NPAD_HANDHELD)] | 140 | .players[Service::HID::Controller_NPad::NPadIdToIndex(Service::HID::NPAD_HANDHELD)] |
| 107 | .connected = ui->handheld_connected->isChecked(); | 141 | .connected = ui->handheld_connected->isChecked(); |
| @@ -112,20 +146,17 @@ void ConfigureInput::applyConfiguration() { | |||
| 112 | } | 146 | } |
| 113 | 147 | ||
| 114 | void ConfigureInput::updateUIEnabled() { | 148 | void ConfigureInput::updateUIEnabled() { |
| 115 | for (std::size_t i = 0; i < players_enabled.size(); ++i) { | ||
| 116 | const auto enabled = players_enabled[i]->checkState() == Qt::Checked; | ||
| 117 | |||
| 118 | player_controller[i]->setEnabled(enabled); | ||
| 119 | player_configure[i]->setEnabled(enabled); | ||
| 120 | } | ||
| 121 | |||
| 122 | bool hit_disabled = false; | 149 | bool hit_disabled = false; |
| 123 | for (auto* player : players_enabled) { | 150 | for (auto* player : players_controller) { |
| 124 | player->setDisabled(hit_disabled); | 151 | player->setDisabled(hit_disabled); |
| 125 | if (!player->isChecked()) | 152 | if (!hit_disabled && player->currentIndex() == 0) |
| 126 | hit_disabled = true; | 153 | hit_disabled = true; |
| 127 | } | 154 | } |
| 128 | 155 | ||
| 156 | for (std::size_t i = 0; i < players_controller.size(); ++i) { | ||
| 157 | players_configure[i]->setEnabled(players_controller[i]->currentIndex() != 0); | ||
| 158 | } | ||
| 159 | |||
| 129 | ui->handheld_connected->setEnabled(!ui->use_docked_mode->isChecked()); | 160 | ui->handheld_connected->setEnabled(!ui->use_docked_mode->isChecked()); |
| 130 | ui->handheld_configure->setEnabled(ui->handheld_connected->isChecked() && | 161 | ui->handheld_configure->setEnabled(ui->handheld_connected->isChecked() && |
| 131 | !ui->use_docked_mode->isChecked()); | 162 | !ui->use_docked_mode->isChecked()); |
| @@ -135,12 +166,16 @@ void ConfigureInput::updateUIEnabled() { | |||
| 135 | } | 166 | } |
| 136 | 167 | ||
| 137 | void ConfigureInput::loadConfiguration() { | 168 | void ConfigureInput::loadConfiguration() { |
| 138 | std::stable_partition(Settings::values.players.begin(), Settings::values.players.end(), | 169 | std::stable_partition( |
| 139 | [](const auto& player) { return player.connected; }); | 170 | Settings::values.players.begin(), |
| 140 | 171 | Settings::values.players.begin() + | |
| 141 | for (std::size_t i = 0; i < players_enabled.size(); ++i) { | 172 | Service::HID::Controller_NPad::NPadIdToIndex(Service::HID::NPAD_HANDHELD), |
| 142 | players_enabled[i]->setChecked(Settings::values.players[i].connected); | 173 | [](const auto& player) { return player.connected; }); |
| 143 | player_controller[i]->setCurrentIndex(static_cast<u8>(Settings::values.players[i].type)); | 174 | |
| 175 | for (std::size_t i = 0; i < players_controller.size(); ++i) { | ||
| 176 | const auto connected = Settings::values.players[i].connected; | ||
| 177 | players_controller[i]->setCurrentIndex( | ||
| 178 | connected ? static_cast<u8>(Settings::values.players[i].type) + 1 : 0); | ||
| 144 | } | 179 | } |
| 145 | 180 | ||
| 146 | ui->use_docked_mode->setChecked(Settings::values.use_docked_mode); | 181 | ui->use_docked_mode->setChecked(Settings::values.use_docked_mode); |
| @@ -157,12 +192,10 @@ void ConfigureInput::loadConfiguration() { | |||
| 157 | } | 192 | } |
| 158 | 193 | ||
| 159 | void ConfigureInput::restoreDefaults() { | 194 | void ConfigureInput::restoreDefaults() { |
| 160 | players_enabled[0]->setCheckState(Qt::Checked); | 195 | players_controller[0]->setCurrentIndex(2); |
| 161 | player_controller[0]->setCurrentIndex(1); | ||
| 162 | 196 | ||
| 163 | for (std::size_t i = 1; i < players_enabled.size(); ++i) { | 197 | for (std::size_t i = 1; i < players_controller.size(); ++i) { |
| 164 | players_enabled[i]->setCheckState(Qt::Unchecked); | 198 | players_controller[i]->setCurrentIndex(0); |
| 165 | player_controller[i]->setCurrentIndex(0); | ||
| 166 | } | 199 | } |
| 167 | 200 | ||
| 168 | ui->use_docked_mode->setCheckState(Qt::Unchecked); | 201 | ui->use_docked_mode->setCheckState(Qt::Unchecked); |
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h index 51b8e609c..29a8a03f8 100644 --- a/src/yuzu/configuration/configure_input.h +++ b/src/yuzu/configuration/configure_input.h | |||
| @@ -43,6 +43,8 @@ private: | |||
| 43 | template <typename Dialog, typename... Args> | 43 | template <typename Dialog, typename... Args> |
| 44 | void CallConfigureDialog(Args&&... args); | 44 | void CallConfigureDialog(Args&&... args); |
| 45 | 45 | ||
| 46 | void OnDockedModeChanged(bool last_state, bool new_state); | ||
| 47 | |||
| 46 | /// Load configuration settings. | 48 | /// Load configuration settings. |
| 47 | void loadConfiguration(); | 49 | void loadConfiguration(); |
| 48 | /// Restore all buttons to their default values. | 50 | /// Restore all buttons to their default values. |
| @@ -50,7 +52,6 @@ private: | |||
| 50 | 52 | ||
| 51 | std::unique_ptr<Ui::ConfigureInput> ui; | 53 | std::unique_ptr<Ui::ConfigureInput> ui; |
| 52 | 54 | ||
| 53 | std::array<QCheckBox*, 8> players_enabled; | 55 | std::array<QComboBox*, 8> players_controller; |
| 54 | std::array<QComboBox*, 8> player_controller; | 56 | std::array<QPushButton*, 8> players_configure; |
| 55 | std::array<QPushButton*, 8> player_configure; | ||
| 56 | }; | 57 | }; |
diff --git a/src/yuzu/configuration/configure_input.ui b/src/yuzu/configuration/configure_input.ui index f12896b47..8beae959e 100644 --- a/src/yuzu/configuration/configure_input.ui +++ b/src/yuzu/configuration/configure_input.ui | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>473</width> | 9 | <width>473</width> |
| 10 | <height>677</height> | 10 | <height>685</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| @@ -49,62 +49,6 @@ | |||
| 49 | </property> | 49 | </property> |
| 50 | </widget> | 50 | </widget> |
| 51 | </item> | 51 | </item> |
| 52 | <item row="1" column="1"> | ||
| 53 | <widget class="QCheckBox" name="player1_checkbox"> | ||
| 54 | <property name="text"> | ||
| 55 | <string>Player 1</string> | ||
| 56 | </property> | ||
| 57 | </widget> | ||
| 58 | </item> | ||
| 59 | <item row="7" column="1"> | ||
| 60 | <widget class="QCheckBox" name="player7_checkbox"> | ||
| 61 | <property name="text"> | ||
| 62 | <string>Player 7</string> | ||
| 63 | </property> | ||
| 64 | </widget> | ||
| 65 | </item> | ||
| 66 | <item row="4" column="1"> | ||
| 67 | <widget class="QCheckBox" name="player4_checkbox"> | ||
| 68 | <property name="text"> | ||
| 69 | <string>Player 4</string> | ||
| 70 | </property> | ||
| 71 | </widget> | ||
| 72 | </item> | ||
| 73 | <item row="5" column="1"> | ||
| 74 | <widget class="QCheckBox" name="player5_checkbox"> | ||
| 75 | <property name="text"> | ||
| 76 | <string>Player 5</string> | ||
| 77 | </property> | ||
| 78 | </widget> | ||
| 79 | </item> | ||
| 80 | <item row="6" column="1"> | ||
| 81 | <widget class="QCheckBox" name="player6_checkbox"> | ||
| 82 | <property name="text"> | ||
| 83 | <string>Player 6</string> | ||
| 84 | </property> | ||
| 85 | </widget> | ||
| 86 | </item> | ||
| 87 | <item row="8" column="1"> | ||
| 88 | <widget class="QCheckBox" name="player8_checkbox"> | ||
| 89 | <property name="text"> | ||
| 90 | <string>Player 8</string> | ||
| 91 | </property> | ||
| 92 | </widget> | ||
| 93 | </item> | ||
| 94 | <item row="3" column="1"> | ||
| 95 | <widget class="QCheckBox" name="player3_checkbox"> | ||
| 96 | <property name="text"> | ||
| 97 | <string>Player 3</string> | ||
| 98 | </property> | ||
| 99 | </widget> | ||
| 100 | </item> | ||
| 101 | <item row="2" column="1"> | ||
| 102 | <widget class="QCheckBox" name="player2_checkbox"> | ||
| 103 | <property name="text"> | ||
| 104 | <string>Player 2</string> | ||
| 105 | </property> | ||
| 106 | </widget> | ||
| 107 | </item> | ||
| 108 | <item row="2" column="2"> | 52 | <item row="2" column="2"> |
| 109 | <widget class="QComboBox" name="player2_combobox"> | 53 | <widget class="QComboBox" name="player2_combobox"> |
| 110 | <property name="minimumSize"> | 54 | <property name="minimumSize"> |
| @@ -250,13 +194,65 @@ | |||
| 250 | </property> | 194 | </property> |
| 251 | </spacer> | 195 | </spacer> |
| 252 | </item> | 196 | </item> |
| 253 | <item row="0" column="1"> | 197 | <item row="1" column="1"> |
| 254 | <widget class="QLabel" name="label_2"> | 198 | <widget class="QLabel" name="label_3"> |
| 199 | <property name="minimumSize"> | ||
| 200 | <size> | ||
| 201 | <width>55</width> | ||
| 202 | <height>0</height> | ||
| 203 | </size> | ||
| 204 | </property> | ||
| 255 | <property name="text"> | 205 | <property name="text"> |
| 256 | <string>Enabled</string> | 206 | <string>Player 1</string> |
| 257 | </property> | 207 | </property> |
| 258 | <property name="alignment"> | 208 | </widget> |
| 259 | <set>Qt::AlignCenter</set> | 209 | </item> |
| 210 | <item row="2" column="1"> | ||
| 211 | <widget class="QLabel" name="label_4"> | ||
| 212 | <property name="text"> | ||
| 213 | <string>Player 2</string> | ||
| 214 | </property> | ||
| 215 | </widget> | ||
| 216 | </item> | ||
| 217 | <item row="3" column="1"> | ||
| 218 | <widget class="QLabel" name="label_5"> | ||
| 219 | <property name="text"> | ||
| 220 | <string>Player 3</string> | ||
| 221 | </property> | ||
| 222 | </widget> | ||
| 223 | </item> | ||
| 224 | <item row="4" column="1"> | ||
| 225 | <widget class="QLabel" name="label_6"> | ||
| 226 | <property name="text"> | ||
| 227 | <string>Player 4</string> | ||
| 228 | </property> | ||
| 229 | </widget> | ||
| 230 | </item> | ||
| 231 | <item row="5" column="1"> | ||
| 232 | <widget class="QLabel" name="label_7"> | ||
| 233 | <property name="text"> | ||
| 234 | <string>Player 5</string> | ||
| 235 | </property> | ||
| 236 | </widget> | ||
| 237 | </item> | ||
| 238 | <item row="6" column="1"> | ||
| 239 | <widget class="QLabel" name="label_8"> | ||
| 240 | <property name="text"> | ||
| 241 | <string>Player 6</string> | ||
| 242 | </property> | ||
| 243 | </widget> | ||
| 244 | </item> | ||
| 245 | <item row="7" column="1"> | ||
| 246 | <widget class="QLabel" name="label_9"> | ||
| 247 | <property name="text"> | ||
| 248 | <string>Player 7</string> | ||
| 249 | </property> | ||
| 250 | </widget> | ||
| 251 | </item> | ||
| 252 | <item row="8" column="1"> | ||
| 253 | <widget class="QLabel" name="label_10"> | ||
| 254 | <property name="text"> | ||
| 255 | <string>Player 8</string> | ||
| 260 | </property> | 256 | </property> |
| 261 | </widget> | 257 | </widget> |
| 262 | </item> | 258 | </item> |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 995725b0f..ba6e09368 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -325,6 +325,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, u8 player_index, boo | |||
| 325 | ui->buttonHome->setEnabled(false); | 325 | ui->buttonHome->setEnabled(false); |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | ConfigureInputPlayer::~ConfigureInputPlayer() = default; | ||
| 329 | |||
| 328 | void ConfigureInputPlayer::applyConfiguration() { | 330 | void ConfigureInputPlayer::applyConfiguration() { |
| 329 | auto& buttons = | 331 | auto& buttons = |
| 330 | debug ? Settings::values.debug_pad_buttons : Settings::values.players[player_index].buttons; | 332 | debug ? Settings::values.debug_pad_buttons : Settings::values.players[player_index].buttons; |
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h index 8248cd7de..b0e5550c5 100644 --- a/src/yuzu/configuration/configure_input_player.h +++ b/src/yuzu/configuration/configure_input_player.h | |||
| @@ -30,6 +30,7 @@ class ConfigureInputPlayer : public QDialog { | |||
| 30 | 30 | ||
| 31 | public: | 31 | public: |
| 32 | explicit ConfigureInputPlayer(QWidget* parent, u8 player_index, bool debug = false); | 32 | explicit ConfigureInputPlayer(QWidget* parent, u8 player_index, bool debug = false); |
| 33 | ~ConfigureInputPlayer() override; | ||
| 33 | 34 | ||
| 34 | /// Save all button configurations to settings file | 35 | /// Save all button configurations to settings file |
| 35 | void applyConfiguration(); | 36 | void applyConfiguration(); |
diff --git a/src/yuzu/configuration/configure_mouse_advanced.cpp b/src/yuzu/configuration/configure_mouse_advanced.cpp index ac9c84096..dab58fbaa 100644 --- a/src/yuzu/configuration/configure_mouse_advanced.cpp +++ b/src/yuzu/configuration/configure_mouse_advanced.cpp | |||
| @@ -112,6 +112,8 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent) | |||
| 112 | resize(0, 0); | 112 | resize(0, 0); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | ConfigureMouseAdvanced::~ConfigureMouseAdvanced() = default; | ||
| 116 | |||
| 115 | void ConfigureMouseAdvanced::applyConfiguration() { | 117 | void ConfigureMouseAdvanced::applyConfiguration() { |
| 116 | std::transform(buttons_param.begin(), buttons_param.end(), | 118 | std::transform(buttons_param.begin(), buttons_param.end(), |
| 117 | Settings::values.mouse_buttons.begin(), | 119 | Settings::values.mouse_buttons.begin(), |
diff --git a/src/yuzu/configuration/configure_mouse_advanced.h b/src/yuzu/configuration/configure_mouse_advanced.h index 983ac4158..218df2bda 100644 --- a/src/yuzu/configuration/configure_mouse_advanced.h +++ b/src/yuzu/configuration/configure_mouse_advanced.h | |||
| @@ -23,6 +23,7 @@ class ConfigureMouseAdvanced : public QDialog { | |||
| 23 | 23 | ||
| 24 | public: | 24 | public: |
| 25 | explicit ConfigureMouseAdvanced(QWidget* parent); | 25 | explicit ConfigureMouseAdvanced(QWidget* parent); |
| 26 | ~ConfigureMouseAdvanced() override; | ||
| 26 | 27 | ||
| 27 | void applyConfiguration(); | 28 | void applyConfiguration(); |
| 28 | 29 | ||