Module: wine Branch: master Commit: b50d1fa3140b7bc9b4749a6bfb411148d45c1a60 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b50d1fa3140b7bc9b4749a6bfb...
Author: Bruno Jesus bjesus@codeweavers.com Date: Tue Jun 13 10:53:42 2017 -0300
dinput: Limit axes while remaping broken devices.
Signed-off-by: Bruno Jesus bjesus@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dinput/joystick_linux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index 1032659..963e62f 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -253,10 +253,14 @@ static INT find_joystick_devices(void) /* If no axes were configured but there are axes assume a 1-to-1 (wii controller) */ if (joydev.axis_count && !found_axes) { + int axes_limit = min(joydev.axis_count, 8); /* generic driver limit */ + ERR("Incoherent joystick data, advertised %d axes, detected 0. Assuming 1-to-1.\n", - joydev.axis_count); - for (j = 0; j < joydev.axis_count; j++) + joydev.axis_count); + for (j = 0; j < axes_limit; j++) joydev.dev_axes_map[j] = j; + + joydev.axis_count = axes_limit; } }