mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-21 02:08:16 +00:00
Create path_get
This commit is contained in:
parent
4e50b7d5be
commit
be81edad84
10
command.c
10
command.c
@ -1499,7 +1499,7 @@ static bool command_event_save_core_config(void)
|
||||
}
|
||||
|
||||
/* Infer file name based on libretro core. */
|
||||
if (!string_is_empty(path_get_core()) && path_file_exists(path_get_core()))
|
||||
if (!string_is_empty(path_get(RARCH_PATH_CORE)) && path_file_exists(path_get(RARCH_PATH_CORE)))
|
||||
{
|
||||
unsigned i;
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_USING_CORE_NAME_FOR_NEW_CONFIG));
|
||||
@ -1511,7 +1511,7 @@ static bool command_event_save_core_config(void)
|
||||
|
||||
fill_pathname_base_noext(
|
||||
config_name,
|
||||
path_get_core(),
|
||||
path_get(RARCH_PATH_CORE),
|
||||
sizeof(config_name));
|
||||
|
||||
fill_pathname_join(config_path, config_dir, config_name,
|
||||
@ -1842,14 +1842,14 @@ bool command_event(enum event_command cmd, void *data)
|
||||
core_info_ctx_find_t info_find;
|
||||
|
||||
#if defined(HAVE_DYNAMIC)
|
||||
if (string_is_empty(path_get_core()))
|
||||
if (string_is_empty(path_get(RARCH_PATH_CORE)))
|
||||
return false;
|
||||
#endif
|
||||
libretro_get_system_info(
|
||||
path_get_core(),
|
||||
path_get(RARCH_PATH_CORE),
|
||||
system,
|
||||
ptr);
|
||||
info_find.path = path_get_core();
|
||||
info_find.path = path_get(RARCH_PATH_CORE);
|
||||
|
||||
if (!core_info_load(&info_find))
|
||||
{
|
||||
|
@ -2049,10 +2049,10 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
}
|
||||
|
||||
/* Safe-guard against older behavior. */
|
||||
if (path_is_directory(path_get_core()))
|
||||
if (path_is_directory(path_get(RARCH_PATH_CORE)))
|
||||
{
|
||||
RARCH_WARN("\"libretro_path\" is a directory, using this for \"libretro_directory\" instead.\n");
|
||||
strlcpy(settings->directory.libretro, path_get_core(),
|
||||
strlcpy(settings->directory.libretro, path_get(RARCH_PATH_CORE),
|
||||
sizeof(settings->directory.libretro));
|
||||
path_clear_core();
|
||||
}
|
||||
@ -2283,7 +2283,7 @@ bool config_load_override(void)
|
||||
|
||||
/* Store the libretro_path we're using since it will be
|
||||
* overwritten by the override when reloading. */
|
||||
strlcpy(buf, path_get_core(), sizeof(buf));
|
||||
strlcpy(buf, path_get(RARCH_PATH_CORE), sizeof(buf));
|
||||
|
||||
/* Toggle has_save_path to false so it resets */
|
||||
retroarch_override_setting_unset(RARCH_OVERRIDE_SETTING_STATE_PATH);
|
||||
|
10
dynamic.c
10
dynamic.c
@ -222,7 +222,7 @@ static void load_dynamic_core(void)
|
||||
retroarch_fail(1, "init_libretro_sym()");
|
||||
}
|
||||
|
||||
if (string_is_empty(path_get_core()))
|
||||
if (string_is_empty(path_get(RARCH_PATH_CORE)))
|
||||
{
|
||||
RARCH_ERR("RetroArch is built for dynamic libretro cores, but "
|
||||
"libretro_path is not set. Cannot continue.\n");
|
||||
@ -237,12 +237,12 @@ static void load_dynamic_core(void)
|
||||
path_get_core_size());
|
||||
|
||||
RARCH_LOG("Loading dynamic libretro core from: \"%s\"\n",
|
||||
path_get_core());
|
||||
lib_handle = dylib_load(path_get_core());
|
||||
path_get(RARCH_PATH_CORE));
|
||||
lib_handle = dylib_load(path_get(RARCH_PATH_CORE));
|
||||
if (!lib_handle)
|
||||
{
|
||||
RARCH_ERR("Failed to open libretro core: \"%s\"\n",
|
||||
path_get_core());
|
||||
path_get(RARCH_PATH_CORE));
|
||||
RARCH_ERR("Error(s): %s\n", dylib_error());
|
||||
retroarch_fail(1, "load_dynamic()");
|
||||
}
|
||||
@ -1265,7 +1265,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||
{
|
||||
const char **path = (const char**)data;
|
||||
#ifdef HAVE_DYNAMIC
|
||||
*path = path_get_core();
|
||||
*path = path_get(RARCH_PATH_CORE);
|
||||
#else
|
||||
*path = NULL;
|
||||
#endif
|
||||
|
@ -302,7 +302,7 @@ static int win32_drag_query_file(HWND hwnd, WPARAM wparam)
|
||||
if(!string_is_equal(info->systemname, current_core->systemname))
|
||||
break;
|
||||
|
||||
if(string_is_equal(path_get_core(), info->path))
|
||||
if(string_is_equal(path_get(RARCH_PATH_CORE), info->path))
|
||||
{
|
||||
/* Our previous core supports the current rom */
|
||||
content_ctx_info_t content_info = {0};
|
||||
|
20
paths.c
20
paths.c
@ -318,7 +318,7 @@ static bool path_init_subsystem(void)
|
||||
info = libretro_find_subsystem_info(
|
||||
system->subsystem.data,
|
||||
system->subsystem.size,
|
||||
path_get_subsystem());
|
||||
path_get(RARCH_PATH_SUBSYSTEM));
|
||||
|
||||
/* We'll handle this error gracefully later. */
|
||||
|
||||
@ -468,11 +468,6 @@ void path_fill_names(void)
|
||||
|
||||
/* Core file path */
|
||||
|
||||
const char *path_get_subsystem(void)
|
||||
{
|
||||
return subsystem_path;
|
||||
}
|
||||
|
||||
const char *path_get_basename(void)
|
||||
{
|
||||
return path_main_basename;
|
||||
@ -483,9 +478,20 @@ char *path_get_core_ptr(void)
|
||||
return path_libretro;
|
||||
}
|
||||
|
||||
const char *path_get_core(void)
|
||||
const char *path_get(enum rarch_path_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case RARCH_PATH_SUBSYSTEM:
|
||||
return subsystem_path;
|
||||
case RARCH_PATH_CORE:
|
||||
return path_libretro;
|
||||
default:
|
||||
case RARCH_PATH_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool path_is_core_empty(void)
|
||||
|
5
paths.h
5
paths.h
@ -55,6 +55,7 @@ void path_fill_names(void);
|
||||
|
||||
/* set functions */
|
||||
|
||||
|
||||
bool path_set(enum rarch_path_type type, const char *path);
|
||||
|
||||
void path_set_redirect(void);
|
||||
@ -79,7 +80,7 @@ struct string_list *path_get_subsystem_list(void);
|
||||
|
||||
/* get functions */
|
||||
|
||||
const char *path_get_subsystem(void);
|
||||
const char *path_get(enum rarch_path_type type);
|
||||
|
||||
bool path_get_content(char **fullpath);
|
||||
|
||||
@ -87,8 +88,6 @@ const char *path_get_current_savefile_dir(void);
|
||||
|
||||
const char *path_get_basename(void);
|
||||
|
||||
const char *path_get_core(void);
|
||||
|
||||
const char *path_get_core_options(void);
|
||||
|
||||
const char *path_get_config(void);
|
||||
|
@ -601,13 +601,13 @@ static const struct retro_subsystem_info *init_content_file_subsystem(bool *ret)
|
||||
if (system)
|
||||
special =
|
||||
libretro_find_subsystem_info(system->subsystem.data,
|
||||
system->subsystem.size, path_get_subsystem());
|
||||
system->subsystem.size, path_get(RARCH_PATH_SUBSYSTEM));
|
||||
|
||||
if (!special)
|
||||
{
|
||||
RARCH_ERR(
|
||||
"Failed to find subsystem \"%s\" in libretro implementation.\n",
|
||||
path_get_subsystem());
|
||||
path_get(RARCH_PATH_SUBSYSTEM));
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -848,8 +848,8 @@ static void menu_content_environment_get(int *argc, char *argv[],
|
||||
if (fullpath && *fullpath)
|
||||
wrap_args->content_path = fullpath;
|
||||
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_LIBRETRO))
|
||||
wrap_args->libretro_path = string_is_empty(path_get_core()) ? NULL :
|
||||
path_get_core();
|
||||
wrap_args->libretro_path = string_is_empty(path_get(RARCH_PATH_CORE)) ? NULL :
|
||||
path_get(RARCH_PATH_CORE);
|
||||
|
||||
}
|
||||
#endif
|
||||
@ -952,7 +952,7 @@ static bool task_load_content(content_ctx_info_t *content_info,
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
core_path = path_get_core();
|
||||
core_path = path_get(RARCH_PATH_CORE);
|
||||
core_name = info->library_name;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user