Create RARCH_CTL_SET_PATHS

This commit is contained in:
twinaphex 2016-01-29 11:00:01 +01:00
parent 4456cb85f6
commit 912b62dca9
3 changed files with 18 additions and 21 deletions

View File

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

View File

@ -524,23 +524,6 @@ static void set_paths_redirect(const char *path)
} }
} }
void rarch_set_paths(const char *path)
{
global_t *global = global_get_ptr();
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));
set_paths_redirect(path);
}
enum rarch_content_type rarch_path_is_media_type(const char *path) enum rarch_content_type rarch_path_is_media_type(const char *path)
@ -1013,7 +996,7 @@ static void parse_input(int argc, char *argv[])
} }
} }
else if (!*global->subsystem && optind < argc) else if (!*global->subsystem && optind < argc)
rarch_set_paths(argv[optind]); rarch_ctl(RARCH_CTL_SET_PATHS, (void*)argv[optind]);
else if (*global->subsystem && optind < argc) else if (*global->subsystem && optind < argc)
set_special_paths(argv + optind, argc - optind); set_special_paths(argv + optind, argc - optind);
else else
@ -1306,6 +1289,20 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
switch(state) switch(state)
{ {
case RARCH_CTL_SET_PATHS:
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));
set_paths_redirect((const char*)data);
break;
case RARCH_CTL_IS_PLAIN_CORE: case RARCH_CTL_IS_PLAIN_CORE:
return (current_core_type == CORE_TYPE_PLAIN); return (current_core_type == CORE_TYPE_PLAIN);
case RARCH_CTL_IS_DUMMY_CORE: case RARCH_CTL_IS_DUMMY_CORE:

View File

@ -106,6 +106,8 @@ enum rarch_ctl_state
RARCH_CTL_SET_SRAM_ENABLE, RARCH_CTL_SET_SRAM_ENABLE,
RARCH_CTL_SET_PATHS,
RARCH_CTL_SET_FORCE_FULLSCREEN, RARCH_CTL_SET_FORCE_FULLSCREEN,
RARCH_CTL_UNSET_FORCE_FULLSCREEN, RARCH_CTL_UNSET_FORCE_FULLSCREEN,
@ -173,8 +175,6 @@ int rarch_main_init(int argc, char *argv[]);
**/ **/
void rarch_main_deinit(void); void rarch_main_deinit(void);
void rarch_set_paths(const char *path);
int rarch_info_get_capabilities(enum rarch_capabilities type, int rarch_info_get_capabilities(enum rarch_capabilities type,
char *s, size_t len); char *s, size_t len);