From fa606ee479633099709b8e8850e4633671110c1b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 1 Jan 2017 05:36:18 +0100 Subject: [PATCH] Cleanup command_event_save_current_config --- command.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/command.c b/command.c index aa4fe15306..80011e6457 100644 --- a/command.c +++ b/command.c @@ -1591,29 +1591,35 @@ static bool command_event_save_core_config(void) * Saves current configuration file to disk, and (optionally) * autosave state. **/ -static void command_event_save_current_config(int override_type) +static void command_event_save_current_config(enum override_type type) { char msg[128] = {0}; - if (override_type) + switch (type) { - if (config_save_overrides(override_type)) - { - strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg)); - RARCH_LOG("[overrides] %s\n", msg); + case OVERRIDE_NONE: + if (!path_is_empty(RARCH_PATH_CONFIG)) + command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg)); + break; + case OVERRIDE_GAME: + case OVERRIDE_CORE: + if (config_save_overrides(type)) + { + strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg)); + RARCH_LOG("[overrides] %s\n", msg); - /* set overrides to active so the original config can be - restored after closing content */ - runloop_ctl(RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, NULL); - } - else - { - strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_SAVING), sizeof(msg)); - RARCH_ERR("[overrides] %s\n", msg); - } + /* set overrides to active so the original config can be + restored after closing content */ + runloop_ctl(RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, NULL); + } + else + { + strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_SAVING), sizeof(msg)); + RARCH_ERR("[overrides] %s\n", msg); + } + break; } - else if (!path_is_empty(RARCH_PATH_CONFIG)) - command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg)); + if (!string_is_empty(msg)) runloop_msg_queue_push(msg, 1, 180, true);