Joystick Raw Input: Do not add the axis if the center is 0 - prevents malformed vJoy 2.0.5 axes from causing 86Box to crash with a division by zero.
This commit is contained in:
@@ -98,6 +98,8 @@ joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_t *joy, USAGE usage)
|
|||||||
void
|
void
|
||||||
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
|
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
|
||||||
{
|
{
|
||||||
|
LONG center;
|
||||||
|
|
||||||
if (joy->nr_axes >= 8)
|
if (joy->nr_axes >= 8)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -141,6 +143,9 @@ joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS
|
|||||||
}
|
}
|
||||||
rawjoy->axis[joy->nr_axes].min = prop->LogicalMin;
|
rawjoy->axis[joy->nr_axes].min = prop->LogicalMin;
|
||||||
|
|
||||||
|
center = (rawjoy->axis[joy->nr_axes].max - rawjoy->axis[joy->nr_axes].min + 1) / 2;
|
||||||
|
|
||||||
|
if (center != 0x00)
|
||||||
joy->nr_axes++;
|
joy->nr_axes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ joystick_add_button(raw_joystick_t *rawjoy, plat_joystick_t *joy, USAGE usage)
|
|||||||
void
|
void
|
||||||
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
|
joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS prop)
|
||||||
{
|
{
|
||||||
|
LONG center;
|
||||||
|
|
||||||
if (joy->nr_axes >= 8)
|
if (joy->nr_axes >= 8)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -142,6 +144,9 @@ joystick_add_axis(raw_joystick_t *rawjoy, plat_joystick_t *joy, PHIDP_VALUE_CAPS
|
|||||||
}
|
}
|
||||||
rawjoy->axis[joy->nr_axes].min = prop->LogicalMin;
|
rawjoy->axis[joy->nr_axes].min = prop->LogicalMin;
|
||||||
|
|
||||||
|
center = (rawjoy->axis[joy->nr_axes].max - rawjoy->axis[joy->nr_axes].min + 1) / 2;
|
||||||
|
|
||||||
|
if (center != 0x00)
|
||||||
joy->nr_axes++;
|
joy->nr_axes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user