Rémi Bernon : dinput: Look for PID direction collection and set DIEP_DIRECTION if found.

Alexandre Julliard julliard at winehq.org
Thu Oct 7 16:21:20 CDT 2021


Module: wine
Branch: master
Commit: 453940f571c361419b1c93f730d57df6815f00ea
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=453940f571c361419b1c93f730d57df6815f00ea

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu Oct  7 10:40:07 2021 +0200

dinput: Look for PID direction collection and set DIEP_DIRECTION if found.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput/joystick_hid.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 66899e73e53..1bc8e752524 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -92,7 +92,10 @@ struct pid_effect_update
     ULONG type_coll;
     ULONG axes_coll;
     ULONG axis_count;
+    ULONG direction_coll;
+    ULONG direction_count;
     struct hid_value_caps *axis_caps[6];
+    struct hid_value_caps *direction_caps[6];
     struct hid_value_caps *duration_caps;
     struct hid_value_caps *gain_caps;
     struct hid_value_caps *sample_period_caps;
@@ -1138,6 +1141,7 @@ static HRESULT WINAPI hid_joystick_GetEffectInfo( IDirectInputDevice8W *iface, D
     }
     if (effect_update->trigger_button_caps) info->dwDynamicParams |= DIEP_TRIGGERBUTTON;
     if (effect_update->trigger_repeat_interval_caps) info->dwDynamicParams |= DIEP_TRIGGERREPEATINTERVAL;
+    if (effect_update->direction_coll) info->dwDynamicParams |= DIEP_DIRECTION;
     if (effect_update->axes_coll) info->dwDynamicParams |= DIEP_AXES;
 
     if (!(collection = effect_update->type_coll)) return DIERR_DEVICENOTREG;
@@ -1831,6 +1835,7 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps *
                 SET_SUB_COLLECTION( effect_update, type_coll );
             break;
         case PID_USAGE_AXES_ENABLE: SET_SUB_COLLECTION( effect_update, axes_coll ); break;
+        case PID_USAGE_DIRECTION: SET_SUB_COLLECTION( effect_update, direction_coll ); break;
         }
     }
 
@@ -1887,6 +1892,13 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap
         else effect_update->axis_caps[effect_update->axis_count] = caps;
         effect_update->axis_count++;
     }
+    if (instance->wCollectionNumber == effect_update->direction_coll)
+    {
+        SET_REPORT_ID( effect_update );
+        if (effect_update->direction_count >= 6) FIXME( "more than 6 PID directions detected\n" );
+        else effect_update->direction_caps[effect_update->direction_count] = caps;
+        effect_update->direction_count++;
+    }
 
 #undef SET_REPORT_ID
 




More information about the wine-cvs mailing list