Make sure we only read input object from the device state input report and only look for generic and button usage pages to find the report.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/joystick_hid.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 29cb8990689..a20925b6176 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -937,6 +937,8 @@ static BOOL check_device_state_button( struct hid_joystick *impl, struct hid_cap struct parse_device_state_params *params = data; BYTE old_value, value;
+ if (instance->wReportId != impl->device_state_report_id) return DIENUM_CONTINUE; + value = params->buttons[instance->wUsage - 1]; old_value = params->old_state[instance->dwOfs]; impl->device_state[instance->dwOfs] = value; @@ -1008,6 +1010,8 @@ static BOOL read_device_state_value( struct hid_joystick *impl, struct hid_caps LONG old_value, value; NTSTATUS status;
+ if (instance->wReportId != impl->device_state_report_id) return DIENUM_CONTINUE; + extra = impl->input_extra_caps + (value_caps - impl->input_value_caps); status = HidP_GetUsageValue( HidP_Input, instance->wUsagePage, 0, instance->wUsage, &logical_value, impl->preparsed, report_buf, report_len ); @@ -1360,10 +1364,15 @@ static BOOL init_objects( struct hid_joystick *impl, struct hid_caps *caps, if (instance->dwType & DIDFT_AXIS) impl->dev_caps.dwAxes++; if (instance->dwType & DIDFT_POV) impl->dev_caps.dwPOVs++;
- if (!impl->device_state_report_id) - impl->device_state_report_id = instance->wReportId; - else if (impl->device_state_report_id != instance->wReportId) - FIXME( "multiple device state reports found!\n" ); + if (instance->dwType & (DIDFT_BUTTON|DIDFT_AXIS|DIDFT_POV) && + (instance->wUsagePage == HID_USAGE_PAGE_GENERIC || + instance->wUsagePage == HID_USAGE_PAGE_BUTTON)) + { + if (!impl->device_state_report_id) + impl->device_state_report_id = instance->wReportId; + else if (impl->device_state_report_id != instance->wReportId) + FIXME( "multiple device state reports found!\n" ); + }
return DIENUM_CONTINUE; }