Move game_options_path to paths

This commit is contained in:
twinaphex 2016-03-02 05:29:12 +01:00
parent 1b1b59692b
commit 5dfc3f31db
4 changed files with 27 additions and 23 deletions

View File

@ -1547,7 +1547,6 @@ static int action_ok_option_create(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
char game_path[PATH_MAX_LENGTH];
rarch_system_info_t *system = NULL;
config_file_t *conf = NULL;
if (!rarch_game_options_validate(game_path, sizeof(game_path), true))
@ -1566,13 +1565,15 @@ static int action_ok_option_create(const char *path,
return false;
}
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if(config_file_write(conf, game_path))
{
global_t *global = global_get_ptr();
runloop_msg_queue_push("Core options file created successfully",
1, 100, true);
strlcpy(system->game_options_path, game_path, sizeof(system->game_options_path));
strlcpy(global->path.core_options_path,
game_path, sizeof(global->path.core_options_path));
}
config_file_free(conf);

View File

@ -1081,26 +1081,29 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
}
break;
case RUNLOOP_CTL_CORE_OPTIONS_DEINIT:
if (!runloop_system.core_options)
return false;
/* 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';
global_t *global = global_get_ptr();
if (!global || !runloop_system.core_options)
return false;
/* check if game options file was just created and flush
to that file instead */
if(!string_is_empty(global->path.core_options_path))
{
core_option_flush_game_specific(runloop_system.core_options,
global->path.core_options_path);
global->path.core_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;
}
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;
break;
case RUNLOOP_CTL_KEY_EVENT_GET:
{

View File

@ -161,6 +161,7 @@ typedef struct rarch_path
#endif
/* Config file associated with per-core configs. */
char core_specific_config[PATH_MAX_LENGTH];
char core_options_path[PATH_MAX_LENGTH];
} rarch_path_t;
typedef struct rarch_resolution

View File

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