summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-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
7 files changed, 125 insertions, 114 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 }