diff options
author | german77 <juangerman-13@hotmail.com> | 2021-11-14 17:45:07 +0100 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2021-11-25 03:30:28 +0100 |
commit | bca299e8e0489867f7d4bbfd264e221e7e61ae1e (patch) | |
tree | 312f145bfcaffa9b7ecc2710443fa3737bf379e4 /src/input_common/input_mapping.cpp | |
parent | core/hid: Improve accuracy of the keyboard implementation (diff) | |
download | yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.gz yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.bz2 yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.lz yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.xz yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.zst yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.zip |
Diffstat (limited to 'src/input_common/input_mapping.cpp')
-rw-r--r-- | src/input_common/input_mapping.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/input_common/input_mapping.cpp b/src/input_common/input_mapping.cpp index 0ffc71028..0eeeff372 100644 --- a/src/input_common/input_mapping.cpp +++ b/src/input_common/input_mapping.cpp @@ -28,6 +28,10 @@ void MappingFactory::RegisterInput(const MappingData& data) { if (!is_enabled) { return; } + if (!IsDriverValid(data)) { + return; + } + switch (input_type) { case Polling::InputType::Button: RegisterButton(data); @@ -168,4 +172,25 @@ void MappingFactory::RegisterMotion(const MappingData& data) { input_queue.Push(new_input); } +bool MappingFactory::IsDriverValid(const MappingData& data) const { + // Only port 0 can be mapped on the keyboard + if (data.engine == "keyboard" && data.pad.port != 0) { + return false; + } + // The following drivers don't need to be mapped + if (data.engine == "tas") { + return false; + } + if (data.engine == "touch") { + return false; + } + if (data.engine == "touch_from_button") { + return false; + } + if (data.engine == "analog_from_button") { + return false; + } + return true; +} + } // namespace InputCommon |