Commit 3cd13628 authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

dinput: Use correct data structure for EVIOCGABS instead of an array.

parent ca8a0a8a
...@@ -149,14 +149,8 @@ struct JoyDev { ...@@ -149,14 +149,8 @@ struct JoyDev {
BYTE keybits[(KEY_MAX+7)/8]; BYTE keybits[(KEY_MAX+7)/8];
BYTE ffbits[(FF_MAX+7)/8]; BYTE ffbits[(FF_MAX+7)/8];
#define AXIS_ABS 0
#define AXIS_ABSMIN 1
#define AXIS_ABSMAX 2
#define AXIS_ABSFUZZ 3
#define AXIS_ABSFLAT 4
/* data returned by the EVIOCGABS() ioctl */ /* data returned by the EVIOCGABS() ioctl */
int axes[ABS_MAX][5]; struct input_absinfo axes[ABS_MAX];
}; };
struct JoystickImpl struct JoystickImpl
...@@ -290,11 +284,11 @@ static void find_joydevs(void) ...@@ -290,11 +284,11 @@ static void find_joydevs(void)
if (-1!=ioctl(fd,EVIOCGABS(j),&(joydev.axes[j]))) { if (-1!=ioctl(fd,EVIOCGABS(j),&(joydev.axes[j]))) {
TRACE(" ... with axis %d: cur=%d, min=%d, max=%d, fuzz=%d, flat=%d\n", TRACE(" ... with axis %d: cur=%d, min=%d, max=%d, fuzz=%d, flat=%d\n",
j, j,
joydev.axes[j][AXIS_ABS], joydev.axes[j].value,
joydev.axes[j][AXIS_ABSMIN], joydev.axes[j].minimum,
joydev.axes[j][AXIS_ABSMAX], joydev.axes[j].maximum,
joydev.axes[j][AXIS_ABSFUZZ], joydev.axes[j].fuzz,
joydev.axes[j][AXIS_ABSFLAT] joydev.axes[j].flat
); );
} }
} }
...@@ -420,12 +414,12 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm ...@@ -420,12 +414,12 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[i], df->dwObjSize); memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[i], df->dwObjSize);
newDevice->axes[i] = idx; newDevice->axes[i] = idx;
newDevice->props[idx].lDevMin = newDevice->joydev->axes[i][AXIS_ABSMIN]; newDevice->props[idx].lDevMin = newDevice->joydev->axes[i].minimum;
newDevice->props[idx].lDevMax = newDevice->joydev->axes[i][AXIS_ABSMAX]; newDevice->props[idx].lDevMax = newDevice->joydev->axes[i].maximum;
newDevice->props[idx].lMin = 0; newDevice->props[idx].lMin = 0;
newDevice->props[idx].lMax = 0xffff; newDevice->props[idx].lMax = 0xffff;
newDevice->props[idx].lSaturation = 0; newDevice->props[idx].lSaturation = 0;
newDevice->props[idx].lDeadZone = MulDiv(newDevice->joydev->axes[i][AXIS_ABSFLAT], 0xffff, newDevice->props[idx].lDeadZone = MulDiv(newDevice->joydev->axes[i].flat, 0xffff,
newDevice->props[idx].lDevMax - newDevice->props[idx].lDevMin); newDevice->props[idx].lDevMax - newDevice->props[idx].lDevMin);
df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(newDevice->numAxes++) | DIDFT_ABSAXIS; df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(newDevice->numAxes++) | DIDFT_ABSAXIS;
...@@ -615,7 +609,7 @@ static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface) ...@@ -615,7 +609,7 @@ static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
*/ */
#define CENTER_AXIS(a) \ #define CENTER_AXIS(a) \
(ji->axes[a] == -1 ? 0 : joystick_map_axis( &ji->props[ji->axes[a]], \ (ji->axes[a] == -1 ? 0 : joystick_map_axis( &ji->props[ji->axes[a]], \
ji->joydev->axes[a][AXIS_ABS] )) ji->joydev->axes[a].value ))
static void fake_current_js_state(JoystickImpl *ji) static void fake_current_js_state(JoystickImpl *ji)
{ {
int i; int i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment