summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-07-12 17:16:36 +0200
committerYuri Sizov <yuris@humnom.net>2023-07-12 17:16:36 +0200
commit55b74c7cdf5157312ef9e7086cd3d3725249f315 (patch)
tree113a976b5345636b8ab9025d33af1b74672b90ac /platform/linuxbsd
parent4d862d6cc9bfe2c2d772f16222e00996b6aee943 (diff)
parent8de98dbf21ba734feb26d5568151bd810d566817 (diff)
downloadredot-engine-55b74c7cdf5157312ef9e7086cd3d3725249f315.tar.gz
Merge pull request #76045 from Eoin-ONeill-Yokai/steaminput-fix
Prevent double input events on gamepad when running through steam input
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r--platform/linuxbsd/joypad_linux.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp
index 71c03898c8..342cff82e9 100644
--- a/platform/linuxbsd/joypad_linux.cpp
+++ b/platform/linuxbsd/joypad_linux.cpp
@@ -393,6 +393,16 @@ void JoypadLinux::open_joypad(const char *p_path) {
return;
}
+ uint16_t vendor = BSWAP16(inpid.vendor);
+ uint16_t product = BSWAP16(inpid.product);
+ uint16_t version = BSWAP16(inpid.version);
+
+ if (input->should_ignore_device(vendor, product)) {
+ // This can be true in cases where Steam is passing information into the game to ignore
+ // original gamepads when using virtual rebindings (See SteamInput).
+ return;
+ }
+
MutexLock lock(joypads_mutex[joy_num]);
Joypad &joypad = joypads[joy_num];
joypad.reset();
@@ -401,10 +411,6 @@ void JoypadLinux::open_joypad(const char *p_path) {
setup_joypad_properties(joypad);
sprintf(uid, "%04x%04x", BSWAP16(inpid.bustype), 0);
if (inpid.vendor && inpid.product && inpid.version) {
- uint16_t vendor = BSWAP16(inpid.vendor);
- uint16_t product = BSWAP16(inpid.product);
- uint16_t version = BSWAP16(inpid.version);
-
sprintf(uid + String(uid).length(), "%04x%04x%04x%04x%04x%04x", vendor, 0, product, 0, version, 0);
input->joy_connection_changed(joy_num, true, name, uid);
} else {