Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52267 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 6 ++++-- dlls/dinput/tests/joystick8.c | 1 - 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 834b87f5fe0..a4c85351648 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -240,11 +240,13 @@ LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD }
static BOOL match_device_object( DIDATAFORMAT *device_format, DIDATAFORMAT *user_format, - const DIDATAFORMAT *format, const DIOBJECTDATAFORMAT *match_obj ) + const DIDATAFORMAT *format, const DIOBJECTDATAFORMAT *match_obj, DWORD version ) { DWORD i, device_instance, instance = DIDFT_GETINSTANCE( match_obj->dwType ); DIOBJECTDATAFORMAT *device_obj, *user_obj;
+ if (version < 0x0700 && instance == 0xff) instance = 0xffff; + for (i = 0; i < device_format->dwNumObjs; i++) { user_obj = user_format->rgodf + i; @@ -292,7 +294,7 @@ static HRESULT dinput_device_init_user_format( struct dinput_device *impl, const { match_obj = format->rgodf + i;
- if (!match_device_object( device_format, user_format, format, match_obj )) + if (!match_device_object( device_format, user_format, format, match_obj, impl->dinput->dwVersion )) { WARN( "object %s not found\n", debugstr_diobjectdataformat( match_obj ) ); if (!(match_obj->dwType & DIDFT_OPTIONAL)) goto failed; diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 492db1dfc9b..2d7c5a0e857 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -1511,7 +1511,6 @@ static void test_simple_joystick( DWORD version ) ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); objdataformat[1].dwType = DIDFT_AXIS | DIDFT_MAKEINSTANCE( 0xff ); hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); - todo_wine_if( version < 0x0700 ) ok( hr == (version < 0x0700 ? DI_OK : DIERR_INVALIDPARAM), "SetDataFormat returned: %#x\n", hr ); objdataformat[1].dwType = DIDFT_AXIS | DIDFT_MAKEINSTANCE( 1 );