diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-06-01 00:48:49 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-06-01 00:48:49 +0200 |
commit | 612fe6a9c2f97f20a1be255e188cd46d63c7175b (patch) | |
tree | 09eefd0b6a07419422485b72df11dd962c3edd98 | |
parent | 57448f65797f7726a53387c804fb3f5cc04e292f (diff) |
Workaround weird steam input (in-game) behavior where steam triggers playstation button + options when pressing both l3 and r3 at the same timeHEADmaster
-rw-r--r-- | include/GlobalHotkeys/GlobalHotkeysJoystick.hpp | 2 | ||||
-rw-r--r-- | src/GlobalHotkeys/GlobalHotkeysJoystick.cpp | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp b/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp index 4b266cb..0177d29 100644 --- a/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp +++ b/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp @@ -56,6 +56,8 @@ namespace gsr { bool down_pressed = false; bool left_pressed = false; bool right_pressed = false; + bool l3_button_pressed = false; + bool r3_button_pressed = false; bool save_replay = false; bool save_1_min_replay = false; diff --git a/src/GlobalHotkeys/GlobalHotkeysJoystick.cpp b/src/GlobalHotkeys/GlobalHotkeysJoystick.cpp index 23f8a20..5969438 100644 --- a/src/GlobalHotkeys/GlobalHotkeysJoystick.cpp +++ b/src/GlobalHotkeys/GlobalHotkeysJoystick.cpp @@ -11,6 +11,8 @@ namespace gsr { static constexpr int triangle_button = 2; static constexpr int options_button = 9; static constexpr int playstation_button = 10; + static constexpr int l3_button = 11; + static constexpr int r3_button = 12; static constexpr int axis_up_down = 7; static constexpr int axis_left_right = 6; @@ -266,7 +268,8 @@ namespace gsr { if((event.type & JS_EVENT_BUTTON) == JS_EVENT_BUTTON) { switch(event.number) { case playstation_button: { - playstation_button_pressed = event.value == button_pressed; + // Workaround weird steam input (in-game) behavior where steam triggers playstation button + options when pressing both l3 and r3 at the same time + playstation_button_pressed = (event.value == button_pressed) && !l3_button_pressed && !r3_button_pressed; break; } case options_button: { @@ -284,6 +287,14 @@ namespace gsr { save_10_min_replay = true; break; } + case l3_button: { + l3_button_pressed = event.value == button_pressed; + break; + } + case r3_button: { + r3_button_pressed = event.value == button_pressed; + break; + } } } else if((event.type & JS_EVENT_AXIS) == JS_EVENT_AXIS && playstation_button_pressed) { const int trigger_threshold = 16383; |