Commit 72e62952 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

xinput: Check that we actually received a value before assignment.

parent 34d5f90d
...@@ -388,22 +388,28 @@ void HID_update_state(xinput_controller* device) ...@@ -388,22 +388,28 @@ void HID_update_state(xinput_controller* device)
} }
} }
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X, &value, private->ppd, target_report, private->report_length); if(HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X, &value,
private->ppd, target_report, private->report_length) == HIDP_STATUS_SUCCESS)
device->state.Gamepad.sThumbLX = scale_short(value, &private->lx); device->state.Gamepad.sThumbLX = scale_short(value, &private->lx);
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Y, &value, private->ppd, target_report, private->report_length); if(HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Y, &value,
private->ppd, target_report, private->report_length) == HIDP_STATUS_SUCCESS)
device->state.Gamepad.sThumbLY = -scale_short(value, &private->ly) - 1; device->state.Gamepad.sThumbLY = -scale_short(value, &private->ly) - 1;
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RX, &value, private->ppd, target_report, private->report_length); if(HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RX, &value,
private->ppd, target_report, private->report_length) == HIDP_STATUS_SUCCESS)
device->state.Gamepad.sThumbRX = scale_short(value, &private->rx); device->state.Gamepad.sThumbRX = scale_short(value, &private->rx);
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RY, &value, private->ppd, target_report, private->report_length); if(HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RY, &value,
private->ppd, target_report, private->report_length) == HIDP_STATUS_SUCCESS)
device->state.Gamepad.sThumbRY = -scale_short(value, &private->ry) - 1; device->state.Gamepad.sThumbRY = -scale_short(value, &private->ry) - 1;
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RZ, &value, private->ppd, target_report, private->report_length); if(HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RZ, &value,
private->ppd, target_report, private->report_length) == HIDP_STATUS_SUCCESS)
device->state.Gamepad.bRightTrigger = scale_byte(value, &private->rtrigger); device->state.Gamepad.bRightTrigger = scale_byte(value, &private->rtrigger);
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z, &value, private->ppd, target_report, private->report_length); if(HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z, &value,
private->ppd, target_report, private->report_length) == HIDP_STATUS_SUCCESS)
device->state.Gamepad.bLeftTrigger = scale_byte(value, &private->ltrigger); device->state.Gamepad.bLeftTrigger = scale_byte(value, &private->ltrigger);
LeaveCriticalSection(&private->crit); LeaveCriticalSection(&private->crit);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment