summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorGravatar german772022-01-01 21:25:30 -0600
committerGravatar german772022-01-01 22:01:13 -0600
commit7a13a515d9b10a789d20f9ec8e4e52b1112ed171 (patch)
tree9086e5f8d8a9d572003d349acb6caac913e4283a /src/core/hid/emulated_controller.cpp
parentMerge pull request #7654 from Morph1984/dynarmic (diff)
downloadyuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.tar.gz
yuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.tar.xz
yuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.zip
core/hid: Add fallback to fullkey controllers
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
-rw-r--r--src/core/hid/emulated_controller.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 2d3fce276..71fc05807 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -879,10 +879,36 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
879 if (!is_connected) { 879 if (!is_connected) {
880 return; 880 return;
881 } 881 }
882 if (!IsControllerSupported()) { 882 if (IsControllerSupported()) {
883 LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller", 883 return;
884 npad_type); 884 }
885 Disconnect(); 885
886 Disconnect();
887
888 // Fallback fullkey controllers to Pro controllers
889 if (IsControllerFullkey() && supported_style_tag.fullkey) {
890 LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type);
891 SetNpadStyleIndex(NpadStyleIndex::ProController);
892 Connect();
893 return;
894 }
895
896 LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller",
897 npad_type);
898}
899
900bool EmulatedController::IsControllerFullkey(bool use_temporary_value) const {
901 const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
902 switch (type) {
903 case NpadStyleIndex::ProController:
904 case NpadStyleIndex::GameCube:
905 case NpadStyleIndex::NES:
906 case NpadStyleIndex::SNES:
907 case NpadStyleIndex::N64:
908 case NpadStyleIndex::SegaGenesis:
909 return true;
910 default:
911 return false;
886 } 912 }
887} 913}
888 914