From 848a67252f9bd15d72ed9b1c85add0f63ff920e0 Mon Sep 17 00:00:00 2001 From: Themaister Date: Fri, 9 Mar 2012 18:17:53 +0100 Subject: [PATCH] Fix subtle regression. --- driver.h | 9 +++++++-- input/sdl_input.c | 2 +- settings.c | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/driver.h b/driver.h index 1d92a44c61..8d37562fe5 100644 --- a/driver.h +++ b/driver.h @@ -73,7 +73,11 @@ struct snes_keybind bool valid; int id; enum ssnes_key key; - uint64_t joykey; // PC only uses lower 16-bits. + + // PC only uses lower 16-bits. + // Full 64-bit can be used for port-specific purposes, like simplifying multiple binds, etc. + uint64_t joykey; + uint32_t joyaxis; }; @@ -107,11 +111,12 @@ typedef struct audio_driver #define AXIS_NEG(x) (((uint32_t)(x) << 16) | UINT16_C(0xFFFF)) #define AXIS_POS(x) ((uint32_t)(x) | UINT32_C(0xFFFF0000)) #define AXIS_NONE UINT32_C(0xFFFFFFFF) +#define AXIS_DIR_NONE UINT16_C(0xFFFF) #define AXIS_NEG_GET(x) (((uint32_t)(x) >> 16) & UINT16_C(0xFFFF)) #define AXIS_POS_GET(x) ((uint32_t)(x) & UINT16_C(0xFFFF)) -#define NO_BTN UINT64_C(0xFFFFFFFFFFFFFFFF) // I hope no joypad will ever have this many buttons ... ;) +#define NO_BTN UINT16_C(0xFFFF) // I hope no joypad will ever have this many buttons ... ;) #define HAT_UP_MASK (1 << 15) #define HAT_DOWN_MASK (1 << 14) diff --git a/input/sdl_input.c b/input/sdl_input.c index 3cb38b828e..906c1ec35a 100644 --- a/input/sdl_input.c +++ b/input/sdl_input.c @@ -185,7 +185,7 @@ static bool sdl_key_pressed(int key) } #ifndef HAVE_DINPUT -static bool sdl_joykey_pressed(sdl_input_t *sdl, int port_num, uint16_t joykey) +static bool sdl_joykey_pressed(sdl_input_t *sdl, int port_num, uint64_t joykey) { if (joykey == NO_BTN) return false; diff --git a/settings.c b/settings.c index 9c71fdea62..d05c018343 100644 --- a/settings.c +++ b/settings.c @@ -881,12 +881,12 @@ static void save_keybind_axis(config_file_t *conf, if (bind->joyaxis == AXIS_NONE) config_set_string(conf, map->axis, "nul"); - else if (AXIS_NEG_GET(bind->joyaxis) != NO_BTN) + else if (AXIS_NEG_GET(bind->joyaxis) != AXIS_DIR_NONE) { dir = '-'; axis = AXIS_NEG_GET(bind->joyaxis); } - else if (AXIS_POS_GET(bind->joyaxis) != NO_BTN) + else if (AXIS_POS_GET(bind->joyaxis) != AXIS_DIR_NONE) { dir = '+'; axis = AXIS_POS_GET(bind->joyaxis);