Commit 50690e08 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler Committed by Alexandre Julliard

dinput: Enumerate user format object forwards.

It's important for the default broken formats like c_dfDIJoystick2 which have multiple sets of sliders defined with the same offsets.
parent 76a1fd28
...@@ -880,25 +880,23 @@ static HRESULT WINAPI dinput_device_EnumObjects( IDirectInputDevice8W *iface, ...@@ -880,25 +880,23 @@ static HRESULT WINAPI dinput_device_EnumObjects( IDirectInputDevice8W *iface,
static HRESULT enum_object_filter_init( struct dinput_device *impl, DIPROPHEADER *filter ) static HRESULT enum_object_filter_init( struct dinput_device *impl, DIPROPHEADER *filter )
{ {
DIDATAFORMAT *device_format = &impl->device_format, *user_format = &impl->user_format; DIOBJECTDATAFORMAT *user_objs = impl->user_format.rgodf;
DIOBJECTDATAFORMAT *device_obj, *user_obj; DWORD i, count = impl->device_format.dwNumObjs;
if (filter->dwHow > DIPH_BYUSAGE) return DIERR_INVALIDPARAM; if (filter->dwHow > DIPH_BYUSAGE) return DIERR_INVALIDPARAM;
if (filter->dwHow == DIPH_BYUSAGE && !(impl->instance.dwDevType & DIDEVTYPE_HID)) return DIERR_UNSUPPORTED; if (filter->dwHow == DIPH_BYUSAGE && !(impl->instance.dwDevType & DIDEVTYPE_HID)) return DIERR_UNSUPPORTED;
if (filter->dwHow != DIPH_BYOFFSET) return DI_OK; if (filter->dwHow != DIPH_BYOFFSET) return DI_OK;
if (!user_format->rgodf) return DIERR_NOTFOUND; if (!user_objs) return DIERR_NOTFOUND;
user_obj = user_format->rgodf + device_format->dwNumObjs; for (i = 0; i < count; i++)
device_obj = device_format->rgodf + device_format->dwNumObjs;
while (user_obj-- > user_format->rgodf && device_obj-- > device_format->rgodf)
{ {
if (!user_obj->dwType) continue; if (!user_objs[i].dwType) continue;
if (user_obj->dwOfs == filter->dwObj) break; if (user_objs[i].dwOfs == filter->dwObj) break;
} }
if (user_obj < user_format->rgodf) return DIERR_NOTFOUND; if (i == count) return DIERR_NOTFOUND;
filter->dwObj = device_obj->dwOfs; filter->dwObj = impl->device_format.rgodf[i].dwOfs;
return DI_OK; return DI_OK;
} }
......
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