xinput: Check that we actually received a value before assignment.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46999 Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
34d5f90db6
commit
72e62952db
|
@ -388,23 +388,29 @@ 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);
|
||||
device->state.Gamepad.sThumbLX = scale_short(value, &private->lx);
|
||||
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);
|
||||
|
||||
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Y, &value, private->ppd, target_report, private->report_length);
|
||||
device->state.Gamepad.sThumbLY = -scale_short(value, &private->ly) - 1;
|
||||
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;
|
||||
|
||||
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RX, &value, private->ppd, target_report, private->report_length);
|
||||
device->state.Gamepad.sThumbRX = scale_short(value, &private->rx);
|
||||
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);
|
||||
|
||||
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RY, &value, private->ppd, target_report, private->report_length);
|
||||
device->state.Gamepad.sThumbRY = -scale_short(value, &private->ry) - 1;
|
||||
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;
|
||||
|
||||
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RZ, &value, private->ppd, target_report, private->report_length);
|
||||
device->state.Gamepad.bRightTrigger = scale_byte(value, &private->rtrigger);
|
||||
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);
|
||||
|
||||
HidP_GetScaledUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z, &value, private->ppd, target_report, private->report_length);
|
||||
device->state.Gamepad.bLeftTrigger = scale_byte(value, &private->ltrigger);
|
||||
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);
|
||||
LeaveCriticalSection(&private->crit);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue