From 34b0b4accbfc8ce48467428b35e712e4048231a1 Mon Sep 17 00:00:00 2001 From: Ivo Ivanov Date: Mon, 15 Nov 2021 11:14:07 +0100 Subject: [PATCH] dinput: Return DI_OK when HID joystick CreateEffect succeeds. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Alexandre Julliard --- dlls/dinput/device.c | 2 +- dlls/dinput8/tests/hid.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index b423337c9ce..c58ffc7ac73 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -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 ); diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 9bbe5dbcbcc..78c178086c9 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -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 );