Skip to content

Commit

Permalink
Keyboard mapping bit fix (#15392)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonninnos committed Jun 18, 2023
1 parent fdd5f9e commit 8a862bf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions input/input_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -4222,6 +4222,7 @@ void config_read_keybinds_conf(void *data)
unsigned i;
input_driver_state_t *input_st = &input_driver_st;
config_file_t *conf = (config_file_t*)data;
bool key_store[RETROK_LAST] = {0};

if (!conf)
return;
Expand Down Expand Up @@ -4255,15 +4256,19 @@ void config_read_keybinds_conf(void *data)

fill_pathname_join_delim(str, prefix, btn, '_', sizeof(str));

/* Clear old mapping bit */
BIT512_CLEAR_PTR(&input_st->keyboard_mapping_bits, bind->key);
/* Clear old mapping bit unless just recently set */
if (!key_store[bind->key])
input_keyboard_mapping_bits(0, bind->key);

entry = config_get_entry(conf, str);
if (entry && !string_is_empty(entry->value))
bind->key = input_config_translate_str_to_rk(
entry->value);
/* Store mapping bit */
BIT512_SET_PTR(&input_st->keyboard_mapping_bits, bind->key);

/* Store new mapping bit and remember it for a while
* so that next clear leaves the new key alone */
input_keyboard_mapping_bits(1, bind->key);
key_store[bind->key] = true;

input_config_parse_joy_button (str, conf, prefix, btn, bind);
input_config_parse_joy_axis (str, conf, prefix, btn, bind);
Expand Down

0 comments on commit 8a862bf

Please sign in to comment.