write to game options files if created instead of the main options file

This commit is contained in:
radius 2016-01-31 01:54:12 -05:00
parent f5b7add383
commit 659a3ef5d8
4 changed files with 30 additions and 4 deletions

View File

@ -536,6 +536,7 @@ void uninit_libretro_sym(struct retro_core_t *current_core)
memset(current_core, 0, sizeof(struct retro_core_t));
runloop_ctl(RUNLOOP_CTL_CORE_OPTIONS_DEINIT, NULL);
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_FREE, NULL);
camera_driver_ctl(RARCH_CAMERA_CTL_UNSET_ACTIVE, NULL);
location_driver_ctl(RARCH_LOCATION_CTL_UNSET_ACTIVE, NULL);

View File

@ -1329,6 +1329,7 @@ static int action_ok_option_create(const char *path,
{
char game_path[PATH_MAX_LENGTH];
rarch_system_info_t *system = NULL;
config_file_t *conf = NULL;
if (!rarch_option_create(game_path, sizeof(game_path)))
{
@ -1337,12 +1338,23 @@ static int action_ok_option_create(const char *path,
return 0;
}
conf = config_file_new(game_path);
if (!conf)
{
conf = config_file_new(NULL);
if (!conf)
return false;
}
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if(core_option_flush_game_specific(system->core_options,
game_path))
menu_display_msg_queue_push("Core options file saved successfully",
if(config_file_write(conf, game_path))
{
menu_display_msg_queue_push("Core options file created successfully",
1, 100, true);
strlcpy(system->game_options_path, game_path, sizeof(system->game_options_path));
}
return 0;
}

View File

@ -1093,9 +1093,21 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
if (!runloop_system.core_options)
return false;
core_option_flush(runloop_system.core_options);
/* check if game options file was just created and flush
to that file instead */
if(!string_is_empty(runloop_system.game_options_path))
{
core_option_flush_game_specific(runloop_system.core_options, runloop_system.game_options_path);
runloop_system.game_options_path[0] = '\0';
}
else
core_option_flush(runloop_system.core_options);
core_option_free(runloop_system.core_options);
if (runloop_ctl(RUNLOOP_CTL_IS_GAME_OPTIONS_ACTIVE, NULL))
runloop_ctl(RUNLOOP_CTL_UNSET_GAME_OPTIONS_ACTIVE, NULL);
runloop_system.core_options = NULL;
return true;
case RUNLOOP_CTL_KEY_EVENT_GET:

View File

@ -33,6 +33,7 @@ extern "C" {
typedef struct rarch_system_info
{
char title_buf[64];
char game_options_path[PATH_MAX_LENGTH];
struct retro_system_info info;