Module: wine Branch: master Commit: 489c62f9ebe114e9abb718351d31fcdf74700d5d URL: https://source.winehq.org/git/wine.git/?a=commit;h=489c62f9ebe114e9abb718351...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed Oct 6 10:21:59 2021 +0200
dinput: Add DIDFT_FFEFFECTTRIGGER flag on trigger buttons.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dinput/joystick_hid.c | 9 ++++++++- dlls/dinput8/tests/hid.c | 8 ++------ 2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 846d4095391..1c7c54e20c9 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -285,7 +285,7 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header, DWORD collection = 0, object = 0, axis = 0, button = 0, pov = 0, value_ofs = 0, button_ofs = 0, i, j; struct hid_preparsed_data *preparsed = (struct hid_preparsed_data *)impl->preparsed; DIDEVICEOBJECTINSTANCEW instance = {.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW)}; - struct hid_value_caps *caps, *caps_end, *nary, *nary_end; + struct hid_value_caps *caps, *caps_end, *nary, *nary_end, *effect_caps; DIDATAFORMAT *format = impl->base.data_format.wine_df; int *offsets = impl->base.data_format.offsets; struct hid_collection_node *node, *node_end; @@ -356,6 +356,8 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header, } }
+ effect_caps = impl->pid_effect_update.trigger_button_caps; + for (caps = HID_INPUT_VALUE_CAPS( preparsed ), caps_end = caps + preparsed->input_caps_count; caps != caps_end; ++caps) { @@ -372,6 +374,11 @@ static BOOL enum_objects( struct hid_joystick *impl, const DIPROPHEADER *header, instance.dwOfs = button_ofs; instance.dwType = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( button++ ); instance.dwFlags = 0; + if (effect_caps && effect_caps->logical_min <= j && effect_caps->logical_max >= j) + { + instance.dwType |= DIDFT_FFEFFECTTRIGGER; + instance.dwFlags |= DIDOI_FFEFFECTTRIGGER; + } 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 aad23ad4c61..df0a07546fb 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3294,8 +3294,6 @@ static BOOL CALLBACK find_test_device( const DIDEVICEINSTANCEW *devinst, void *c
struct check_objects_todos { - BOOL type; - BOOL flags; BOOL dimension; BOOL exponent; }; @@ -3323,9 +3321,7 @@ static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *ar check_member( *obj, *exp, "%u", dwSize ); check_member_guid( *obj, *exp, guidType ); check_member( *obj, *exp, "%#x", dwOfs ); - todo_wine_if( todo->type ) check_member( *obj, *exp, "%#x", dwType ); - todo_wine_if( todo->flags ) check_member( *obj, *exp, "%#x", dwFlags ); if (!localized) todo_wine check_member_wstr( *obj, *exp, tszName ); check_member( *obj, *exp, "%u", dwFFMaxForce ); @@ -6395,8 +6391,8 @@ static void test_force_feedback_joystick( void ) {}, {}, {}, - {.type = TRUE, .flags = TRUE}, - {.type = TRUE, .flags = TRUE}, + {}, + {}, {}, {}, {},