Various fixes to traveler joystick input logic and to simulated joystick device

This commit is contained in:
Gregory Nutt 2014-12-14 12:23:19 -06:00
parent b972c34d5f
commit df30780f37
2 changed files with 11 additions and 9 deletions

View File

@ -221,12 +221,12 @@ int up_buttonevent(int x, int y, int buttons)
g_ajoy_sample.as_buttons |= AJOY_BUTTON_1_BIT; g_ajoy_sample.as_buttons |= AJOY_BUTTON_1_BIT;
} }
if ((buttons & 1) != 0) if ((buttons & 2) != 0)
{ {
g_ajoy_sample.as_buttons |= AJOY_BUTTON_2_BIT; g_ajoy_sample.as_buttons |= AJOY_BUTTON_2_BIT;
} }
if ((buttons & 1) != 0) if ((buttons & 4) != 0)
{ {
g_ajoy_sample.as_buttons |= AJOY_BUTTON_3_BIT; g_ajoy_sample.as_buttons |= AJOY_BUTTON_3_BIT;
} }
@ -242,14 +242,16 @@ int up_buttonevent(int x, int y, int buttons)
/* Check button presses */ /* Check button presses */
changed = g_ajoy_buttons ^ g_ajoy_sample.as_buttons; changed = g_ajoy_buttons ^ g_ajoy_sample.as_buttons;
pressed = changed & (AJOY_SUPPORTED & g_ajoy_buttons); if (changed != 0)
released = changed & (AJOY_SUPPORTED & ~g_ajoy_buttons);
if ((pressed & g_ajoy_pset) != 0 || (released & g_ajoy_rset) != 0)
{ {
/* Call the interrupt handler */ pressed = changed & (AJOY_SUPPORTED & g_ajoy_pset);
released = changed & (AJOY_SUPPORTED & ~g_ajoy_rset);
if ((pressed & g_ajoy_pset) != 0 || (released & g_ajoy_rset) != 0)
{
/* Call the interrupt handler */
g_ajoy_handler(&g_ajoylower, g_ajoy_arg); g_ajoy_handler(&g_ajoylower, g_ajoy_arg);
}
} }
} }

View File

@ -572,7 +572,7 @@ CONFIG_GRAPHICS_TRAVELER_JOYDEV="/dev/ajoy0"
# #
CONFIG_GRAPHICS_TRAVELER_ROMFSDEMO=y CONFIG_GRAPHICS_TRAVELER_ROMFSDEMO=y
# CONFIG_GRAPHICS_TRAVELER_PERFMON is not set # CONFIG_GRAPHICS_TRAVELER_PERFMON is not set
CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL=3 CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL=0
# #
# Interpreters # Interpreters