Commit e87ccb8b authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

dinput: Assume a 1-to-1 axes map when no axes match.

The wiimote is a well known problematic device, mainly because it is not a joystick. It is a USB device. But the classic controller is at least advertised as a joystick with 6 axes and 11 buttons (js driver only, NO event). Signed-off-by: 's avatarBruno Jesus <bjesus@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 985acda3
......@@ -228,19 +228,36 @@ static INT find_joystick_devices(void)
else
if ((joydev.dev_axes_map = HeapAlloc(GetProcessHeap(), 0, joydev.axis_count * sizeof(int))))
{
INT j;
INT j, found_axes = 0;
/* Remap to DI numbers */
for (j = 0; j < joydev.axis_count; j++)
{
if (axes_map[j] < 8)
{
/* Axis match 1-to-1 */
joydev.dev_axes_map[j] = j;
found_axes++;
}
else if (axes_map[j] == 16 ||
axes_map[j] == 17)
{
/* POV axis */
joydev.dev_axes_map[j] = 8;
found_axes++;
}
else
joydev.dev_axes_map[j] = -1;
}
/* If no axes were configured but there are axes assume a 1-to-1 (wii controller) */
if (joydev.axis_count && !found_axes)
{
ERR("Incoherent joystick data, advertised %d axes, detected 0. Assuming 1-to-1.\n",
joydev.axis_count);
for (j = 0; j < joydev.axis_count; j++)
joydev.dev_axes_map[j] = j;
}
}
/* Find vendor_id and product_id in sysfs */
......
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