Commit b07ff6ec authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

dinput: Remove redundant variable.

parent 493b6915
...@@ -93,7 +93,6 @@ struct JoystickImpl ...@@ -93,7 +93,6 @@ struct JoystickImpl
LONG deadzone; LONG deadzone;
int *axis_map; int *axis_map;
int axes; int axes;
int buttons;
POINTL povs[4]; POINTL povs[4];
}; };
...@@ -428,9 +427,9 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di ...@@ -428,9 +427,9 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
} }
#endif #endif
#ifdef JSIOCGBUTTONS #ifdef JSIOCGBUTTONS
if (ioctl(newDevice->joyfd,JSIOCGBUTTONS,&newDevice->buttons) < 0) { if (ioctl(newDevice->joyfd, JSIOCGBUTTONS, &newDevice->devcaps.dwButtons) < 0) {
WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", newDevice->dev, strerror(errno)); WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", newDevice->dev, strerror(errno));
newDevice->buttons = 2; newDevice->devcaps.dwButtons = 2;
} }
#endif #endif
...@@ -441,10 +440,10 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di ...@@ -441,10 +440,10 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice->axes = 16; newDevice->axes = 16;
} }
if (newDevice->buttons > 128) if (newDevice->devcaps.dwButtons > 128)
{ {
WARN("Can't support %d buttons. Clamping down to 128\n", newDevice->buttons); WARN("Can't support %d buttons. Clamping down to 128\n", newDevice->devcaps.dwButtons);
newDevice->buttons = 128; newDevice->devcaps.dwButtons = 128;
} }
newDevice->base.lpVtbl = jvt; newDevice->base.lpVtbl = jvt;
...@@ -456,7 +455,6 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di ...@@ -456,7 +455,6 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
/* setup_dinput_options may change these */ /* setup_dinput_options may change these */
newDevice->deadzone = 0; newDevice->deadzone = 0;
newDevice->devcaps.dwButtons = newDevice->buttons;
/* do any user specified configuration */ /* do any user specified configuration */
hr = setup_dinput_options(newDevice); hr = setup_dinput_options(newDevice);
...@@ -467,7 +465,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di ...@@ -467,7 +465,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2.dwSize))) goto FAILED; if (!(df = HeapAlloc(GetProcessHeap(), 0, c_dfDIJoystick2.dwSize))) goto FAILED;
memcpy(df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize); memcpy(df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize);
df->dwNumObjs = newDevice->devcaps.dwAxes + newDevice->devcaps.dwPOVs + newDevice->buttons; df->dwNumObjs = newDevice->devcaps.dwAxes + newDevice->devcaps.dwPOVs + newDevice->devcaps.dwButtons;
if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto FAILED; if (!(df->rgodf = HeapAlloc(GetProcessHeap(), 0, df->dwNumObjs * df->dwObjSize))) goto FAILED;
for (i = 0; i < newDevice->axes; i++) for (i = 0; i < newDevice->axes; i++)
...@@ -483,7 +481,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di ...@@ -483,7 +481,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
i++; /* POV takes 2 axes */ i++; /* POV takes 2 axes */
} }
} }
for (i = 0; i < newDevice->buttons; i++) for (i = 0; i < newDevice->devcaps.dwButtons; i++)
{ {
memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[i + 12], df->dwObjSize); memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[i + 12], df->dwObjSize);
df->rgodf[idx ].pguid = &GUID_Button; df->rgodf[idx ].pguid = &GUID_Button;
......
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