summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hid/emulated_controller.cpp34
-rw-r--r--src/core/hid/emulated_controller.h6
2 files changed, 36 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
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index d887eca87..c0994ab4d 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -321,6 +321,12 @@ private:
321 void LoadTASParams(); 321 void LoadTASParams();
322 322
323 /** 323 /**
324 * @param use_temporary_value If true tmp_npad_type will be used
325 * @return true if the controller style is fullkey
326 */
327 bool IsControllerFullkey(bool use_temporary_value = false) const;
328
329 /**
324 * Checks the current controller type against the supported_style_tag 330 * Checks the current controller type against the supported_style_tag
325 * @param use_temporary_value If true tmp_npad_type will be used 331 * @param use_temporary_value If true tmp_npad_type will be used
326 * @return true if the controller is supported 332 * @return true if the controller is supported