[PATCH 06/11] dinput: Remove redundant check for DIEP_DIRECTION.

Rémi Bernon rbernon at codeweavers.com
Fri Nov 12 02:49:42 CST 2021


From: Ivo Ivanov <logos128 at gmail.com>

It is implied from the complete_mask check above.

Signed-off-by: Ivo Ivanov <logos128 at gmail.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/joystick_hid.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index b5b3c73d3de..4fdf961a04d 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -2698,24 +2698,21 @@ static HRESULT WINAPI hid_joystick_effect_Download( IDirectInputEffect *iface )
         set_parameter_value_us( impl, impl->effect_update_buf, effect_update->trigger_repeat_interval_caps,
                                 impl->params.dwTriggerRepeatInterval );
 
-        if (impl->flags & DIEP_DIRECTION)
+        count = 1;
+        usage = PID_USAGE_DIRECTION_ENABLE;
+        status = HidP_SetUsages( HidP_Output, HID_USAGE_PAGE_PID, 0, &usage, &count,
+                                 impl->joystick->preparsed, impl->effect_update_buf, report_len );
+        if (status != HIDP_STATUS_SUCCESS) WARN( "HidP_SetUsages returned %#x\n", status );
+
+        spherical.rglDirection = directions;
+        convert_directions_to_spherical( &impl->params, &spherical );
+
+        if (!effect_update->direction_count) WARN( "no PID effect direction caps found\n" );
+        else for (i = 0; i < spherical.cAxes - 1; ++i)
         {
-            count = 1;
-            usage = PID_USAGE_DIRECTION_ENABLE;
-            status = HidP_SetUsages( HidP_Output, HID_USAGE_PAGE_PID, 0, &usage, &count,
-                                     impl->joystick->preparsed, impl->effect_update_buf, report_len );
-            if (status != HIDP_STATUS_SUCCESS) WARN( "HidP_SetUsages returned %#x\n", status );
-
-            spherical.rglDirection = directions;
-            convert_directions_to_spherical( &impl->params, &spherical );
-
-            if (!effect_update->direction_count) WARN( "no PID effect direction caps found\n" );
-            else for (i = 0; i < spherical.cAxes - 1; ++i)
-            {
-                tmp = directions[i] + (i == 0 ? 9000 : 0);
-                caps = effect_update->direction_caps[effect_update->direction_count - i - 1];
-                set_parameter_value( impl, impl->effect_update_buf, caps, tmp % 36000 );
-            }
+            tmp = directions[i] + (i == 0 ? 9000 : 0);
+            caps = effect_update->direction_caps[effect_update->direction_count - i - 1];
+            set_parameter_value( impl, impl->effect_update_buf, caps, tmp % 36000 );
         }
 
         status = HidP_SetUsageValue( HidP_Output, HID_USAGE_PAGE_PID, 0, PID_USAGE_TRIGGER_BUTTON,
-- 
2.33.1




More information about the wine-devel mailing list