Commit 621af39c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Use user object data format array to keep user offsets.

parent 6677ba78
......@@ -38,10 +38,6 @@ typedef struct
typedef struct
{
int size;
DataTransform *dt;
int *offsets; /* object offsets */
LPDIDATAFORMAT wine_df; /* wine internal data format */
} DataFormat;
......
......@@ -2009,16 +2009,21 @@ static BOOL get_parameters_object_id( struct hid_joystick *impl, struct hid_valu
static BOOL get_parameters_object_ofs( struct hid_joystick *impl, struct hid_value_caps *caps,
DIDEVICEOBJECTINSTANCEW *instance, void *data )
{
DIDATAFORMAT *format = impl->base.data_format.wine_df;
int *offsets = impl->base.data_format.offsets;
ULONG i;
DIDATAFORMAT *device_format = impl->base.data_format.wine_df, *user_format = impl->base.user_format;
DIOBJECTDATAFORMAT *device_obj, *user_obj;
if (!user_format) return DIENUM_CONTINUE;
if (!offsets) return DIENUM_CONTINUE;
for (i = 0; i < format->dwNumObjs; ++i)
if (format->rgodf[i].dwOfs == instance->dwOfs) break;
if (i == format->dwNumObjs) return DIENUM_CONTINUE;
*(DWORD *)data = offsets[i];
user_obj = user_format->rgodf + device_format->dwNumObjs;
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 (device_obj->dwType == instance->dwType) break;
}
if (user_obj < user_format->rgodf) return DIENUM_CONTINUE;
*(DWORD *)data = user_obj->dwOfs;
return DIENUM_STOP;
}
......
......@@ -4539,7 +4539,6 @@ static void test_simple_joystick(void)
hr = IDirectInputDevice8_GetDeviceState( device, dataformat.dwDataSize, buffer );
ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
todo_wine
ok( ((ULONG *)buffer)[0] == 0x512b, "got %#x, expected %#x\n", ((ULONG *)buffer)[0], 0x512b );
ok( ((ULONG *)buffer)[1] == 0, "got %#x, expected %#x\n", ((ULONG *)buffer)[1], 0 );
ok( ((ULONG *)buffer)[2] == 0x7fff, "got %#x, expected %#x\n", ((ULONG *)buffer)[2], 0x7fff );
......
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