summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/frontend/applets/controller.cpp10
-rw-r--r--src/core/hid/emulated_controller.cpp44
-rw-r--r--src/core/hid/emulated_controller.h18
-rw-r--r--src/core/hid/hid_types.h13
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp129
-rw-r--r--src/core/hle/service/hid/controllers/npad.h11
-rw-r--r--src/core/hle/service/hid/hid.cpp14
-rw-r--r--src/yuzu/applets/qt_controller.cpp65
-rw-r--r--src/yuzu/applets/qt_controller.h8
-rw-r--r--src/yuzu/applets/qt_software_keyboard.cpp14
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp87
-rw-r--r--src/yuzu/configuration/configure_input_player.h8
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.cpp18
-rw-r--r--src/yuzu/configuration/configure_input_player_widget.h2
-rw-r--r--src/yuzu/main.cpp2
15 files changed, 228 insertions, 215 deletions
diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp
index 212ace892..6dbd38ffa 100644
--- a/src/core/frontend/applets/controller.cpp
+++ b/src/core/frontend/applets/controller.cpp
@@ -44,26 +44,26 @@ void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callb
44 // Connect controllers based on the following priority list from highest to lowest priority: 44 // Connect controllers based on the following priority list from highest to lowest priority:
45 // Pro Controller -> Dual Joycons -> Left Joycon/Right Joycon -> Handheld 45 // Pro Controller -> Dual Joycons -> Left Joycon/Right Joycon -> Handheld
46 if (parameters.allow_pro_controller) { 46 if (parameters.allow_pro_controller) {
47 controller->SetNpadType(Core::HID::NpadType::ProController); 47 controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController);
48 controller->Connect(); 48 controller->Connect();
49 } else if (parameters.allow_dual_joycons) { 49 } else if (parameters.allow_dual_joycons) {
50 controller->SetNpadType(Core::HID::NpadType::JoyconDual); 50 controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::JoyconDual);
51 controller->Connect(); 51 controller->Connect();
52 } else if (parameters.allow_left_joycon && parameters.allow_right_joycon) { 52 } else if (parameters.allow_left_joycon && parameters.allow_right_joycon) {
53 // Assign left joycons to even player indices and right joycons to odd player indices. 53 // Assign left joycons to even player indices and right joycons to odd player indices.
54 // We do this since Captain Toad Treasure Tracker expects a left joycon for Player 1 and 54 // We do this since Captain Toad Treasure Tracker expects a left joycon for Player 1 and
55 // a right Joycon for Player 2 in 2 Player Assist mode. 55 // a right Joycon for Player 2 in 2 Player Assist mode.
56 if (index % 2 == 0) { 56 if (index % 2 == 0) {
57 controller->SetNpadType(Core::HID::NpadType::JoyconLeft); 57 controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::JoyconLeft);
58 controller->Connect(); 58 controller->Connect();
59 } else { 59 } else {
60 controller->SetNpadType(Core::HID::NpadType::JoyconRight); 60 controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::JoyconRight);
61 controller->Connect(); 61 controller->Connect();
62 } 62 }
63 } else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld && 63 } else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld &&
64 !Settings::values.use_docked_mode.GetValue()) { 64 !Settings::values.use_docked_mode.GetValue()) {
65 // We should *never* reach here under any normal circumstances. 65 // We should *never* reach here under any normal circumstances.
66 controller->SetNpadType(Core::HID::NpadType::Handheld); 66 controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Handheld);
67 controller->Connect(); 67 controller->Connect();
68 } else { 68 } else {
69 UNREACHABLE_MSG("Unable to add a new controller based on the given parameters!"); 69 UNREACHABLE_MSG("Unable to add a new controller based on the given parameters!");
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 6fe3744fd..a200992f2 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -13,38 +13,38 @@ EmulatedController::EmulatedController(NpadIdType npad_id_type_) : npad_id_type(
13 13
14EmulatedController::~EmulatedController() = default; 14EmulatedController::~EmulatedController() = default;
15 15
16NpadType EmulatedController::MapSettingsTypeToNPad(Settings::ControllerType type) { 16NpadStyleIndex EmulatedController::MapSettingsTypeToNPad(Settings::ControllerType type) {
17 switch (type) { 17 switch (type) {
18 case Settings::ControllerType::ProController: 18 case Settings::ControllerType::ProController:
19 return NpadType::ProController; 19 return NpadStyleIndex::ProController;
20 case Settings::ControllerType::DualJoyconDetached: 20 case Settings::ControllerType::DualJoyconDetached:
21 return NpadType::JoyconDual; 21 return NpadStyleIndex::JoyconDual;
22 case Settings::ControllerType::LeftJoycon: 22 case Settings::ControllerType::LeftJoycon:
23 return NpadType::JoyconLeft; 23 return NpadStyleIndex::JoyconLeft;
24 case Settings::ControllerType::RightJoycon: 24 case Settings::ControllerType::RightJoycon:
25 return NpadType::JoyconRight; 25 return NpadStyleIndex::JoyconRight;
26 case Settings::ControllerType::Handheld: 26 case Settings::ControllerType::Handheld:
27 return NpadType::Handheld; 27 return NpadStyleIndex::Handheld;
28 case Settings::ControllerType::GameCube: 28 case Settings::ControllerType::GameCube:
29 return NpadType::GameCube; 29 return NpadStyleIndex::GameCube;
30 default: 30 default:
31 return NpadType::ProController; 31 return NpadStyleIndex::ProController;
32 } 32 }
33} 33}
34 34
35Settings::ControllerType EmulatedController::MapNPadToSettingsType(NpadType type) { 35Settings::ControllerType EmulatedController::MapNPadToSettingsType(NpadStyleIndex type) {
36 switch (type) { 36 switch (type) {
37 case NpadType::ProController: 37 case NpadStyleIndex::ProController:
38 return Settings::ControllerType::ProController; 38 return Settings::ControllerType::ProController;
39 case NpadType::JoyconDual: 39 case NpadStyleIndex::JoyconDual:
40 return Settings::ControllerType::DualJoyconDetached; 40 return Settings::ControllerType::DualJoyconDetached;
41 case NpadType::JoyconLeft: 41 case NpadStyleIndex::JoyconLeft:
42 return Settings::ControllerType::LeftJoycon; 42 return Settings::ControllerType::LeftJoycon;
43 case NpadType::JoyconRight: 43 case NpadStyleIndex::JoyconRight:
44 return Settings::ControllerType::RightJoycon; 44 return Settings::ControllerType::RightJoycon;
45 case NpadType::Handheld: 45 case NpadStyleIndex::Handheld:
46 return Settings::ControllerType::Handheld; 46 return Settings::ControllerType::Handheld;
47 case NpadType::GameCube: 47 case NpadStyleIndex::GameCube:
48 return Settings::ControllerType::GameCube; 48 return Settings::ControllerType::GameCube;
49 default: 49 default:
50 return Settings::ControllerType::ProController; 50 return Settings::ControllerType::ProController;
@@ -79,9 +79,9 @@ void EmulatedController::ReloadFromSettings() {
79 79
80 // Other or debug controller should always be a pro controller 80 // Other or debug controller should always be a pro controller
81 if (npad_id_type != NpadIdType::Other) { 81 if (npad_id_type != NpadIdType::Other) {
82 SetNpadType(MapSettingsTypeToNPad(player.controller_type)); 82 SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
83 } else { 83 } else {
84 SetNpadType(NpadType::ProController); 84 SetNpadStyleIndex(NpadStyleIndex::ProController);
85 } 85 }
86 86
87 if (player.connected) { 87 if (player.connected) {
@@ -306,7 +306,7 @@ void EmulatedController::DisableConfiguration() {
306 if (is_connected) { 306 if (is_connected) {
307 Disconnect(); 307 Disconnect();
308 } 308 }
309 SetNpadType(tmp_npad_type); 309 SetNpadStyleIndex(tmp_npad_type);
310 } 310 }
311 311
312 // Apply temporary connected status to the real controller 312 // Apply temporary connected status to the real controller
@@ -569,10 +569,10 @@ void EmulatedController::SetButton(Common::Input::CallbackStatus callback, std::
569 } 569 }
570 } 570 }
571 if (!is_connected) { 571 if (!is_connected) {
572 if (npad_id_type == NpadIdType::Player1 && npad_type != NpadType::Handheld) { 572 if (npad_id_type == NpadIdType::Player1 && npad_type != NpadStyleIndex::Handheld) {
573 Connect(); 573 Connect();
574 } 574 }
575 if (npad_id_type == NpadIdType::Handheld && npad_type == NpadType::Handheld) { 575 if (npad_id_type == NpadIdType::Handheld && npad_type == NpadStyleIndex::Handheld) {
576 Connect(); 576 Connect();
577 } 577 }
578 } 578 }
@@ -896,14 +896,14 @@ NpadIdType EmulatedController::GetNpadIdType() const {
896 return npad_id_type; 896 return npad_id_type;
897} 897}
898 898
899NpadType EmulatedController::GetNpadType(bool get_temporary_value) const { 899NpadStyleIndex EmulatedController::GetNpadStyleIndex(bool get_temporary_value) const {
900 if (get_temporary_value) { 900 if (get_temporary_value) {
901 return tmp_npad_type; 901 return tmp_npad_type;
902 } 902 }
903 return npad_type; 903 return npad_type;
904} 904}
905 905
906void EmulatedController::SetNpadType(NpadType npad_type_) { 906void EmulatedController::SetNpadStyleIndex(NpadStyleIndex npad_type_) {
907 { 907 {
908 std::lock_guard lock{mutex}; 908 std::lock_guard lock{mutex};
909 909
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index 9a8bdf14d..fa2e89c0b 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -142,23 +142,23 @@ public:
142 YUZU_NON_MOVEABLE(EmulatedController); 142 YUZU_NON_MOVEABLE(EmulatedController);
143 143
144 /// Converts the controller type from settings to npad type 144 /// Converts the controller type from settings to npad type
145 static NpadType MapSettingsTypeToNPad(Settings::ControllerType type); 145 static NpadStyleIndex MapSettingsTypeToNPad(Settings::ControllerType type);
146 146
147 /// Converts npad type to the equivalent of controller type from settings 147 /// Converts npad type to the equivalent of controller type from settings
148 static Settings::ControllerType MapNPadToSettingsType(NpadType type); 148 static Settings::ControllerType MapNPadToSettingsType(NpadStyleIndex type);
149 149
150 /// Gets the NpadIdType for this controller 150 /// Gets the NpadIdType for this controller
151 NpadIdType GetNpadIdType() const; 151 NpadIdType GetNpadIdType() const;
152 152
153 /// Sets the NpadType for this controller 153 /// Sets the NpadStyleIndex for this controller
154 void SetNpadType(NpadType npad_type_); 154 void SetNpadStyleIndex(NpadStyleIndex npad_type_);
155 155
156 /** 156 /**
157 * Gets the NpadType for this controller 157 * Gets the NpadStyleIndex for this controller
158 * @param If true tmp_npad_type will be returned 158 * @param If true tmp_npad_type will be returned
159 * @return NpadType set on the controller 159 * @return NpadStyleIndex set on the controller
160 */ 160 */
161 NpadType GetNpadType(bool get_temporary_value = false) const; 161 NpadStyleIndex GetNpadStyleIndex(bool get_temporary_value = false) const;
162 162
163 /// Sets the connected status to true 163 /// Sets the connected status to true
164 void Connect(); 164 void Connect();
@@ -351,14 +351,14 @@ private:
351 void TriggerOnChange(ControllerTriggerType type, bool is_service_update); 351 void TriggerOnChange(ControllerTriggerType type, bool is_service_update);
352 352
353 NpadIdType npad_id_type; 353 NpadIdType npad_id_type;
354 NpadType npad_type{NpadType::None}; 354 NpadStyleIndex npad_type{NpadStyleIndex::None};
355 bool is_connected{false}; 355 bool is_connected{false};
356 bool is_configuring{false}; 356 bool is_configuring{false};
357 f32 motion_sensitivity{0.01f}; 357 f32 motion_sensitivity{0.01f};
358 bool force_update_motion{false}; 358 bool force_update_motion{false};
359 359
360 // Temporary values to avoid doing changes while the controller is on configuration mode 360 // Temporary values to avoid doing changes while the controller is on configuration mode
361 NpadType tmp_npad_type{NpadType::None}; 361 NpadStyleIndex tmp_npad_type{NpadStyleIndex::None};
362 bool tmp_is_connected{false}; 362 bool tmp_is_connected{false};
363 363
364 ButtonParams button_params; 364 ButtonParams button_params;
diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h
index f8a0d5edd..7e4f6a804 100644
--- a/src/core/hid/hid_types.h
+++ b/src/core/hid/hid_types.h
@@ -84,8 +84,8 @@ constexpr NpadIdType IndexToNpadIdType(size_t index) {
84 } 84 }
85} 85}
86 86
87// This is nn::hid::NpadType 87// This is nn::hid::NpadStyleIndex
88enum class NpadType : u8 { 88enum class NpadStyleIndex : u8 {
89 None = 0, 89 None = 0,
90 ProController = 3, 90 ProController = 3,
91 Handheld = 4, 91 Handheld = 4,
@@ -94,7 +94,14 @@ enum class NpadType : u8 {
94 JoyconRight = 7, 94 JoyconRight = 7,
95 GameCube = 8, 95 GameCube = 8,
96 Pokeball = 9, 96 Pokeball = 9,
97 MaxNpadType = 10, 97 NES = 10,
98 HandheldNES = 11,
99 SNES = 12,
100 N64 = 13,
101 SegaGenesis = 14,
102 SystemExt = 32,
103 System = 33,
104 MaxNpadType = 34,
98}; 105};
99 106
100// This is nn::hid::NpadStyleTag 107// This is nn::hid::NpadStyleTag
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 0b5a23696..e4a3d9163 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -93,7 +93,7 @@ bool Controller_NPad::IsNpadIdValid(u32 npad_id) {
93 93
94bool Controller_NPad::IsDeviceHandleValid(const DeviceHandle& device_handle) { 94bool Controller_NPad::IsDeviceHandleValid(const DeviceHandle& device_handle) {
95 return IsNpadIdValid(device_handle.npad_id) && 95 return IsNpadIdValid(device_handle.npad_id) &&
96 device_handle.npad_type < Core::HID::NpadType::MaxNpadType && 96 device_handle.npad_type < Core::HID::NpadStyleIndex::MaxNpadType &&
97 device_handle.device_index < DeviceIndex::MaxDeviceIndex; 97 device_handle.device_index < DeviceIndex::MaxDeviceIndex;
98} 98}
99 99
@@ -134,7 +134,7 @@ void Controller_NPad::ControllerUpdate(Core::HID::ControllerTriggerType type,
134 134
135 auto& controller = controller_data[controller_idx]; 135 auto& controller = controller_data[controller_idx];
136 const auto is_connected = controller.device->IsConnected(); 136 const auto is_connected = controller.device->IsConnected();
137 const auto npad_type = controller.device->GetNpadType(); 137 const auto npad_type = controller.device->GetNpadStyleIndex();
138 switch (type) { 138 switch (type) {
139 case Core::HID::ControllerTriggerType::Connected: 139 case Core::HID::ControllerTriggerType::Connected:
140 case Core::HID::ControllerTriggerType::Disconnected: 140 case Core::HID::ControllerTriggerType::Disconnected:
@@ -161,9 +161,9 @@ void Controller_NPad::ControllerUpdate(Core::HID::ControllerTriggerType type,
161 161
162void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { 162void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
163 auto& controller = controller_data[controller_idx]; 163 auto& controller = controller_data[controller_idx];
164 const auto controller_type = controller.device->GetNpadType(); 164 const auto controller_type = controller.device->GetNpadStyleIndex();
165 auto& shared_memory = controller.shared_memory_entry; 165 auto& shared_memory = controller.shared_memory_entry;
166 if (controller_type == Core::HID::NpadType::None) { 166 if (controller_type == Core::HID::NpadStyleIndex::None) {
167 controller.styleset_changed_event->GetWritableEvent().Signal(); 167 controller.styleset_changed_event->GetWritableEvent().Signal();
168 return; 168 return;
169 } 169 }
@@ -171,10 +171,10 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
171 shared_memory.device_type.raw = 0; 171 shared_memory.device_type.raw = 0;
172 shared_memory.system_properties.raw = 0; 172 shared_memory.system_properties.raw = 0;
173 switch (controller_type) { 173 switch (controller_type) {
174 case Core::HID::NpadType::None: 174 case Core::HID::NpadStyleIndex::None:
175 UNREACHABLE(); 175 UNREACHABLE();
176 break; 176 break;
177 case Core::HID::NpadType::ProController: 177 case Core::HID::NpadStyleIndex::ProController:
178 shared_memory.style_set.fullkey.Assign(1); 178 shared_memory.style_set.fullkey.Assign(1);
179 shared_memory.device_type.fullkey.Assign(1); 179 shared_memory.device_type.fullkey.Assign(1);
180 shared_memory.system_properties.is_vertical.Assign(1); 180 shared_memory.system_properties.is_vertical.Assign(1);
@@ -183,7 +183,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
183 shared_memory.assignment_mode = NpadJoyAssignmentMode::Single; 183 shared_memory.assignment_mode = NpadJoyAssignmentMode::Single;
184 shared_memory.applet_footer.type = AppletFooterUiType::SwitchProController; 184 shared_memory.applet_footer.type = AppletFooterUiType::SwitchProController;
185 break; 185 break;
186 case Core::HID::NpadType::Handheld: 186 case Core::HID::NpadStyleIndex::Handheld:
187 shared_memory.style_set.handheld.Assign(1); 187 shared_memory.style_set.handheld.Assign(1);
188 shared_memory.device_type.handheld_left.Assign(1); 188 shared_memory.device_type.handheld_left.Assign(1);
189 shared_memory.device_type.handheld_right.Assign(1); 189 shared_memory.device_type.handheld_right.Assign(1);
@@ -193,7 +193,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
193 shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual; 193 shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual;
194 shared_memory.applet_footer.type = AppletFooterUiType::HandheldJoyConLeftJoyConRight; 194 shared_memory.applet_footer.type = AppletFooterUiType::HandheldJoyConLeftJoyConRight;
195 break; 195 break;
196 case Core::HID::NpadType::JoyconDual: 196 case Core::HID::NpadStyleIndex::JoyconDual:
197 shared_memory.style_set.joycon_dual.Assign(1); 197 shared_memory.style_set.joycon_dual.Assign(1);
198 shared_memory.device_type.joycon_left.Assign(1); 198 shared_memory.device_type.joycon_left.Assign(1);
199 shared_memory.device_type.joycon_right.Assign(1); 199 shared_memory.device_type.joycon_right.Assign(1);
@@ -203,7 +203,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
203 shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual; 203 shared_memory.assignment_mode = NpadJoyAssignmentMode::Dual;
204 shared_memory.applet_footer.type = AppletFooterUiType::JoyDual; 204 shared_memory.applet_footer.type = AppletFooterUiType::JoyDual;
205 break; 205 break;
206 case Core::HID::NpadType::JoyconLeft: 206 case Core::HID::NpadStyleIndex::JoyconLeft:
207 shared_memory.style_set.joycon_left.Assign(1); 207 shared_memory.style_set.joycon_left.Assign(1);
208 shared_memory.device_type.joycon_left.Assign(1); 208 shared_memory.device_type.joycon_left.Assign(1);
209 shared_memory.system_properties.is_horizontal.Assign(1); 209 shared_memory.system_properties.is_horizontal.Assign(1);
@@ -211,7 +211,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
211 shared_memory.assignment_mode = NpadJoyAssignmentMode::Single; 211 shared_memory.assignment_mode = NpadJoyAssignmentMode::Single;
212 shared_memory.applet_footer.type = AppletFooterUiType::JoyLeftHorizontal; 212 shared_memory.applet_footer.type = AppletFooterUiType::JoyLeftHorizontal;
213 break; 213 break;
214 case Core::HID::NpadType::JoyconRight: 214 case Core::HID::NpadStyleIndex::JoyconRight:
215 shared_memory.style_set.joycon_right.Assign(1); 215 shared_memory.style_set.joycon_right.Assign(1);
216 shared_memory.device_type.joycon_right.Assign(1); 216 shared_memory.device_type.joycon_right.Assign(1);
217 shared_memory.system_properties.is_horizontal.Assign(1); 217 shared_memory.system_properties.is_horizontal.Assign(1);
@@ -219,14 +219,14 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) {
219 shared_memory.assignment_mode = NpadJoyAssignmentMode::Single; 219 shared_memory.assignment_mode = NpadJoyAssignmentMode::Single;
220 shared_memory.applet_footer.type = AppletFooterUiType::JoyRightHorizontal; 220 shared_memory.applet_footer.type = AppletFooterUiType::JoyRightHorizontal;
221 break; 221 break;
222 case Core::HID::NpadType::GameCube: 222 case Core::HID::NpadStyleIndex::GameCube:
223 shared_memory.style_set.gamecube.Assign(1); 223 shared_memory.style_set.gamecube.Assign(1);
224 // The GC Controller behaves like a wired Pro Controller 224 // The GC Controller behaves like a wired Pro Controller
225 shared_memory.device_type.fullkey.Assign(1); 225 shared_memory.device_type.fullkey.Assign(1);
226 shared_memory.system_properties.is_vertical.Assign(1); 226 shared_memory.system_properties.is_vertical.Assign(1);
227 shared_memory.system_properties.use_plus.Assign(1); 227 shared_memory.system_properties.use_plus.Assign(1);
228 break; 228 break;
229 case Core::HID::NpadType::Pokeball: 229 case Core::HID::NpadStyleIndex::Pokeball:
230 shared_memory.style_set.palma.Assign(1); 230 shared_memory.style_set.palma.Assign(1);
231 shared_memory.device_type.palma.Assign(1); 231 shared_memory.device_type.palma.Assign(1);
232 shared_memory.assignment_mode = NpadJoyAssignmentMode::Single; 232 shared_memory.assignment_mode = NpadJoyAssignmentMode::Single;
@@ -307,7 +307,7 @@ void Controller_NPad::OnInit() {
307 const auto& device = controller.device; 307 const auto& device = controller.device;
308 if (device->IsConnected()) { 308 if (device->IsConnected()) {
309 const std::size_t index = Core::HID::NpadIdTypeToIndex(device->GetNpadIdType()); 309 const std::size_t index = Core::HID::NpadIdTypeToIndex(device->GetNpadIdType());
310 AddNewControllerAt(device->GetNpadType(), index); 310 AddNewControllerAt(device->GetNpadStyleIndex(), index);
311 } 311 }
312 } 312 }
313} 313}
@@ -347,7 +347,7 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
347 std::lock_guard lock{mutex}; 347 std::lock_guard lock{mutex};
348 const auto controller_idx = NPadIdToIndex(npad_id); 348 const auto controller_idx = NPadIdToIndex(npad_id);
349 auto& controller = controller_data[controller_idx]; 349 auto& controller = controller_data[controller_idx];
350 const auto controller_type = controller.device->GetNpadType(); 350 const auto controller_type = controller.device->GetNpadStyleIndex();
351 if (!controller.device->IsConnected()) { 351 if (!controller.device->IsConnected()) {
352 return; 352 return;
353 } 353 }
@@ -359,7 +359,7 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
359 359
360 using btn = Core::HID::NpadButton; 360 using btn = Core::HID::NpadButton;
361 pad_entry.npad_buttons.raw = btn::None; 361 pad_entry.npad_buttons.raw = btn::None;
362 if (controller_type != Core::HID::NpadType::JoyconLeft) { 362 if (controller_type != Core::HID::NpadStyleIndex::JoyconLeft) {
363 constexpr btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R | 363 constexpr btn right_button_mask = btn::A | btn::B | btn::X | btn::Y | btn::StickR | btn::R |
364 btn::ZR | btn::Plus | btn::StickRLeft | btn::StickRUp | 364 btn::ZR | btn::Plus | btn::StickRLeft | btn::StickRUp |
365 btn::StickRRight | btn::StickRDown; 365 btn::StickRRight | btn::StickRDown;
@@ -367,7 +367,7 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
367 pad_entry.r_stick = stick_state.right; 367 pad_entry.r_stick = stick_state.right;
368 } 368 }
369 369
370 if (controller_type != Core::HID::NpadType::JoyconRight) { 370 if (controller_type != Core::HID::NpadStyleIndex::JoyconRight) {
371 constexpr btn left_button_mask = 371 constexpr btn left_button_mask =
372 btn::Left | btn::Up | btn::Right | btn::Down | btn::StickL | btn::L | btn::ZL | 372 btn::Left | btn::Up | btn::Right | btn::Down | btn::StickL | btn::L | btn::ZL |
373 btn::Minus | btn::StickLLeft | btn::StickLUp | btn::StickLRight | btn::StickLDown; 373 btn::Minus | btn::StickLLeft | btn::StickLUp | btn::StickLRight | btn::StickLDown;
@@ -375,17 +375,17 @@ void Controller_NPad::RequestPadStateUpdate(u32 npad_id) {
375 pad_entry.l_stick = stick_state.left; 375 pad_entry.l_stick = stick_state.left;
376 } 376 }
377 377
378 if (controller_type == Core::HID::NpadType::JoyconLeft) { 378 if (controller_type == Core::HID::NpadStyleIndex::JoyconLeft) {
379 pad_entry.npad_buttons.left_sl.Assign(button_state.left_sl); 379 pad_entry.npad_buttons.left_sl.Assign(button_state.left_sl);
380 pad_entry.npad_buttons.left_sr.Assign(button_state.left_sr); 380 pad_entry.npad_buttons.left_sr.Assign(button_state.left_sr);
381 } 381 }
382 382
383 if (controller_type == Core::HID::NpadType::JoyconRight) { 383 if (controller_type == Core::HID::NpadStyleIndex::JoyconRight) {
384 pad_entry.npad_buttons.right_sl.Assign(button_state.right_sl); 384 pad_entry.npad_buttons.right_sl.Assign(button_state.right_sl);
385 pad_entry.npad_buttons.right_sr.Assign(button_state.right_sr); 385 pad_entry.npad_buttons.right_sr.Assign(button_state.right_sr);
386 } 386 }
387 387
388 if (controller_type == Core::HID::NpadType::GameCube) { 388 if (controller_type == Core::HID::NpadStyleIndex::GameCube) {
389 const auto& trigger_state = controller.device->GetTriggers(); 389 const auto& trigger_state = controller.device->GetTriggers();
390 trigger_entry.l_analog = trigger_state.left; 390 trigger_entry.l_analog = trigger_state.left;
391 trigger_entry.r_analog = trigger_state.right; 391 trigger_entry.r_analog = trigger_state.right;
@@ -406,9 +406,10 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
406 auto& controller = controller_data[i]; 406 auto& controller = controller_data[i];
407 auto& npad = controller.shared_memory_entry; 407 auto& npad = controller.shared_memory_entry;
408 408
409 const auto& controller_type = controller.device->GetNpadType(); 409 const auto& controller_type = controller.device->GetNpadStyleIndex();
410 410
411 if (controller_type == Core::HID::NpadType::None || !controller.device->IsConnected()) { 411 if (controller_type == Core::HID::NpadStyleIndex::None ||
412 !controller.device->IsConnected()) {
412 // Refresh shared memory 413 // Refresh shared memory
413 std::memcpy(data + NPAD_OFFSET + (i * sizeof(NpadInternalState)), 414 std::memcpy(data + NPAD_OFFSET + (i * sizeof(NpadInternalState)),
414 &controller.shared_memory_entry, sizeof(NpadInternalState)); 415 &controller.shared_memory_entry, sizeof(NpadInternalState));
@@ -426,10 +427,10 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
426 libnx_state.connection_status.raw = 0; 427 libnx_state.connection_status.raw = 0;
427 libnx_state.connection_status.is_connected.Assign(1); 428 libnx_state.connection_status.is_connected.Assign(1);
428 switch (controller_type) { 429 switch (controller_type) {
429 case Core::HID::NpadType::None: 430 case Core::HID::NpadStyleIndex::None:
430 UNREACHABLE(); 431 UNREACHABLE();
431 break; 432 break;
432 case Core::HID::NpadType::ProController: 433 case Core::HID::NpadStyleIndex::ProController:
433 pad_state.connection_status.raw = 0; 434 pad_state.connection_status.raw = 0;
434 pad_state.connection_status.is_connected.Assign(1); 435 pad_state.connection_status.is_connected.Assign(1);
435 pad_state.connection_status.is_wired.Assign(1); 436 pad_state.connection_status.is_wired.Assign(1);
@@ -439,7 +440,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
439 npad.fullkey_lifo.ReadCurrentEntry().state.sampling_number + 1; 440 npad.fullkey_lifo.ReadCurrentEntry().state.sampling_number + 1;
440 npad.fullkey_lifo.WriteNextEntry(pad_state); 441 npad.fullkey_lifo.WriteNextEntry(pad_state);
441 break; 442 break;
442 case Core::HID::NpadType::Handheld: 443 case Core::HID::NpadStyleIndex::Handheld:
443 pad_state.connection_status.raw = 0; 444 pad_state.connection_status.raw = 0;
444 pad_state.connection_status.is_connected.Assign(1); 445 pad_state.connection_status.is_connected.Assign(1);
445 pad_state.connection_status.is_wired.Assign(1); 446 pad_state.connection_status.is_wired.Assign(1);
@@ -457,7 +458,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
457 npad.handheld_lifo.ReadCurrentEntry().state.sampling_number + 1; 458 npad.handheld_lifo.ReadCurrentEntry().state.sampling_number + 1;
458 npad.handheld_lifo.WriteNextEntry(pad_state); 459 npad.handheld_lifo.WriteNextEntry(pad_state);
459 break; 460 break;
460 case Core::HID::NpadType::JoyconDual: 461 case Core::HID::NpadStyleIndex::JoyconDual:
461 pad_state.connection_status.raw = 0; 462 pad_state.connection_status.raw = 0;
462 pad_state.connection_status.is_connected.Assign(1); 463 pad_state.connection_status.is_connected.Assign(1);
463 pad_state.connection_status.is_left_connected.Assign(1); 464 pad_state.connection_status.is_left_connected.Assign(1);
@@ -469,7 +470,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
469 npad.joy_dual_lifo.ReadCurrentEntry().state.sampling_number + 1; 470 npad.joy_dual_lifo.ReadCurrentEntry().state.sampling_number + 1;
470 npad.joy_dual_lifo.WriteNextEntry(pad_state); 471 npad.joy_dual_lifo.WriteNextEntry(pad_state);
471 break; 472 break;
472 case Core::HID::NpadType::JoyconLeft: 473 case Core::HID::NpadStyleIndex::JoyconLeft:
473 pad_state.connection_status.raw = 0; 474 pad_state.connection_status.raw = 0;
474 pad_state.connection_status.is_connected.Assign(1); 475 pad_state.connection_status.is_connected.Assign(1);
475 pad_state.connection_status.is_left_connected.Assign(1); 476 pad_state.connection_status.is_left_connected.Assign(1);
@@ -479,7 +480,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
479 npad.joy_left_lifo.ReadCurrentEntry().state.sampling_number + 1; 480 npad.joy_left_lifo.ReadCurrentEntry().state.sampling_number + 1;
480 npad.joy_left_lifo.WriteNextEntry(pad_state); 481 npad.joy_left_lifo.WriteNextEntry(pad_state);
481 break; 482 break;
482 case Core::HID::NpadType::JoyconRight: 483 case Core::HID::NpadStyleIndex::JoyconRight:
483 pad_state.connection_status.raw = 0; 484 pad_state.connection_status.raw = 0;
484 pad_state.connection_status.is_connected.Assign(1); 485 pad_state.connection_status.is_connected.Assign(1);
485 pad_state.connection_status.is_right_connected.Assign(1); 486 pad_state.connection_status.is_right_connected.Assign(1);
@@ -489,7 +490,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
489 npad.joy_right_lifo.ReadCurrentEntry().state.sampling_number + 1; 490 npad.joy_right_lifo.ReadCurrentEntry().state.sampling_number + 1;
490 npad.joy_right_lifo.WriteNextEntry(pad_state); 491 npad.joy_right_lifo.WriteNextEntry(pad_state);
491 break; 492 break;
492 case Core::HID::NpadType::GameCube: 493 case Core::HID::NpadStyleIndex::GameCube:
493 pad_state.connection_status.raw = 0; 494 pad_state.connection_status.raw = 0;
494 pad_state.connection_status.is_connected.Assign(1); 495 pad_state.connection_status.is_connected.Assign(1);
495 pad_state.connection_status.is_wired.Assign(1); 496 pad_state.connection_status.is_wired.Assign(1);
@@ -502,7 +503,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
502 npad.fullkey_lifo.WriteNextEntry(pad_state); 503 npad.fullkey_lifo.WriteNextEntry(pad_state);
503 npad.gc_trigger_lifo.WriteNextEntry(trigger_state); 504 npad.gc_trigger_lifo.WriteNextEntry(trigger_state);
504 break; 505 break;
505 case Core::HID::NpadType::Pokeball: 506 case Core::HID::NpadStyleIndex::Pokeball:
506 pad_state.connection_status.raw = 0; 507 pad_state.connection_status.raw = 0;
507 pad_state.connection_status.is_connected.Assign(1); 508 pad_state.connection_status.is_connected.Assign(1);
508 pad_state.sampling_number = 509 pad_state.sampling_number =
@@ -534,9 +535,10 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
534 for (std::size_t i = 0; i < controller_data.size(); ++i) { 535 for (std::size_t i = 0; i < controller_data.size(); ++i) {
535 auto& controller = controller_data[i]; 536 auto& controller = controller_data[i];
536 537
537 const auto& controller_type = controller.device->GetNpadType(); 538 const auto& controller_type = controller.device->GetNpadStyleIndex();
538 539
539 if (controller_type == Core::HID::NpadType::None || !controller.device->IsConnected()) { 540 if (controller_type == Core::HID::NpadStyleIndex::None ||
541 !controller.device->IsConnected()) {
540 continue; 542 continue;
541 } 543 }
542 544
@@ -557,10 +559,10 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
557 } 559 }
558 560
559 switch (controller_type) { 561 switch (controller_type) {
560 case Core::HID::NpadType::None: 562 case Core::HID::NpadStyleIndex::None:
561 UNREACHABLE(); 563 UNREACHABLE();
562 break; 564 break;
563 case Core::HID::NpadType::ProController: 565 case Core::HID::NpadStyleIndex::ProController:
564 sixaxis_fullkey_state.attribute.raw = 0; 566 sixaxis_fullkey_state.attribute.raw = 0;
565 if (sixaxis_sensors_enabled) { 567 if (sixaxis_sensors_enabled) {
566 sixaxis_fullkey_state.attribute.is_connected.Assign(1); 568 sixaxis_fullkey_state.attribute.is_connected.Assign(1);
@@ -570,7 +572,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
570 sixaxis_fullkey_state.orientation = motion_state[0].orientation; 572 sixaxis_fullkey_state.orientation = motion_state[0].orientation;
571 } 573 }
572 break; 574 break;
573 case Core::HID::NpadType::Handheld: 575 case Core::HID::NpadStyleIndex::Handheld:
574 sixaxis_handheld_state.attribute.raw = 0; 576 sixaxis_handheld_state.attribute.raw = 0;
575 if (sixaxis_sensors_enabled) { 577 if (sixaxis_sensors_enabled) {
576 sixaxis_handheld_state.attribute.is_connected.Assign(1); 578 sixaxis_handheld_state.attribute.is_connected.Assign(1);
@@ -580,7 +582,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
580 sixaxis_handheld_state.orientation = motion_state[0].orientation; 582 sixaxis_handheld_state.orientation = motion_state[0].orientation;
581 } 583 }
582 break; 584 break;
583 case Core::HID::NpadType::JoyconDual: 585 case Core::HID::NpadStyleIndex::JoyconDual:
584 sixaxis_dual_left_state.attribute.raw = 0; 586 sixaxis_dual_left_state.attribute.raw = 0;
585 sixaxis_dual_right_state.attribute.raw = 0; 587 sixaxis_dual_right_state.attribute.raw = 0;
586 if (sixaxis_sensors_enabled) { 588 if (sixaxis_sensors_enabled) {
@@ -600,7 +602,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
600 sixaxis_dual_right_state.orientation = motion_state[1].orientation; 602 sixaxis_dual_right_state.orientation = motion_state[1].orientation;
601 } 603 }
602 break; 604 break;
603 case Core::HID::NpadType::JoyconLeft: 605 case Core::HID::NpadStyleIndex::JoyconLeft:
604 sixaxis_left_lifo_state.attribute.raw = 0; 606 sixaxis_left_lifo_state.attribute.raw = 0;
605 if (sixaxis_sensors_enabled) { 607 if (sixaxis_sensors_enabled) {
606 sixaxis_left_lifo_state.attribute.is_connected.Assign(1); 608 sixaxis_left_lifo_state.attribute.is_connected.Assign(1);
@@ -610,7 +612,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
610 sixaxis_left_lifo_state.orientation = motion_state[0].orientation; 612 sixaxis_left_lifo_state.orientation = motion_state[0].orientation;
611 } 613 }
612 break; 614 break;
613 case Core::HID::NpadType::JoyconRight: 615 case Core::HID::NpadStyleIndex::JoyconRight:
614 sixaxis_right_lifo_state.attribute.raw = 0; 616 sixaxis_right_lifo_state.attribute.raw = 0;
615 if (sixaxis_sensors_enabled) { 617 if (sixaxis_sensors_enabled) {
616 sixaxis_right_lifo_state.attribute.is_connected.Assign(1); 618 sixaxis_right_lifo_state.attribute.is_connected.Assign(1);
@@ -779,11 +781,11 @@ void Controller_NPad::VibrateController(const DeviceHandle& vibration_device_han
779 } 781 }
780 782
781 // Some games try to send mismatched parameters in the device handle, block these. 783 // Some games try to send mismatched parameters in the device handle, block these.
782 if ((controller.device->GetNpadType() == Core::HID::NpadType::JoyconLeft && 784 if ((controller.device->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconLeft &&
783 (vibration_device_handle.npad_type == Core::HID::NpadType::JoyconRight || 785 (vibration_device_handle.npad_type == Core::HID::NpadStyleIndex::JoyconRight ||
784 vibration_device_handle.device_index == DeviceIndex::Right)) || 786 vibration_device_handle.device_index == DeviceIndex::Right)) ||
785 (controller.device->GetNpadType() == Core::HID::NpadType::JoyconRight && 787 (controller.device->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconRight &&
786 (vibration_device_handle.npad_type == Core::HID::NpadType::JoyconLeft || 788 (vibration_device_handle.npad_type == Core::HID::NpadStyleIndex::JoyconLeft ||
787 vibration_device_handle.device_index == DeviceIndex::Left))) { 789 vibration_device_handle.device_index == DeviceIndex::Left))) {
788 return; 790 return;
789 } 791 }
@@ -876,11 +878,12 @@ void Controller_NPad::SignalStyleSetChangedEvent(u32 npad_id) const {
876 controller.styleset_changed_event->GetWritableEvent().Signal(); 878 controller.styleset_changed_event->GetWritableEvent().Signal();
877} 879}
878 880
879void Controller_NPad::AddNewControllerAt(Core::HID::NpadType controller, std::size_t npad_index) { 881void Controller_NPad::AddNewControllerAt(Core::HID::NpadStyleIndex controller,
882 std::size_t npad_index) {
880 UpdateControllerAt(controller, npad_index, true); 883 UpdateControllerAt(controller, npad_index, true);
881} 884}
882 885
883void Controller_NPad::UpdateControllerAt(Core::HID::NpadType type, std::size_t npad_index, 886void Controller_NPad::UpdateControllerAt(Core::HID::NpadStyleIndex type, std::size_t npad_index,
884 bool connected) { 887 bool connected) {
885 auto& controller = controller_data[npad_index]; 888 auto& controller = controller_data[npad_index];
886 if (!connected) { 889 if (!connected) {
@@ -888,7 +891,7 @@ void Controller_NPad::UpdateControllerAt(Core::HID::NpadType type, std::size_t n
888 return; 891 return;
889 } 892 }
890 893
891 controller.device->SetNpadType(type); 894 controller.device->SetNpadStyleIndex(type);
892 InitNewlyAddedController(npad_index); 895 InitNewlyAddedController(npad_index);
893} 896}
894 897
@@ -971,13 +974,13 @@ void Controller_NPad::MergeSingleJoyAsDualJoy(u32 npad_id_1, u32 npad_id_2) {
971 974
972 // If the controllers at both npad indices form a pair of left and right joycons, merge them. 975 // If the controllers at both npad indices form a pair of left and right joycons, merge them.
973 // Otherwise, do nothing. 976 // Otherwise, do nothing.
974 if ((controller_1->GetNpadType() == Core::HID::NpadType::JoyconLeft && 977 if ((controller_1->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconLeft &&
975 controller_2->GetNpadType() == Core::HID::NpadType::JoyconRight) || 978 controller_2->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconRight) ||
976 (controller_2->GetNpadType() == Core::HID::NpadType::JoyconLeft && 979 (controller_2->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconLeft &&
977 controller_1->GetNpadType() == Core::HID::NpadType::JoyconRight)) { 980 controller_1->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::JoyconRight)) {
978 // Disconnect the joycon at the second id and connect the dual joycon at the first index. 981 // Disconnect the joycon at the second id and connect the dual joycon at the first index.
979 DisconnectNpad(npad_id_2); 982 DisconnectNpad(npad_id_2);
980 AddNewControllerAt(Core::HID::NpadType::JoyconDual, npad_index_1); 983 AddNewControllerAt(Core::HID::NpadStyleIndex::JoyconDual, npad_index_1);
981 } 984 }
982} 985}
983 986
@@ -1000,8 +1003,8 @@ bool Controller_NPad::SwapNpadAssignment(u32 npad_id_1, u32 npad_id_2) {
1000 const auto npad_index_2 = NPadIdToIndex(npad_id_2); 1003 const auto npad_index_2 = NPadIdToIndex(npad_id_2);
1001 const auto& controller_1 = controller_data[npad_index_1].device; 1004 const auto& controller_1 = controller_data[npad_index_1].device;
1002 const auto& controller_2 = controller_data[npad_index_2].device; 1005 const auto& controller_2 = controller_data[npad_index_2].device;
1003 const auto type_index_1 = controller_1->GetNpadType(); 1006 const auto type_index_1 = controller_1->GetNpadStyleIndex();
1004 const auto type_index_2 = controller_2->GetNpadType(); 1007 const auto type_index_2 = controller_2->GetNpadStyleIndex();
1005 1008
1006 if (!IsControllerSupported(type_index_1) || !IsControllerSupported(type_index_2)) { 1009 if (!IsControllerSupported(type_index_1) || !IsControllerSupported(type_index_2)) {
1007 return false; 1010 return false;
@@ -1039,9 +1042,9 @@ void Controller_NPad::SetAnalogStickUseCenterClamp(bool use_center_clamp) {
1039void Controller_NPad::ClearAllConnectedControllers() { 1042void Controller_NPad::ClearAllConnectedControllers() {
1040 for (auto& controller : controller_data) { 1043 for (auto& controller : controller_data) {
1041 if (controller.device->IsConnected() && 1044 if (controller.device->IsConnected() &&
1042 controller.device->GetNpadType() != Core::HID::NpadType::None) { 1045 controller.device->GetNpadStyleIndex() != Core::HID::NpadStyleIndex::None) {
1043 controller.device->SetNpadType(Core::HID::NpadType::None);
1044 controller.device->Disconnect(); 1046 controller.device->Disconnect();
1047 controller.device->SetNpadStyleIndex(Core::HID::NpadStyleIndex::None);
1045 } 1048 }
1046 } 1049 }
1047} 1050}
@@ -1054,7 +1057,7 @@ void Controller_NPad::DisconnectAllConnectedControllers() {
1054 1057
1055void Controller_NPad::ConnectAllDisconnectedControllers() { 1058void Controller_NPad::ConnectAllDisconnectedControllers() {
1056 for (auto& controller : controller_data) { 1059 for (auto& controller : controller_data) {
1057 if (controller.device->GetNpadType() != Core::HID::NpadType::None && 1060 if (controller.device->GetNpadStyleIndex() != Core::HID::NpadStyleIndex::None &&
1058 !controller.device->IsConnected()) { 1061 !controller.device->IsConnected()) {
1059 controller.device->Connect(); 1062 controller.device->Connect();
1060 } 1063 }
@@ -1063,8 +1066,8 @@ void Controller_NPad::ConnectAllDisconnectedControllers() {
1063 1066
1064void Controller_NPad::ClearAllControllers() { 1067void Controller_NPad::ClearAllControllers() {
1065 for (auto& controller : controller_data) { 1068 for (auto& controller : controller_data) {
1066 controller.device->SetNpadType(Core::HID::NpadType::None);
1067 controller.device->Disconnect(); 1069 controller.device->Disconnect();
1070 controller.device->SetNpadStyleIndex(Core::HID::NpadStyleIndex::None);
1068 } 1071 }
1069} 1072}
1070 1073
@@ -1072,8 +1075,8 @@ u32 Controller_NPad::GetAndResetPressState() {
1072 return press_state.exchange(0); 1075 return press_state.exchange(0);
1073} 1076}
1074 1077
1075bool Controller_NPad::IsControllerSupported(Core::HID::NpadType controller) const { 1078bool Controller_NPad::IsControllerSupported(Core::HID::NpadStyleIndex controller) const {
1076 if (controller == Core::HID::NpadType::Handheld) { 1079 if (controller == Core::HID::NpadStyleIndex::Handheld) {
1077 const bool support_handheld = 1080 const bool support_handheld =
1078 std::find(supported_npad_id_types.begin(), supported_npad_id_types.end(), 1081 std::find(supported_npad_id_types.begin(), supported_npad_id_types.end(),
1079 NPAD_HANDHELD) != supported_npad_id_types.end(); 1082 NPAD_HANDHELD) != supported_npad_id_types.end();
@@ -1093,17 +1096,17 @@ bool Controller_NPad::IsControllerSupported(Core::HID::NpadType controller) cons
1093 [](u32 npad_id) { return npad_id <= MAX_NPAD_ID; })) { 1096 [](u32 npad_id) { return npad_id <= MAX_NPAD_ID; })) {
1094 Core::HID::NpadStyleTag style = GetSupportedStyleSet(); 1097 Core::HID::NpadStyleTag style = GetSupportedStyleSet();
1095 switch (controller) { 1098 switch (controller) {
1096 case Core::HID::NpadType::ProController: 1099 case Core::HID::NpadStyleIndex::ProController:
1097 return style.fullkey; 1100 return style.fullkey;
1098 case Core::HID::NpadType::JoyconDual: 1101 case Core::HID::NpadStyleIndex::JoyconDual:
1099 return style.joycon_dual; 1102 return style.joycon_dual;
1100 case Core::HID::NpadType::JoyconLeft: 1103 case Core::HID::NpadStyleIndex::JoyconLeft:
1101 return style.joycon_left; 1104 return style.joycon_left;
1102 case Core::HID::NpadType::JoyconRight: 1105 case Core::HID::NpadStyleIndex::JoyconRight:
1103 return style.joycon_right; 1106 return style.joycon_right;
1104 case Core::HID::NpadType::GameCube: 1107 case Core::HID::NpadStyleIndex::GameCube:
1105 return style.gamecube; 1108 return style.gamecube;
1106 case Core::HID::NpadType::Pokeball: 1109 case Core::HID::NpadStyleIndex::Pokeball:
1107 return style.palma; 1110 return style.palma;
1108 default: 1111 default:
1109 return false; 1112 return false;
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index 871d245fd..512fb5afc 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -96,7 +96,7 @@ public:
96 }; 96 };
97 97
98 struct DeviceHandle { 98 struct DeviceHandle {
99 Core::HID::NpadType npad_type; 99 Core::HID::NpadStyleIndex npad_type;
100 u8 npad_id; 100 u8 npad_id;
101 DeviceIndex device_index; 101 DeviceIndex device_index;
102 INSERT_PADDING_BYTES_NOINIT(1); 102 INSERT_PADDING_BYTES_NOINIT(1);
@@ -160,9 +160,10 @@ public:
160 void SignalStyleSetChangedEvent(u32 npad_id) const; 160 void SignalStyleSetChangedEvent(u32 npad_id) const;
161 161
162 // Adds a new controller at an index. 162 // Adds a new controller at an index.
163 void AddNewControllerAt(Core::HID::NpadType controller, std::size_t npad_index); 163 void AddNewControllerAt(Core::HID::NpadStyleIndex controller, std::size_t npad_index);
164 // Adds a new controller at an index with connection status. 164 // Adds a new controller at an index with connection status.
165 void UpdateControllerAt(Core::HID::NpadType controller, std::size_t npad_index, bool connected); 165 void UpdateControllerAt(Core::HID::NpadStyleIndex controller, std::size_t npad_index,
166 bool connected);
166 167
167 void DisconnectNpad(u32 npad_id); 168 void DisconnectNpad(u32 npad_id);
168 void DisconnectNpadAtIndex(std::size_t index); 169 void DisconnectNpadAtIndex(std::size_t index);
@@ -496,7 +497,7 @@ private:
496 std::array<VibrationData, 2> vibration{}; 497 std::array<VibrationData, 2> vibration{};
497 bool unintended_home_button_input_protection{}; 498 bool unintended_home_button_input_protection{};
498 bool is_connected{}; 499 bool is_connected{};
499 Core::HID::NpadType npad_type{Core::HID::NpadType::None}; 500 Core::HID::NpadStyleIndex npad_type{Core::HID::NpadStyleIndex::None};
500 501
501 // Current pad state 502 // Current pad state
502 NPadGenericState npad_pad_state{}; 503 NPadGenericState npad_pad_state{};
@@ -513,7 +514,7 @@ private:
513 514
514 void ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t controller_idx); 515 void ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t controller_idx);
515 void InitNewlyAddedController(std::size_t controller_idx); 516 void InitNewlyAddedController(std::size_t controller_idx);
516 bool IsControllerSupported(Core::HID::NpadType controller) const; 517 bool IsControllerSupported(Core::HID::NpadStyleIndex controller) const;
517 void RequestPadStateUpdate(u32 npad_id); 518 void RequestPadStateUpdate(u32 npad_id);
518 void WriteEmptyEntry(NpadInternalState& npad); 519 void WriteEmptyEntry(NpadInternalState& npad);
519 520
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index ac48f96d3..648e69de9 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -1131,18 +1131,18 @@ void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) {
1131 Core::HID::VibrationDeviceInfo vibration_device_info; 1131 Core::HID::VibrationDeviceInfo vibration_device_info;
1132 1132
1133 switch (vibration_device_handle.npad_type) { 1133 switch (vibration_device_handle.npad_type) {
1134 case Core::HID::NpadType::ProController: 1134 case Core::HID::NpadStyleIndex::ProController:
1135 case Core::HID::NpadType::Handheld: 1135 case Core::HID::NpadStyleIndex::Handheld:
1136 case Core::HID::NpadType::JoyconDual: 1136 case Core::HID::NpadStyleIndex::JoyconDual:
1137 case Core::HID::NpadType::JoyconLeft: 1137 case Core::HID::NpadStyleIndex::JoyconLeft:
1138 case Core::HID::NpadType::JoyconRight: 1138 case Core::HID::NpadStyleIndex::JoyconRight:
1139 default: 1139 default:
1140 vibration_device_info.type = Core::HID::VibrationDeviceType::LinearResonantActuator; 1140 vibration_device_info.type = Core::HID::VibrationDeviceType::LinearResonantActuator;
1141 break; 1141 break;
1142 case Core::HID::NpadType::GameCube: 1142 case Core::HID::NpadStyleIndex::GameCube:
1143 vibration_device_info.type = Core::HID::VibrationDeviceType::GcErm; 1143 vibration_device_info.type = Core::HID::VibrationDeviceType::GcErm;
1144 break; 1144 break;
1145 case Core::HID::NpadType::Pokeball: 1145 case Core::HID::NpadStyleIndex::Pokeball:
1146 vibration_device_info.type = Core::HID::VibrationDeviceType::Unknown; 1146 vibration_device_info.type = Core::HID::VibrationDeviceType::Unknown;
1147 break; 1147 break;
1148 } 1148 }
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp
index 9c6377cf0..6a2cdda63 100644
--- a/src/yuzu/applets/qt_controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -28,31 +28,31 @@
28namespace { 28namespace {
29 29
30void UpdateController(Core::HID::EmulatedController* controller, 30void UpdateController(Core::HID::EmulatedController* controller,
31 Core::HID::NpadType controller_type, bool connected) { 31 Core::HID::NpadStyleIndex controller_type, bool connected) {
32 if (controller->IsConnected()) { 32 if (controller->IsConnected()) {
33 controller->Disconnect(); 33 controller->Disconnect();
34 } 34 }
35 controller->SetNpadType(controller_type); 35 controller->SetNpadStyleIndex(controller_type);
36 if (connected) { 36 if (connected) {
37 controller->Connect(); 37 controller->Connect();
38 } 38 }
39} 39}
40 40
41// Returns true if the given controller type is compatible with the given parameters. 41// Returns true if the given controller type is compatible with the given parameters.
42bool IsControllerCompatible(Core::HID::NpadType controller_type, 42bool IsControllerCompatible(Core::HID::NpadStyleIndex controller_type,
43 Core::Frontend::ControllerParameters parameters) { 43 Core::Frontend::ControllerParameters parameters) {
44 switch (controller_type) { 44 switch (controller_type) {
45 case Core::HID::NpadType::ProController: 45 case Core::HID::NpadStyleIndex::ProController:
46 return parameters.allow_pro_controller; 46 return parameters.allow_pro_controller;
47 case Core::HID::NpadType::JoyconDual: 47 case Core::HID::NpadStyleIndex::JoyconDual:
48 return parameters.allow_dual_joycons; 48 return parameters.allow_dual_joycons;
49 case Core::HID::NpadType::JoyconLeft: 49 case Core::HID::NpadStyleIndex::JoyconLeft:
50 return parameters.allow_left_joycon; 50 return parameters.allow_left_joycon;
51 case Core::HID::NpadType::JoyconRight: 51 case Core::HID::NpadStyleIndex::JoyconRight:
52 return parameters.allow_right_joycon; 52 return parameters.allow_right_joycon;
53 case Core::HID::NpadType::Handheld: 53 case Core::HID::NpadStyleIndex::Handheld:
54 return parameters.enable_single_mode && parameters.allow_handheld; 54 return parameters.enable_single_mode && parameters.allow_handheld;
55 case Core::HID::NpadType::GameCube: 55 case Core::HID::NpadStyleIndex::GameCube:
56 return parameters.allow_gamecube_controller; 56 return parameters.allow_gamecube_controller;
57 default: 57 default:
58 return false; 58 return false;
@@ -183,7 +183,7 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
183 connect(emulated_controllers[i], qOverload<int>(&QComboBox::currentIndexChanged), 183 connect(emulated_controllers[i], qOverload<int>(&QComboBox::currentIndexChanged),
184 [this, i](int index) { 184 [this, i](int index) {
185 UpdateDockedState(GetControllerTypeFromIndex(index, i) == 185 UpdateDockedState(GetControllerTypeFromIndex(index, i) ==
186 Core::HID::NpadType::Handheld); 186 Core::HID::NpadStyleIndex::Handheld);
187 }); 187 });
188 } 188 }
189 } 189 }
@@ -243,7 +243,7 @@ void QtControllerSelectorDialog::LoadConfiguration() {
243 player_groupboxes[index]->setChecked(connected); 243 player_groupboxes[index]->setChecked(connected);
244 connected_controller_checkboxes[index]->setChecked(connected); 244 connected_controller_checkboxes[index]->setChecked(connected);
245 emulated_controllers[index]->setCurrentIndex( 245 emulated_controllers[index]->setCurrentIndex(
246 GetIndexFromControllerType(controller->GetNpadType(), index)); 246 GetIndexFromControllerType(controller->GetNpadStyleIndex(), index));
247 } 247 }
248 248
249 UpdateDockedState(handheld->IsConnected()); 249 UpdateDockedState(handheld->IsConnected());
@@ -402,32 +402,33 @@ void QtControllerSelectorDialog::SetEmulatedControllers(std::size_t player_index
402 emulated_controllers[player_index]->clear(); 402 emulated_controllers[player_index]->clear();
403 403
404 pairs.emplace_back(emulated_controllers[player_index]->count(), 404 pairs.emplace_back(emulated_controllers[player_index]->count(),
405 Core::HID::NpadType::ProController); 405 Core::HID::NpadStyleIndex::ProController);
406 emulated_controllers[player_index]->addItem(tr("Pro Controller")); 406 emulated_controllers[player_index]->addItem(tr("Pro Controller"));
407 407
408 pairs.emplace_back(emulated_controllers[player_index]->count(), 408 pairs.emplace_back(emulated_controllers[player_index]->count(),
409 Core::HID::NpadType::JoyconDual); 409 Core::HID::NpadStyleIndex::JoyconDual);
410 emulated_controllers[player_index]->addItem(tr("Dual Joycons")); 410 emulated_controllers[player_index]->addItem(tr("Dual Joycons"));
411 411
412 pairs.emplace_back(emulated_controllers[player_index]->count(), 412 pairs.emplace_back(emulated_controllers[player_index]->count(),
413 Core::HID::NpadType::JoyconLeft); 413 Core::HID::NpadStyleIndex::JoyconLeft);
414 emulated_controllers[player_index]->addItem(tr("Left Joycon")); 414 emulated_controllers[player_index]->addItem(tr("Left Joycon"));
415 415
416 pairs.emplace_back(emulated_controllers[player_index]->count(), 416 pairs.emplace_back(emulated_controllers[player_index]->count(),
417 Core::HID::NpadType::JoyconRight); 417 Core::HID::NpadStyleIndex::JoyconRight);
418 emulated_controllers[player_index]->addItem(tr("Right Joycon")); 418 emulated_controllers[player_index]->addItem(tr("Right Joycon"));
419 419
420 if (player_index == 0) { 420 if (player_index == 0) {
421 pairs.emplace_back(emulated_controllers[player_index]->count(), 421 pairs.emplace_back(emulated_controllers[player_index]->count(),
422 Core::HID::NpadType::Handheld); 422 Core::HID::NpadStyleIndex::Handheld);
423 emulated_controllers[player_index]->addItem(tr("Handheld")); 423 emulated_controllers[player_index]->addItem(tr("Handheld"));
424 } 424 }
425 425
426 pairs.emplace_back(emulated_controllers[player_index]->count(), Core::HID::NpadType::GameCube); 426 pairs.emplace_back(emulated_controllers[player_index]->count(),
427 Core::HID::NpadStyleIndex::GameCube);
427 emulated_controllers[player_index]->addItem(tr("GameCube Controller")); 428 emulated_controllers[player_index]->addItem(tr("GameCube Controller"));
428} 429}
429 430
430Core::HID::NpadType QtControllerSelectorDialog::GetControllerTypeFromIndex( 431Core::HID::NpadStyleIndex QtControllerSelectorDialog::GetControllerTypeFromIndex(
431 int index, std::size_t player_index) const { 432 int index, std::size_t player_index) const {
432 const auto& pairs = index_controller_type_pairs[player_index]; 433 const auto& pairs = index_controller_type_pairs[player_index];
433 434
@@ -435,13 +436,13 @@ Core::HID::NpadType QtControllerSelectorDialog::GetControllerTypeFromIndex(
435 [index](const auto& pair) { return pair.first == index; }); 436 [index](const auto& pair) { return pair.first == index; });
436 437
437 if (it == pairs.end()) { 438 if (it == pairs.end()) {
438 return Core::HID::NpadType::ProController; 439 return Core::HID::NpadStyleIndex::ProController;
439 } 440 }
440 441
441 return it->second; 442 return it->second;
442} 443}
443 444
444int QtControllerSelectorDialog::GetIndexFromControllerType(Core::HID::NpadType type, 445int QtControllerSelectorDialog::GetIndexFromControllerType(Core::HID::NpadStyleIndex type,
445 std::size_t player_index) const { 446 std::size_t player_index) const {
446 const auto& pairs = index_controller_type_pairs[player_index]; 447 const auto& pairs = index_controller_type_pairs[player_index];
447 448
@@ -465,16 +466,16 @@ void QtControllerSelectorDialog::UpdateControllerIcon(std::size_t player_index)
465 const QString stylesheet = [this, player_index] { 466 const QString stylesheet = [this, player_index] {
466 switch (GetControllerTypeFromIndex(emulated_controllers[player_index]->currentIndex(), 467 switch (GetControllerTypeFromIndex(emulated_controllers[player_index]->currentIndex(),
467 player_index)) { 468 player_index)) {
468 case Core::HID::NpadType::ProController: 469 case Core::HID::NpadStyleIndex::ProController:
469 case Core::HID::NpadType::GameCube: 470 case Core::HID::NpadStyleIndex::GameCube:
470 return QStringLiteral("image: url(:/controller/applet_pro_controller%0); "); 471 return QStringLiteral("image: url(:/controller/applet_pro_controller%0); ");
471 case Core::HID::NpadType::JoyconDual: 472 case Core::HID::NpadStyleIndex::JoyconDual:
472 return QStringLiteral("image: url(:/controller/applet_dual_joycon%0); "); 473 return QStringLiteral("image: url(:/controller/applet_dual_joycon%0); ");
473 case Core::HID::NpadType::JoyconLeft: 474 case Core::HID::NpadStyleIndex::JoyconLeft:
474 return QStringLiteral("image: url(:/controller/applet_joycon_left%0); "); 475 return QStringLiteral("image: url(:/controller/applet_joycon_left%0); ");
475 case Core::HID::NpadType::JoyconRight: 476 case Core::HID::NpadStyleIndex::JoyconRight:
476 return QStringLiteral("image: url(:/controller/applet_joycon_right%0); "); 477 return QStringLiteral("image: url(:/controller/applet_joycon_right%0); ");
477 case Core::HID::NpadType::Handheld: 478 case Core::HID::NpadStyleIndex::Handheld:
478 return QStringLiteral("image: url(:/controller/applet_handheld%0); "); 479 return QStringLiteral("image: url(:/controller/applet_handheld%0); ");
479 default: 480 default:
480 return QString{}; 481 return QString{};
@@ -507,9 +508,9 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
507 const auto controller_type = GetControllerTypeFromIndex( 508 const auto controller_type = GetControllerTypeFromIndex(
508 emulated_controllers[player_index]->currentIndex(), player_index); 509 emulated_controllers[player_index]->currentIndex(), player_index);
509 const auto player_connected = player_groupboxes[player_index]->isChecked() && 510 const auto player_connected = player_groupboxes[player_index]->isChecked() &&
510 controller_type != Core::HID::NpadType::Handheld; 511 controller_type != Core::HID::NpadStyleIndex::Handheld;
511 512
512 if (controller->GetNpadType() == controller_type && 513 if (controller->GetNpadStyleIndex() == controller_type &&
513 controller->IsConnected() == player_connected) { 514 controller->IsConnected() == player_connected) {
514 // Set vibration devices in the event that the input device has changed. 515 // Set vibration devices in the event that the input device has changed.
515 ConfigureVibration::SetVibrationDevices(player_index); 516 ConfigureVibration::SetVibrationDevices(player_index);
@@ -523,10 +524,10 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
523 524
524 // Handheld 525 // Handheld
525 if (player_index == 0) { 526 if (player_index == 0) {
526 if (controller_type == Core::HID::NpadType::Handheld) { 527 if (controller_type == Core::HID::NpadStyleIndex::Handheld) {
527 auto* handheld = 528 auto* handheld =
528 system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); 529 system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
529 UpdateController(handheld, Core::HID::NpadType::Handheld, 530 UpdateController(handheld, Core::HID::NpadStyleIndex::Handheld,
530 player_groupboxes[player_index]->isChecked()); 531 player_groupboxes[player_index]->isChecked());
531 } 532 }
532 } 533 }
@@ -537,7 +538,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
537void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) { 538void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) {
538 if (!player_groupboxes[player_index]->isChecked() || 539 if (!player_groupboxes[player_index]->isChecked() ||
539 GetControllerTypeFromIndex(emulated_controllers[player_index]->currentIndex(), 540 GetControllerTypeFromIndex(emulated_controllers[player_index]->currentIndex(),
540 player_index) == Core::HID::NpadType::Handheld) { 541 player_index) == Core::HID::NpadStyleIndex::Handheld) {
541 led_patterns_boxes[player_index][0]->setChecked(false); 542 led_patterns_boxes[player_index][0]->setChecked(false);
542 led_patterns_boxes[player_index][1]->setChecked(false); 543 led_patterns_boxes[player_index][1]->setChecked(false);
543 led_patterns_boxes[player_index][2]->setChecked(false); 544 led_patterns_boxes[player_index][2]->setChecked(false);
@@ -632,7 +633,7 @@ void QtControllerSelectorDialog::DisableUnsupportedPlayers() {
632 for (std::size_t index = max_supported_players; index < NUM_PLAYERS; ++index) { 633 for (std::size_t index = max_supported_players; index < NUM_PLAYERS; ++index) {
633 auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index); 634 auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index);
634 // Disconnect any unsupported players here and disable or hide them if applicable. 635 // Disconnect any unsupported players here and disable or hide them if applicable.
635 UpdateController(controller, controller->GetNpadType(), false); 636 UpdateController(controller, controller->GetNpadStyleIndex(), false);
636 // Hide the player widgets when max_supported_controllers is less than or equal to 4. 637 // Hide the player widgets when max_supported_controllers is less than or equal to 4.
637 if (max_supported_players <= 4) { 638 if (max_supported_players <= 4) {
638 player_widgets[index]->hide(); 639 player_widgets[index]->hide();
diff --git a/src/yuzu/applets/qt_controller.h b/src/yuzu/applets/qt_controller.h
index dd981f479..cc343e5ae 100644
--- a/src/yuzu/applets/qt_controller.h
+++ b/src/yuzu/applets/qt_controller.h
@@ -32,7 +32,7 @@ class System;
32} 32}
33 33
34namespace Core::HID { 34namespace Core::HID {
35enum class NpadType : u8; 35enum class NpadStyleIndex : u8;
36} 36}
37 37
38class QtControllerSelectorDialog final : public QDialog { 38class QtControllerSelectorDialog final : public QDialog {
@@ -74,10 +74,10 @@ private:
74 void SetEmulatedControllers(std::size_t player_index); 74 void SetEmulatedControllers(std::size_t player_index);
75 75
76 // Gets the Controller Type for a given controller combobox index per player. 76 // Gets the Controller Type for a given controller combobox index per player.
77 Core::HID::NpadType GetControllerTypeFromIndex(int index, std::size_t player_index) const; 77 Core::HID::NpadStyleIndex GetControllerTypeFromIndex(int index, std::size_t player_index) const;
78 78
79 // Gets the controller combobox index for a given Controller Type per player. 79 // Gets the controller combobox index for a given Controller Type per player.
80 int GetIndexFromControllerType(Core::HID::NpadType type, std::size_t player_index) const; 80 int GetIndexFromControllerType(Core::HID::NpadStyleIndex type, std::size_t player_index) const;
81 81
82 // Updates the controller icons per player. 82 // Updates the controller icons per player.
83 void UpdateControllerIcon(std::size_t player_index); 83 void UpdateControllerIcon(std::size_t player_index);
@@ -139,7 +139,7 @@ private:
139 std::array<QComboBox*, NUM_PLAYERS> emulated_controllers; 139 std::array<QComboBox*, NUM_PLAYERS> emulated_controllers;
140 140
141 /// Pairs of emulated controller index and Controller Type enum per player. 141 /// Pairs of emulated controller index and Controller Type enum per player.
142 std::array<std::vector<std::pair<int, Core::HID::NpadType>>, NUM_PLAYERS> 142 std::array<std::vector<std::pair<int, Core::HID::NpadStyleIndex>>, NUM_PLAYERS>
143 index_controller_type_pairs; 143 index_controller_type_pairs;
144 144
145 // Labels representing the number of connected controllers 145 // Labels representing the number of connected controllers
diff --git a/src/yuzu/applets/qt_software_keyboard.cpp b/src/yuzu/applets/qt_software_keyboard.cpp
index 3d91f8034..de7f98c4f 100644
--- a/src/yuzu/applets/qt_software_keyboard.cpp
+++ b/src/yuzu/applets/qt_software_keyboard.cpp
@@ -801,7 +801,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
801 const auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); 801 const auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
802 const auto* player_1 = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); 802 const auto* player_1 = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
803 const auto controller_type = 803 const auto controller_type =
804 handheld->IsConnected() ? handheld->GetNpadType() : player_1->GetNpadType(); 804 handheld->IsConnected() ? handheld->GetNpadStyleIndex() : player_1->GetNpadStyleIndex();
805 805
806 const QString theme = [] { 806 const QString theme = [] {
807 if (QIcon::themeName().contains(QStringLiteral("dark")) || 807 if (QIcon::themeName().contains(QStringLiteral("dark")) ||
@@ -813,8 +813,8 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
813 }(); 813 }();
814 814
815 switch (controller_type) { 815 switch (controller_type) {
816 case Core::HID::NpadType::ProController: 816 case Core::HID::NpadStyleIndex::ProController:
817 case Core::HID::NpadType::GameCube: 817 case Core::HID::NpadStyleIndex::GameCube:
818 ui->icon_controller->setStyleSheet( 818 ui->icon_controller->setStyleSheet(
819 QStringLiteral("image: url(:/overlay/controller_pro%1.png);").arg(theme)); 819 QStringLiteral("image: url(:/overlay/controller_pro%1.png);").arg(theme));
820 ui->icon_controller_shift->setStyleSheet( 820 ui->icon_controller_shift->setStyleSheet(
@@ -822,7 +822,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
822 ui->icon_controller_num->setStyleSheet( 822 ui->icon_controller_num->setStyleSheet(
823 QStringLiteral("image: url(:/overlay/controller_pro%1.png);").arg(theme)); 823 QStringLiteral("image: url(:/overlay/controller_pro%1.png);").arg(theme));
824 break; 824 break;
825 case Core::HID::NpadType::JoyconDual: 825 case Core::HID::NpadStyleIndex::JoyconDual:
826 ui->icon_controller->setStyleSheet( 826 ui->icon_controller->setStyleSheet(
827 QStringLiteral("image: url(:/overlay/controller_dual_joycon%1.png);").arg(theme)); 827 QStringLiteral("image: url(:/overlay/controller_dual_joycon%1.png);").arg(theme));
828 ui->icon_controller_shift->setStyleSheet( 828 ui->icon_controller_shift->setStyleSheet(
@@ -830,7 +830,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
830 ui->icon_controller_num->setStyleSheet( 830 ui->icon_controller_num->setStyleSheet(
831 QStringLiteral("image: url(:/overlay/controller_dual_joycon%1.png);").arg(theme)); 831 QStringLiteral("image: url(:/overlay/controller_dual_joycon%1.png);").arg(theme));
832 break; 832 break;
833 case Core::HID::NpadType::JoyconLeft: 833 case Core::HID::NpadStyleIndex::JoyconLeft:
834 ui->icon_controller->setStyleSheet( 834 ui->icon_controller->setStyleSheet(
835 QStringLiteral("image: url(:/overlay/controller_single_joycon_left%1.png);") 835 QStringLiteral("image: url(:/overlay/controller_single_joycon_left%1.png);")
836 .arg(theme)); 836 .arg(theme));
@@ -841,7 +841,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
841 QStringLiteral("image: url(:/overlay/controller_single_joycon_left%1.png);") 841 QStringLiteral("image: url(:/overlay/controller_single_joycon_left%1.png);")
842 .arg(theme)); 842 .arg(theme));
843 break; 843 break;
844 case Core::HID::NpadType::JoyconRight: 844 case Core::HID::NpadStyleIndex::JoyconRight:
845 ui->icon_controller->setStyleSheet( 845 ui->icon_controller->setStyleSheet(
846 QStringLiteral("image: url(:/overlay/controller_single_joycon_right%1.png);") 846 QStringLiteral("image: url(:/overlay/controller_single_joycon_right%1.png);")
847 .arg(theme)); 847 .arg(theme));
@@ -852,7 +852,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() {
852 QStringLiteral("image: url(:/overlay/controller_single_joycon_right%1.png);") 852 QStringLiteral("image: url(:/overlay/controller_single_joycon_right%1.png);")
853 .arg(theme)); 853 .arg(theme));
854 break; 854 break;
855 case Core::HID::NpadType::Handheld: 855 case Core::HID::NpadStyleIndex::Handheld:
856 ui->icon_controller->setStyleSheet( 856 ui->icon_controller->setStyleSheet(
857 QStringLiteral("image: url(:/overlay/controller_handheld%1.png);").arg(theme)); 857 QStringLiteral("image: url(:/overlay/controller_handheld%1.png);").arg(theme));
858 ui->icon_controller_shift->setStyleSheet( 858 ui->icon_controller_shift->setStyleSheet(
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp
index 8d6289d8e..95a9b8614 100644
--- a/src/yuzu/configuration/configure_input_player.cpp
+++ b/src/yuzu/configuration/configure_input_player.cpp
@@ -455,7 +455,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
455 connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), 455 connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged),
456 [this](int index) { 456 [this](int index) {
457 emit HandheldStateChanged(GetControllerTypeFromIndex(index) == 457 emit HandheldStateChanged(GetControllerTypeFromIndex(index) ==
458 Core::HID::NpadType::Handheld); 458 Core::HID::NpadStyleIndex::Handheld);
459 }); 459 });
460 } 460 }
461 461
@@ -482,7 +482,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
482 UpdateControllerEnabledButtons(); 482 UpdateControllerEnabledButtons();
483 UpdateControllerButtonNames(); 483 UpdateControllerButtonNames();
484 UpdateMotionButtons(); 484 UpdateMotionButtons();
485 const Core::HID::NpadType type = 485 const Core::HID::NpadStyleIndex type =
486 GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); 486 GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
487 487
488 if (player_index == 0) { 488 if (player_index == 0) {
@@ -492,10 +492,10 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
492 system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); 492 system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
493 bool is_connected = emulated_controller->IsConnected(true); 493 bool is_connected = emulated_controller->IsConnected(true);
494 494
495 emulated_controller_p1->SetNpadType(type); 495 emulated_controller_p1->SetNpadStyleIndex(type);
496 emulated_controller_hanheld->SetNpadType(type); 496 emulated_controller_hanheld->SetNpadStyleIndex(type);
497 if (is_connected) { 497 if (is_connected) {
498 if (type == Core::HID::NpadType::Handheld) { 498 if (type == Core::HID::NpadStyleIndex::Handheld) {
499 emulated_controller_p1->Disconnect(); 499 emulated_controller_p1->Disconnect();
500 emulated_controller_hanheld->Connect(); 500 emulated_controller_hanheld->Connect();
501 emulated_controller = emulated_controller_hanheld; 501 emulated_controller = emulated_controller_hanheld;
@@ -507,7 +507,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
507 } 507 }
508 ui->controllerFrame->SetController(emulated_controller); 508 ui->controllerFrame->SetController(emulated_controller);
509 } 509 }
510 emulated_controller->SetNpadType(type); 510 emulated_controller->SetNpadStyleIndex(type);
511 }); 511 });
512 512
513 connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this, 513 connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this,
@@ -607,7 +607,8 @@ void ConfigureInputPlayer::LoadConfiguration() {
607 return; 607 return;
608 } 608 }
609 609
610 const int comboBoxIndex = GetIndexFromControllerType(emulated_controller->GetNpadType(true)); 610 const int comboBoxIndex =
611 GetIndexFromControllerType(emulated_controller->GetNpadStyleIndex(true));
611 ui->comboControllerType->setCurrentIndex(comboBoxIndex); 612 ui->comboControllerType->setCurrentIndex(comboBoxIndex);
612 ui->groupConnectedController->setChecked(emulated_controller->IsConnected(true)); 613 ui->groupConnectedController->setChecked(emulated_controller->IsConnected(true));
613} 614}
@@ -810,37 +811,37 @@ void ConfigureInputPlayer::SetConnectableControllers() {
810 811
811 if (enable_all || npad_style_set.fullkey == 1) { 812 if (enable_all || npad_style_set.fullkey == 1) {
812 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), 813 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(),
813 Core::HID::NpadType::ProController); 814 Core::HID::NpadStyleIndex::ProController);
814 ui->comboControllerType->addItem(tr("Pro Controller")); 815 ui->comboControllerType->addItem(tr("Pro Controller"));
815 } 816 }
816 817
817 if (enable_all || npad_style_set.joycon_dual == 1) { 818 if (enable_all || npad_style_set.joycon_dual == 1) {
818 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), 819 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(),
819 Core::HID::NpadType::JoyconDual); 820 Core::HID::NpadStyleIndex::JoyconDual);
820 ui->comboControllerType->addItem(tr("Dual Joycons")); 821 ui->comboControllerType->addItem(tr("Dual Joycons"));
821 } 822 }
822 823
823 if (enable_all || npad_style_set.joycon_left == 1) { 824 if (enable_all || npad_style_set.joycon_left == 1) {
824 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), 825 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(),
825 Core::HID::NpadType::JoyconLeft); 826 Core::HID::NpadStyleIndex::JoyconLeft);
826 ui->comboControllerType->addItem(tr("Left Joycon")); 827 ui->comboControllerType->addItem(tr("Left Joycon"));
827 } 828 }
828 829
829 if (enable_all || npad_style_set.joycon_right == 1) { 830 if (enable_all || npad_style_set.joycon_right == 1) {
830 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), 831 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(),
831 Core::HID::NpadType::JoyconRight); 832 Core::HID::NpadStyleIndex::JoyconRight);
832 ui->comboControllerType->addItem(tr("Right Joycon")); 833 ui->comboControllerType->addItem(tr("Right Joycon"));
833 } 834 }
834 835
835 if (player_index == 0 && (enable_all || npad_style_set.handheld == 1)) { 836 if (player_index == 0 && (enable_all || npad_style_set.handheld == 1)) {
836 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), 837 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(),
837 Core::HID::NpadType::Handheld); 838 Core::HID::NpadStyleIndex::Handheld);
838 ui->comboControllerType->addItem(tr("Handheld")); 839 ui->comboControllerType->addItem(tr("Handheld"));
839 } 840 }
840 841
841 if (enable_all || npad_style_set.gamecube == 1) { 842 if (enable_all || npad_style_set.gamecube == 1) {
842 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(), 843 index_controller_type_pairs.emplace_back(ui->comboControllerType->count(),
843 Core::HID::NpadType::GameCube); 844 Core::HID::NpadStyleIndex::GameCube);
844 ui->comboControllerType->addItem(tr("GameCube Controller")); 845 ui->comboControllerType->addItem(tr("GameCube Controller"));
845 } 846 }
846 }; 847 };
@@ -853,19 +854,19 @@ void ConfigureInputPlayer::SetConnectableControllers() {
853 add_controllers(false, system.HIDCore().GetSupportedStyleTag()); 854 add_controllers(false, system.HIDCore().GetSupportedStyleTag());
854} 855}
855 856
856Core::HID::NpadType ConfigureInputPlayer::GetControllerTypeFromIndex(int index) const { 857Core::HID::NpadStyleIndex ConfigureInputPlayer::GetControllerTypeFromIndex(int index) const {
857 const auto it = 858 const auto it =
858 std::find_if(index_controller_type_pairs.begin(), index_controller_type_pairs.end(), 859 std::find_if(index_controller_type_pairs.begin(), index_controller_type_pairs.end(),
859 [index](const auto& pair) { return pair.first == index; }); 860 [index](const auto& pair) { return pair.first == index; });
860 861
861 if (it == index_controller_type_pairs.end()) { 862 if (it == index_controller_type_pairs.end()) {
862 return Core::HID::NpadType::ProController; 863 return Core::HID::NpadStyleIndex::ProController;
863 } 864 }
864 865
865 return it->second; 866 return it->second;
866} 867}
867 868
868int ConfigureInputPlayer::GetIndexFromControllerType(Core::HID::NpadType type) const { 869int ConfigureInputPlayer::GetIndexFromControllerType(Core::HID::NpadStyleIndex type) const {
869 const auto it = 870 const auto it =
870 std::find_if(index_controller_type_pairs.begin(), index_controller_type_pairs.end(), 871 std::find_if(index_controller_type_pairs.begin(), index_controller_type_pairs.end(),
871 [type](const auto& pair) { return pair.second == type; }); 872 [type](const auto& pair) { return pair.second == type; });
@@ -888,7 +889,7 @@ void ConfigureInputPlayer::UpdateInputDevices() {
888void ConfigureInputPlayer::UpdateControllerAvailableButtons() { 889void ConfigureInputPlayer::UpdateControllerAvailableButtons() {
889 auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); 890 auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
890 if (debug) { 891 if (debug) {
891 layout = Core::HID::NpadType::ProController; 892 layout = Core::HID::NpadStyleIndex::ProController;
892 } 893 }
893 894
894 // List of all the widgets that will be hidden by any of the following layouts that need 895 // List of all the widgets that will be hidden by any of the following layouts that need
@@ -913,15 +914,15 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {
913 914
914 std::vector<QWidget*> layout_hidden; 915 std::vector<QWidget*> layout_hidden;
915 switch (layout) { 916 switch (layout) {
916 case Core::HID::NpadType::ProController: 917 case Core::HID::NpadStyleIndex::ProController:
917 case Core::HID::NpadType::JoyconDual: 918 case Core::HID::NpadStyleIndex::JoyconDual:
918 case Core::HID::NpadType::Handheld: 919 case Core::HID::NpadStyleIndex::Handheld:
919 layout_hidden = { 920 layout_hidden = {
920 ui->buttonShoulderButtonsSLSR, 921 ui->buttonShoulderButtonsSLSR,
921 ui->horizontalSpacerShoulderButtonsWidget2, 922 ui->horizontalSpacerShoulderButtonsWidget2,
922 }; 923 };
923 break; 924 break;
924 case Core::HID::NpadType::JoyconLeft: 925 case Core::HID::NpadStyleIndex::JoyconLeft:
925 layout_hidden = { 926 layout_hidden = {
926 ui->horizontalSpacerShoulderButtonsWidget2, 927 ui->horizontalSpacerShoulderButtonsWidget2,
927 ui->buttonShoulderButtonsRight, 928 ui->buttonShoulderButtonsRight,
@@ -929,7 +930,7 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {
929 ui->bottomRight, 930 ui->bottomRight,
930 }; 931 };
931 break; 932 break;
932 case Core::HID::NpadType::JoyconRight: 933 case Core::HID::NpadStyleIndex::JoyconRight:
933 layout_hidden = { 934 layout_hidden = {
934 ui->horizontalSpacerShoulderButtonsWidget, 935 ui->horizontalSpacerShoulderButtonsWidget,
935 ui->buttonShoulderButtonsLeft, 936 ui->buttonShoulderButtonsLeft,
@@ -937,7 +938,7 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {
937 ui->bottomLeft, 938 ui->bottomLeft,
938 }; 939 };
939 break; 940 break;
940 case Core::HID::NpadType::GameCube: 941 case Core::HID::NpadStyleIndex::GameCube:
941 layout_hidden = { 942 layout_hidden = {
942 ui->buttonShoulderButtonsSLSR, 943 ui->buttonShoulderButtonsSLSR,
943 ui->horizontalSpacerShoulderButtonsWidget2, 944 ui->horizontalSpacerShoulderButtonsWidget2,
@@ -957,7 +958,7 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() {
957void ConfigureInputPlayer::UpdateControllerEnabledButtons() { 958void ConfigureInputPlayer::UpdateControllerEnabledButtons() {
958 auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); 959 auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
959 if (debug) { 960 if (debug) {
960 layout = Core::HID::NpadType::ProController; 961 layout = Core::HID::NpadStyleIndex::ProController;
961 } 962 }
962 963
963 // List of all the widgets that will be disabled by any of the following layouts that need 964 // List of all the widgets that will be disabled by any of the following layouts that need
@@ -974,13 +975,13 @@ void ConfigureInputPlayer::UpdateControllerEnabledButtons() {
974 975
975 std::vector<QWidget*> layout_disable; 976 std::vector<QWidget*> layout_disable;
976 switch (layout) { 977 switch (layout) {
977 case Core::HID::NpadType::ProController: 978 case Core::HID::NpadStyleIndex::ProController:
978 case Core::HID::NpadType::JoyconDual: 979 case Core::HID::NpadStyleIndex::JoyconDual:
979 case Core::HID::NpadType::Handheld: 980 case Core::HID::NpadStyleIndex::Handheld:
980 case Core::HID::NpadType::JoyconLeft: 981 case Core::HID::NpadStyleIndex::JoyconLeft:
981 case Core::HID::NpadType::JoyconRight: 982 case Core::HID::NpadStyleIndex::JoyconRight:
982 break; 983 break;
983 case Core::HID::NpadType::GameCube: 984 case Core::HID::NpadStyleIndex::GameCube:
984 layout_disable = { 985 layout_disable = {
985 ui->buttonHome, 986 ui->buttonHome,
986 ui->buttonLStickPressedGroup, 987 ui->buttonLStickPressedGroup,
@@ -1007,24 +1008,24 @@ void ConfigureInputPlayer::UpdateMotionButtons() {
1007 1008
1008 // Show/hide the "Motion 1/2" groupboxes depending on the currently selected controller. 1009 // Show/hide the "Motion 1/2" groupboxes depending on the currently selected controller.
1009 switch (GetControllerTypeFromIndex(ui->comboControllerType->currentIndex())) { 1010 switch (GetControllerTypeFromIndex(ui->comboControllerType->currentIndex())) {
1010 case Core::HID::NpadType::ProController: 1011 case Core::HID::NpadStyleIndex::ProController:
1011 case Core::HID::NpadType::JoyconLeft: 1012 case Core::HID::NpadStyleIndex::JoyconLeft:
1012 case Core::HID::NpadType::Handheld: 1013 case Core::HID::NpadStyleIndex::Handheld:
1013 // Show "Motion 1" and hide "Motion 2". 1014 // Show "Motion 1" and hide "Motion 2".
1014 ui->buttonMotionLeftGroup->show(); 1015 ui->buttonMotionLeftGroup->show();
1015 ui->buttonMotionRightGroup->hide(); 1016 ui->buttonMotionRightGroup->hide();
1016 break; 1017 break;
1017 case Core::HID::NpadType::JoyconRight: 1018 case Core::HID::NpadStyleIndex::JoyconRight:
1018 // Show "Motion 2" and hide "Motion 1". 1019 // Show "Motion 2" and hide "Motion 1".
1019 ui->buttonMotionLeftGroup->hide(); 1020 ui->buttonMotionLeftGroup->hide();
1020 ui->buttonMotionRightGroup->show(); 1021 ui->buttonMotionRightGroup->show();
1021 break; 1022 break;
1022 case Core::HID::NpadType::GameCube: 1023 case Core::HID::NpadStyleIndex::GameCube:
1023 // Hide both "Motion 1/2". 1024 // Hide both "Motion 1/2".
1024 ui->buttonMotionLeftGroup->hide(); 1025 ui->buttonMotionLeftGroup->hide();
1025 ui->buttonMotionRightGroup->hide(); 1026 ui->buttonMotionRightGroup->hide();
1026 break; 1027 break;
1027 case Core::HID::NpadType::JoyconDual: 1028 case Core::HID::NpadStyleIndex::JoyconDual:
1028 default: 1029 default:
1029 // Show both "Motion 1/2". 1030 // Show both "Motion 1/2".
1030 ui->buttonMotionLeftGroup->show(); 1031 ui->buttonMotionLeftGroup->show();
@@ -1036,15 +1037,15 @@ void ConfigureInputPlayer::UpdateMotionButtons() {
1036void ConfigureInputPlayer::UpdateControllerButtonNames() { 1037void ConfigureInputPlayer::UpdateControllerButtonNames() {
1037 auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); 1038 auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
1038 if (debug) { 1039 if (debug) {
1039 layout = Core::HID::NpadType::ProController; 1040 layout = Core::HID::NpadStyleIndex::ProController;
1040 } 1041 }
1041 1042
1042 switch (layout) { 1043 switch (layout) {
1043 case Core::HID::NpadType::ProController: 1044 case Core::HID::NpadStyleIndex::ProController:
1044 case Core::HID::NpadType::JoyconDual: 1045 case Core::HID::NpadStyleIndex::JoyconDual:
1045 case Core::HID::NpadType::Handheld: 1046 case Core::HID::NpadStyleIndex::Handheld:
1046 case Core::HID::NpadType::JoyconLeft: 1047 case Core::HID::NpadStyleIndex::JoyconLeft:
1047 case Core::HID::NpadType::JoyconRight: 1048 case Core::HID::NpadStyleIndex::JoyconRight:
1048 ui->buttonMiscButtonsPlusGroup->setTitle(tr("Plus")); 1049 ui->buttonMiscButtonsPlusGroup->setTitle(tr("Plus"));
1049 ui->buttonShoulderButtonsButtonZLGroup->setTitle(tr("ZL")); 1050 ui->buttonShoulderButtonsButtonZLGroup->setTitle(tr("ZL"));
1050 ui->buttonShoulderButtonsZRGroup->setTitle(tr("ZR")); 1051 ui->buttonShoulderButtonsZRGroup->setTitle(tr("ZR"));
@@ -1052,7 +1053,7 @@ void ConfigureInputPlayer::UpdateControllerButtonNames() {
1052 ui->LStick->setTitle(tr("Left Stick")); 1053 ui->LStick->setTitle(tr("Left Stick"));
1053 ui->RStick->setTitle(tr("Right Stick")); 1054 ui->RStick->setTitle(tr("Right Stick"));
1054 break; 1055 break;
1055 case Core::HID::NpadType::GameCube: 1056 case Core::HID::NpadStyleIndex::GameCube:
1056 ui->buttonMiscButtonsPlusGroup->setTitle(tr("Start / Pause")); 1057 ui->buttonMiscButtonsPlusGroup->setTitle(tr("Start / Pause"));
1057 ui->buttonShoulderButtonsButtonZLGroup->setTitle(tr("L")); 1058 ui->buttonShoulderButtonsButtonZLGroup->setTitle(tr("L"));
1058 ui->buttonShoulderButtonsZRGroup->setTitle(tr("R")); 1059 ui->buttonShoulderButtonsZRGroup->setTitle(tr("R"));
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h
index 02d6920f1..7bff4b196 100644
--- a/src/yuzu/configuration/configure_input_player.h
+++ b/src/yuzu/configuration/configure_input_player.h
@@ -51,7 +51,7 @@ class System;
51 51
52namespace Core::HID { 52namespace Core::HID {
53class EmulatedController; 53class EmulatedController;
54enum class NpadType : u8; 54enum class NpadStyleIndex : u8;
55} // namespace Core::HID 55} // namespace Core::HID
56 56
57class ConfigureInputPlayer : public QWidget { 57class ConfigureInputPlayer : public QWidget {
@@ -134,10 +134,10 @@ private:
134 void SetConnectableControllers(); 134 void SetConnectableControllers();
135 135
136 /// Gets the Controller Type for a given controller combobox index. 136 /// Gets the Controller Type for a given controller combobox index.
137 Core::HID::NpadType GetControllerTypeFromIndex(int index) const; 137 Core::HID::NpadStyleIndex GetControllerTypeFromIndex(int index) const;
138 138
139 /// Gets the controller combobox index for a given Controller Type. 139 /// Gets the controller combobox index for a given Controller Type.
140 int GetIndexFromControllerType(Core::HID::NpadType type) const; 140 int GetIndexFromControllerType(Core::HID::NpadStyleIndex type) const;
141 141
142 /// Update the available input devices. 142 /// Update the available input devices.
143 void UpdateInputDevices(); 143 void UpdateInputDevices();
@@ -182,7 +182,7 @@ private:
182 std::unique_ptr<QTimer> poll_timer; 182 std::unique_ptr<QTimer> poll_timer;
183 183
184 /// Stores a pair of "Connected Controllers" combobox index and Controller Type enum. 184 /// Stores a pair of "Connected Controllers" combobox index and Controller Type enum.
185 std::vector<std::pair<int, Core::HID::NpadType>> index_controller_type_pairs; 185 std::vector<std::pair<int, Core::HID::NpadStyleIndex>> index_controller_type_pairs;
186 186
187 static constexpr int PLAYER_COUNT = 8; 187 static constexpr int PLAYER_COUNT = 8;
188 std::array<QCheckBox*, PLAYER_COUNT> player_connected_checkbox; 188 std::array<QCheckBox*, PLAYER_COUNT> player_connected_checkbox;
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp
index 7e71a0f58..e63c25e70 100644
--- a/src/yuzu/configuration/configure_input_player_widget.cpp
+++ b/src/yuzu/configuration/configure_input_player_widget.cpp
@@ -147,7 +147,7 @@ void PlayerControlPreview::ControllerUpdate(Core::HID::ControllerTriggerType typ
147 needs_redraw = true; 147 needs_redraw = true;
148 break; 148 break;
149 case Core::HID::ControllerTriggerType::Type: 149 case Core::HID::ControllerTriggerType::Type:
150 controller_type = controller->GetNpadType(true); 150 controller_type = controller->GetNpadStyleIndex(true);
151 needs_redraw = true; 151 needs_redraw = true;
152 break; 152 break;
153 case Core::HID::ControllerTriggerType::Color: 153 case Core::HID::ControllerTriggerType::Color:
@@ -221,22 +221,22 @@ void PlayerControlPreview::paintEvent(QPaintEvent* event) {
221 const QPointF center = rect().center(); 221 const QPointF center = rect().center();
222 222
223 switch (controller_type) { 223 switch (controller_type) {
224 case Core::HID::NpadType::Handheld: 224 case Core::HID::NpadStyleIndex::Handheld:
225 DrawHandheldController(p, center); 225 DrawHandheldController(p, center);
226 break; 226 break;
227 case Core::HID::NpadType::JoyconDual: 227 case Core::HID::NpadStyleIndex::JoyconDual:
228 DrawDualController(p, center); 228 DrawDualController(p, center);
229 break; 229 break;
230 case Core::HID::NpadType::JoyconLeft: 230 case Core::HID::NpadStyleIndex::JoyconLeft:
231 DrawLeftController(p, center); 231 DrawLeftController(p, center);
232 break; 232 break;
233 case Core::HID::NpadType::JoyconRight: 233 case Core::HID::NpadStyleIndex::JoyconRight:
234 DrawRightController(p, center); 234 DrawRightController(p, center);
235 break; 235 break;
236 case Core::HID::NpadType::GameCube: 236 case Core::HID::NpadStyleIndex::GameCube:
237 DrawGCController(p, center); 237 DrawGCController(p, center);
238 break; 238 break;
239 case Core::HID::NpadType::ProController: 239 case Core::HID::NpadStyleIndex::ProController:
240 default: 240 default:
241 DrawProController(p, center); 241 DrawProController(p, center);
242 break; 242 break;
@@ -2394,7 +2394,7 @@ void PlayerControlPreview::DrawGCJoystick(QPainter& p, const QPointF center,
2394 2394
2395void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPointF center_right) { 2395void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPointF center_right) {
2396 using namespace Settings::NativeAnalog; 2396 using namespace Settings::NativeAnalog;
2397 if (controller_type != Core::HID::NpadType::JoyconLeft) { 2397 if (controller_type != Core::HID::NpadStyleIndex::JoyconLeft) {
2398 DrawJoystickProperties(p, center_right, stick_values[RStick].x.properties); 2398 DrawJoystickProperties(p, center_right, stick_values[RStick].x.properties);
2399 p.setPen(colors.indicator); 2399 p.setPen(colors.indicator);
2400 p.setBrush(colors.indicator); 2400 p.setBrush(colors.indicator);
@@ -2404,7 +2404,7 @@ void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPo
2404 DrawJoystickDot(p, center_right, stick_values[RStick], false); 2404 DrawJoystickDot(p, center_right, stick_values[RStick], false);
2405 } 2405 }
2406 2406
2407 if (controller_type != Core::HID::NpadType::JoyconRight) { 2407 if (controller_type != Core::HID::NpadStyleIndex::JoyconRight) {
2408 DrawJoystickProperties(p, center_left, stick_values[LStick].x.properties); 2408 DrawJoystickProperties(p, center_left, stick_values[LStick].x.properties);
2409 p.setPen(colors.indicator); 2409 p.setPen(colors.indicator);
2410 p.setBrush(colors.indicator); 2410 p.setBrush(colors.indicator);
diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h
index acc53a9e3..ee217f3c9 100644
--- a/src/yuzu/configuration/configure_input_player_widget.h
+++ b/src/yuzu/configuration/configure_input_player_widget.h
@@ -203,7 +203,7 @@ private:
203 bool is_controller_set{}; 203 bool is_controller_set{};
204 bool is_connected{}; 204 bool is_connected{};
205 bool needs_redraw{}; 205 bool needs_redraw{};
206 Core::HID::NpadType controller_type; 206 Core::HID::NpadStyleIndex controller_type;
207 207
208 bool mapping_active{}; 208 bool mapping_active{};
209 int blink_counter{}; 209 int blink_counter{};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 7c95851b3..a10522f5f 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -841,7 +841,7 @@ void GMainWindow::InitializeWidgets() {
841 tr("Handheld controller can't be used on docked mode. Pro " 841 tr("Handheld controller can't be used on docked mode. Pro "
842 "controller will be selected.")); 842 "controller will be selected."));
843 handheld->Disconnect(); 843 handheld->Disconnect();
844 player_1->SetNpadType(Core::HID::NpadType::ProController); 844 player_1->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController);
845 player_1->Connect(); 845 player_1->Connect();
846 } 846 }
847 847