mirror of
https://github.com/libretro/RetroArch
synced 2024-12-29 12:31:05 +00:00
input remapping cleanups
This commit is contained in:
parent
0ced9ca913
commit
6a561f6414
@ -1305,7 +1305,7 @@ static void command_event_restore_default_shader_preset(void)
|
||||
static void command_event_restore_remaps(void)
|
||||
{
|
||||
if (rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL))
|
||||
input_remapping_set_defaults();
|
||||
input_remapping_set_defaults(true);
|
||||
}
|
||||
|
||||
static bool command_event_save_auto_state(void)
|
||||
|
@ -1586,7 +1586,7 @@ static void config_set_defaults(void)
|
||||
#endif
|
||||
|
||||
input_config_reset();
|
||||
input_remapping_set_defaults();
|
||||
input_remapping_set_defaults(true);
|
||||
input_autoconfigure_reset();
|
||||
|
||||
/* Verify that binds are in proper order. */
|
||||
@ -3009,7 +3009,7 @@ bool config_load_remap(void)
|
||||
else
|
||||
{
|
||||
RARCH_LOG("Remaps: no game-specific remap found at %s.\n", game_path);
|
||||
input_remapping_set_defaults();
|
||||
input_remapping_set_defaults(false);
|
||||
}
|
||||
|
||||
/* Create a new config file from core_path */
|
||||
@ -3029,7 +3029,7 @@ bool config_load_remap(void)
|
||||
else
|
||||
{
|
||||
RARCH_LOG("Remaps: no core-specific remap found at %s.\n", core_path);
|
||||
input_remapping_set_defaults();
|
||||
input_remapping_set_defaults(false);
|
||||
}
|
||||
|
||||
new_conf = NULL;
|
||||
|
@ -246,10 +246,16 @@ bool input_remapping_remove_file(const char *path)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void input_remapping_set_defaults(void)
|
||||
void input_remapping_set_defaults(bool deinit)
|
||||
{
|
||||
unsigned i, j;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!global)
|
||||
return;
|
||||
|
||||
global->name.remapfile[0] = '\0';
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ bool input_remapping_save_file(const char *path);
|
||||
|
||||
bool input_remapping_remove_file(const char *path);
|
||||
|
||||
void input_remapping_set_defaults(void);
|
||||
void input_remapping_set_defaults(bool deinit);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
@ -2141,7 +2141,7 @@ static int generic_action_ok_remap_file_operation(const char *path,
|
||||
{
|
||||
if (action_type == ACTION_OK_REMAP_FILE_SAVE_CORE)
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_CORE_ACTIVE, NULL);
|
||||
else
|
||||
else if (action_type == ACTION_OK_REMAP_FILE_SAVE_GAME)
|
||||
rarch_ctl(RARCH_CTL_SET_REMAPS_GAME_ACTIVE, NULL);
|
||||
|
||||
runloop_msg_queue_push(
|
||||
@ -2157,10 +2157,19 @@ static int generic_action_ok_remap_file_operation(const char *path,
|
||||
{
|
||||
if(input_remapping_remove_file(file))
|
||||
{
|
||||
if (action_type == ACTION_OK_REMAP_FILE_REMOVE_CORE)
|
||||
if (action_type == ACTION_OK_REMAP_FILE_REMOVE_CORE &&
|
||||
rarch_ctl(RARCH_CTL_IS_REMAPS_CORE_ACTIVE, NULL))
|
||||
{
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE, NULL);
|
||||
else
|
||||
input_remapping_set_defaults(true);
|
||||
}
|
||||
|
||||
else if (action_type == ACTION_OK_REMAP_FILE_REMOVE_GAME &&
|
||||
rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL))
|
||||
{
|
||||
rarch_ctl(RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE, NULL);
|
||||
input_remapping_set_defaults(true);
|
||||
}
|
||||
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_REMAP_FILE_REMOVED_SUCCESSFULLY),
|
||||
|
@ -48,13 +48,7 @@
|
||||
|
||||
static int action_start_remap_file_load(unsigned type, const char *label)
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (!global)
|
||||
return -1;
|
||||
|
||||
global->name.remapfile[0] = '\0';
|
||||
input_remapping_set_defaults();
|
||||
input_remapping_set_defaults(true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user