Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 18 ++++++++++++++++++ dlls/dinput8/tests/hid.c | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 1a22c7c8baa..7c212797ec1 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -255,6 +255,23 @@ static BOOL enum_object( struct hid_joystick *impl, const DIPROPHEADER *filter, return DIENUM_CONTINUE; }
+static void check_pid_effect_axis_caps( struct hid_joystick *impl, DIDEVICEOBJECTINSTANCEW *instance ) +{ + struct pid_effect_update *effect_update = &impl->pid_effect_update; + ULONG i; + + for (i = 0; i < effect_update->axis_count; ++i) + { + if (effect_update->axis_caps[i]->usage_page != instance->wUsagePage) continue; + if (effect_update->axis_caps[i]->usage_min > instance->wUsage) continue; + if (effect_update->axis_caps[i]->usage_max >= instance->wUsage) break; + } + + if (i == effect_update->axis_count) return; + instance->dwType |= DIDFT_FFACTUATOR; + instance->dwFlags |= DIDOI_FFACTUATOR; +} + static void set_axis_type( DIDEVICEOBJECTINSTANCEW *instance, BOOL *seen, DWORD i, DWORD *count ) { if (!seen[i]) instance->dwType = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( i ); @@ -326,6 +343,7 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header, instance.dwFlags = DIDOI_ASPECTPOSITION; break; } + check_pid_effect_axis_caps( impl, &instance ); instance.wUsagePage = caps->usage_page; instance.wUsage = j; instance.guidType = *object_usage_to_guid( instance.wUsagePage, instance.wUsage ); diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index f4e180a85f3..cddb5aa1aac 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5590,7 +5590,7 @@ static void test_force_feedback_joystick( void ) const struct check_objects_todos objects_todos[ARRAY_SIZE(expect_objects)] = { {}, - {.type = TRUE, .flags = TRUE}, + {}, {.type = TRUE, .flags = TRUE}, {.type = TRUE, .flags = TRUE}, };