mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
(ovr) start implementing diff function
This commit is contained in:
parent
1fbeebf8a9
commit
c6c054bad1
69
command.c
69
command.c
@ -1569,43 +1569,52 @@ static bool command_event_save_core_config(void)
|
|||||||
**/
|
**/
|
||||||
void command_event_save_current_config(bool overrides)
|
void command_event_save_current_config(bool overrides)
|
||||||
{
|
{
|
||||||
if (overrides)
|
|
||||||
return;
|
|
||||||
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
if (settings->config_save_on_exit && !string_is_empty(global->path.config))
|
if (!overrides)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (settings->config_save_on_exit && !string_is_empty(global->path.config))
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
char msg[128] = {0};
|
||||||
|
const char *config_path = config_get_active_path();
|
||||||
|
|
||||||
|
/* Save last core-specific config to the default config location,
|
||||||
|
* needed on consoles for core switching and reusing last good
|
||||||
|
* config for new cores.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Flush out the core specific config. */
|
||||||
|
if (config_path)
|
||||||
|
ret = config_save_file(config_path);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
snprintf(msg, sizeof(msg), "%s \"%s\".",
|
||||||
|
msg_hash_to_str(MSG_SAVED_NEW_CONFIG_TO),
|
||||||
|
global->path.config);
|
||||||
|
RARCH_LOG("%s\n", msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(msg, sizeof(msg), "%s \"%s\".",
|
||||||
|
msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO),
|
||||||
|
global->path.config);
|
||||||
|
RARCH_ERR("%s\n", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
runloop_msg_queue_push(msg, 1, 180, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
char msg[128] = {0};
|
char msg[128] = {0};
|
||||||
const char *config_path = config_get_active_path();
|
|
||||||
|
|
||||||
/* Save last core-specific config to the default config location,
|
ret = config_save_file_diff();
|
||||||
* needed on consoles for core switching and reusing last good
|
return;
|
||||||
* config for new cores.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Flush out the core specific config. */
|
|
||||||
if (config_path)
|
|
||||||
ret = config_save_file(config_path);
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
snprintf(msg, sizeof(msg), "%s \"%s\".",
|
|
||||||
msg_hash_to_str(MSG_SAVED_NEW_CONFIG_TO),
|
|
||||||
global->path.config);
|
|
||||||
RARCH_LOG("%s\n", msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(msg, sizeof(msg), "%s \"%s\".",
|
|
||||||
msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO),
|
|
||||||
global->path.config);
|
|
||||||
RARCH_ERR("%s\n", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
runloop_msg_queue_push(msg, 1, 180, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1294,9 +1294,10 @@ static bool config_load_file(const char *path, bool set_defaults,
|
|||||||
char tmp_append_path[PATH_MAX_LENGTH] = {0}; /* Don't destroy append_config_path. */
|
char tmp_append_path[PATH_MAX_LENGTH] = {0}; /* Don't destroy append_config_path. */
|
||||||
unsigned msg_color = 0;
|
unsigned msg_color = 0;
|
||||||
config_file_t *conf = NULL;
|
config_file_t *conf = NULL;
|
||||||
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
if (!settings)
|
if (!settings)
|
||||||
settings = config_get_ptr();
|
settings = config_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
|
|
||||||
struct config_bool_setting_ptr bool_settings[] = {
|
struct config_bool_setting_ptr bool_settings[] = {
|
||||||
{ "video_windowed_fullscreen", &settings->video.windowed_fullscreen},
|
{ "video_windowed_fullscreen", &settings->video.windowed_fullscreen},
|
||||||
@ -2221,7 +2222,7 @@ bool config_load_override(void)
|
|||||||
/* Reset save paths. */
|
/* Reset save paths. */
|
||||||
retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_STATE_PATH);
|
retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_STATE_PATH);
|
||||||
retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_SAVE_PATH);
|
retroarch_override_setting_set(RARCH_OVERRIDE_SETTING_SAVE_PATH);
|
||||||
|
global->path.append_config[0] = '\0';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3314,6 +3315,33 @@ bool config_save_file(const char *path)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* config_save_file:
|
||||||
|
* @path : Path that shall be written to.
|
||||||
|
*
|
||||||
|
* Writes a config file to disk.
|
||||||
|
*
|
||||||
|
* Returns: true (1) on success, otherwise returns false (0).
|
||||||
|
**/
|
||||||
|
bool config_save_file_diff()
|
||||||
|
{
|
||||||
|
unsigned i = 0;
|
||||||
|
bool ret = false;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
settings_t *orig = (settings_t*)calloc(1, sizeof(settings_t));
|
||||||
|
global_t *global = global_get_ptr();
|
||||||
|
|
||||||
|
/* Load the original config file in memory */
|
||||||
|
config_load_file(global->path.config, false, orig);
|
||||||
|
|
||||||
|
/* Test to compare with a well known setting */
|
||||||
|
/*RARCH_LOG ("Rewind: %d %d\n", settings->rewind_enable, orig->rewind_enable);
|
||||||
|
RARCH_LOG ("DBG: %d %d\n", settings->debug_panel_enable, orig->cheevos.enable);
|
||||||
|
RARCH_LOG ("FPS: %d %d\n", settings->fps_show, orig->fps_show);
|
||||||
|
RARCH_LOG ("FPS: %s %s\n", settings->username, orig->username);*/
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Replaces currently loaded configuration file with
|
/* Replaces currently loaded configuration file with
|
||||||
* another one. Will load a dummy core to flush state
|
* another one. Will load a dummy core to flush state
|
||||||
* properly. */
|
* properly. */
|
||||||
|
@ -653,6 +653,16 @@ bool config_save_autoconf_profile(const char *path, unsigned user);
|
|||||||
**/
|
**/
|
||||||
bool config_save_file(const char *path);
|
bool config_save_file(const char *path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* config_save_file_diff:
|
||||||
|
* @path : Path that shall be written to.
|
||||||
|
*
|
||||||
|
* Writes a config file override to disk.
|
||||||
|
*
|
||||||
|
* Returns: true (1) on success, otherwise returns false (0).
|
||||||
|
**/
|
||||||
|
bool config_save_file_diff();
|
||||||
|
|
||||||
/* Replaces currently loaded configuration file with
|
/* Replaces currently loaded configuration file with
|
||||||
* another one. Will load a dummy core to flush state
|
* another one. Will load a dummy core to flush state
|
||||||
* properly. */
|
* properly. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user