summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorGravatar german772021-11-04 12:08:54 -0600
committerGravatar Narr the Reg2021-11-24 20:30:27 -0600
commit5d0f3540c4b085103afa27d6120ea29e0324a5a2 (patch)
tree9cdfe756391969476385d3f391d74a6e75aa5889 /src/core/hid/emulated_controller.cpp
parentconfig: Cleanup and documentation (diff)
downloadyuzu-5d0f3540c4b085103afa27d6120ea29e0324a5a2.tar.gz
yuzu-5d0f3540c4b085103afa27d6120ea29e0324a5a2.tar.xz
yuzu-5d0f3540c4b085103afa27d6120ea29e0324a5a2.zip
core/hid: Rename NpadType to NpadStyleIndex
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
-rw-r--r--src/core/hid/emulated_controller.cpp44
1 files changed, 22 insertions, 22 deletions
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