Vitaliy Margolen : dinput: Set default joystick axes mapping for evdev.

Alexandre Julliard julliard at winehq.org
Wed Aug 19 11:31:56 CDT 2009


Module: wine
Branch: master
Commit: 2941cc72e5f650a9d113d33eaf30ccbb028d0173
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2941cc72e5f650a9d113d33eaf30ccbb028d0173

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Sat Aug 15 11:58:56 2009 -0600

dinput: Set default joystick axes mapping for evdev.

---

 dlls/dinput/joystick_linuxinput.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 07524c0..d2f8dc1 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -378,6 +378,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
     JoystickImpl* newDevice;
     LPDIDATAFORMAT df = NULL;
     int i, idx = 0;
+    BYTE default_axis_map[WINE_JOYSTICK_MAX_AXES + WINE_JOYSTICK_MAX_POVS*2];
 
     newDevice = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(JoystickImpl));
     if (!newDevice) return NULL;
@@ -411,6 +412,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
             newDevice->dev_axes_to_di[i] = idx;
             newDevice->generic.props[idx].lDevMin = newDevice->joydev->axes[i].minimum;
             newDevice->generic.props[idx].lDevMax = newDevice->joydev->axes[i].maximum;
+            default_axis_map[idx] = i;
             idx++;
         }
         else
@@ -424,16 +426,19 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
         {
             newDevice->generic.device_axis_count += 2;
             newDevice->generic.props[idx].lDevMin = newDevice->joydev->axes[ABS_HAT0X + i * 2].minimum;
-            newDevice->dev_axes_to_di[ABS_HAT0X + i * 2] = idx++;
+            newDevice->dev_axes_to_di[ABS_HAT0X + i * 2] = idx;
             newDevice->generic.props[idx].lDevMax = newDevice->joydev->axes[ABS_HAT0Y + i * 2].maximum;
-            newDevice->dev_axes_to_di[ABS_HAT0Y + i * 2] = idx++;
+            newDevice->dev_axes_to_di[ABS_HAT0Y + i * 2] = idx + 1;
+
+            default_axis_map[idx] = default_axis_map[idx + 1] = WINE_JOYSTICK_MAX_AXES + i;
+            idx += 2;
         }
         else
             newDevice->dev_axes_to_di[ABS_HAT0X + i * 2] = newDevice->dev_axes_to_di[ABS_HAT0Y + i * 2] = -1;
     }
 
     /* do any user specified configuration */
-    if (setup_dinput_options(&newDevice->generic, NULL) != DI_OK) goto failed;
+    if (setup_dinput_options(&newDevice->generic, default_axis_map) != DI_OK) goto failed;
 
     /* Create copy of default data format */
     if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2.dwSize))) goto failed;




More information about the wine-cvs mailing list