dinput: Return DI_OK when HID joystick CreateEffect succeeds.

SetParameters returns DI_DOWNLOADSKIPPED if the device is not acquired
exclusively.

This fixes Assetto Corsa Competizione and Assetto Corsa not having FFB
due to calling CreateEffect before acquiring the device, which skips the
effect download and returns DI_DOWNLOADSKIPPED.

In particular, ACC tries twice to create the effect, and each time they
unacquire the device to turn off the autocenter, and then create the
effect while still in unacquired state, which in turn returns
DI_DOWNLOADSKIPPED, etc.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51922
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ivo Ivanov 2021-11-15 11:14:07 +01:00 committed by Alexandre Julliard
parent ee8015b97a
commit 34b0b4accb
2 changed files with 1 additions and 2 deletions

View File

@ -1375,7 +1375,7 @@ static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, c
if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) flags |= DIEP_NODOWNLOAD;
hr = IDirectInputEffect_SetParameters( *out, params, flags );
if (FAILED(hr)) goto failed;
return hr;
return DI_OK;
failed:
IDirectInputEffect_Release( *out );

View File

@ -6153,7 +6153,6 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
set_hid_expect( file, NULL, 0 );
hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, &expect_desc, &effect, NULL );
todo_wine
ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
ref = IDirectInputEffect_Release( effect );
ok( ref == 0, "Release returned %d\n", ref );