summaryrefslogtreecommitdiff
path: root/src/input_common/input_mapping.cpp
diff options
context:
space:
mode:
authorGravatar german772021-11-14 10:45:07 -0600
committerGravatar Narr the Reg2021-11-24 20:30:28 -0600
commitbca299e8e0489867f7d4bbfd264e221e7e61ae1e (patch)
tree312f145bfcaffa9b7ecc2710443fa3737bf379e4 /src/input_common/input_mapping.cpp
parentcore/hid: Improve accuracy of the keyboard implementation (diff)
downloadyuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.gz
yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.tar.xz
yuzu-bca299e8e0489867f7d4bbfd264e221e7e61ae1e.zip
input_common: Allow keyboard to be backwards compatible
Diffstat (limited to '')
-rw-r--r--src/input_common/input_mapping.cpp25
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) {
28 if (!is_enabled) { 28 if (!is_enabled) {
29 return; 29 return;
30 } 30 }
31 if (!IsDriverValid(data)) {
32 return;
33 }
34
31 switch (input_type) { 35 switch (input_type) {
32 case Polling::InputType::Button: 36 case Polling::InputType::Button:
33 RegisterButton(data); 37 RegisterButton(data);
@@ -168,4 +172,25 @@ void MappingFactory::RegisterMotion(const MappingData& data) {
168 input_queue.Push(new_input); 172 input_queue.Push(new_input);
169} 173}
170 174
175bool MappingFactory::IsDriverValid(const MappingData& data) const {
176 // Only port 0 can be mapped on the keyboard
177 if (data.engine == "keyboard" && data.pad.port != 0) {
178 return false;
179 }
180 // The following drivers don't need to be mapped
181 if (data.engine == "tas") {
182 return false;
183 }
184 if (data.engine == "touch") {
185 return false;
186 }
187 if (data.engine == "touch_from_button") {
188 return false;
189 }
190 if (data.engine == "analog_from_button") {
191 return false;
192 }
193 return true;
194}
195
171} // namespace InputCommon 196} // namespace InputCommon