Rename config_get/config_set functions

This commit is contained in:
twinaphex 2016-09-17 12:51:44 +02:00
parent 56d8be90ec
commit b89def5d8f
11 changed files with 44 additions and 47 deletions

View File

@ -1497,8 +1497,7 @@ static bool command_event_save_core_config(void)
}
/* Infer file name based on libretro core. */
if (!string_is_empty(config_get_active_core_path())
&& path_file_exists(config_get_active_core_path()))
if (!string_is_empty(path_get_core()) && path_file_exists(path_get_core()))
{
unsigned i;
RARCH_LOG("%s\n", msg_hash_to_str(MSG_USING_CORE_NAME_FOR_NEW_CONFIG));
@ -1510,7 +1509,7 @@ static bool command_event_save_core_config(void)
fill_pathname_base_noext(
config_name,
config_get_active_core_path(),
path_get_core(),
sizeof(config_name));
fill_pathname_join(config_path, config_dir, config_name,
@ -1601,7 +1600,7 @@ void command_event_save_current_config(int override_type)
&& !string_is_empty(global->path.config))
{
bool ret = false;
const char *config_path = config_get_active_path();
const char *config_path = path_get_config();
/* Save last core-specific config to the default config location,
* needed on consoles for core switching and reusing last good
@ -1883,14 +1882,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(config_get_active_core_path()))
if (string_is_empty(path_get_core()))
return false;
#endif
libretro_get_system_info(
config_get_active_core_path(),
path_get_core(),
system,
ptr);
info_find.path = config_get_active_core_path();
info_find.path = path_get_core();
if (!core_info_load(&info_find))
{

View File

@ -655,7 +655,7 @@ static int populate_settings_path(settings_t *settings, struct config_path_setti
#endif
#ifndef HAVE_DYNAMIC
SETTING_PATH("libretro_path",
config_get_active_core_path_ptr(), false, NULL, false);
path_get_core_ptr(), false, NULL, false);
#endif
SETTING_PATH(
"screenshot_directory",
@ -1868,7 +1868,7 @@ static bool config_load_file(const char *path, bool set_defaults,
#ifndef HAVE_DYNAMIC
if (config_get_path(conf, "libretro_path", tmp_str, sizeof(tmp_str)))
config_set_active_core_path(tmp_str);
path_set_core(tmp_str);
#endif
#ifdef RARCH_CONSOLE
@ -1991,12 +1991,12 @@ static bool config_load_file(const char *path, bool set_defaults,
}
/* Safe-guard against older behavior. */
if (path_is_directory(config_get_active_core_path()))
if (path_is_directory(path_get_core()))
{
RARCH_WARN("\"libretro_path\" is a directory, using this for \"libretro_directory\" instead.\n");
strlcpy(settings->directory.libretro, config_get_active_core_path(),
strlcpy(settings->directory.libretro, path_get_core(),
sizeof(settings->directory.libretro));
config_clear_active_core_path();
path_clear_core();
}
if (string_is_equal(settings->path.menu_wallpaper, "default"))
@ -2216,7 +2216,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, config_get_active_core_path(), sizeof(buf));
strlcpy(buf, path_get_core(), sizeof(buf));
/* Toggle has_save_path to false so it resets */
retroarch_override_setting_unset(RARCH_OVERRIDE_SETTING_STATE_PATH);
@ -2227,7 +2227,7 @@ bool config_load_override(void)
/* Restore the libretro_path we're using
* since it will be overwritten by the override when reloading. */
config_set_active_core_path(buf);
path_set_core(buf);
runloop_msg_queue_push("Configuration override loaded.", 1, 100, true);
/* Reset save paths. */
@ -3205,7 +3205,7 @@ bool config_replace(char *path)
rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL);
/* Load core in new config. */
config_clear_active_core_path();
path_clear_core();
if (!task_push_content_load_default(
NULL, NULL,

View File

@ -221,7 +221,7 @@ static void load_dynamic_core(void)
retroarch_fail(1, "init_libretro_sym()");
}
if (string_is_empty(config_get_active_core_path()))
if (string_is_empty(path_get_core()))
{
RARCH_ERR("RetroArch is built for dynamic libretro cores, but "
"libretro_path is not set. Cannot continue.\n");
@ -232,16 +232,16 @@ static void load_dynamic_core(void)
* saved to content history, and a relative path would
* break in that scenario. */
path_resolve_realpath(
config_get_active_core_path_ptr(),
config_get_active_core_path_size());
path_get_core_ptr(),
path_get_core_size());
RARCH_LOG("Loading dynamic libretro core from: \"%s\"\n",
config_get_active_core_path());
lib_handle = dylib_load(config_get_active_core_path());
path_get_core());
lib_handle = dylib_load(path_get_core());
if (!lib_handle)
{
RARCH_ERR("Failed to open libretro core: \"%s\"\n",
config_get_active_core_path());
path_get_core());
RARCH_ERR("Error(s): %s\n", dylib_error());
retroarch_fail(1, "load_dynamic()");
}
@ -1264,7 +1264,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
{
const char **path = (const char**)data;
#ifdef HAVE_DYNAMIC
*path = config_get_active_core_path();
*path = path_get_core();
#else
*path = NULL;
#endif

View File

@ -60,9 +60,7 @@ void main_exit(void *args)
#endif
frontend_driver_deinit(args);
frontend_driver_exitspawn(
config_get_active_core_path_ptr(),
config_get_active_core_path_size());
frontend_driver_exitspawn(path_get_core_ptr(), path_get_core_size());
rarch_ctl(RARCH_CTL_DESTROY, NULL);

View File

@ -2144,8 +2144,8 @@ static bool setting_append_list(
&group_info,
&subgroup_info,
parent_group);
(*list)[list_info->index - 1].size = config_get_active_core_path_size();
(*list)[list_info->index - 1].value.target.string = config_get_active_core_path_ptr();
(*list)[list_info->index - 1].size = path_get_core_size();
(*list)[list_info->index - 1].value.target.string = path_get_core_ptr();
(*list)[list_info->index - 1].values = ext_name;
menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_LOAD_CORE);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_BROWSER_ACTION);

