diff options
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 34 |
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 | |||
| 900 | bool 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 | ||