17 lines
1.1 KiB
Diff
17 lines
1.1 KiB
Diff
--- a/src/joystick/emscripten/SDL_sysjoystick.c
|
|
+++ b/src/joystick/emscripten/SDL_sysjoystick.c
|
|
@@ -653,6 +653,14 @@
|
|
if (item->hat_is_axis && i == 9) {
|
|
continue; // this axis is a hat
|
|
}
|
|
+ // An axis SDL has no value for yet rests where it was:
|
|
+ // report that first. Without it SDL takes the first
|
|
+ // value an axis reports as its rest and drops it, so a
|
|
+ // stick's first push each way was lost. (Other drivers
|
|
+ // report the axes' values when the device is opened.)
|
|
+ if (!joystick->axes[i].has_initial_value) {
|
|
+ SDL_SendJoystickAxis(timestamp, item->joystick, i, (Sint16)(32767.0f * item->axis[i]));
|
|
+ }
|
|
if (item->axis[i] != gamepadState.axis[i]) {
|
|
SDL_SendJoystickAxis(timestamp, item->joystick, i, (Sint16)(32767.0f * gamepadState.axis[i]));
|
|
item->axis[i] = gamepadState.axis[i];
|