summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-12-30 05:15:08 +0100
committergerman77 <juangerman-13@hotmail.com>2021-12-30 05:51:53 +0100
commit9ee5c4ec5629c185d29dd41468047004acef2e29 (patch)
tree997dd6a3916e3bd84cf5a109421d18f72d678fc4 /src/core
parentMerge pull request #7620 from bunnei/kernel-thread-x18 (diff)
downloadyuzu-9ee5c4ec5629c185d29dd41468047004acef2e29.tar
yuzu-9ee5c4ec5629c185d29dd41468047004acef2e29.tar.gz
yuzu-9ee5c4ec5629c185d29dd41468047004acef2e29.tar.bz2
yuzu-9ee5c4ec5629c185d29dd41468047004acef2e29.tar.lz
yuzu-9ee5c4ec5629c185d29dd41468047004acef2e29.tar.xz
yuzu-9ee5c4ec5629c185d29dd41468047004acef2e29.tar.zst
yuzu-9ee5c4ec5629c185d29dd41468047004acef2e29.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/frontend/applets/controller.cpp10
-rw-r--r--src/core/hid/emulated_controller.cpp12
-rw-r--r--src/core/hid/emulated_controller.h10
3 files changed, 19 insertions, 13 deletions
diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp
index 6dbd38ffa..e1033b634 100644
--- a/src/core/frontend/applets/controller.cpp
+++ b/src/core/frontend/applets/controller.cpp
@@ -45,26 +45,26 @@ void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callb
// Pro Controller -> Dual Joycons -> Left Joycon/Right Joycon -> Handheld
if (parameters.allow_pro_controller) {
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController);
- controller->Connect();
+ controller->Connect(true);
} else if (parameters.allow_dual_joycons) {
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::JoyconDual);
- controller->Connect();
+ controller->Connect(true);
} else if (parameters.allow_left_joycon && parameters.allow_right_joycon) {
// Assign left joycons to even player indices and right joycons to odd player indices.
// We do this since Captain Toad Treasure Tracker expects a left joycon for Player 1 and
// a right Joycon for Player 2 in 2 Player Assist mode.
if (index % 2 == 0) {
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::JoyconLeft);
- controller->Connect();
+ controller->Connect(true);
} else {
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::JoyconRight);
- controller->Connect();
+ controller->Connect(true);
}
} else if (index == 0 && parameters.enable_single_mode && parameters.allow_handheld &&
!Settings::values.use_docked_mode.GetValue()) {
// We should *never* reach here under any normal circumstances.
controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Handheld);
- controller->Connect();
+ controller->Connect(true);
} else {
UNREACHABLE_MSG("Unable to add a new controller based on the given parameters!");
}
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)
}
}
-bool EmulatedController::IsControllerSupported() const {
- switch (npad_type) {
+bool EmulatedController::IsControllerSupported(bool use_temporary_value) const {
+ const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
+ switch (type) {
case NpadStyleIndex::ProController:
return supported_style_tag.fullkey;
case NpadStyleIndex::Handheld:
@@ -915,9 +916,10 @@ bool EmulatedController::IsControllerSupported() const {
}
}
-void EmulatedController::Connect() {
- if (!IsControllerSupported()) {
- LOG_ERROR(Service_HID, "Controller type {} is not supported", npad_type);
+void EmulatedController::Connect(bool use_temporary_value) {
+ if (!IsControllerSupported(use_temporary_value)) {
+ const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type;
+ LOG_ERROR(Service_HID, "Controller type {} is not supported", type);
return;
}
{
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index e42aafebc..d887eca87 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -167,8 +167,11 @@ public:
*/
void SetSupportedNpadStyleTag(NpadStyleTag supported_styles);
- /// Sets the connected status to true
- void Connect();
+ /**
+ * Sets the connected status to true
+ * @param use_temporary_value If true tmp_npad_type will be used
+ */
+ void Connect(bool use_temporary_value = false);
/// Sets the connected status to false
void Disconnect();
@@ -319,9 +322,10 @@ private:
/**
* Checks the current controller type against the supported_style_tag
+ * @param use_temporary_value If true tmp_npad_type will be used
* @return true if the controller is supported
*/
- bool IsControllerSupported() const;
+ bool IsControllerSupported(bool use_temporary_value = false) const;
/**
* Updates the button status of the controller