From f92aecd28b1ddb83349fa7871bd095cde1e6b21c Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 5 Apr 2015 13:52:43 -0500 Subject: [PATCH] Overrides: - renamed the function to something more suitable and cleaned up the comments a bit - moved back !global->system.info.library_name check, this shouldn't return false, this is not an error but an early return condition --- configuration.c | 21 ++++++++++----------- configuration.h | 12 +++++++++++- retroarch.c | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/configuration.c b/configuration.c index 66ea28dc49..9466297889 100644 --- a/configuration.c +++ b/configuration.c @@ -1630,27 +1630,22 @@ static void config_load_core_specific(void) } /** - * config_append_specific: + * config_load_override: * * Tries to append game-specific and core-specific configuration. * These settings will always have precedence, thus this feature * can be used to enforce overrides. * - * Let $RETROARCH_CFG be the directory that contains retroarch.cfg, - * $CORE_NAME be the name of the libretro core library in use and - * $ROM_NAME the basename of the ROM (without the extension and - * directory). - * * This function only has an effect if a game-specific or core-specific * configuration file exists at respective locations. * - * core-specific: $RETROARCH_CFG/$CORE_NAME/$CORE_NAME.cfg - * game-specific: $RETROARCH_CFG/$CORE_NAME/$ROM_NAME.cfg + * core-specific: $CONFIG_DIR/$CORE_NAME/$CORE_NAME.cfg fallback: $CURRENT_CFG_LOCATION/$CORE_NAME/$CORE_NAME.cfg + * game-specific: $CONFIG_DIR/$CORE_NAME/$ROM_NAME.cfg fallback: $CURRENT_CFG_LOCATION/$CORE_NAME/$GAME_NAME.cfg * - * Returns: False if there was an error. + * Returns: false if there was an error. * */ -bool config_append_specific(void) +bool config_load_override(void) { char config_directory[PATH_MAX_LENGTH], /* path to the directory containing retroarch.cfg (prefix) */ core_path[PATH_MAX_LENGTH], /* final path for core-specific configuration (prefix+suffix) */ @@ -1662,7 +1657,11 @@ bool config_append_specific(void) RARCH_LOG("Game name: %s\n",global->basename); RARCH_LOG("Core name: %s\n",global->system.info.library_name); - if (!global || !settings || !global->system.info.library_name) + //early return in case a library isn't loaded + if(!global->system.info.library_name) + return true; + + if (!global || !settings ) { RARCH_ERR("Could not obtain global pointer or configuration file pointer to retrieve path of retroarch.cfg.\n"); return false; diff --git a/configuration.h b/configuration.h index 33c84cb38f..9c489cfcf8 100644 --- a/configuration.h +++ b/configuration.h @@ -400,7 +400,17 @@ const char *config_get_default_menu(void); */ void config_load(void); -bool config_append_specific(void); +/** + * config_load_override: + * + * Tries to append game-specific and core-specific configuration. + * These settings will always have precedence, thus this feature + * can be used to enforce overrides. + * + * Returns: false if there was an error. + * + */ +bool config_load_override(void); /** * config_save_keybinds_file: diff --git a/retroarch.c b/retroarch.c index 5555af4d4e..0ca5946b64 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1886,7 +1886,7 @@ static bool init_core(void) driver_t *driver = driver_get_ptr(); global_t *global = global_get_ptr(); - config_append_specific(); + config_load_override(); verify_api_version(); pretro_init();