mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Move code from retroarch.c to runloop.c
This commit is contained in:
parent
2b87cd9313
commit
9982452c18
67
retroarch.c
67
retroarch.c
@ -863,43 +863,6 @@ void retroarch_path_set_redirect(settings_t *settings)
|
||||
dir_set(RARCH_DIR_CURRENT_SAVESTATE, new_savestate_dir);
|
||||
}
|
||||
|
||||
static void runloop_path_set_basename(runloop_state_t *runloop_st,
|
||||
const char *path)
|
||||
{
|
||||
char *dst = NULL;
|
||||
|
||||
path_set(RARCH_PATH_CONTENT, path);
|
||||
path_set(RARCH_PATH_BASENAME, path);
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
/* Removing extension is a bit tricky for compressed files.
|
||||
* Basename means:
|
||||
* /file/to/path/game.extension should be:
|
||||
* /file/to/path/game
|
||||
*
|
||||
* Two things to consider here are: /file/to/path/ is expected
|
||||
* to be a directory and "game" is a single file. This is used for
|
||||
* states and srm default paths.
|
||||
*
|
||||
* For compressed files we have:
|
||||
*
|
||||
* /file/to/path/comp.7z#game.extension and
|
||||
* /file/to/path/comp.7z#folder/game.extension
|
||||
*
|
||||
* The choice I take here is:
|
||||
* /file/to/path/game as basename. We might end up in a writable
|
||||
* directory then and the name of srm and states are meaningful.
|
||||
*
|
||||
*/
|
||||
path_basedir_wrapper(runloop_st->runtime_content_path_basename);
|
||||
if (!string_is_empty(runloop_st->runtime_content_path_basename))
|
||||
fill_pathname_dir(runloop_st->runtime_content_path_basename, path, "", sizeof(runloop_st->runtime_content_path_basename));
|
||||
#endif
|
||||
|
||||
if ((dst = strrchr(runloop_st->runtime_content_path_basename, '.')))
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
void path_set_special(char **argv, unsigned num_content)
|
||||
{
|
||||
unsigned i;
|
||||
@ -912,7 +875,7 @@ void path_set_special(char **argv, unsigned num_content)
|
||||
|
||||
|
||||
/* First content file is the significant one. */
|
||||
runloop_path_set_basename(runloop_st, argv[0]);
|
||||
runloop_path_set_basename(argv[0]);
|
||||
|
||||
string_list_initialize(&subsystem_paths);
|
||||
|
||||
@ -1060,28 +1023,6 @@ size_t path_get_realsize(enum rarch_path_type type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void runloop_path_set_names(runloop_state_t *runloop_st)
|
||||
{
|
||||
if (!retroarch_override_setting_is_set(
|
||||
RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
|
||||
fill_pathname_noext(runloop_st->name.savefile,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
".srm", sizeof(runloop_st->name.savefile));
|
||||
|
||||
if (!retroarch_override_setting_is_set(
|
||||
RARCH_OVERRIDE_SETTING_STATE_PATH, NULL))
|
||||
fill_pathname_noext(runloop_st->name.savestate,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
".state", sizeof(runloop_st->name.savestate));
|
||||
|
||||
#ifdef HAVE_CHEATS
|
||||
if (!string_is_empty(runloop_st->runtime_content_path_basename))
|
||||
fill_pathname_noext(runloop_st->name.cheatfile,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
".cht", sizeof(runloop_st->name.cheatfile));
|
||||
#endif
|
||||
}
|
||||
|
||||
bool path_set(enum rarch_path_type type, const char *path)
|
||||
{
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
@ -1097,8 +1038,8 @@ bool path_set(enum rarch_path_type type, const char *path)
|
||||
sizeof(runloop_st->runtime_content_path_basename));
|
||||
break;
|
||||
case RARCH_PATH_NAMES:
|
||||
runloop_path_set_basename(runloop_st, path);
|
||||
runloop_path_set_names(runloop_st);
|
||||
runloop_path_set_basename(path);
|
||||
runloop_path_set_names();
|
||||
retroarch_path_set_redirect(config_get_ptr());
|
||||
break;
|
||||
case RARCH_PATH_CORE:
|
||||
@ -5429,7 +5370,7 @@ bool retroarch_main_init(int argc, char *argv[])
|
||||
if (!string_is_empty(recording_st->path))
|
||||
command_event(CMD_EVENT_RECORD_INIT, NULL);
|
||||
|
||||
runloop_path_init_savefile(runloop_st);
|
||||
runloop_path_init_savefile();
|
||||
|
||||
command_event(CMD_EVENT_SET_PER_GAME_RESOLUTION, NULL);
|
||||
|
||||
|
63
runloop.c
63
runloop.c
@ -5731,8 +5731,9 @@ void runloop_path_fill_names(void)
|
||||
}
|
||||
|
||||
|
||||
void runloop_path_init_savefile(runloop_state_t *runloop_st)
|
||||
void runloop_path_init_savefile(void)
|
||||
{
|
||||
runloop_state_t *runloop_st = &runloop_state;
|
||||
bool should_sram_be_used = runloop_st->use_sram
|
||||
&& !runloop_st->is_sram_save_disabled;
|
||||
|
||||
@ -9411,3 +9412,63 @@ char* crt_switch_core_name(void)
|
||||
{
|
||||
return (char*)runloop_state.system.info.library_name;
|
||||
}
|
||||
|
||||
void runloop_path_set_basename(const char *path)
|
||||
{
|
||||
runloop_state_t *runloop_st = &runloop_state;
|
||||
char *dst = NULL;
|
||||
|
||||
path_set(RARCH_PATH_CONTENT, path);
|
||||
path_set(RARCH_PATH_BASENAME, path);
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
/* Removing extension is a bit tricky for compressed files.
|
||||
* Basename means:
|
||||
* /file/to/path/game.extension should be:
|
||||
* /file/to/path/game
|
||||
*
|
||||
* Two things to consider here are: /file/to/path/ is expected
|
||||
* to be a directory and "game" is a single file. This is used for
|
||||
* states and srm default paths.
|
||||
*
|
||||
* For compressed files we have:
|
||||
*
|
||||
* /file/to/path/comp.7z#game.extension and
|
||||
* /file/to/path/comp.7z#folder/game.extension
|
||||
*
|
||||
* The choice I take here is:
|
||||
* /file/to/path/game as basename. We might end up in a writable
|
||||
* directory then and the name of srm and states are meaningful.
|
||||
*
|
||||
*/
|
||||
path_basedir_wrapper(runloop_st->runtime_content_path_basename);
|
||||
if (!string_is_empty(runloop_st->runtime_content_path_basename))
|
||||
fill_pathname_dir(runloop_st->runtime_content_path_basename, path, "", sizeof(runloop_st->runtime_content_path_basename));
|
||||
#endif
|
||||
|
||||
if ((dst = strrchr(runloop_st->runtime_content_path_basename, '.')))
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
void runloop_path_set_names(void)
|
||||
{
|
||||
runloop_state_t *runloop_st = &runloop_state;
|
||||
if (!retroarch_override_setting_is_set(
|
||||
RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL))
|
||||
fill_pathname_noext(runloop_st->name.savefile,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
".srm", sizeof(runloop_st->name.savefile));
|
||||
|
||||
if (!retroarch_override_setting_is_set(
|
||||
RARCH_OVERRIDE_SETTING_STATE_PATH, NULL))
|
||||
fill_pathname_noext(runloop_st->name.savestate,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
".state", sizeof(runloop_st->name.savestate));
|
||||
|
||||
#ifdef HAVE_CHEATS
|
||||
if (!string_is_empty(runloop_st->runtime_content_path_basename))
|
||||
fill_pathname_noext(runloop_st->name.cheatfile,
|
||||
runloop_st->runtime_content_path_basename,
|
||||
".cht", sizeof(runloop_st->name.cheatfile));
|
||||
#endif
|
||||
}
|
||||
|
@ -437,7 +437,13 @@ void runloop_msg_queue_deinit(void);
|
||||
|
||||
void runloop_msg_queue_init(void);
|
||||
|
||||
void runloop_path_init_savefile(runloop_state_t *runloop_st);
|
||||
void runloop_path_init_savefile(void);
|
||||
|
||||
void runloop_path_set_basename(const char *path);
|
||||
|
||||
void runloop_path_init_savefile(void);
|
||||
|
||||
void runloop_path_set_names(void);
|
||||
|
||||
runloop_state_t *runloop_state_get_ptr(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user