mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
use config_file_exists where applicable in per-game/per-core config
functions
This commit is contained in:
parent
6888a0cc71
commit
706a63fedf
@ -3165,7 +3165,6 @@ bool config_load_override(void)
|
|||||||
char *game_path = NULL;
|
char *game_path = NULL;
|
||||||
char *content_path = NULL;
|
char *content_path = NULL;
|
||||||
char *config_directory = NULL;
|
char *config_directory = NULL;
|
||||||
config_file_t *new_conf = NULL;
|
|
||||||
bool should_append = false;
|
bool should_append = false;
|
||||||
rarch_system_info_t *system = runloop_get_system_info();
|
rarch_system_info_t *system = runloop_get_system_info();
|
||||||
const char *core_name = system ?
|
const char *core_name = system ?
|
||||||
@ -3219,14 +3218,11 @@ bool config_load_override(void)
|
|||||||
|
|
||||||
/* per-core overrides */
|
/* per-core overrides */
|
||||||
/* Create a new config file from core_path */
|
/* Create a new config file from core_path */
|
||||||
new_conf = config_file_read(core_path);
|
if (config_file_exists(core_path))
|
||||||
|
|
||||||
if (new_conf)
|
|
||||||
{
|
{
|
||||||
RARCH_LOG("[Overrides] core-specific overrides found at %s.\n",
|
RARCH_LOG("[Overrides] core-specific overrides found at %s.\n",
|
||||||
core_path);
|
core_path);
|
||||||
|
|
||||||
config_file_free(new_conf);
|
|
||||||
path_set(RARCH_PATH_CONFIG_APPEND, core_path);
|
path_set(RARCH_PATH_CONFIG_APPEND, core_path);
|
||||||
|
|
||||||
should_append = true;
|
should_append = true;
|
||||||
@ -3237,16 +3233,12 @@ bool config_load_override(void)
|
|||||||
|
|
||||||
/* per-content-dir overrides */
|
/* per-content-dir overrides */
|
||||||
/* Create a new config file from content_path */
|
/* Create a new config file from content_path */
|
||||||
new_conf = config_file_read(content_path);
|
if (config_file_exists(content_path))
|
||||||
|
|
||||||
if (new_conf)
|
|
||||||
{
|
{
|
||||||
char *temp_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
char *temp_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||||
|
|
||||||
temp_path[0] = '\0';
|
temp_path[0] = '\0';
|
||||||
|
|
||||||
config_file_free(new_conf);
|
|
||||||
|
|
||||||
RARCH_LOG("[Overrides] content-dir-specific overrides found at %s.\n",
|
RARCH_LOG("[Overrides] content-dir-specific overrides found at %s.\n",
|
||||||
game_path);
|
game_path);
|
||||||
|
|
||||||
@ -3272,16 +3264,12 @@ bool config_load_override(void)
|
|||||||
|
|
||||||
/* per-game overrides */
|
/* per-game overrides */
|
||||||
/* Create a new config file from game_path */
|
/* Create a new config file from game_path */
|
||||||
new_conf = config_file_read(game_path);
|
if (config_file_exists(game_path))
|
||||||
|
|
||||||
if (new_conf)
|
|
||||||
{
|
{
|
||||||
char *temp_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
char *temp_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||||
|
|
||||||
temp_path[0] = '\0';
|
temp_path[0] = '\0';
|
||||||
|
|
||||||
config_file_free(new_conf);
|
|
||||||
|
|
||||||
RARCH_LOG("[Overrides] game-specific overrides found at %s.\n",
|
RARCH_LOG("[Overrides] game-specific overrides found at %s.\n",
|
||||||
game_path);
|
game_path);
|
||||||
|
|
||||||
@ -3394,11 +3382,11 @@ bool config_unload_override(void)
|
|||||||
bool config_load_remap(void)
|
bool config_load_remap(void)
|
||||||
{
|
{
|
||||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||||
|
config_file_t *new_conf = NULL;
|
||||||
char *remap_directory = NULL;
|
char *remap_directory = NULL;
|
||||||
char *core_path = NULL;
|
char *core_path = NULL;
|
||||||
char *game_path = NULL;
|
char *game_path = NULL;
|
||||||
char *content_path = NULL;
|
char *content_path = NULL;
|
||||||
config_file_t *new_conf = NULL;
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
rarch_system_info_t *system = runloop_get_system_info();
|
rarch_system_info_t *system = runloop_get_system_info();
|
||||||
const char *core_name = system ? system->info.library_name : NULL;
|
const char *core_name = system ? system->info.library_name : NULL;
|
||||||
@ -3406,10 +3394,6 @@ bool config_load_remap(void)
|
|||||||
const char *game_name = path_basename(rarch_path_basename);
|
const char *game_name = path_basename(rarch_path_basename);
|
||||||
char content_dir_name[PATH_MAX_LENGTH];
|
char content_dir_name[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
if (!string_is_empty(rarch_path_basename))
|
|
||||||
fill_pathname_parent_dir_name(content_dir_name,
|
|
||||||
rarch_path_basename, sizeof(content_dir_name));
|
|
||||||
|
|
||||||
if (string_is_empty(core_name) || string_is_empty(game_name))
|
if (string_is_empty(core_name) || string_is_empty(game_name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -3418,6 +3402,10 @@ bool config_load_remap(void)
|
|||||||
if (string_is_empty(settings->paths.directory_input_remapping))
|
if (string_is_empty(settings->paths.directory_input_remapping))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!string_is_empty(rarch_path_basename))
|
||||||
|
fill_pathname_parent_dir_name(content_dir_name,
|
||||||
|
rarch_path_basename, sizeof(content_dir_name));
|
||||||
|
|
||||||
/* path to the directory containing retroarch.cfg (prefix) */
|
/* path to the directory containing retroarch.cfg (prefix) */
|
||||||
remap_directory = (char*)
|
remap_directory = (char*)
|
||||||
malloc(PATH_MAX_LENGTH * sizeof(char));
|
malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||||
@ -3544,7 +3532,6 @@ static bool config_load_shader_preset_internal(
|
|||||||
const char *special_name)
|
const char *special_name)
|
||||||
{
|
{
|
||||||
unsigned idx;
|
unsigned idx;
|
||||||
config_file_t *new_conf = NULL;
|
|
||||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
char *shader_path = (char*)malloc(path_size);
|
char *shader_path = (char*)malloc(path_size);
|
||||||
@ -3563,8 +3550,7 @@ static bool config_load_shader_preset_internal(
|
|||||||
file_path_str((enum file_path_enum)(idx)),
|
file_path_str((enum file_path_enum)(idx)),
|
||||||
path_size);
|
path_size);
|
||||||
|
|
||||||
/* Create a new config file */
|
if (!config_file_exists(shader_path))
|
||||||
if (!(new_conf = config_file_read(shader_path)))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Shader preset exists, load it. */
|
/* Shader preset exists, load it. */
|
||||||
@ -3575,7 +3561,6 @@ static bool config_load_shader_preset_internal(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
config_file_free(new_conf);
|
|
||||||
free(shader_path);
|
free(shader_path);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user