View File

@ -53,7 +53,7 @@ void menu_shader_manager_init(void)
struct video_shader *shader = NULL;
config_file_t *conf = NULL;
settings_t *settings = config_get_ptr();
const char *config_path = config_get_active_path();
const char *config_path = path_get_config();
menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
&shader);

14
paths.c
View File

@ -415,37 +415,37 @@ void path_fill_names(void)
sizeof(global->name.ips));
}
char *config_get_active_core_path_ptr(void)
char *path_get_core_ptr(void)
{
return path_libretro;
}
const char *config_get_active_core_path(void)
const char *path_get_core(void)
{
return path_libretro;
}
bool config_active_core_path_is_empty(void)
bool path_is_core_empty(void)
{
return !path_libretro[0];
}
size_t config_get_active_core_path_size(void)
size_t path_get_core_size(void)
{
return sizeof(path_libretro);
}
void config_set_active_core_path(const char *path)
void path_set_core(const char *path)
{
strlcpy(path_libretro, path, sizeof(path_libretro));
}
void config_clear_active_core_path(void)
void path_clear_core(void)
{
*path_libretro = '\0';
}
const char *config_get_active_path(void)
const char *path_get_config(void)
{
global_t *global = global_get_ptr();

14
paths.h
View File

@ -35,19 +35,19 @@ void path_set_basename(const char *path);
const char *path_get_current_savefile_dir(void);
const char *config_get_active_path(void);
char *path_get_core_ptr(void);
const char *config_get_active_core_path(void);
const char *path_get_core(void);
char *config_get_active_core_path_ptr(void);
bool path_is_core_empty(void);
void config_set_active_core_path(const char *path);
size_t path_get_core_size(void);
void config_clear_active_core_path(void);
void path_set_core(const char *path);
bool config_active_core_path_is_empty(void);
void path_clear_core(void);
size_t config_get_active_core_path_size(void);
const char *path_get_config(void);
RETRO_END_DECLS

View File

@ -639,7 +639,7 @@ static void retroarch_parse_input(int argc, char *argv[])
case 'L':
if (path_is_directory(optarg))
{
config_clear_active_core_path();
path_clear_core();
strlcpy(settings->directory.libretro, optarg,
sizeof(settings->directory.libretro));

View File

@ -842,7 +842,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
const char *fullpath = (const char*)data;
if (!fullpath)
return false;
config_set_active_core_path(fullpath);
path_set_core(fullpath);
}
break;
case RUNLOOP_CTL_CLEAR_CONTENT_PATH:

View File

@ -1613,8 +1613,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(config_get_active_core_path()) ? NULL :
config_get_active_core_path();
wrap_args->libretro_path = string_is_empty(path_get_core()) ? NULL :
path_get_core();
}
#endif
@ -1717,7 +1717,7 @@ static bool task_load_content(content_ctx_info_t *content_info,
#endif
break;
default:
core_path = config_get_active_core_path();
core_path = path_get_core();
core_name = info->library_name;
break;
}