godot/platform
Lisandro Lorea d92f9017c6
Fix gamepad triggers not working on web exports
Fixes #81758

DisplayServerWeb::process_joypads handles buttons 6 and 7 of the
HTML5 Standard Gamepad as a special case by doing:
`input->joy_axis(idx, (JoyAxis)b, s_btns[b]);`

This doesn't work because there is no JoyAxis 6 or 7 in the enum

To fix this we use JoyAxis::TRIGGER_LEFT and TRIGGER_RIGHT for button 6
and 7

However since we are now lying to input->joy_axis we also need to lie in
the mappings for the standard gamepad in godotcontrollersdb.txt,
otherwise input->joy_axis will try to find a mapping to axis 4(LT) and
axis 5(RT) that's not defined.

Therefore we set lefttrigger to +a4 and righttrigger to +a5 in the
mapping, to match what we are actually sending.

A cleaner, and more involved fix to this would be modifying
input->joy_button so that it can handle analog buttons and map them to
axes preserving their value instead of converting to boolean

(cherry picked from commit 9dd372f316)
2024-09-17 08:57:45 +02:00
..
android [Windows] Fix broken apksigner detection. 2024-09-17 08:57:44 +02:00
ios [iOS] Fix dylib GDExtension convertion. 2024-08-09 12:44:48 +03:00
linuxbsd Use wayland-egl-core.h instead of wayland-egl.h 2024-09-16 17:17:49 +02:00
macos Only main binaries require entitlements. This fixes signing issues on macOS. 2024-09-17 08:57:41 +02:00
web Fix gamepad triggers not working on web exports 2024-09-17 08:57:45 +02:00
windows [Windows] Use the same API for all OS_Windows::*_environment functions. 2024-09-17 08:57:43 +02:00
register_platform_apis.h One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
SCsub Update pre-commit hooks configuration to use ruff instead of black 2024-05-21 18:02:29 -05:00