diff --git a/configuration.c b/configuration.c index b6d8359960..2ecc4a1fbf 100644 --- a/configuration.c +++ b/configuration.c @@ -2556,37 +2556,6 @@ static bool check_menu_driver_compatibility(void) } #endif -static void config_read_keybinds_conf(config_file_t *conf) -{ - unsigned i; - - for (i = 0; i < MAX_USERS; i++) - { - unsigned j; - - for (j = 0; input_config_bind_map_get_valid(j); j++) - { - struct retro_keybind *bind = &input_config_binds[i][j]; - const char *prefix = input_config_get_prefix(i, input_config_bind_map_get_meta(j)); - const char *btn = input_config_bind_map_get_base(j); - - if (!bind->valid) - continue; - if (!input_config_bind_map_get_valid(j)) - continue; - if (!btn) - continue; - if (!prefix) - continue; - - input_config_parse_key(conf, prefix, btn, bind); - input_config_parse_joy_button(conf, prefix, btn, bind); - input_config_parse_joy_axis(conf, prefix, btn, bind); - input_config_parse_mouse_button(conf, prefix, btn, bind); - } - } -} - static bool check_shader_compatibility(enum file_path_enum enum_idx) { settings_t *settings = config_get_ptr(); @@ -2616,58 +2585,6 @@ static bool check_shader_compatibility(enum file_path_enum enum_idx) return false; } -#if 0 -static bool config_read_keybinds(const char *path) -{ - config_file_t *conf = (config_file_t*)config_file_new(path); - - if (!conf) - return false; - - config_read_keybinds_conf(conf); - config_file_free(conf); - - return true; -} - -/* Also dumps inherited values, useful for logging. */ -static void config_file_dump_all(config_file_t *conf) -{ - struct config_entry_list *list = NULL; - struct config_include_list *includes = conf->includes; - - while (includes) - { - RARCH_LOG("#include \"%s\"\n", includes->path); - includes = includes->next; - } - - list = conf->entries; - - while (list) - { - RARCH_LOG("%s = \"%s\"%s\n", list->key, - list->value, list->readonly ? " (included)" : ""); - list = list->next; - } -} -#endif - -/* - * This is no longer used, so comment out to silence warnings... -#ifdef HAVE_MENU -static void config_get_hex_base(config_file_t *conf, - const char *key, unsigned *base) -{ - unsigned tmp = 0; - if (!base) - return; - if (config_get_hex(conf, key, &tmp)) - *base = tmp; -} -#endif -*/ - /** * config_load: * @path : path to be read from. diff --git a/input/input_driver.c b/input/input_driver.c index 0b47f9f850..3287728a43 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -2412,13 +2412,13 @@ const char *input_config_bind_map_get_desc(unsigned i) return msg_hash_to_str(keybind->desc); } -void input_config_parse_key(void *data, +static void input_config_parse_key( + config_file_t *conf, const char *prefix, const char *btn, struct retro_keybind *bind) { char tmp[64]; char key[64]; - config_file_t *conf = (config_file_t*)data; tmp[0] = key[0] = '\0'; @@ -2534,7 +2534,8 @@ static void parse_hat(struct retro_keybind *bind, const char *str) bind->joykey = HAT_MAP(hat, hat_dir); } -void input_config_parse_joy_button(void *data, const char *prefix, +static void input_config_parse_joy_button( + config_file_t *conf, const char *prefix, const char *btn, struct retro_keybind *bind) { char str[256]; @@ -2542,7 +2543,6 @@ void input_config_parse_joy_button(void *data, const char *prefix, char key[64]; char key_label[64]; char *tmp_a = NULL; - config_file_t *conf = (config_file_t*)data; str[0] = tmp[0] = key[0] = key_label[0] = '\0'; @@ -2581,7 +2581,8 @@ void input_config_parse_joy_button(void *data, const char *prefix, } } -void input_config_parse_joy_axis(void *data, const char *prefix, +static void input_config_parse_joy_axis( + config_file_t *conf, const char *prefix, const char *axis, struct retro_keybind *bind) { char str[256]; @@ -2589,7 +2590,6 @@ void input_config_parse_joy_axis(void *data, const char *prefix, char key[64]; char key_label[64]; char *tmp_a = NULL; - config_file_t *conf = (config_file_t*)data; str[0] = tmp[0] = key[0] = key_label[0] = '\0'; @@ -2627,14 +2627,14 @@ void input_config_parse_joy_axis(void *data, const char *prefix, } } -void input_config_parse_mouse_button(void *data, const char *prefix, +static void input_config_parse_mouse_button( + config_file_t *conf, const char *prefix, const char *btn, struct retro_keybind *bind) { int val; char str[256]; char tmp[64]; char key[64]; - config_file_t *conf = (config_file_t*)data; str[0] = tmp[0] = key[0] = '\0'; @@ -3052,3 +3052,56 @@ void input_config_reset(void) input_device_names[i][j] = 0; } } + +void config_read_keybinds_conf(void *data) +{ + unsigned i; + config_file_t *conf = (config_file_t*)data; + + if (!conf) + return; + + for (i = 0; i < MAX_USERS; i++) + { + unsigned j; + + for (j = 0; input_config_bind_map_get_valid(j); j++) + { + struct retro_keybind *bind = &input_config_binds[i][j]; + const char *prefix = input_config_get_prefix(i, input_config_bind_map_get_meta(j)); + const char *btn = input_config_bind_map_get_base(j); + + if (!bind->valid) + continue; + if (!input_config_bind_map_get_valid(j)) + continue; + if (!btn) + continue; + if (!prefix) + continue; + + input_config_parse_key(conf, prefix, btn, bind); + input_config_parse_joy_button(conf, prefix, btn, bind); + input_config_parse_joy_axis(conf, prefix, btn, bind); + input_config_parse_mouse_button(conf, prefix, btn, bind); + } + } +} + +void input_autoconfigure_joypad_conf(void *data, + struct retro_keybind *binds) +{ + unsigned i; + config_file_t *conf = (config_file_t*)data; + + if (!conf) + return; + + for (i = 0; i < RARCH_BIND_LIST_END; i++) + { + input_config_parse_joy_button(conf, "input", + input_config_bind_map_get_base(i), &binds[i]); + input_config_parse_joy_axis(conf, "input", + input_config_bind_map_get_base(i), &binds[i]); + } +} diff --git a/input/input_driver.h b/input/input_driver.h index b808d2eebb..e7a57ee1f5 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -741,18 +741,9 @@ const char *input_config_get_prefix(unsigned user, bool meta); **/ unsigned input_config_translate_str_to_bind_id(const char *str); -void input_config_parse_key(void *data, - const char *prefix, const char *btn, - struct retro_keybind *bind); +void config_read_keybinds_conf(void *data); -void input_config_parse_joy_button(void *data, const char *prefix, - const char *btn, struct retro_keybind *bind); - -void input_config_parse_joy_axis(void *data, const char *prefix, - const char *axis, struct retro_keybind *bind); - -void input_config_parse_mouse_button(void *data, const char *prefix, - const char *btn, struct retro_keybind *bind); +void input_autoconfigure_joypad_conf(void *data, struct retro_keybind *binds); void input_config_set_device_name(unsigned port, const char *name); diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index f11ebc8d11..b6cc2ffeec 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -162,20 +162,6 @@ void input_autoconfigure_joypad_reindex_devices() } } -static void input_autoconfigure_joypad_conf(config_file_t *conf, - struct retro_keybind *binds) -{ - unsigned i; - - for (i = 0; i < RARCH_BIND_LIST_END; i++) - { - input_config_parse_joy_button(conf, "input", - input_config_bind_map_get_base(i), &binds[i]); - input_config_parse_joy_axis(conf, "input", - input_config_bind_map_get_base(i), &binds[i]); - } -} - static int input_autoconfigure_joypad_try_from_conf(config_file_t *conf, autoconfig_params_t *params) {