Create retroarch_set_pathnames

This commit is contained in:
twinaphex 2016-05-11 04:32:29 +02:00
parent 030513bcee
commit 7ebfe1b66d
3 changed files with 22 additions and 18 deletions

View File

@ -870,7 +870,7 @@ static bool command_event_disk_control_append_image(const char *path)
* If we actually use append_image, we assume that we
* started out in a single disk case, and that this way
* of doing it makes the most sense. */
rarch_ctl(RARCH_CTL_SET_PATHS, (void*)path);
retroarch_set_pathnames(path);
retroarch_fill_pathnames();
}

View File

@ -1040,7 +1040,7 @@ static void retroarch_parse_input(int argc, char *argv[])
{
/* We requested explicit ROM, so use PLAIN core type. */
current_core_type = CORE_TYPE_PLAIN;
rarch_ctl(RARCH_CTL_SET_PATHS, (void*)argv[optind]);
retroarch_set_pathnames((const char*)argv[optind]);
}
else if (*global->subsystem && optind < argc)
{
@ -1340,20 +1340,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
switch(state)
{
case RARCH_CTL_SET_PATHS:
retroarch_set_basename((const char*)data);
if (!global->has_set.save_path)
fill_pathname_noext(global->name.savefile, global->name.base,
".srm", sizeof(global->name.savefile));
if (!global->has_set.state_path)
fill_pathname_noext(global->name.savestate, global->name.base,
".state", sizeof(global->name.savestate));
fill_pathname_noext(global->name.cheatfile, global->name.base,
".cht", sizeof(global->name.cheatfile));
retroarch_set_paths_redirect((const char*)data);
break;
case RARCH_CTL_IS_PLAIN_CORE:
return (current_core_type == CORE_TYPE_PLAIN);
case RARCH_CTL_IS_DUMMY_CORE:
@ -1556,6 +1542,24 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
return true;
}
void retroarch_set_pathnames(const char *path)
{
global_t *global = global_get_ptr();
retroarch_set_basename(path);
if (!global->has_set.save_path)
fill_pathname_noext(global->name.savefile, global->name.base,
".srm", sizeof(global->name.savefile));
if (!global->has_set.state_path)
fill_pathname_noext(global->name.savestate, global->name.base,
".state", sizeof(global->name.savestate));
fill_pathname_noext(global->name.cheatfile, global->name.base,
".cht", sizeof(global->name.cheatfile));
retroarch_set_paths_redirect(path);
}
void retroarch_fill_pathnames(void)
{
global_t *global = global_get_ptr();

View File

@ -101,8 +101,6 @@ enum rarch_ctl_state
RARCH_CTL_SET_SRAM_ENABLE,
RARCH_CTL_SET_PATHS,
RARCH_CTL_SET_FORCE_FULLSCREEN,
RARCH_CTL_UNSET_FORCE_FULLSCREEN,
@ -169,6 +167,8 @@ const char *retroarch_get_current_savefile_dir(void);
bool retroarch_validate_game_options(char *s, size_t len, bool mkdir);
void retroarch_set_pathnames(const char *path);
void retroarch_fill_pathnames(void);
/**