mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Simplify command_event_save_current_config
This commit is contained in:
parent
28417a02b7
commit
ccb8ecec4d
49
retroarch.c
49
retroarch.c
@ -12980,40 +12980,47 @@ static void command_event_save_current_config(
|
|||||||
struct rarch_state *p_rarch,
|
struct rarch_state *p_rarch,
|
||||||
enum override_type type)
|
enum override_type type)
|
||||||
{
|
{
|
||||||
char msg[128];
|
|
||||||
|
|
||||||
msg[0] = '\0';
|
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case OVERRIDE_NONE:
|
case OVERRIDE_NONE:
|
||||||
if (path_is_empty(RARCH_PATH_CONFIG))
|
{
|
||||||
strcpy_literal(msg, "[Config]: Config directory not set, cannot save configuration.");
|
if (path_is_empty(RARCH_PATH_CONFIG))
|
||||||
else
|
{
|
||||||
command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg));
|
char msg[128];
|
||||||
|
msg[0] = '\0';
|
||||||
|
strcpy_literal(msg, "[Config]: Config directory not set, cannot save configuration.");
|
||||||
|
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char msg[256];
|
||||||
|
msg[0] = '\0';
|
||||||
|
command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg));
|
||||||
|
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case OVERRIDE_GAME:
|
case OVERRIDE_GAME:
|
||||||
case OVERRIDE_CORE:
|
case OVERRIDE_CORE:
|
||||||
case OVERRIDE_CONTENT_DIR:
|
case OVERRIDE_CONTENT_DIR:
|
||||||
if (config_save_overrides(type, &runloop_state.system))
|
|
||||||
{
|
{
|
||||||
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg));
|
char msg[128];
|
||||||
|
msg[0] = '\0';
|
||||||
|
if (config_save_overrides(type, &runloop_state.system))
|
||||||
|
{
|
||||||
|
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg));
|
||||||
|
/* set overrides to active so the original config can be
|
||||||
|
restored after closing content */
|
||||||
|
runloop_state.overrides_active = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_SAVING), sizeof(msg));
|
||||||
RARCH_LOG("[Config - Overrides]: %s\n", msg);
|
RARCH_LOG("[Config - Overrides]: %s\n", msg);
|
||||||
|
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||||
/* set overrides to active so the original config can be
|
|
||||||
restored after closing content */
|
|
||||||
runloop_state.overrides_active = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_SAVING), sizeof(msg));
|
|
||||||
RARCH_ERR("[Config - Overrides]: %s\n", msg);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string_is_empty(msg))
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user