Rémi Bernon : dinput: Make sure converted direction values are always positive.

Alexandre Julliard julliard at winehq.org
Wed May 18 15:38:31 CDT 2022


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Apr 29 15:58:40 2022 +0200

dinput: Make sure converted direction values are always positive.

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

---

 dlls/dinput/joystick_hid.c         |  1 +
 dlls/dinput/tests/force_feedback.c | 27 ---------------------------
 2 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 07cf2e6158d..1f4b300be74 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -2307,6 +2307,7 @@ static void convert_directions_to_spherical( const DIEFFECT *in, DIEFFECT *out )
             for (j = 1; j < i; ++j) tmp = sqrt( tmp * tmp + in->rglDirection[j] * in->rglDirection[j] );
             tmp = atan2( in->rglDirection[i], tmp );
             out->rglDirection[i - 1] = tmp * 18000 / M_PI;
+            if (out->rglDirection[i - 1] < 0) out->rglDirection[i - 1] += 36000;
         }
         if (in->cAxes) out->rglDirection[in->cAxes - 1] = 0;
         out->cAxes = in->cAxes;
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c
index 05b0ad9c427..c471a80de00 100644
--- a/dlls/dinput/tests/force_feedback.c
+++ b/dlls/dinput/tests/force_feedback.c
@@ -5476,20 +5476,11 @@ static void test_windows_gaming_input(void)
             .report_buf = {8,0x01,0x4c,0x7f,0x28,0x00,0x50,0x00},
         },
         /* update effect */
-        {
-            .code = IOCTL_HID_WRITE_REPORT,
-            .report_id = 3,
-            .report_len = 18,
-            .report_buf = {3,0x01,0x02,0x08,0x78,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0xce,0x00,0x00,0x00},
-            .wine_only = TRUE,
-            .todo = TRUE,
-        },
         {
             .code = IOCTL_HID_WRITE_REPORT,
             .report_id = 3,
             .report_len = 18,
             .report_buf = {3,0x01,0x02,0x08,0x78,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0x4e,0x01,0x00,0x00},
-            .todo = TRUE,
         },
     };
     struct hid_expect expect_create_condition[] =
@@ -5554,20 +5545,11 @@ static void test_windows_gaming_input(void)
             .report_buf = {8,0x01,0x19,0x4c,0x14,0x00,0x3c,0x00},
         },
         /* update effect */
-        {
-            .code = IOCTL_HID_WRITE_REPORT,
-            .report_id = 3,
-            .report_len = 18,
-            .report_buf = {3,0x01,0x04,0x08,0x5a,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0x7f,0xce,0x00,0x00,0x00},
-            .wine_only = TRUE,
-            .todo = TRUE,
-        },
         {
             .code = IOCTL_HID_WRITE_REPORT,
             .report_id = 3,
             .report_len = 18,
             .report_buf = {3,0x01,0x04,0x08,0x5a,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0x7f,0x4e,0x01,0x00,0x00},
-            .todo = TRUE,
         },
     };
     struct hid_expect expect_create_ramp[] =
@@ -5601,20 +5583,11 @@ static void test_windows_gaming_input(void)
             .report_buf = {8,0x01,0x19,0x4c,0x14,0x00,0x3c,0x00},
         },
         /* update effect */
-        {
-            .code = IOCTL_HID_WRITE_REPORT,
-            .report_id = 3,
-            .report_len = 18,
-            .report_buf = {3,0x01,0x05,0x08,0x5a,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0xce,0x00,0x00,0x00},
-            .wine_only = TRUE,
-            .todo = TRUE,
-        },
         {
             .code = IOCTL_HID_WRITE_REPORT,
             .report_id = 3,
             .report_len = 18,
             .report_buf = {3,0x01,0x05,0x08,0x5a,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0xff,0xff,0x4e,0x01,0x00,0x00},
-            .todo = TRUE,
         },
     };
     struct hid_expect expect_effect_start =




More information about the wine-cvs mailing list