We normally should not peek messages here, but because of current winex11.drv design, we have to call MsgWaitForMultipleObjectsEx from time to time to pull keyboard or mouse events.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51956 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 3 +-- dlls/dinput/dinput_main.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index d375229e2c0..c79b182bc66 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1535,10 +1535,9 @@ static HRESULT WINAPI dinput_device_Poll( IDirectInputDevice8W *iface ) EnterCriticalSection( &impl->crit ); if (!impl->acquired) hr = DIERR_NOTACQUIRED; LeaveCriticalSection( &impl->crit ); - if (hr != DI_OK) return hr;
if (impl->vtbl->poll) return impl->vtbl->poll( iface ); - return DI_OK; + return hr; }
static HRESULT WINAPI dinput_device_SendDeviceData( IDirectInputDevice8W *iface, DWORD size, diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 3286e887662..835a8656bd1 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1430,6 +1430,8 @@ void check_dinput_events(void) * (for example Culpa Innata) * - some games only poll the device, and neither keyboard nor mouse * (for example Civilization: Call to Power 2) + * - some games do not explicitly poll for keyboard events + * (for example Morrowind in its key binding page) */ MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, 0); }
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51953 Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index d7e64af9928..610a75871f1 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -1470,7 +1470,7 @@ HRESULT hid_joystick_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *in
if (instance->dwSize != sizeof(DIDEVICEINSTANCEW)) return S_FALSE; - if (version < 0x0800 && type != DIDEVTYPE_JOYSTICK) + if (version < 0x0800 && type != 0 && type != DIDEVTYPE_JOYSTICK) return S_FALSE; if (version >= 0x0800 && type != DI8DEVCLASS_ALL && type != DI8DEVCLASS_GAMECTRL) return S_FALSE;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index c6d01b8bee7..af8d48dfc90 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -7356,11 +7356,16 @@ static void test_force_feedback_joystick( void ) hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE ); ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+ prop_dword.diph.dwHow = DIPH_DEVICE; + prop_dword.diph.dwObj = 0; + prop_dword.dwData = DIPROPAUTOCENTER_ON; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); + todo_wine + ok( hr == DI_OK, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr ); + hr = IDirectInputDevice8_Acquire( device ); ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
- prop_dword.diph.dwHow = DIPH_DEVICE; - prop_dword.diph.dwObj = 0; prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph ); todo_wine
Star Wars Episode I Racer will ignore force-feedback joystick devices if we return an error here.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 3 ++- dlls/dinput8/tests/hid.c | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index c79b182bc66..dff1f3426d3 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1082,7 +1082,8 @@ static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, co EnterCriticalSection( &impl->crit ); if (impl->acquired) hr = DIERR_ACQUIRED; else if (value->dwData > DIPROPAUTOCENTER_ON) hr = DIERR_INVALIDPARAM; - else hr = DIERR_UNSUPPORTED; + else if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) hr = DIERR_UNSUPPORTED; + else hr = DI_OK; LeaveCriticalSection( &impl->crit ); return hr; } diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index af8d48dfc90..a0e202ba804 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -7360,7 +7360,6 @@ static void test_force_feedback_joystick( void ) prop_dword.diph.dwObj = 0; prop_dword.dwData = DIPROPAUTOCENTER_ON; hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); - todo_wine ok( hr == DI_OK, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
hr = IDirectInputDevice8_Acquire( device );
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 5 +++-- dlls/dinput/joystick_hid.c | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index dff1f3426d3..85392c6b30b 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1357,7 +1357,7 @@ static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, c IUnknown *outer ) { struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); - DWORD flags = DIEP_ALLPARAMS; + DWORD flags; HRESULT hr;
TRACE( "iface %p, guid %s, params %p, out %p, outer %p\n", iface, debugstr_guid( guid ), @@ -1372,8 +1372,9 @@ static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, c
hr = IDirectInputEffect_Initialize( *out, DINPUT_instance, impl->dinput->dwVersion, guid ); if (FAILED(hr)) goto failed; - if (!params) return DI_OK; + + flags = params->dwSize == sizeof(DIEFFECT_DX6) ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5; if (!impl->acquired || !(impl->dwCoopLevel & DISCL_EXCLUSIVE)) flags |= DIEP_NODOWNLOAD; hr = IDirectInputEffect_SetParameters( *out, params, flags ); if (FAILED(hr)) goto failed; diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 610a75871f1..20a10bde6ae 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -2149,7 +2149,11 @@ static HRESULT WINAPI hid_joystick_effect_GetParameters( IDirectInputEffect *ifa if (flags & DIEP_DURATION) params->dwDuration = impl->params.dwDuration; if (flags & DIEP_GAIN) params->dwGain = impl->params.dwGain; if (flags & DIEP_SAMPLEPERIOD) params->dwSamplePeriod = impl->params.dwSamplePeriod; - if (flags & DIEP_STARTDELAY) params->dwStartDelay = impl->params.dwStartDelay; + if (flags & DIEP_STARTDELAY) + { + if (params->dwSize != sizeof(DIEFFECT_DX6)) return DIERR_INVALIDPARAM; + params->dwStartDelay = impl->params.dwStartDelay; + } if (flags & DIEP_TRIGGERREPEATINTERVAL) params->dwTriggerRepeatInterval = impl->params.dwTriggerRepeatInterval;
if (flags & DIEP_TRIGGERBUTTON) @@ -2336,6 +2340,7 @@ static HRESULT WINAPI hid_joystick_effect_SetParameters( IDirectInputEffect *ifa } if (flags & DIEP_STARTDELAY) { + if (params->dwSize != sizeof(DIEFFECT_DX6)) return DIERR_INVALIDPARAM; if (impl->params.dwStartDelay != params->dwStartDelay) impl->modified = TRUE; impl->params.dwStartDelay = params->dwStartDelay; }
Star Wars Episode I Racer force-feedback doesn't work otherwise as it passes a DIEFFECT_DX5 struct to SetParameters.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 20a10bde6ae..541aa26e73b 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -2043,7 +2043,7 @@ static HRESULT WINAPI hid_joystick_effect_GetParameters( IDirectInputEffect *ifa TRACE( "iface %p, params %p, flags %#x.\n", iface, params, flags );
if (!params) return DI_OK; - if (params->dwSize != sizeof(DIEFFECT)) return DIERR_INVALIDPARAM; + if (params->dwSize != sizeof(DIEFFECT_DX6) && params->dwSize != sizeof(DIEFFECT_DX5)) return DIERR_INVALIDPARAM; capacity = params->cAxes; object_flags = params->dwFlags & (DIEFF_OBJECTIDS | DIEFF_OBJECTOFFSETS); direction_flags = params->dwFlags & (DIEFF_CARTESIAN | DIEFF_POLAR | DIEFF_SPHERICAL); @@ -2199,7 +2199,7 @@ static HRESULT WINAPI hid_joystick_effect_SetParameters( IDirectInputEffect *ifa TRACE( "iface %p, params %p, flags %#x.\n", iface, params, flags );
if (!params) return E_POINTER; - if (params->dwSize != sizeof(DIEFFECT)) return DIERR_INVALIDPARAM; + if (params->dwSize != sizeof(DIEFFECT_DX6) && params->dwSize != sizeof(DIEFFECT_DX5)) return DIERR_INVALIDPARAM; object_flags = params->dwFlags & (DIEFF_OBJECTIDS | DIEFF_OBJECTOFFSETS); direction_flags = params->dwFlags & (DIEFF_CARTESIAN | DIEFF_POLAR | DIEFF_SPHERICAL);
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/Makefile.in | 2 +- dlls/dinput8/tests/hid.c | 359 ++++++++++++++++++++++++--------- 2 files changed, 261 insertions(+), 100 deletions(-)
diff --git a/dlls/dinput8/tests/Makefile.in b/dlls/dinput8/tests/Makefile.in index 579cf3d2f4b..18624b9d523 100644 --- a/dlls/dinput8/tests/Makefile.in +++ b/dlls/dinput8/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = dinput8.dll -IMPORTS = dinput8 ole32 user32 hid advapi32 uuid crypt32 newdev setupapi wintrust +IMPORTS = dinput8 dinput ole32 user32 hid advapi32 uuid crypt32 newdev setupapi wintrust
driver_hid_IMPORTS = winecrt0 ntoskrnl hal hidclass driver_hid_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index a0e202ba804..8778e0587b4 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3321,18 +3321,37 @@ static BOOL CALLBACK find_test_device( const DIDEVICEINSTANCEW *devinst, void *c return DIENUM_CONTINUE; }
+struct check_objects_todos +{ + BOOL type; + BOOL guid; + BOOL usage; +}; + struct check_objects_params { + DWORD version; UINT index; UINT expect_count; const DIDEVICEOBJECTINSTANCEW *expect_objs; + const struct check_objects_todos *todo_objs; + BOOL todo_extra; };
static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *args ) { static const DIDEVICEOBJECTINSTANCEW unexpected_obj = {0}; + static const struct check_objects_todos todo_none = {0}; struct check_objects_params *params = args; const DIDEVICEOBJECTINSTANCEW *exp = params->expect_objs + params->index; + const struct check_objects_todos *todo; + + if (!params->todo_objs) todo = &todo_none; + else todo = params->todo_objs + params->index; + + todo_wine_if( params->todo_extra && params->index >= params->expect_count ) + ok( params->index < params->expect_count, "unexpected extra object\n" ); + if (params->index >= params->expect_count) return DIENUM_CONTINUE;
winetest_push_context( "obj[%d]", params->index );
@@ -3340,8 +3359,11 @@ static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *ar if (params->index >= params->expect_count) exp = &unexpected_obj;
check_member( *obj, *exp, "%u", dwSize ); + todo_wine_if( todo->guid ) check_member_guid( *obj, *exp, guidType ); + todo_wine_if( params->version < 0x800 && (obj->dwType & (DIDFT_OUTPUT | DIDFT_BUTTON)) ) check_member( *obj, *exp, "%#x", dwOfs ); + todo_wine_if( todo->type ) check_member( *obj, *exp, "%#x", dwType ); check_member( *obj, *exp, "%#x", dwFlags ); if (!localized) todo_wine check_member_wstr( *obj, *exp, tszName ); @@ -3350,6 +3372,7 @@ static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *ar check_member( *obj, *exp, "%u", wCollectionNumber ); check_member( *obj, *exp, "%u", wDesignatorIndex ); check_member( *obj, *exp, "%#04x", wUsagePage ); + todo_wine_if( todo->usage ) check_member( *obj, *exp, "%#04x", wUsage ); check_member( *obj, *exp, "%#04x", dwDimension ); check_member( *obj, *exp, "%#04x", wExponent ); @@ -3712,6 +3735,7 @@ static void test_simple_joystick(void)
struct check_objects_params check_objects_params = { + .version = DIRECTINPUT_VERSION, .expect_count = ARRAY_SIZE(expect_objects), .expect_objs = expect_objects, }; @@ -5306,7 +5330,7 @@ static BOOL test_device_types(void) return success; }
-static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) +static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWORD version ) { struct hid_expect expect_download[] = { @@ -5329,7 +5353,7 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) .code = IOCTL_HID_WRITE_REPORT, .report_id = 3, .report_len = 11, - .report_buf = {0x03,0x01,0x01,0x08,0x01,0x00,0x06,0x00,0x01,0x55,0xd5}, + .report_buf = {0x03,0x01,0x01,0x08,0x01,0x00,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0xd5}, }, /* start command when DIEP_START is set */ { @@ -5398,9 +5422,9 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) .report_buf = {1, 0x01}, }; static const DWORD expect_axes_init[2] = {0}; - static const DIEFFECT expect_desc_init = + const DIEFFECT expect_desc_init = { - .dwSize = sizeof(DIEFFECT), + .dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5), .dwTriggerButton = -1, .rgdwAxes = (void *)expect_axes_init, }; @@ -5431,9 +5455,9 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) .dwPhase = 3000, .dwPeriod = 4000, }; - static const DIEFFECT expect_desc = + const DIEFFECT expect_desc = { - .dwSize = sizeof(DIEFFECT), + .dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5), .dwFlags = DIEFF_SPHERICAL | DIEFF_OBJECTIDS, .dwDuration = 1000, .dwSamplePeriod = 2000, @@ -5477,19 +5501,30 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) ok( hr == DI_OK, "EnumCreatedEffectObjects returned %#x\n", hr ); ok( check_params.count == 1, "got count %u, expected 1\n", check_params.count );
- hr = IDirectInputEffect_Initialize( effect, NULL, DIRECTINPUT_VERSION, &GUID_Sine ); + hr = IDirectInputEffect_Initialize( effect, NULL, version, &GUID_Sine ); ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#x\n", hr ); + hr = IDirectInputEffect_Initialize( effect, instance, 0x800 - (version - 0x700), &GUID_Sine ); + if (version == 0x800) + { + todo_wine + ok( hr == DIERR_BETADIRECTINPUTVERSION, "Initialize returned %#x\n", hr ); + } + else + { + todo_wine + ok( hr == DIERR_OLDDIRECTINPUTVERSION, "Initialize returned %#x\n", hr ); + } hr = IDirectInputEffect_Initialize( effect, instance, 0, &GUID_Sine ); todo_wine ok( hr == DIERR_NOTINITIALIZED, "Initialize returned %#x\n", hr ); - hr = IDirectInputEffect_Initialize( effect, instance, DIRECTINPUT_VERSION, NULL ); + hr = IDirectInputEffect_Initialize( effect, instance, version, NULL ); ok( hr == E_POINTER, "Initialize returned %#x\n", hr );
- hr = IDirectInputEffect_Initialize( effect, instance, DIRECTINPUT_VERSION, &GUID_NULL ); + hr = IDirectInputEffect_Initialize( effect, instance, version, &GUID_NULL ); ok( hr == DIERR_DEVICENOTREG, "Initialize returned %#x\n", hr ); - hr = IDirectInputEffect_Initialize( effect, instance, DIRECTINPUT_VERSION, &GUID_Sine ); + hr = IDirectInputEffect_Initialize( effect, instance, version, &GUID_Sine ); ok( hr == DI_OK, "Initialize returned %#x\n", hr ); - hr = IDirectInputEffect_Initialize( effect, instance, DIRECTINPUT_VERSION, &GUID_Square ); + hr = IDirectInputEffect_Initialize( effect, instance, version, &GUID_Square ); ok( hr == DI_OK, "Initialize returned %#x\n", hr );
hr = IDirectInputEffect_GetEffectGuid( effect, NULL ); @@ -5505,7 +5540,15 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) ok( hr == DI_OK, "GetParameters returned %#x\n", hr ); hr = IDirectInputEffect_GetParameters( effect, &desc, 0 ); ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr ); - desc.dwSize = sizeof(DIEFFECT); + desc.dwSize = sizeof(DIEFFECT_DX5) + 2; + hr = IDirectInputEffect_GetParameters( effect, &desc, 0 ); + ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr ); + desc.dwSize = sizeof(DIEFFECT_DX5); + hr = IDirectInputEffect_GetParameters( effect, &desc, 0 ); + ok( hr == DI_OK, "GetParameters returned %#x\n", hr ); + hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_STARTDELAY ); + ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr ); + desc.dwSize = sizeof(DIEFFECT_DX6); hr = IDirectInputEffect_GetParameters( effect, &desc, 0 ); ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
@@ -5525,18 +5568,20 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) ok( hr == DI_OK, "GetParameters returned %#x\n", hr ); check_member( desc, expect_desc_init, "%u", dwDuration ); memset( &desc, 0xcd, sizeof(desc) ); - desc.dwSize = sizeof(DIEFFECT); + desc.dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5); desc.dwFlags = 0; - flags = DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_STARTDELAY | DIEP_TRIGGERREPEATINTERVAL; + desc.dwStartDelay = 0xdeadbeef; + flags = DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_TRIGGERREPEATINTERVAL | (version >= 0x700 ? DIEP_STARTDELAY : 0); hr = IDirectInputEffect_GetParameters( effect, &desc, flags ); ok( hr == DI_OK, "GetParameters returned %#x\n", hr ); check_member( desc, expect_desc_init, "%u", dwSamplePeriod ); check_member( desc, expect_desc_init, "%u", dwGain ); - check_member( desc, expect_desc_init, "%u", dwStartDelay ); + if (version >= 0x700) check_member( desc, expect_desc_init, "%u", dwStartDelay ); + else ok( desc.dwStartDelay == 0xdeadbeef, "got dwStartDelay %#x\n", desc.dwStartDelay ); check_member( desc, expect_desc_init, "%u", dwTriggerRepeatInterval );
memset( &desc, 0xcd, sizeof(desc) ); - desc.dwSize = sizeof(DIEFFECT); + desc.dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5); desc.dwFlags = 0; desc.lpEnvelope = NULL; hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_ENVELOPE ); @@ -5555,7 +5600,7 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) desc.lpEnvelope = NULL; desc.cbTypeSpecificParams = 0; desc.lpvTypeSpecificParams = NULL; - hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_ALLPARAMS ); + hr = IDirectInputEffect_GetParameters( effect, &desc, version >= 0x700 ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5 ); ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr ); hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_TRIGGERBUTTON ); ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr ); @@ -5609,7 +5654,7 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) desc.lpEnvelope = &envelope; desc.cbTypeSpecificParams = sizeof(periodic); desc.lpvTypeSpecificParams = &periodic; - hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_ALLPARAMS ); + hr = IDirectInputEffect_GetParameters( effect, &desc, version >= 0x700 ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5 ); ok( hr == DI_OK, "GetParameters returned %#x\n", hr ); check_member( desc, expect_desc_init, "%u", dwDuration ); check_member( desc, expect_desc_init, "%u", dwSamplePeriod ); @@ -5624,7 +5669,8 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) check_member( desc, expect_desc_init, "%p", lpEnvelope ); todo_wine check_member( desc, expect_desc_init, "%u", cbTypeSpecificParams ); - check_member( desc, expect_desc_init, "%u", dwStartDelay ); + if (version >= 0x700) check_member( desc, expect_desc_init, "%u", dwStartDelay ); + else ok( desc.dwStartDelay == 0xcdcdcdcd, "got dwStartDelay %#x\n", desc.dwStartDelay );
set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Unacquire( device ); @@ -5647,7 +5693,7 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) memset( &desc, 0, sizeof(desc) ); hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_NODOWNLOAD ); ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr ); - desc.dwSize = sizeof(DIEFFECT); + desc.dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5); hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_NODOWNLOAD ); ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
@@ -5684,12 +5730,13 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) hr = IDirectInputEffect_Unload( effect ); ok( hr == DI_NOEFFECT, "Unload returned %#x\n", hr );
- hr = IDirectInputEffect_SetParameters( effect, &expect_desc, - DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_STARTDELAY | - DIEP_TRIGGERREPEATINTERVAL | DIEP_NODOWNLOAD ); + flags = DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_TRIGGERREPEATINTERVAL | DIEP_NODOWNLOAD; + if (version >= 0x700) flags |= DIEP_STARTDELAY; + hr = IDirectInputEffect_SetParameters( effect, &expect_desc, flags ); ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr ); desc.dwDuration = 0; - flags = DIEP_DURATION | DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_STARTDELAY | DIEP_TRIGGERREPEATINTERVAL; + flags = DIEP_DURATION | DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_TRIGGERREPEATINTERVAL; + if (version >= 0x700) flags |= DIEP_STARTDELAY; hr = IDirectInputEffect_GetParameters( effect, &desc, flags ); ok( hr == DI_OK, "GetParameters returned %#x\n", hr ); check_member( desc, expect_desc, "%u", dwDuration ); @@ -5701,7 +5748,8 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) check_member( desc, expect_desc_init, "%p", rglDirection ); check_member( desc, expect_desc_init, "%p", lpEnvelope ); check_member( desc, expect_desc_init, "%u", cbTypeSpecificParams ); - check_member( desc, expect_desc, "%u", dwStartDelay ); + if (version >= 0x700) check_member( desc, expect_desc, "%u", dwStartDelay ); + else ok( desc.dwStartDelay == 0, "got dwStartDelay %#x\n", desc.dwStartDelay );
hr = IDirectInputEffect_Download( effect ); ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#x\n", hr ); @@ -5740,7 +5788,8 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) desc.lpEnvelope = NULL; desc.cbTypeSpecificParams = 0; desc.lpvTypeSpecificParams = NULL; - hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_ALLPARAMS | DIEP_NODOWNLOAD ); + flags = version >= 0x700 ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5; + hr = IDirectInputEffect_SetParameters( effect, &desc, flags | DIEP_NODOWNLOAD ); ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr ); hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_TRIGGERBUTTON | DIEP_NODOWNLOAD ); ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr ); @@ -5992,7 +6041,7 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file ) ok( ref == 0, "Release returned %d\n", ref ); }
-static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file ) +static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file, DWORD version ) { struct hid_expect expect_create[] = { @@ -6015,7 +6064,7 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file ) .code = IOCTL_HID_WRITE_REPORT, .report_id = 3, .report_len = 11, - .report_buf = {0x03,0x01,0x03,0x08,0x01,0x00,0x06,0x00,0x01,0x55,0x00}, + .report_buf = {0x03,0x01,0x03,0x08,0x01,0x00,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0x00}, }, }; struct hid_expect expect_create_1[] = @@ -6032,7 +6081,7 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file ) .code = IOCTL_HID_WRITE_REPORT, .report_id = 3, .report_len = 11, - .report_buf = {0x03,0x01,0x03,0x08,0x01,0x00,0x06,0x00,0x01,0x00,0x00}, + .report_buf = {0x03,0x01,0x03,0x08,0x01,0x00,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x00,0x00}, }, }; struct hid_expect expect_create_2[] = @@ -6049,7 +6098,7 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file ) .code = IOCTL_HID_WRITE_REPORT, .report_id = 3, .report_len = 11, - .report_buf = {0x03,0x01,0x03,0x08,0x01,0x00,0x06,0x00,0x01,0x55,0x00}, + .report_buf = {0x03,0x01,0x03,0x08,0x01,0x00,version >= 0x700 ? 0x06 : 0x00,0x00,0x01,0x55,0x00}, }, }; struct hid_expect expect_destroy = @@ -6104,9 +6153,9 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file ) .lDeadBand = -12000, }, }; - static const DIEFFECT expect_desc = + const DIEFFECT expect_desc = { - .dwSize = sizeof(DIEFFECT), + .dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5), .dwFlags = DIEFF_SPHERICAL | DIEFF_OBJECTIDS, .dwDuration = 1000, .dwSamplePeriod = 2000, @@ -6130,7 +6179,7 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file ) DWORD axes[4] = {0}; DIEFFECT desc = { - .dwSize = sizeof(DIEFFECT), + .dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5), .dwFlags = DIEFF_SPHERICAL | DIEFF_OBJECTIDS, .cAxes = 4, .rgdwAxes = axes, @@ -6158,7 +6207,7 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file ) ok( IsEqualGUID( &guid, &GUID_Spring ), "got guid %s, expected %s\n", debugstr_guid( &guid ), debugstr_guid( &GUID_Spring ) );
- hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_ALLPARAMS ); + hr = IDirectInputEffect_GetParameters( effect, &desc, version >= 0x700 ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5 ); ok( hr == DI_OK, "GetParameters returned %#x\n", hr ); check_member( desc, expect_desc, "%u", dwDuration ); check_member( desc, expect_desc, "%u", dwSamplePeriod ); @@ -6171,7 +6220,8 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file ) check_member( desc, expect_desc, "%d", rglDirection[0] ); check_member( desc, expect_desc, "%d", rglDirection[1] ); check_member( desc, expect_desc, "%u", cbTypeSpecificParams ); - check_member( desc, expect_desc, "%u", dwStartDelay ); + if (version >= 0x700) check_member( desc, expect_desc, "%u", dwStartDelay ); + else ok( desc.dwStartDelay == 0, "got dwStartDelay %#x\n", desc.dwStartDelay ); check_member( envelope, expect_envelope, "%u", dwAttackLevel ); check_member( envelope, expect_envelope, "%u", dwAttackTime ); check_member( envelope, expect_envelope, "%u", dwFadeLevel ); @@ -6225,7 +6275,7 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file ) set_hid_expect( file, NULL, 0 ); }
-static void test_force_feedback_joystick( void ) +static void test_force_feedback_joystick(DWORD version) { #include "psh_hid_macros.h" const unsigned char report_descriptor[] = { @@ -6553,12 +6603,13 @@ static void test_force_feedback_joystick( void ) { .InputReportByteLength = 5, }; - static const DIDEVCAPS expect_caps = + const DIDEVCAPS expect_caps = { .dwSize = sizeof(DIDEVCAPS), .dwFlags = DIDC_FORCEFEEDBACK | DIDC_ATTACHED | DIDC_EMULATED | DIDC_STARTDELAY | DIDC_FFFADE | DIDC_FFATTACK | DIDC_DEADBAND | DIDC_SATURATION, - .dwDevType = DIDEVTYPE_HID | (DI8DEVTYPEJOYSTICK_LIMITED << 8) | DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID | (DI8DEVTYPEJOYSTICK_LIMITED << 8) | DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID | (DIDEVTYPEJOYSTICK_UNKNOWN << 8) | DIDEVTYPE_JOYSTICK, .dwAxes = 3, .dwButtons = 2, .dwFFSamplePeriod = 1000000, @@ -6579,13 +6630,76 @@ static void test_force_feedback_joystick( void ) .dwSize = sizeof(DIDEVICEINSTANCEW), .guidInstance = expect_guid_product, .guidProduct = expect_guid_product, - .dwDevType = DIDEVTYPE_HID | (DI8DEVTYPEJOYSTICK_LIMITED << 8) | DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID | (DI8DEVTYPEJOYSTICK_LIMITED << 8) | DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID | (DIDEVTYPEJOYSTICK_UNKNOWN << 8) | DIDEVTYPE_JOYSTICK, .tszInstanceName = L"Wine test root driver", .tszProductName = L"Wine test root driver", .guidFFDriver = IID_IDirectInputPIDDriver, .wUsagePage = HID_USAGE_PAGE_GENERIC, .wUsage = HID_USAGE_GENERIC_JOYSTICK, }; + const DIDEVICEOBJECTINSTANCEW expect_objects_5[] = + { + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_XAxis, + .dwType = DIDFT_ABSAXIS|DIDFT_MAKEINSTANCE(0)|DIDFT_FFACTUATOR, + .dwFlags = DIDOI_ASPECTPOSITION|DIDOI_FFACTUATOR, + .tszName = L"X Axis", + .wCollectionNumber = 1, + .wUsagePage = HID_USAGE_PAGE_GENERIC, + .wUsage = HID_USAGE_GENERIC_X, + .wReportId = 1, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_YAxis, + .dwOfs = 0x4, + .dwType = DIDFT_ABSAXIS|DIDFT_MAKEINSTANCE(1)|DIDFT_FFACTUATOR, + .dwFlags = DIDOI_ASPECTPOSITION|DIDOI_FFACTUATOR, + .tszName = L"Y Axis", + .wCollectionNumber = 1, + .wUsagePage = HID_USAGE_PAGE_GENERIC, + .wUsage = HID_USAGE_GENERIC_Y, + .wReportId = 1, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_ZAxis, + .dwOfs = 0x8, + .dwType = DIDFT_ABSAXIS|DIDFT_MAKEINSTANCE(2)|DIDFT_FFACTUATOR, + .dwFlags = DIDOI_ASPECTPOSITION|DIDOI_FFACTUATOR, + .tszName = L"Z Axis", + .wCollectionNumber = 1, + .wUsagePage = HID_USAGE_PAGE_GENERIC, + .wUsage = HID_USAGE_GENERIC_Z, + .wReportId = 1, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Button, + .dwOfs = 0x30, + .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(0)|DIDFT_FFEFFECTTRIGGER, + .dwFlags = DIDOI_FFEFFECTTRIGGER, + .tszName = L"Button 0", + .wCollectionNumber = 1, + .wUsagePage = HID_USAGE_PAGE_BUTTON, + .wUsage = 0x1, + .wReportId = 1, + }, + { + .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), + .guidType = GUID_Button, + .dwOfs = 0x31, + .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(1)|DIDFT_FFEFFECTTRIGGER, + .dwFlags = DIDOI_FFEFFECTTRIGGER, + .tszName = L"Button 1", + .wCollectionNumber = 1, + .wUsagePage = HID_USAGE_PAGE_BUTTON, + .wUsage = 0x2, + .wReportId = 1, + }, + }; const DIDEVICEOBJECTINSTANCEW expect_objects[] = { { @@ -6626,7 +6740,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Button, - .dwOfs = 0x64, + .dwOfs = version >= 0x800 ? 0x64 : 0x10, .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(0)|DIDFT_FFEFFECTTRIGGER, .dwFlags = DIDOI_FFEFFECTTRIGGER, .tszName = L"Button 0", @@ -6638,7 +6752,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Button, - .dwOfs = 0x65, + .dwOfs = version >= 0x800 ? 0x65 : 0x11, .dwType = DIDFT_PSHBUTTON|DIDFT_MAKEINSTANCE(1)|DIDFT_FFEFFECTTRIGGER, .dwFlags = DIDOI_FFEFFECTTRIGGER, .tszName = L"Button 1", @@ -6650,7 +6764,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x6c, + .dwOfs = version >= 0x800 ? 0x6c : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(12)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"DC Device Reset", @@ -6662,7 +6776,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x10, + .dwOfs = version >= 0x800 ? 0x10 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(13)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Effect Block Index", @@ -6674,7 +6788,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x6d, + .dwOfs = version >= 0x800 ? 0x6d : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(14)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Start", @@ -6686,7 +6800,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x6e, + .dwOfs = version >= 0x800 ? 0x6e : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(15)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Start Solo", @@ -6698,7 +6812,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x6f, + .dwOfs = version >= 0x800 ? 0x6f : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(16)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Op Effect Stop", @@ -6710,7 +6824,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x14, + .dwOfs = version >= 0x800 ? 0x14 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(17)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Loop Count", @@ -6722,7 +6836,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x18, + .dwOfs = version >= 0x800 ? 0x18 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(18)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Effect Block Index", @@ -6734,7 +6848,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x70, + .dwOfs = version >= 0x800 ? 0x70 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(19)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"ET Square", @@ -6746,7 +6860,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x71, + .dwOfs = version >= 0x800 ? 0x71 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(20)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"ET Sine", @@ -6758,7 +6872,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x72, + .dwOfs = version >= 0x800 ? 0x72 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(21)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"ET Spring", @@ -6770,7 +6884,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x73, + .dwOfs = version >= 0x800 ? 0x73 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(22)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Z Axis", @@ -6782,7 +6896,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x74, + .dwOfs = version >= 0x800 ? 0x74 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(23)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Y Axis", @@ -6794,7 +6908,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x75, + .dwOfs = version >= 0x800 ? 0x75 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(24)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"X Axis", @@ -6806,7 +6920,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x76, + .dwOfs = version >= 0x800 ? 0x76 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(25)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Direction Enable", @@ -6818,7 +6932,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x1c, + .dwOfs = version >= 0x800 ? 0x1c : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(26)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Start Delay", @@ -6832,7 +6946,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x20, + .dwOfs = version >= 0x800 ? 0x20 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(27)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Duration", @@ -6846,7 +6960,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x24, + .dwOfs = version >= 0x800 ? 0x24 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(28)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Trigger Button", @@ -6858,7 +6972,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x28, + .dwOfs = version >= 0x800 ? 0x28 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(29)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Unknown 29", @@ -6871,7 +6985,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x2c, + .dwOfs = version >= 0x800 ? 0x2c : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(30)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Unknown 30", @@ -6884,7 +6998,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x30, + .dwOfs = version >= 0x800 ? 0x30 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(31)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Magnitude", @@ -6896,7 +7010,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x34, + .dwOfs = version >= 0x800 ? 0x34 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(32)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Fade Level", @@ -6908,7 +7022,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x38, + .dwOfs = version >= 0x800 ? 0x38 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(33)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Attack Level", @@ -6920,7 +7034,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x3c, + .dwOfs = version >= 0x800 ? 0x3c : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(34)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Fade Time", @@ -6934,7 +7048,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x40, + .dwOfs = version >= 0x800 ? 0x40 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(35)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Attack Time", @@ -6948,7 +7062,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x44, + .dwOfs = version >= 0x800 ? 0x44 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(36)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Unknown 36", @@ -6960,7 +7074,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x48, + .dwOfs = version >= 0x800 ? 0x48 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(37)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Unknown 37", @@ -6972,7 +7086,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x4c, + .dwOfs = version >= 0x800 ? 0x4c : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(38)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"CP Offset", @@ -6984,7 +7098,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x50, + .dwOfs = version >= 0x800 ? 0x50 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(39)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Negative Coefficient", @@ -6996,7 +7110,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x54, + .dwOfs = version >= 0x800 ? 0x54 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(40)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Positive Coefficient", @@ -7008,7 +7122,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x58, + .dwOfs = version >= 0x800 ? 0x58 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(41)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Negative Saturation", @@ -7020,7 +7134,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x5c, + .dwOfs = version >= 0x800 ? 0x5c : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(42)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Positive Saturation", @@ -7032,7 +7146,7 @@ static void test_force_feedback_joystick( void ) { .dwSize = sizeof(DIDEVICEOBJECTINSTANCEW), .guidType = GUID_Unknown, - .dwOfs = 0x60, + .dwOfs = version >= 0x800 ? 0x60 : 0, .dwType = DIDFT_NODATA|DIDFT_MAKEINSTANCE(43)|DIDFT_OUTPUT, .dwFlags = 0x80008000, .tszName = L"Dead Band", @@ -7202,10 +7316,19 @@ static void test_force_feedback_joystick( void ) } };
+ struct check_objects_todos todo_objects_5[ARRAY_SIZE(expect_objects_5)] = + { + {.guid = TRUE, .type = TRUE, .usage = TRUE}, + {0}, + {.guid = TRUE, .type = TRUE, .usage = TRUE}, + }; struct check_objects_params check_objects_params = { - .expect_count = ARRAY_SIZE(expect_objects), - .expect_objs = expect_objects, + .version = version, + .expect_count = version < 0x700 ? ARRAY_SIZE(expect_objects_5) : ARRAY_SIZE(expect_objects), + .expect_objs = version < 0x700 ? expect_objects_5 : expect_objects, + .todo_objs = version < 0x700 ? todo_objects_5 : NULL, + .todo_extra = version < 0x700 ? TRUE : FALSE, }; struct check_effects_params check_effects_params = { @@ -7237,13 +7360,16 @@ static void test_force_feedback_joystick( void ) IDirectInputDevice8W *device; DIEFFESCAPE escape = {0}; DIDEVCAPS caps = {0}; - IDirectInput8W *di; - char buffer[1024]; + IDirectInput8W *di8; + IDirectInputW *di; ULONG res, ref; + char buffer[1024]; HANDLE file; HRESULT hr; HWND hwnd;
+ winetest_push_context("version %#x", version); + GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd ); GetTempPathW( ARRAY_SIZE(tempdir), tempdir ); SetCurrentDirectoryW( tempdir ); @@ -7251,24 +7377,59 @@ static void test_force_feedback_joystick( void ) cleanup_registry_keys(); if (!dinput_driver_start( report_descriptor, sizeof(report_descriptor), &hid_caps )) goto done;
- hr = DirectInput8Create( instance, DIRECTINPUT_VERSION, &IID_IDirectInput8W, (void **)&di, NULL ); - if (FAILED(hr)) + if (version >= 0x800) { - win_skip( "DirectInput8Create returned %#x\n", hr ); - goto done; - } + hr = DirectInput8Create( instance, version, &IID_IDirectInput8W, (void **)&di8, NULL ); + if (FAILED(hr)) + { + win_skip( "DirectInput8Create returned %#x\n", hr ); + goto done; + }
- hr = IDirectInput8_EnumDevices( di, DI8DEVCLASS_ALL, find_test_device, &devinst, DIEDFL_ALLDEVICES ); - ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr ); - if (!IsEqualGUID( &devinst.guidProduct, &expect_guid_product )) + hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, find_test_device, &devinst, DIEDFL_ALLDEVICES ); + ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr ); + if (!IsEqualGUID( &devinst.guidProduct, &expect_guid_product )) + { + win_skip( "device not found, skipping tests\n" ); + ref = IDirectInput8_Release( di8 ); + ok( ref == 0, "Release returned %d\n", ref ); + goto done; + } + + hr = IDirectInput8_CreateDevice( di8, &expect_guid_product, &device, NULL ); + ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); + + ref = IDirectInput8_Release( di8 ); + todo_wine + ok( ref == 0, "Release returned %d\n", ref ); + } + else { - win_skip( "device not found, skipping tests\n" ); - IDirectInput8_Release( di ); - goto done; - } + hr = DirectInputCreateEx( instance, version, &IID_IDirectInput2W, (void **)&di, NULL ); + if (FAILED(hr)) + { + win_skip( "DirectInputCreateEx returned %#x\n", hr ); + goto done; + }
- hr = IDirectInput8_CreateDevice( di, &expect_guid_product, &device, NULL ); - ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); + hr = IDirectInput_EnumDevices( di, 0, find_test_device, &devinst, DIEDFL_ALLDEVICES ); + ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr ); + if (!IsEqualGUID( &devinst.guidProduct, &expect_guid_product )) + { + win_skip( "device not found, skipping tests\n" ); + + ref = IDirectInput_Release( di ); + ok( ref == 0, "Release returned %d\n", ref ); + goto done; + } + + hr = IDirectInput_CreateDevice( di, &expect_guid_product, (IDirectInputDeviceW **)&device, NULL ); + ok( hr == DI_OK, "CreateDevice returned %#x\n", hr ); + + ref = IDirectInput_Release( di ); + todo_wine + ok( ref == 0, "Release returned %d\n", ref ); + }
hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst ); ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr ); @@ -7442,11 +7603,11 @@ static void test_force_feedback_joystick( void ) objdata.dwData = 0x80; res = 1; hr = IDirectInputDevice8_SendDeviceData( device, sizeof(DIDEVICEOBJECTDATA), &objdata, &res, 0 ); - todo_wine - ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#x\n", hr ); + if (version < 0x800) ok( hr == DI_OK, "SendDeviceData returned %#x\n", hr ); + else todo_wine ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#x\n", hr );
- test_periodic_effect( device, file ); - test_condition_effect( device, file ); + test_periodic_effect( device, file, version ); + test_condition_effect( device, file, version );
set_hid_expect( file, &expect_dc_reset, sizeof(expect_dc_reset) ); hr = IDirectInputDevice8_Unacquire( device ); @@ -7459,13 +7620,11 @@ static void test_force_feedback_joystick( void ) DestroyWindow( hwnd ); CloseHandle( file );
- ref = IDirectInput8_Release( di ); - ok( ref == 0, "Release returned %d\n", ref ); - done: pnp_driver_stop(); cleanup_registry_keys(); SetCurrentDirectoryW( cwd ); + winetest_pop_context(); }
START_TEST( hid ) @@ -7511,7 +7670,9 @@ START_TEST( hid ) if (test_device_types()) { test_simple_joystick(); - test_force_feedback_joystick(); + test_force_feedback_joystick(0x500); + test_force_feedback_joystick(0x700); + test_force_feedback_joystick(0x800); } CoUninitialize();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=101406
Your paranoid android.
=== w7u_adm (32 bit report) ===
dinput8: device: Timeout
=== debiant2 (32 bit report) ===
Report validation errors: dinput8:hid prints too much data (34078 bytes)
=== debiant2 (64 bit WoW report) ===
Report validation errors: dinput8:hid prints too much data (34126 bytes)
On 11/8/21 10:33, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=101406
Your paranoid android.
=== w7u_adm (32 bit report) ===
dinput8: device: Timeout
=== debiant2 (32 bit report) ===
Report validation errors: dinput8:hid prints too much data (34078 bytes)
=== debiant2 (64 bit WoW report) ===
Report validation errors: dinput8:hid prints too much data (34126 bytes)
Please ignore this last patch for now, I'll try to reduce the amount of todo first. It was mainly to validate the changes in earlier patches, but as it's not convenient to have the tests commited first anyway it could probably be delayed a bit.