winebus.sys: Fix incorrect hid_device_set index check.
Instead of checking it in set_report_from_joystick_event.
This commit is contained in:
parent
f79d4343a9
commit
bbdec47b96
2 changed files with 5 additions and 7 deletions
|
@ -841,8 +841,7 @@ static BOOL set_report_from_joystick_event(struct sdl_device *impl, SDL_Event *e
|
|||
{
|
||||
SDL_JoyAxisEvent *ie = &event->jaxis;
|
||||
|
||||
if (ie->axis >= ARRAY_SIZE(absolute_axis_usages)) break;
|
||||
hid_device_set_abs_axis(iface, ie->axis, ie->value);
|
||||
if (!hid_device_set_abs_axis(iface, ie->axis, ie->value)) break;
|
||||
bus_event_queue_input_report(&event_queue, iface, state->report_buf, state->report_len);
|
||||
break;
|
||||
}
|
||||
|
@ -850,8 +849,7 @@ static BOOL set_report_from_joystick_event(struct sdl_device *impl, SDL_Event *e
|
|||
{
|
||||
SDL_JoyBallEvent *ie = &event->jball;
|
||||
|
||||
if (ie->ball >= ARRAY_SIZE(relative_axis_usages) / 2) break;
|
||||
hid_device_set_rel_axis(iface, 2 * ie->ball, ie->xrel);
|
||||
if (!hid_device_set_rel_axis(iface, 2 * ie->ball, ie->xrel)) break;
|
||||
hid_device_set_rel_axis(iface, 2 * ie->ball + 1, ie->yrel);
|
||||
bus_event_queue_input_report(&event_queue, iface, state->report_buf, state->report_len);
|
||||
break;
|
||||
|
|
|
@ -1376,7 +1376,7 @@ BOOL hid_device_set_abs_axis(struct unix_device *iface, ULONG index, LONG value)
|
|||
{
|
||||
struct hid_device_state *state = &iface->hid_device_state;
|
||||
ULONG offset = state->abs_axis_start + index * 4;
|
||||
if (index > state->abs_axis_count) return FALSE;
|
||||
if (index >= state->abs_axis_count) return FALSE;
|
||||
*(ULONG *)(state->report_buf + offset) = LE_ULONG(value);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1385,7 +1385,7 @@ BOOL hid_device_set_rel_axis(struct unix_device *iface, ULONG index, LONG value)
|
|||
{
|
||||
struct hid_device_state *state = &iface->hid_device_state;
|
||||
ULONG offset = state->rel_axis_start + index * 4;
|
||||
if (index > state->rel_axis_count) return FALSE;
|
||||
if (index >= state->rel_axis_count) return FALSE;
|
||||
*(ULONG *)(state->report_buf + offset) = LE_ULONG(value);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1395,7 +1395,7 @@ BOOL hid_device_set_button(struct unix_device *iface, ULONG index, BOOL is_set)
|
|||
struct hid_device_state *state = &iface->hid_device_state;
|
||||
ULONG offset = state->button_start + (index / 8);
|
||||
BYTE mask = (1 << (index % 8));
|
||||
if (index > state->button_count) return FALSE;
|
||||
if (index >= state->button_count) return FALSE;
|
||||
if (is_set) state->report_buf[offset] |= mask;
|
||||
else state->report_buf[offset] &= ~mask;
|
||||
return TRUE;
|
||||
|
|
Loading…
Add table
Reference in a new issue