summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Morph2021-11-29 18:01:05 -0500
committerGravatar Morph2021-11-29 19:21:50 -0500
commitb86fcf7c316d8a024f6ed90e46a20fb977b55f5e (patch)
tree0a6ab4c3a89bfc6ad8821dd0b964d1e19295f313 /src
parentcore: hid: hid_core: Add (Enable/DIsable)AllControllerConfiguration (diff)
downloadyuzu-b86fcf7c316d8a024f6ed90e46a20fb977b55f5e.tar.gz
yuzu-b86fcf7c316d8a024f6ed90e46a20fb977b55f5e.tar.xz
yuzu-b86fcf7c316d8a024f6ed90e46a20fb977b55f5e.zip
qt_controller: Make use of (Enable/Disable)AllControllerConfiguration
This also moves the use of DisableConfiguration to the destructor.
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/applets/qt_controller.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp
index 7e80e7836..c5685db2e 100644
--- a/src/yuzu/applets/qt_controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -139,7 +139,6 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
139 DisableUnsupportedPlayers(); 139 DisableUnsupportedPlayers();
140 140
141 for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) { 141 for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) {
142 system.HIDCore().GetEmulatedControllerByIndex(player_index)->EnableConfiguration();
143 SetEmulatedControllers(player_index); 142 SetEmulatedControllers(player_index);
144 } 143 }
145 144
@@ -205,9 +204,6 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
205 // If all the parameters are met AND only allows a single player, 204 // If all the parameters are met AND only allows a single player,
206 // stop the constructor here as we do not need to continue. 205 // stop the constructor here as we do not need to continue.
207 if (CheckIfParametersMet() && parameters.enable_single_mode) { 206 if (CheckIfParametersMet() && parameters.enable_single_mode) {
208 for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) {
209 system.HIDCore().GetEmulatedControllerByIndex(player_index)->DisableConfiguration();
210 }
211 return; 207 return;
212 } 208 }
213 209
@@ -221,7 +217,9 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
221 resize(0, 0); 217 resize(0, 0);
222} 218}
223 219
224QtControllerSelectorDialog::~QtControllerSelectorDialog() = default; 220QtControllerSelectorDialog::~QtControllerSelectorDialog() {
221 system.HIDCore().DisableAllControllerConfiguration();
222}
225 223
226int QtControllerSelectorDialog::exec() { 224int QtControllerSelectorDialog::exec() {
227 if (parameters_met && parameters.enable_single_mode) { 225 if (parameters_met && parameters.enable_single_mode) {
@@ -237,12 +235,11 @@ void QtControllerSelectorDialog::ApplyConfiguration() {
237 235
238 Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); 236 Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked());
239 Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); 237 Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked());
240 for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) {
241 system.HIDCore().GetEmulatedControllerByIndex(player_index)->DisableConfiguration();
242 }
243} 238}
244 239
245void QtControllerSelectorDialog::LoadConfiguration() { 240void QtControllerSelectorDialog::LoadConfiguration() {
241 system.HIDCore().EnableAllControllerConfiguration();
242
246 const auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); 243 const auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
247 for (std::size_t index = 0; index < NUM_PLAYERS; ++index) { 244 for (std::size_t index = 0; index < NUM_PLAYERS; ++index) {
248 const auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index); 245 const auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index);