Refactor rarch_fill_pathnames

This commit is contained in:
twinaphex 2015-09-27 02:18:45 +02:00
parent 767a866573
commit a842a490f9
3 changed files with 23 additions and 27 deletions

View File

@ -368,7 +368,7 @@ void event_disk_control_append_image(const char *path)
* started out in a single disk case, and that this way
* of doing it makes the most sense. */
rarch_set_paths(path);
rarch_fill_pathnames();
rarch_ctl(RARCH_ACTION_STATE_FILL_PATHNAMES, NULL);
}
event_command(EVENT_CMD_AUTOSAVE_INIT);
@ -691,7 +691,7 @@ static bool event_init_content(void)
return true;
if (!global->inited.core.no_content)
rarch_fill_pathnames();
rarch_ctl(RARCH_ACTION_STATE_FILL_PATHNAMES, NULL);
if (!init_content_file())
return false;

View File

@ -999,28 +999,6 @@ static void rarch_init_savefile_paths(void)
}
}
void rarch_fill_pathnames(void)
{
global_t *global = global_get_ptr();
rarch_init_savefile_paths();
strlcpy(global->bsv.movie_path, global->name.savefile,
sizeof(global->bsv.movie_path));
if (!*global->name.base)
return;
if (!*global->name.ups)
fill_pathname_noext(global->name.ups, global->name.base, ".ups",
sizeof(global->name.ups));
if (!*global->name.bps)
fill_pathname_noext(global->name.bps, global->name.base, ".bps",
sizeof(global->name.bps));
if (!*global->name.ips)
fill_pathname_noext(global->name.ips, global->name.base, ".ips",
sizeof(global->name.ips));
}
static bool init_state(void)
{
driver_t *driver = driver_get_ptr();
@ -1432,6 +1410,24 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
if (pretro_api_version() != RETRO_API_VERSION)
RARCH_WARN("%s\n", msg_hash_to_str(MSG_LIBRETRO_ABI_BREAK));
break;
case RARCH_ACTION_STATE_FILL_PATHNAMES:
rarch_init_savefile_paths();
strlcpy(global->bsv.movie_path, global->name.savefile,
sizeof(global->bsv.movie_path));
if (!*global->name.base)
return false;
if (!*global->name.ups)
fill_pathname_noext(global->name.ups, global->name.base, ".ups",
sizeof(global->name.ups));
if (!*global->name.bps)
fill_pathname_noext(global->name.bps, global->name.base, ".bps",
sizeof(global->name.bps));
if (!*global->name.ips)
fill_pathname_noext(global->name.ips, global->name.base, ".ips",
sizeof(global->name.ips));
break;
case RARCH_ACTION_STATE_NONE:
default:
return false;

View File

@ -91,7 +91,9 @@ enum rarch_ctl_state
* Make sure we haven't compiled for something we cannot run.
* Ideally, code would get swapped out depending on CPU support,
* but this will do for now. */
RARCH_ACTION_STATE_VALIDATE_CPU_FEATURES
RARCH_ACTION_STATE_VALIDATE_CPU_FEATURES,
RARCH_ACTION_STATE_FILL_PATHNAMES
};
enum rarch_content_type
@ -189,8 +191,6 @@ int rarch_defer_core(core_info_list_t *data,
const char *dir, const char *path, const char *menu_label,
char *s, size_t len);
void rarch_fill_pathnames(void);
/**
* rarch_init_system_av_info:
*