summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2021-12-30 16:54:35 -0800
committerGravatar GitHub2021-12-30 16:54:35 -0800
commit667a8ae163681f68d90010bc7dd05eb7398524d6 (patch)
treedea803db312fc0e36c5ed2c9000cacf3bd4df7c3 /src/core/hid/emulated_controller.cpp
parentMerge pull request #7635 from bunnei/set-heap-size (diff)
parentcore/hid: Fix controller type validation (diff)
downloadyuzu-667a8ae163681f68d90010bc7dd05eb7398524d6.tar.gz
yuzu-667a8ae163681f68d90010bc7dd05eb7398524d6.tar.xz
yuzu-667a8ae163681f68d90010bc7dd05eb7398524d6.zip
Merge pull request #7647 from german77/toad
core/hid: Fix controller type validation
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
-rw-r--r--src/core/hid/emulated_controller.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index ff9d7a7e3..2d3fce276 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -886,8 +886,9 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
886 } 886 }
887} 887}
888 888
889bool EmulatedController::IsControllerSupported() const { 889bool EmulatedController::IsControllerSupported(bool use_temporary_value) const {
890 switch (npad_type) { 890 const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
891 switch (type) {
891 case NpadStyleIndex::ProController: 892 case NpadStyleIndex::ProController:
892 return supported_style_tag.fullkey; 893 return supported_style_tag.fullkey;
893 case NpadStyleIndex::Handheld: 894 case NpadStyleIndex::Handheld:
@@ -915,9 +916,10 @@ bool EmulatedController::IsControllerSupported() const {
915 } 916 }
916} 917}
917 918
918void EmulatedController::Connect() { 919void EmulatedController::Connect(bool use_temporary_value) {
919 if (!IsControllerSupported()) { 920 if (!IsControllerSupported(use_temporary_value)) {
920 LOG_ERROR(Service_HID, "Controller type {} is not supported", npad_type); 921 const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
922 LOG_ERROR(Service_HID, "Controller type {} is not supported", type);
921 return; 923 return;
922 } 924 }
923 { 925 {