Rémi Bernon : dinput: Look for PID axes enable collection and set DIEP_AXES if found.

Alexandre Julliard julliard at winehq.org
Tue Oct 5 15:51:40 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Oct  5 08:43:27 2021 +0200

dinput: Look for PID axes enable collection and set DIEP_AXES 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 | 14 ++++++++++++++
 dlls/dinput8/tests/hid.c   |  4 ----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 38b4e12b72c..1a22c7c8baa 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -90,6 +90,9 @@ struct pid_effect_update
     BYTE id;
     ULONG collection;
     ULONG type_coll;
+    ULONG axes_coll;
+    ULONG axis_count;
+    struct hid_value_caps *axis_caps[6];
     struct hid_value_caps *duration_caps;
     struct hid_value_caps *gain_caps;
     struct hid_value_caps *sample_period_caps;
@@ -1055,6 +1058,8 @@ static HRESULT WINAPI hid_joystick_GetEffectInfo( IDirectInputDevice8W *iface, D
 
     if (!(collection = effect_update->collection)) return DIERR_DEVICENOTREG;
 
+    info->dwDynamicParams = DIEP_TYPESPECIFICPARAMS;
+    if (effect_update->axis_count) info->dwDynamicParams |= DIEP_AXES;
     if (effect_update->duration_caps) info->dwDynamicParams |= DIEP_DURATION;
     if (effect_update->gain_caps) info->dwDynamicParams |= DIEP_GAIN;
     if (effect_update->sample_period_caps) info->dwDynamicParams |= DIEP_SAMPLEPERIOD;
@@ -1065,6 +1070,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->axes_coll) info->dwDynamicParams |= DIEP_AXES;
 
     if (!(collection = effect_update->type_coll)) return DIERR_DEVICENOTREG;
     else
@@ -1756,6 +1762,7 @@ static BOOL init_pid_reports( struct hid_joystick *impl, struct hid_value_caps *
             if (instance->wCollectionNumber == effect_update->collection)
                 SET_SUB_COLLECTION( effect_update, type_coll );
             break;
+        case PID_USAGE_AXES_ENABLE: SET_SUB_COLLECTION( effect_update, axes_coll ); break;
         }
     }
 
@@ -1805,6 +1812,13 @@ static BOOL init_pid_caps( struct hid_joystick *impl, struct hid_value_caps *cap
         if (instance->wUsage == PID_USAGE_TRIGGER_REPEAT_INTERVAL)
             effect_update->trigger_repeat_interval_caps = caps;
     }
+    if (instance->wCollectionNumber == effect_update->axes_coll)
+    {
+        SET_REPORT_ID( effect_update );
+        if (effect_update->axis_count >= 6) FIXME( "more than 6 PID axes detected\n" );
+        else effect_update->axis_caps[effect_update->axis_count] = caps;
+        effect_update->axis_count++;
+    }
 
 #undef SET_REPORT_ID
 
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index 59f5f6ff29d..f4e180a85f3 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -3363,9 +3363,7 @@ static BOOL CALLBACK check_effects( const DIEFFECTINFOW *effect, void *args )
     check_member( *effect, *exp, "%u", dwSize );
     check_member_guid( *effect, *exp, guid );
     check_member( *effect, *exp, "%#x", dwEffType );
-    todo_wine
     check_member( *effect, *exp, "%#x", dwStaticParams );
-    todo_wine
     check_member( *effect, *exp, "%#x", dwDynamicParams );
     check_member_wstr( *effect, *exp, tszName );
 
@@ -5741,9 +5739,7 @@ static void test_force_feedback_joystick( void )
     ok( hr == DI_OK, "IDirectInputDevice8_GetEffectInfo returned %#x\n", hr );
     check_member_guid( effectinfo, expect_effects[0], guid );
     check_member( effectinfo, expect_effects[0], "%#x", dwEffType );
-    todo_wine
     check_member( effectinfo, expect_effects[0], "%#x", dwStaticParams );
-    todo_wine
     check_member( effectinfo, expect_effects[0], "%#x", dwDynamicParams );
     check_member_wstr( effectinfo, expect_effects[0], tszName );
 




More information about the wine-cvs mailing list