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