From 430cdb830445a825150dce5307431142d2a990b1 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Fri, 9 Jan 2015 18:51:37 -0800 Subject: [PATCH] fix joy button handlers --- arch/sdl/joy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/sdl/joy.c b/arch/sdl/joy.c index 00cc2283..a480f914 100644 --- a/arch/sdl/joy.c +++ b/arch/sdl/joy.c @@ -80,7 +80,7 @@ void joy_button_handler(SDL_JoyButtonEvent *jbe) button = SDL_Joysticks[jbe->which].button_map[jbe->button]; - vkey_handler(KEY_JB1 + button, jbe->state == SDL_JOYBUTTONDOWN); + vkey_handler(KEY_JB1 + button, jbe->state == SDL_PRESSED); Joystick.buttons[button].state = jbe->state; @@ -101,6 +101,11 @@ void joy_hat_handler(SDL_JoyHatEvent *jhe) int hat = SDL_Joysticks[jhe->which].hat_map[jhe->hat]; int hbi; + vkey_handler(KEY_JB1 + hat + 0, (jhe->value & SDL_HAT_UP ) > 0); + vkey_handler(KEY_JB1 + hat + 1, (jhe->value & SDL_HAT_RIGHT) > 0); + vkey_handler(KEY_JB1 + hat + 2, (jhe->value & SDL_HAT_DOWN ) > 0); + vkey_handler(KEY_JB1 + hat + 3, (jhe->value & SDL_HAT_LEFT ) > 0); + //Save last state of the hat-button Joystick.buttons[hat ].last_state = Joystick.buttons[hat ].state; Joystick.buttons[hat+1].last_state = Joystick.buttons[hat+1].state; -- 2.39.2