Rémi Bernon : dinput: Only scale parameter value if its physical range is defined.
Alexandre Julliard
julliard at winehq.org
Fri Nov 19 15:45:31 CST 2021
Module: wine
Branch: master
Commit: ef5fa6c71608c1bd9a4f0f7a393fe88a2bab0161
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ef5fa6c71608c1bd9a4f0f7a393fe88a2bab0161
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Fri Nov 19 09:39:38 2021 +0100
dinput: Only scale parameter value if its physical range is defined.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dinput/joystick_hid.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 70c761267f7..11ba9867623 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -676,8 +676,12 @@ static void set_report_value( struct hid_joystick *impl, char *report_buf,
phy_min = caps->physical_min;
phy_max = caps->physical_max;
- if (value > phy_max || value < phy_min) value = -1;
- else value = log_min + (value - phy_min) * (log_max - log_min) / (phy_max - phy_min);
+ if (phy_max || phy_min)
+ {
+ if (value > phy_max || value < phy_min) value = -1;
+ else value = log_min + (value - phy_min) * (log_max - log_min) / (phy_max - phy_min);
+ }
+
status = HidP_SetUsageValue( HidP_Output, caps->usage_page, caps->link_collection,
caps->usage_min, value, preparsed, report_buf, report_len );
if (status != HIDP_STATUS_SUCCESS) WARN( "HidP_SetUsageValue %04x:%04x returned %#x\n",
More information about the wine-cvs
mailing list