summaryrefslogtreecommitdiffstats
path: root/src/input_common/input_mapping.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/input_mapping.cpp')
-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) {
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