Implement action_start callback for remap_file_load

This commit is contained in:
twinaphex 2015-01-24 23:49:35 +01:00
parent 5419757c40
commit 724e748254
4 changed files with 26 additions and 6 deletions

View File

@ -107,3 +107,14 @@ void input_remapping_save_file(const char *path)
config_file_write(conf, remap_file);
config_file_free(conf);
}
void input_remapping_set_defaults(void)
{
unsigned i, j;
for (i = 0; i < MAX_USERS; i++)
{
for (j = 0; j < RARCH_BIND_LIST_END; j++)
g_settings.input.remap_ids[i][j] = g_settings.input.binds[i][j].id;
}
}

View File

@ -42,6 +42,8 @@ bool input_remapping_load_file(const char *path);
**/
void input_remapping_save_file(const char *path);
void input_remapping_set_defaults(void);
#ifdef __cplusplus
}
#endif

View File

@ -945,6 +945,14 @@ static int action_ok_help(const char *path,
return 0;
}
static int action_start_remap_file_load(unsigned type, const char *label,
unsigned action)
{
g_settings.input.remapping_path[0] = '\0';
input_remapping_set_defaults();
return 0;
}
static int action_start_performance_counters_core(unsigned type, const char *label,
unsigned action)
{
@ -2726,7 +2734,9 @@ static void menu_entries_cbs_init_bind_start(menu_file_list_cbs_t *cbs,
cbs->action_start = action_start_lookup_setting;
if (!strcmp(label, "video_shader_pass"))
if (!strcmp(label, "remap_file_load"))
cbs->action_start = action_start_remap_file_load;
else if (!strcmp(label, "video_shader_pass"))
cbs->action_start = action_start_shader_pass;
else if (!strcmp(label, "video_shader_scale_pass"))
cbs->action_start = action_start_shader_scale_pass;

View File

@ -22,6 +22,7 @@
#include <file/file_path.h>
#include "input/input_common.h"
#include "input/input_keymaps.h"
#include "input/input_remapping.h"
#include "settings.h"
#ifdef HAVE_CONFIG_H
@ -537,11 +538,7 @@ static void config_set_defaults(void)
memcpy(g_settings.input.binds[i], retro_keybinds_rest,
sizeof(retro_keybinds_rest));
for (i = 0; i < MAX_USERS; i++)
{
for (j = 0; j < RARCH_BIND_LIST_END; j++)
g_settings.input.remap_ids[i][j] = g_settings.input.binds[i][j].id;
}
input_remapping_set_defaults();
for (i = 0; i < MAX_USERS; i++)
{