winebus.sys: Report hatswitch values correctly.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d0c5a5e89f
commit
2239aae97f
|
@ -303,15 +303,18 @@ static void set_hat_value(struct platform_private *ext, int index, int value)
|
|||
offset = ext->hat_start + index;
|
||||
switch (value)
|
||||
{
|
||||
case SDL_HAT_CENTERED: ext->report_buffer[offset] = 8; break;
|
||||
case SDL_HAT_UP: ext->report_buffer[offset] = 0; break;
|
||||
case SDL_HAT_RIGHTUP: ext->report_buffer[offset] = 1; break;
|
||||
case SDL_HAT_RIGHT: ext->report_buffer[offset] = 2; break;
|
||||
case SDL_HAT_RIGHTDOWN: ext->report_buffer[offset] = 3; break;
|
||||
case SDL_HAT_DOWN: ext->report_buffer[offset] = 4; break;
|
||||
case SDL_HAT_LEFTDOWN: ext->report_buffer[offset] = 5; break;
|
||||
case SDL_HAT_LEFT: ext->report_buffer[offset] = 6; break;
|
||||
case SDL_HAT_LEFTUP: ext->report_buffer[offset] = 7; break;
|
||||
/* 8 1 2
|
||||
* 7 0 3
|
||||
* 6 5 4 */
|
||||
case SDL_HAT_CENTERED: ext->report_buffer[offset] = 0; break;
|
||||
case SDL_HAT_UP: ext->report_buffer[offset] = 1; break;
|
||||
case SDL_HAT_RIGHTUP: ext->report_buffer[offset] = 2; break;
|
||||
case SDL_HAT_RIGHT: ext->report_buffer[offset] = 3; break;
|
||||
case SDL_HAT_RIGHTDOWN: ext->report_buffer[offset] = 4; break;
|
||||
case SDL_HAT_DOWN: ext->report_buffer[offset] = 5; break;
|
||||
case SDL_HAT_LEFTDOWN: ext->report_buffer[offset] = 6; break;
|
||||
case SDL_HAT_LEFT: ext->report_buffer[offset] = 7; break;
|
||||
case SDL_HAT_LEFTUP: ext->report_buffer[offset] = 8; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -303,32 +303,35 @@ static void set_abs_axis_value(struct wine_input_private *ext, int code, int val
|
|||
ext->hat_values[index] = value;
|
||||
if ((code - ABS_HAT0X) % 2)
|
||||
index--;
|
||||
/* 8 1 2
|
||||
* 7 0 3
|
||||
* 6 5 4 */
|
||||
if (ext->hat_values[index] == 0)
|
||||
{
|
||||
if (ext->hat_values[index+1] == 0)
|
||||
value = 8;
|
||||
else if (ext->hat_values[index+1] < 0)
|
||||
value = 0;
|
||||
else if (ext->hat_values[index+1] < 0)
|
||||
value = 1;
|
||||
else
|
||||
value = 4;
|
||||
value = 5;
|
||||
}
|
||||
else if (ext->hat_values[index] > 0)
|
||||
{
|
||||
if (ext->hat_values[index+1] == 0)
|
||||
value = 2;
|
||||
else if (ext->hat_values[index+1] < 0)
|
||||
value = 1;
|
||||
else
|
||||
value = 3;
|
||||
else if (ext->hat_values[index+1] < 0)
|
||||
value = 2;
|
||||
else
|
||||
value = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ext->hat_values[index+1] == 0)
|
||||
value = 6;
|
||||
else if (ext->hat_values[index+1] < 0)
|
||||
value = 7;
|
||||
else if (ext->hat_values[index+1] < 0)
|
||||
value = 8;
|
||||
else
|
||||
value = 5;
|
||||
value = 6;
|
||||
}
|
||||
ext->current_report_buffer[ext->hat_map[index]] = value;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ static const BYTE REPORT_REL_AXIS_TAIL[] = {
|
|||
static const BYTE REPORT_HATSWITCH[] = {
|
||||
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
|
||||
0x09, 0x39, /* USAGE (Hatswitch) */
|
||||
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
|
||||
0x15, 0x01, /* LOGICAL_MINIMUM (1) */
|
||||
0x25, 0x08, /* LOGICAL_MAXIMUM (0x08) */
|
||||
0x35, 0x00, /* PHYSICAL_MINIMUM (0) */
|
||||
0x45, 0x08, /* PHYSICAL_MAXIMUM (8) */
|
||||
|
|
Loading…
Reference in New Issue