mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Might fix hat lookup.
This commit is contained in:
parent
aac2533075
commit
2ef54a7e01
41
settings.c
41
settings.c
@ -697,27 +697,30 @@ static void read_keybinds_keyboard(config_file_t *conf, unsigned player, unsigne
|
|||||||
|
|
||||||
static void parse_hat(struct snes_keybind *bind, const char *str)
|
static void parse_hat(struct snes_keybind *bind, const char *str)
|
||||||
{
|
{
|
||||||
if (isdigit(*str))
|
if (!isdigit(*str))
|
||||||
|
return;
|
||||||
|
|
||||||
|
char *dir = NULL;
|
||||||
|
uint16_t hat = strtoul(str, &dir, 0);
|
||||||
|
uint16_t hat_dir = 0;
|
||||||
|
|
||||||
|
if (!dir)
|
||||||
{
|
{
|
||||||
char *dir = NULL;
|
SSNES_WARN("Found invalid hat in config!\n");
|
||||||
int hat = strtol(str, &dir, 0);
|
return;
|
||||||
int hat_dir = 0;
|
|
||||||
|
|
||||||
if (dir)
|
|
||||||
{
|
|
||||||
if (strcasecmp(str, "up") == 0)
|
|
||||||
hat_dir = HAT_UP_MASK;
|
|
||||||
else if (strcasecmp(str, "down") == 0)
|
|
||||||
hat_dir = HAT_DOWN_MASK;
|
|
||||||
else if (strcasecmp(str, "left") == 0)
|
|
||||||
hat_dir = HAT_LEFT_MASK;
|
|
||||||
else if (strcasecmp(str, "right") == 0)
|
|
||||||
hat_dir = HAT_RIGHT_MASK;
|
|
||||||
|
|
||||||
if (hat_dir)
|
|
||||||
bind->joykey = HAT_MAP(hat, hat_dir);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcasecmp(dir, "up") == 0)
|
||||||
|
hat_dir = HAT_UP_MASK;
|
||||||
|
else if (strcasecmp(dir, "down") == 0)
|
||||||
|
hat_dir = HAT_DOWN_MASK;
|
||||||
|
else if (strcasecmp(dir, "left") == 0)
|
||||||
|
hat_dir = HAT_LEFT_MASK;
|
||||||
|
else if (strcasecmp(dir, "right") == 0)
|
||||||
|
hat_dir = HAT_RIGHT_MASK;
|
||||||
|
|
||||||
|
if (hat_dir)
|
||||||
|
bind->joykey = HAT_MAP(hat, hat_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_keybinds_button(config_file_t *conf, unsigned player, unsigned index, struct snes_keybind *bind)
|
static void read_keybinds_button(config_file_t *conf, unsigned player, unsigned index, struct snes_keybind *bind)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user