1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #76045 from Eoin-ONeill-Yokai/steaminput-fix

Prevent double input events on gamepad when running through steam input
This commit is contained in:
Yuri Sizov
2023-07-12 17:16:36 +02:00
4 changed files with 50 additions and 4 deletions

View File

@@ -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 {