diff options
author | german77 <juangerman-13@hotmail.com> | 2022-01-02 04:25:30 +0100 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2022-01-02 05:01:13 +0100 |
commit | 7a13a515d9b10a789d20f9ec8e4e52b1112ed171 (patch) | |
tree | 9086e5f8d8a9d572003d349acb6caac913e4283a /src/core/hid/emulated_controller.cpp | |
parent | Merge pull request #7654 from Morph1984/dynarmic (diff) | |
download | yuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.tar yuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.tar.gz yuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.tar.bz2 yuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.tar.lz yuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.tar.xz yuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.tar.zst yuzu-7a13a515d9b10a789d20f9ec8e4e52b1112ed171.zip |
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) if (!is_connected) { return; } - if (!IsControllerSupported()) { - LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller", - npad_type); - Disconnect(); + if (IsControllerSupported()) { + return; + } + + Disconnect(); + + // Fallback fullkey controllers to Pro controllers + if (IsControllerFullkey() && supported_style_tag.fullkey) { + LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type); + SetNpadStyleIndex(NpadStyleIndex::ProController); + Connect(); + return; + } + + LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller", + npad_type); +} + +bool EmulatedController::IsControllerFullkey(bool use_temporary_value) const { + const auto type = is_configuring && use_temporary_value ? tmp_npad_type : npad_type; + switch (type) { + case NpadStyleIndex::ProController: + case NpadStyleIndex::GameCube: + case NpadStyleIndex::NES: + case NpadStyleIndex::SNES: + case NpadStyleIndex::N64: + case NpadStyleIndex::SegaGenesis: + return true; + default: + return false; } } |