Fix subtle regression.

This commit is contained in:
Themaister 2012-03-09 18:17:53 +01:00
parent 8d5385d1d7
commit 848a67252f
3 changed files with 10 additions and 5 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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);