Commit 5499ba39 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Allow 0xff as a DIDFT_ANYINSTANCE alias with old dinput version.

parent c69c9b55
......@@ -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;
......
......@@ -1513,7 +1513,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 );
......
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