summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/input_common/main.cpp15
-rw-r--r--src/input_common/main.h2
-rw-r--r--src/input_common/sdl/sdl_impl.cpp52
-rw-r--r--src/input_common/udp/udp.cpp5
-rw-r--r--src/input_common/udp/udp.h2
-rw-r--r--src/yuzu/configuration/configure_debug_controller.cpp4
-rw-r--r--src/yuzu/configuration/configure_debug_controller.h4
-rw-r--r--src/yuzu/configuration/configure_input.cpp13
-rw-r--r--src/yuzu/configuration/configure_input.h2
-rw-r--r--src/yuzu/configuration/configure_input_advanced.cpp2
-rw-r--r--src/yuzu/configuration/configure_input_advanced.h1
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp70
-rw-r--r--src/yuzu/uisettings.h1
13 files changed, 77 insertions, 96 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index b8725e9af..7bad2c45b 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -118,37 +118,38 @@ std::vector<Common::ParamPackage> GetInputDevices() {
118 118
119std::unordered_map<Settings::NativeButton::Values, Common::ParamPackage> GetButtonMappingForDevice( 119std::unordered_map<Settings::NativeButton::Values, Common::ParamPackage> GetButtonMappingForDevice(
120 const Common::ParamPackage& params) { 120 const Common::ParamPackage& params) {
121 std::unordered_map<Settings::NativeButton::Values, Common::ParamPackage> mappings{}; 121 std::unordered_map<Settings::NativeButton::Values, Common::ParamPackage> mappings;
122 if (!params.Has("class") || params.Get("class", "") == "any") { 122 if (!params.Has("class") || params.Get("class", "") == "any") {
123 return mappings; 123 return {};
124 } 124 }
125 if (params.Get("class", "") == "key") { 125 if (params.Get("class", "") == "key") {
126 // TODO consider returning the SDL key codes for the default keybindings 126 // TODO consider returning the SDL key codes for the default keybindings
127 return {};
127 } 128 }
128#ifdef HAVE_SDL2 129#ifdef HAVE_SDL2
129 if (params.Get("class", "") == "sdl") { 130 if (params.Get("class", "") == "sdl") {
130 return sdl->GetButtonMappingForDevice(params); 131 return sdl->GetButtonMappingForDevice(params);
131 } 132 }
132#endif 133#endif
133 return mappings; 134 return {};
134} 135}
135 136
136std::unordered_map<Settings::NativeAnalog::Values, Common::ParamPackage> GetAnalogMappingForDevice( 137std::unordered_map<Settings::NativeAnalog::Values, Common::ParamPackage> GetAnalogMappingForDevice(
137 const Common::ParamPackage& params) { 138 const Common::ParamPackage& params) {
138 std::unordered_map<Settings::NativeAnalog::Values, Common::ParamPackage> mappings{}; 139 std::unordered_map<Settings::NativeAnalog::Values, Common::ParamPackage> mappings;
139 if (!params.Has("class") || params.Get("class", "") == "any") { 140 if (!params.Has("class") || params.Get("class", "") == "any") {
140 return mappings; 141 return {};
141 } 142 }
142 if (params.Get("class", "") == "key") { 143 if (params.Get("class", "") == "key") {
143 // TODO consider returning the SDL key codes for the default keybindings 144 // TODO consider returning the SDL key codes for the default keybindings
144 return mappings; 145 return {};
145 } 146 }
146#ifdef HAVE_SDL2 147#ifdef HAVE_SDL2
147 if (params.Get("class", "") == "sdl") { 148 if (params.Get("class", "") == "sdl") {
148 return sdl->GetAnalogMappingForDevice(params); 149 return sdl->GetAnalogMappingForDevice(params);
149 } 150 }
150#endif 151#endif
151 return mappings; 152 return {};
152} 153}
153 154
154namespace Polling { 155namespace Polling {
diff --git a/src/input_common/main.h b/src/input_common/main.h
index ebc7f9533..e706c3750 100644
--- a/src/input_common/main.h
+++ b/src/input_common/main.h
@@ -76,7 +76,7 @@ public:
76 /// Setup and start polling for inputs, should be called before GetNextInput 76 /// Setup and start polling for inputs, should be called before GetNextInput
77 /// If a device_id is provided, events should be filtered to only include events from this 77 /// If a device_id is provided, events should be filtered to only include events from this
78 /// device id 78 /// device id
79 virtual void Start(std::string device_id = "") = 0; 79 virtual void Start(const std::string& device_id = "") = 0;
80 /// Stop polling 80 /// Stop polling
81 virtual void Stop() = 0; 81 virtual void Stop() = 0;
82 /** 82 /**
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp
index 35a9d45ec..dec7540e2 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -545,17 +545,16 @@ SDLState::~SDLState() {
545 545
546std::vector<Common::ParamPackage> SDLState::GetInputDevices() { 546std::vector<Common::ParamPackage> SDLState::GetInputDevices() {
547 std::scoped_lock lock(joystick_map_mutex); 547 std::scoped_lock lock(joystick_map_mutex);
548 std::vector<Common::ParamPackage> devices = {}; 548 std::vector<Common::ParamPackage> devices;
549 for (const auto& [key, value] : joystick_map) { 549 for (const auto& [key, value] : joystick_map) {
550 for (const auto& joystick : value) { 550 for (const auto& joystick : value) {
551 auto controller = joystick->GetSDLGameController();
552 auto joy = joystick->GetSDLJoystick(); 551 auto joy = joystick->GetSDLJoystick();
553 if (controller) { 552 if (auto controller = joystick->GetSDLGameController()) {
554 std::string name = 553 std::string name =
555 fmt::format("{} {}", SDL_GameControllerName(controller), joystick->GetPort()); 554 fmt::format("{} {}", SDL_GameControllerName(controller), joystick->GetPort());
556 devices.emplace_back(Common::ParamPackage{ 555 devices.emplace_back(Common::ParamPackage{
557 {"class", "sdl"}, 556 {"class", "sdl"},
558 {"display", name}, 557 {"display", std::move(name)},
559 {"guid", joystick->GetGUID()}, 558 {"guid", joystick->GetGUID()},
560 {"port", std::to_string(joystick->GetPort())}, 559 {"port", std::to_string(joystick->GetPort())},
561 }); 560 });
@@ -563,7 +562,7 @@ std::vector<Common::ParamPackage> SDLState::GetInputDevices() {
563 std::string name = fmt::format("{} {}", SDL_JoystickName(joy), joystick->GetPort()); 562 std::string name = fmt::format("{} {}", SDL_JoystickName(joy), joystick->GetPort());
564 devices.emplace_back(Common::ParamPackage{ 563 devices.emplace_back(Common::ParamPackage{
565 {"class", "sdl"}, 564 {"class", "sdl"},
566 {"display", name}, 565 {"display", std::move(name)},
567 {"guid", joystick->GetGUID()}, 566 {"guid", joystick->GetGUID()},
568 {"port", std::to_string(joystick->GetPort())}, 567 {"port", std::to_string(joystick->GetPort())},
569 }); 568 });
@@ -624,54 +623,43 @@ Common::ParamPackage BuildHatParamPackageForButton(int port, std::string guid, u
624} 623}
625 624
626Common::ParamPackage SDLEventToButtonParamPackage(SDLState& state, const SDL_Event& event) { 625Common::ParamPackage SDLEventToButtonParamPackage(SDLState& state, const SDL_Event& event) {
627 Common::ParamPackage params{};
628
629 switch (event.type) { 626 switch (event.type) {
630 case SDL_JOYAXISMOTION: { 627 case SDL_JOYAXISMOTION: {
631 const auto joystick = state.GetSDLJoystickBySDLID(event.jaxis.which); 628 const auto joystick = state.GetSDLJoystickBySDLID(event.jaxis.which);
632 params = BuildAnalogParamPackageForButton(joystick->GetPort(), joystick->GetGUID(), 629 return BuildAnalogParamPackageForButton(joystick->GetPort(), joystick->GetGUID(),
633 event.jaxis.axis, event.jaxis.value); 630 event.jaxis.axis, event.jaxis.value);
634 break;
635 } 631 }
636 case SDL_JOYBUTTONUP: { 632 case SDL_JOYBUTTONUP: {
637 const auto joystick = state.GetSDLJoystickBySDLID(event.jbutton.which); 633 const auto joystick = state.GetSDLJoystickBySDLID(event.jbutton.which);
638 params = BuildButtonParamPackageForButton(joystick->GetPort(), joystick->GetGUID(), 634 return BuildButtonParamPackageForButton(joystick->GetPort(), joystick->GetGUID(),
639 event.jbutton.button); 635 event.jbutton.button);
640 break;
641 } 636 }
642 case SDL_JOYHATMOTION: { 637 case SDL_JOYHATMOTION: {
643 const auto joystick = state.GetSDLJoystickBySDLID(event.jhat.which); 638 const auto joystick = state.GetSDLJoystickBySDLID(event.jhat.which);
644 params = BuildHatParamPackageForButton(joystick->GetPort(), joystick->GetGUID(), 639 return BuildHatParamPackageForButton(joystick->GetPort(), joystick->GetGUID(),
645 event.jhat.hat, event.jhat.value); 640 event.jhat.hat, event.jhat.value);
646 break;
647 } 641 }
648 } 642 }
649 return params; 643 return {};
650} 644}
651 645
652Common::ParamPackage BuildParamPackageForBinding(int port, const std::string& guid, 646Common::ParamPackage BuildParamPackageForBinding(int port, const std::string& guid,
653 const SDL_GameControllerButtonBind& binding) { 647 const SDL_GameControllerButtonBind& binding) {
654 Common::ParamPackage out{};
655 switch (binding.bindType) { 648 switch (binding.bindType) {
656 case SDL_CONTROLLER_BINDTYPE_AXIS: 649 case SDL_CONTROLLER_BINDTYPE_AXIS:
657 out = BuildAnalogParamPackageForButton(port, guid, binding.value.axis); 650 return BuildAnalogParamPackageForButton(port, guid, binding.value.axis);
658 break;
659 case SDL_CONTROLLER_BINDTYPE_BUTTON: 651 case SDL_CONTROLLER_BINDTYPE_BUTTON:
660 out = BuildButtonParamPackageForButton(port, guid, binding.value.button); 652 return BuildButtonParamPackageForButton(port, guid, binding.value.button);
661 break;
662 case SDL_CONTROLLER_BINDTYPE_HAT: 653 case SDL_CONTROLLER_BINDTYPE_HAT:
663 out = BuildHatParamPackageForButton(port, guid, binding.value.hat.hat, 654 return BuildHatParamPackageForButton(port, guid, binding.value.hat.hat,
664 binding.value.hat.hat_mask); 655 binding.value.hat.hat_mask);
665 break;
666 default:
667 break;
668 } 656 }
669 return out; 657 return {};
670}; 658}
671 659
672Common::ParamPackage BuildParamPackageForAnalog(int port, const std::string& guid, int axis_x, 660Common::ParamPackage BuildParamPackageForAnalog(int port, const std::string& guid, int axis_x,
673 int axis_y) { 661 int axis_y) {
674 Common::ParamPackage params{}; 662 Common::ParamPackage params;
675 params.Set("engine", "sdl"); 663 params.Set("engine", "sdl");
676 params.Set("port", port); 664 params.Set("port", port);
677 params.Set("guid", guid); 665 params.Set("guid", guid);
@@ -769,7 +757,7 @@ class SDLPoller : public InputCommon::Polling::DevicePoller {
769public: 757public:
770 explicit SDLPoller(SDLState& state_) : state(state_) {} 758 explicit SDLPoller(SDLState& state_) : state(state_) {}
771 759
772 void Start(std::string device_id) override { 760 void Start(const std::string& device_id) override {
773 state.event_queue.Clear(); 761 state.event_queue.Clear();
774 state.polling = true; 762 state.polling = true;
775 } 763 }
@@ -821,7 +809,7 @@ public:
821 explicit SDLAnalogPreferredPoller(SDLState& state_) 809 explicit SDLAnalogPreferredPoller(SDLState& state_)
822 : SDLPoller(state_), button_poller(state_) {} 810 : SDLPoller(state_), button_poller(state_) {}
823 811
824 void Start(std::string device_id) override { 812 void Start(const std::string& device_id) override {
825 SDLPoller::Start(device_id); 813 SDLPoller::Start(device_id);
826 // Load the game controller 814 // Load the game controller
827 // Reset stored axes 815 // Reset stored axes
diff --git a/src/input_common/udp/udp.cpp b/src/input_common/udp/udp.cpp
index 60cf47123..4b347e47e 100644
--- a/src/input_common/udp/udp.cpp
+++ b/src/input_common/udp/udp.cpp
@@ -89,10 +89,9 @@ State::~State() {
89 Input::UnregisterFactory<Input::MotionDevice>("cemuhookudp"); 89 Input::UnregisterFactory<Input::MotionDevice>("cemuhookudp");
90} 90}
91 91
92std::vector<Common::ParamPackage> State::GetInputDevices() { 92std::vector<Common::ParamPackage> State::GetInputDevices() const {
93 std::vector<Common::ParamPackage> devices = {};
94 // TODO support binding udp devices 93 // TODO support binding udp devices
95 return devices; 94 return {};
96} 95}
97 96
98void State::ReloadUDPClient() { 97void State::ReloadUDPClient() {
diff --git a/src/input_common/udp/udp.h b/src/input_common/udp/udp.h
index 24f6e0857..672a5c812 100644
--- a/src/input_common/udp/udp.h
+++ b/src/input_common/udp/udp.h
@@ -19,7 +19,7 @@ public:
19 State(); 19 State();
20 ~State(); 20 ~State();
21 void ReloadUDPClient(); 21 void ReloadUDPClient();
22 std::vector<Common::ParamPackage> GetInputDevices(); 22 std::vector<Common::ParamPackage> GetInputDevices() const;
23 23
24private: 24private:
25 std::unique_ptr<Client> client; 25 std::unique_ptr<Client> client;
diff --git a/src/yuzu/configuration/configure_debug_controller.cpp b/src/yuzu/configuration/configure_debug_controller.cpp
index 45996b73f..72885b4b8 100644
--- a/src/yuzu/configuration/configure_debug_controller.cpp
+++ b/src/yuzu/configuration/configure_debug_controller.cpp
@@ -6,10 +6,10 @@
6#include "yuzu/configuration/configure_debug_controller.h" 6#include "yuzu/configuration/configure_debug_controller.h"
7 7
8ConfigureDebugController::ConfigureDebugController(QWidget* parent) 8ConfigureDebugController::ConfigureDebugController(QWidget* parent)
9 : QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()) { 9 : QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()),
10 debug_controller(new ConfigureInputPlayer(this, 9, nullptr, true)) {
10 ui->setupUi(this); 11 ui->setupUi(this);
11 12
12 debug_controller = new ConfigureInputPlayer(this, 9, nullptr, true);
13 ui->controllerLayout->addWidget(debug_controller); 13 ui->controllerLayout->addWidget(debug_controller);
14 14
15 connect(ui->clear_all_button, &QPushButton::clicked, this, 15 connect(ui->clear_all_button, &QPushButton::clicked, this,
diff --git a/src/yuzu/configuration/configure_debug_controller.h b/src/yuzu/configuration/configure_debug_controller.h
index df359a4f3..36475bbea 100644
--- a/src/yuzu/configuration/configure_debug_controller.h
+++ b/src/yuzu/configuration/configure_debug_controller.h
@@ -27,7 +27,7 @@ private:
27 void changeEvent(QEvent* event) override; 27 void changeEvent(QEvent* event) override;
28 void RetranslateUI(); 28 void RetranslateUI();
29 29
30 ConfigureInputPlayer* debug_controller;
31
32 std::unique_ptr<Ui::ConfigureDebugController> ui; 30 std::unique_ptr<Ui::ConfigureDebugController> ui;
31
32 ConfigureInputPlayer* debug_controller;
33}; 33};
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp
index 5200d2d0e..0d004c2f7 100644
--- a/src/yuzu/configuration/configure_input.cpp
+++ b/src/yuzu/configuration/configure_input.cpp
@@ -103,13 +103,14 @@ ConfigureInput::ConfigureInput(QWidget* parent)
103 } 103 }
104 }); 104 });
105 connect(player_controllers[i], &ConfigureInputPlayer::RefreshInputDevices, 105 connect(player_controllers[i], &ConfigureInputPlayer::RefreshInputDevices,
106 [&] { UpdateAllInputDevices(); }); 106 [this] { UpdateAllInputDevices(); });
107 connect(player_connected[i], &QCheckBox::stateChanged, 107 connect(player_connected[i], &QCheckBox::stateChanged, [this, i](int state) {
108 [&, i](int state) { player_controllers[i]->ConnectPlayer(state == Qt::Checked); }); 108 player_controllers[i]->ConnectPlayer(state == Qt::Checked);
109 });
109 } 110 }
110 // Only the first player can choose handheld mode so connect the signal just to player 1 111 // Only the first player can choose handheld mode so connect the signal just to player 1
111 connect(player_controllers[0], &ConfigureInputPlayer::HandheldStateChanged, 112 connect(player_controllers[0], &ConfigureInputPlayer::HandheldStateChanged,
112 [&](bool is_handheld) { UpdateDockedState(is_handheld); }); 113 [this](bool is_handheld) { UpdateDockedState(is_handheld); });
113 114
114 advanced = new ConfigureInputAdvanced(this); 115 advanced = new ConfigureInputAdvanced(this);
115 ui->tabAdvanced->setLayout(new QHBoxLayout(ui->tabAdvanced)); 116 ui->tabAdvanced->setLayout(new QHBoxLayout(ui->tabAdvanced));
@@ -182,14 +183,14 @@ void ConfigureInput::LoadPlayerControllerIndices() {
182void ConfigureInput::ClearAll() { 183void ConfigureInput::ClearAll() {
183 // We don't have a good way to know what tab is active, but we can find out by getting the 184 // We don't have a good way to know what tab is active, but we can find out by getting the
184 // parent of the consoleInputSettings 185 // parent of the consoleInputSettings
185 auto player_tab = static_cast<ConfigureInputPlayer*>(ui->consoleInputSettings->parent()); 186 auto* player_tab = static_cast<ConfigureInputPlayer*>(ui->consoleInputSettings->parent());
186 player_tab->ClearAll(); 187 player_tab->ClearAll();
187} 188}
188 189
189void ConfigureInput::RestoreDefaults() { 190void ConfigureInput::RestoreDefaults() {
190 // We don't have a good way to know what tab is active, but we can find out by getting the 191 // We don't have a good way to know what tab is active, but we can find out by getting the
191 // parent of the consoleInputSettings 192 // parent of the consoleInputSettings
192 auto player_tab = static_cast<ConfigureInputPlayer*>(ui->consoleInputSettings->parent()); 193 auto* player_tab = static_cast<ConfigureInputPlayer*>(ui->consoleInputSettings->parent());
193 player_tab->RestoreDefaults(); 194 player_tab->RestoreDefaults();
194 195
195 ui->radioDocked->setChecked(true); 196 ui->radioDocked->setChecked(true);
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h
index 8241d23ef..78ca659da 100644
--- a/src/yuzu/configuration/configure_input.h
+++ b/src/yuzu/configuration/configure_input.h
@@ -15,9 +15,9 @@
15 15
16#include "ui_configure_input.h" 16#include "ui_configure_input.h"
17 17
18class QCheckBox;
18class QString; 19class QString;
19class QTimer; 20class QTimer;
20class QCheckBox;
21 21
22namespace Ui { 22namespace Ui {
23class ConfigureInput; 23class ConfigureInput;
diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp
index 18db04e7e..db42b826b 100644
--- a/src/yuzu/configuration/configure_input_advanced.cpp
+++ b/src/yuzu/configuration/configure_input_advanced.cpp
@@ -9,7 +9,7 @@
9#include "yuzu/configuration/configure_input_advanced.h" 9#include "yuzu/configuration/configure_input_advanced.h"
10 10
11ConfigureInputAdvanced::ConfigureInputAdvanced(QWidget* parent) 11ConfigureInputAdvanced::ConfigureInputAdvanced(QWidget* parent)
12 : QWidget(parent), ui(new Ui::ConfigureInputAdvanced) { 12 : QWidget(parent), ui(std::make_unique<Ui::ConfigureInputAdvanced>()) {
13 ui->setupUi(this); 13 ui->setupUi(this);
14 14
15 controllers_color_buttons = {{ 15 controllers_color_buttons = {{
diff --git a/src/yuzu/configuration/configure_input_advanced.h b/src/yuzu/configuration/configure_input_advanced.h
index d6e913675..d8fcec52d 100644
--- a/src/yuzu/configuration/configure_input_advanced.h
+++ b/src/yuzu/configuration/configure_input_advanced.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <array>
7#include <memory> 8#include <memory>
8#include <QWidget> 9#include <QWidget>
9 10
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 4d79a51f3..68d0d5db7 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -348,22 +348,22 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
348 348
349 // Player Connected checkbox 349 // Player Connected checkbox
350 connect(ui->groupConnectedController, &QGroupBox::toggled, 350 connect(ui->groupConnectedController, &QGroupBox::toggled,
351 [&](bool checked) { emit Connected(checked); }); 351 [this](bool checked) { emit Connected(checked); });
352 352
353 // Set up controller type. Only Player 1 can choose Handheld. 353 // Set up controller type. Only Player 1 can choose Handheld.
354 ui->comboControllerType->clear(); 354 ui->comboControllerType->clear();
355 355
356 QStringList controller_types = { 356 QStringList controller_types = {
357 QStringLiteral("Pro Controller"), 357 tr("Pro Controller"),
358 QStringLiteral("Dual Joycons"), 358 tr("Dual Joycons"),
359 QStringLiteral("Left Joycon"), 359 tr("Left Joycon"),
360 QStringLiteral("Right Joycon"), 360 tr("Right Joycon"),
361 }; 361 };
362 362
363 if (player_index == 0) { 363 if (player_index == 0) {
364 controller_types.append(QStringLiteral("Handheld")); 364 controller_types.append(tr("Handheld"));
365 connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), 365 connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged),
366 [&](int index) { 366 [this](int index) {
367 emit HandheldStateChanged(GetControllerTypeFromIndex(index) == 367 emit HandheldStateChanged(GetControllerTypeFromIndex(index) ==
368 Settings::ControllerType::Handheld); 368 Settings::ControllerType::Handheld);
369 }); 369 });
@@ -375,7 +375,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
375 ui->buttonHome->setEnabled(false); 375 ui->buttonHome->setEnabled(false);
376 ui->groupConnectedController->setCheckable(false); 376 ui->groupConnectedController->setCheckable(false);
377 QStringList debug_controller_types = { 377 QStringList debug_controller_types = {
378 QStringLiteral("Pro Controller"), 378 tr("Pro Controller"),
379 }; 379 };
380 ui->comboControllerType->addItems(debug_controller_types); 380 ui->comboControllerType->addItems(debug_controller_types);
381 } else { 381 } else {
@@ -384,17 +384,18 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
384 384
385 UpdateControllerIcon(); 385 UpdateControllerIcon();
386 UpdateControllerAvailableButtons(); 386 UpdateControllerAvailableButtons();
387 connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [&](int) { 387 connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [this](int) {
388 UpdateControllerIcon(); 388 UpdateControllerIcon();
389 UpdateControllerAvailableButtons(); 389 UpdateControllerAvailableButtons();
390 }); 390 });
391 391
392 connect(ui->comboDevices, qOverload<int>(&QComboBox::currentIndexChanged), 392 connect(ui->comboDevices, qOverload<int>(&QComboBox::currentIndexChanged), this,
393 [&] { UpdateMappingWithDefaults(); }); 393 &ConfigureInputPlayer::UpdateMappingWithDefaults);
394 394
395 ui->buttonRefreshDevices->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); 395 ui->buttonRefreshDevices->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
396 UpdateInputDevices(); 396 UpdateInputDevices();
397 connect(ui->buttonRefreshDevices, &QPushButton::clicked, [&] { emit RefreshInputDevices(); }); 397 connect(ui->buttonRefreshDevices, &QPushButton::clicked,
398 [this] { emit RefreshInputDevices(); });
398 399
399 timeout_timer->setSingleShot(true); 400 timeout_timer->setSingleShot(true);
400 connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); }); 401 connect(timeout_timer.get(), &QTimer::timeout, [this] { SetPollingResult({}, true); });
@@ -707,26 +708,22 @@ void ConfigureInputPlayer::keyPressEvent(QKeyEvent* event) {
707void ConfigureInputPlayer::UpdateControllerIcon() { 708void ConfigureInputPlayer::UpdateControllerIcon() {
708 // We aren't using Qt's built in theme support here since we aren't drawing an icon (and its 709 // We aren't using Qt's built in theme support here since we aren't drawing an icon (and its
709 // "nonstandard" to use an image through the icon support) 710 // "nonstandard" to use an image through the icon support)
710 QString stylesheet{}; 711 const QString stylesheet = [this] {
711 switch (GetControllerTypeFromIndex(ui->comboControllerType->currentIndex())) { 712 switch (GetControllerTypeFromIndex(ui->comboControllerType->currentIndex())) {
712 case Settings::ControllerType::ProController: 713 case Settings::ControllerType::ProController:
713 stylesheet = QStringLiteral("image: url(:/controller/pro_controller%0)"); 714 return QStringLiteral("image: url(:/controller/pro_controller%0)");
714 break; 715 case Settings::ControllerType::DualJoyconDetached:
715 case Settings::ControllerType::DualJoyconDetached: 716 return QStringLiteral("image: url(:/controller/dual_joycon%0)");
716 stylesheet = QStringLiteral("image: url(:/controller/dual_joycon%0)"); 717 case Settings::ControllerType::LeftJoycon:
717 break; 718 return QStringLiteral("image: url(:/controller/single_joycon_left_vertical%0)");
718 case Settings::ControllerType::LeftJoycon: 719 case Settings::ControllerType::RightJoycon:
719 stylesheet = QStringLiteral("image: url(:/controller/single_joycon_left_vertical%0)"); 720 return QStringLiteral("image: url(:/controller/single_joycon_right_vertical%0)");
720 break; 721 case Settings::ControllerType::Handheld:
721 case Settings::ControllerType::RightJoycon: 722 return QStringLiteral("image: url(:/controller/handheld%0)");
722 stylesheet = QStringLiteral("image: url(:/controller/single_joycon_right_vertical%0)"); 723 default:
723 break; 724 return QString{};
724 case Settings::ControllerType::Handheld: 725 }
725 stylesheet = QStringLiteral("image: url(:/controller/handheld%0)"); 726 }();
726 break;
727 default:
728 break;
729 }
730 727
731 const QString theme = [this] { 728 const QString theme = [this] {
732 if (QIcon::themeName().contains(QStringLiteral("dark"))) { 729 if (QIcon::themeName().contains(QStringLiteral("dark"))) {
@@ -744,12 +741,12 @@ void ConfigureInputPlayer::UpdateControllerIcon() {
744void ConfigureInputPlayer::UpdateControllerAvailableButtons() { 741void ConfigureInputPlayer::UpdateControllerAvailableButtons() {
745 auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); 742 auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
746 if (debug) { 743 if (debug) {
747 layout = Settings::ControllerType::DualJoyconDetached; 744 layout = Settings::ControllerType::ProController;
748 } 745 }
749 746
750 // List of all the widgets that will be hidden by any of the following layouts that need 747 // List of all the widgets that will be hidden by any of the following layouts that need
751 // "unhidden" after the controller type changes 748 // "unhidden" after the controller type changes
752 const std::vector<QWidget*> layout_show = { 749 const std::array<QWidget*, 9> layout_show = {
753 ui->buttonShoulderButtonsSLSR, 750 ui->buttonShoulderButtonsSLSR,
754 ui->horizontalSpacerShoulderButtonsWidget, 751 ui->horizontalSpacerShoulderButtonsWidget,
755 ui->horizontalSpacerShoulderButtonsWidget2, 752 ui->horizontalSpacerShoulderButtonsWidget2,
@@ -768,11 +765,6 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {
768 std::vector<QWidget*> layout_hidden; 765 std::vector<QWidget*> layout_hidden;
769 switch (layout) { 766 switch (layout) {
770 case Settings::ControllerType::ProController: 767 case Settings::ControllerType::ProController:
771 layout_hidden = {
772 ui->buttonShoulderButtonsSLSR,
773 ui->horizontalSpacerShoulderButtonsWidget2,
774 };
775 break;
776 case Settings::ControllerType::DualJoyconDetached: 768 case Settings::ControllerType::DualJoyconDetached:
777 case Settings::ControllerType::Handheld: 769 case Settings::ControllerType::Handheld:
778 layout_hidden = { 770 layout_hidden = {
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h
index 533815098..ce3945485 100644
--- a/src/yuzu/uisettings.h
+++ b/src/yuzu/uisettings.h
@@ -13,7 +13,6 @@
13#include <QStringList> 13#include <QStringList>
14#include <QVector> 14#include <QVector>
15#include "common/common_types.h" 15#include "common/common_types.h"
16#include "core/settings.h"
17 16
18namespace UISettings { 17namespace UISettings {
19 18