From f060811ae8d22c76304b057e1028e9e36fa4f197 Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 18:47:58 -0500 Subject: [PATCH 01/12] Add options to save remap files according to the autoload convention --- menu/menu_entries_cbs_deferred_push.c | 8 +++-- menu/menu_entries_cbs_ok.c | 51 +++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index db98446b22..8998694d7d 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -1417,10 +1417,14 @@ static int deferred_push_core_input_remapping_options(void *data, void *userdata return -1; menu_list_clear(list); - menu_list_push(list, "Remap File Load", "remap_file_load", + menu_list_push(list, "Load Remap File", "remap_file_load", MENU_SETTING_ACTION, 0); - menu_list_push(list, "Remap File Save As", + menu_list_push(list, "Save Remap File As", "remap_file_save_as", MENU_SETTING_ACTION, 0); + menu_list_push(list, "Save Core Remap File", + "remap_file_save_core", MENU_SETTING_ACTION, 0); + menu_list_push(list, "Save Game Remap File", + "remap_file_save_game", MENU_SETTING_ACTION, 0); for (p = 0; p < settings->input.max_users; p++) { diff --git a/menu/menu_entries_cbs_ok.c b/menu/menu_entries_cbs_ok.c index af2606aab9..47422bf870 100644 --- a/menu/menu_entries_cbs_ok.c +++ b/menu/menu_entries_cbs_ok.c @@ -508,6 +508,53 @@ static int action_ok_remap_file_save_as(const char *path, return 0; } +static int action_ok_remap_file_save_core(const char *path, + const char *label, unsigned type, size_t idx) +{ + global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); + + const char *core_name; + core_name = global->system.info.library_name; + + char directory[PATH_MAX_LENGTH]; + char file[PATH_MAX_LENGTH]; + + fill_pathname_join(directory,settings->input_remapping_directory,core_name,PATH_MAX_LENGTH); + fill_pathname_join(file,core_name,core_name,PATH_MAX_LENGTH); + + if(!path_file_exists(directory)) + path_mkdir(directory); + + input_remapping_save_file(file); + return 0; +} + +static int action_ok_remap_file_save_game(const char *path, + const char *label, unsigned type, size_t idx) +{ + global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); + + const char *core_name; + core_name = global->system.info.library_name; + + const char *game_name; + game_name = path_basename(global->basename); + + char directory[PATH_MAX_LENGTH]; + char file[PATH_MAX_LENGTH]; + + fill_pathname_join(directory,settings->input_remapping_directory,core_name,PATH_MAX_LENGTH); + fill_pathname_join(file,core_name,game_name,PATH_MAX_LENGTH); + + if(!path_file_exists(directory)) + path_mkdir(directory); + + input_remapping_save_file(file); + return 0; +} + static int action_ok_path_use_directory(const char *path, const char *label, unsigned type, size_t idx) { @@ -1265,6 +1312,10 @@ void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, cbs->action_ok = action_ok_cheat_file_save_as; else if (!strcmp(label, "remap_file_save_as")) cbs->action_ok = action_ok_remap_file_save_as; + else if (!strcmp(label, "remap_file_save_core")) + cbs->action_ok = action_ok_remap_file_save_core; + else if (!strcmp(label, "remap_file_save_game")) + cbs->action_ok = action_ok_remap_file_save_game; else if (!strcmp(label, "core_list")) cbs->action_ok = action_ok_core_list; else if (!strcmp(label, "disk_image_append")) From 507ec172618f54e32f3e50fcc4db32b3e44c7f05 Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 19:54:58 -0500 Subject: [PATCH 02/12] make the override function smarter, now it will return true if overrides have loaded and false otherwise (including on error) move pretro_set_environment(rarch_environment_cb); further down since it wouldn't have achieved the desired effect in that location added a function to restore the original configuration when unloading the core so overrides won't affect the main config --- configuration.c | 42 ++++++++++++++++++++++++++++-------------- configuration.h | 2 ++ retroarch.c | 27 +++++++++++++++++++++------ runloop.h | 2 ++ 4 files changed, 53 insertions(+), 20 deletions(-) diff --git a/configuration.c b/configuration.c index 6eee97756a..30ed007428 100644 --- a/configuration.c +++ b/configuration.c @@ -1651,12 +1651,13 @@ bool config_load_override(void) core_path[PATH_MAX_LENGTH], /* final path for core-specific configuration (prefix+suffix) */ game_path[PATH_MAX_LENGTH]; /* final path for game-specific configuration (prefix+suffix) */ const char *core_name, *game_name; /* suffix */ + global_t *global = global_get_ptr(); /* global pointer */ settings_t *settings = config_get_ptr(); /* config pointer */ //early return in case a library isn't loaded if(!global->system.info.library_name || !strcmp(global->system.info.library_name,"No Core")) - return true; + return false; RARCH_LOG("Game name: %s\n",global->basename); RARCH_LOG("Core name: %s\n",global->system.info.library_name); @@ -1675,17 +1676,15 @@ bool config_load_override(void) else { RARCH_WARN("No config directory set under Settings > Path and retroarch.cfg not found.\n"); - return true; + return false; } RARCH_LOG("Config directory: %s\n", config_directory); - /* Core name: core_name - * i.e. Mupen64plus */ + // core name: core_name core_name = global->system.info.library_name; game_name = path_basename(global->basename); - /* ROM basename: game_name - * no extension or leading directory i.e. "Super Mario 64 (USA)" */ + // content basename: game_name game_name = path_basename(global->basename); /* Concat strings into full paths: core_path, game_path */ @@ -1705,12 +1704,12 @@ bool config_load_override(void) /* Append core-specific */ if (new_conf) { - RARCH_LOG("Core-specific configuration found at %s. Appending.\n", core_path); + RARCH_LOG("Core-specific overrides found at %s. Appending.\n", core_path); strlcpy(global->append_config_path, core_path, sizeof(global->append_config_path)); should_append = true; } else - RARCH_LOG("No core-specific configuration found at %s.\n", core_path); + RARCH_LOG("No core-specific overrides found at %s.\n", core_path); new_conf = NULL; @@ -1720,6 +1719,7 @@ bool config_load_override(void) /* Append game-specific */ if (new_conf) { + RARCH_LOG("Game-specific overrides found at %s. Appending.\n", game_path); if(should_append) { strlcat(global->append_config_path, "|", sizeof(global->append_config_path)); @@ -1727,20 +1727,34 @@ bool config_load_override(void) } else strlcpy(global->append_config_path, game_path, sizeof(global->append_config_path)); - RARCH_LOG("Game-specific configuration found at %s. Appending.\n", game_path); - + should_append = true; } else - RARCH_LOG("No game-specific configuration found at %s.\n", game_path); + RARCH_LOG("No game-specific overrides found at %s.\n", game_path); if(should_append) { - if(!config_load_file(global->config_path, false)) - return false; + if(config_load_file(global->config_path, false)) + return true; } - return true; /* only means no errors were caught */ + return false; +} + +bool core_unload_override(void) +{ + global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); + + *global->append_config_path = NULL; + if(config_load_file(global->config_path, false)) + { + RARCH_LOG("Configuration overrides unloaded, original configuration reset\n"); + return true; + } + else + return false; } /** diff --git a/configuration.h b/configuration.h index 2cda21494c..5a87f107d8 100644 --- a/configuration.h +++ b/configuration.h @@ -412,6 +412,8 @@ void config_load(void); */ bool config_load_override(void); +bool config_unload_override(void); + /** * config_load_remap: * diff --git a/retroarch.c b/retroarch.c index 96949622f5..db79751d10 100644 --- a/retroarch.c +++ b/retroarch.c @@ -415,6 +415,8 @@ static void parse_input(int argc, char *argv[]) *global->bps_name = '\0'; *global->ips_name = '\0'; *global->subsystem = '\0'; + + global->overrides_active = false; if (argc < 2) { @@ -1842,12 +1844,23 @@ static void init_system_av_info(void) static void deinit_core(bool reinit) { + + global_t *global = global_get_ptr(); + pretro_unload_game(); pretro_deinit(); if (reinit) rarch_main_command(RARCH_CMD_DRIVERS_DEINIT); + + + if(global->overrides_active) + { + core_unload_override(); + pretro_set_environment(rarch_environment_cb); + } + uninit_libretro_sym(); } @@ -1884,13 +1897,15 @@ static bool init_content(void) static bool init_core(void) { driver_t *driver = driver_get_ptr(); - global_t *global = global_get_ptr(); - - //needs testing for regressions - pretro_set_environment(rarch_environment_cb); + global_t *global = global_get_ptr(); - if (!config_load_override()) - RARCH_ERR("Error loading override files\n"); + if (config_load_override()) + global->overrides_active = true; + else + global->overrides_active = false; + + pretro_set_environment(rarch_environment_cb); + if (!config_load_remap()) RARCH_ERR("Error loading remap files\n"); diff --git a/runloop.h b/runloop.h index acccac7c5c..f094430b91 100644 --- a/runloop.h +++ b/runloop.h @@ -143,6 +143,8 @@ typedef struct global bool has_set_ups_pref; bool has_set_bps_pref; bool has_set_ips_pref; + + bool overrides_active; /* Config associated with global "default" config. */ char config_path[PATH_MAX_LENGTH]; From 1dd32a8da4dabdce69277b0c4b4c6a074e4cbcb8 Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 19:58:57 -0500 Subject: [PATCH 03/12] style cleanups --- configuration.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/configuration.c b/configuration.c index 30ed007428..56fb20d8a6 100644 --- a/configuration.c +++ b/configuration.c @@ -1651,7 +1651,7 @@ bool config_load_override(void) core_path[PATH_MAX_LENGTH], /* final path for core-specific configuration (prefix+suffix) */ game_path[PATH_MAX_LENGTH]; /* final path for game-specific configuration (prefix+suffix) */ const char *core_name, *game_name; /* suffix */ - + global_t *global = global_get_ptr(); /* global pointer */ settings_t *settings = config_get_ptr(); /* config pointer */ @@ -1719,7 +1719,7 @@ bool config_load_override(void) /* Append game-specific */ if (new_conf) { - RARCH_LOG("Game-specific overrides found at %s. Appending.\n", game_path); + RARCH_LOG("Game-specific overrides found at %s. Appending.\n", game_path); if(should_append) { strlcat(global->append_config_path, "|", sizeof(global->append_config_path)); @@ -1727,7 +1727,7 @@ bool config_load_override(void) } else strlcpy(global->append_config_path, game_path, sizeof(global->append_config_path)); - + should_append = true; } else @@ -1746,15 +1746,15 @@ bool core_unload_override(void) { global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); - + *global->append_config_path = NULL; - if(config_load_file(global->config_path, false)) + if (config_load_file(global->config_path, false)) { RARCH_LOG("Configuration overrides unloaded, original configuration reset\n"); - return true; - } + return true; + } else - return false; + return false; } /** From 931c818038530d6e70f5c7758144f6f1e7372f7a Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 20:07:44 -0500 Subject: [PATCH 04/12] clean up comments for core_load_override --- configuration.c | 10 +++++++++- configuration.h | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/configuration.c b/configuration.c index 56fb20d8a6..7d3022873c 100644 --- a/configuration.c +++ b/configuration.c @@ -1742,7 +1742,15 @@ bool config_load_override(void) return false; } -bool core_unload_override(void) +/** + * config_unload_override: + * + * Unloads configuration overrides if overrides are active. + * + * + * Returns: false if there was an error. + */ + bool core_unload_override(void) { global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); diff --git a/configuration.h b/configuration.h index 5a87f107d8..bddced4a04 100644 --- a/configuration.h +++ b/configuration.h @@ -412,6 +412,14 @@ void config_load(void); */ bool config_load_override(void); +/** + * config_unload_override: + * + * Unloads configuration overrides if overrides are active. + * + * + * Returns: false if there was an error. + */ bool config_unload_override(void); /** From 1293122826c3646e1c93108803b34d53a6cffaec Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 20:16:00 -0500 Subject: [PATCH 05/12] override and remap function comment cleanup made the remap function return true/false depending on what has been done --- configuration.c | 65 ++++++++++++++++++++++--------------------------- configuration.h | 4 +-- 2 files changed, 31 insertions(+), 38 deletions(-) diff --git a/configuration.c b/configuration.c index 7d3022873c..b470df838b 100644 --- a/configuration.c +++ b/configuration.c @@ -1642,7 +1642,7 @@ static void config_load_core_specific(void) * 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 or no action was performed. * */ bool config_load_override(void) @@ -1652,8 +1652,8 @@ bool config_load_override(void) game_path[PATH_MAX_LENGTH]; /* final path for game-specific configuration (prefix+suffix) */ const char *core_name, *game_name; /* suffix */ - global_t *global = global_get_ptr(); /* global pointer */ - settings_t *settings = config_get_ptr(); /* config pointer */ + global_t *global = global_get_ptr(); + settings_t *settings = config_get_ptr(); //early return in case a library isn't loaded if(!global->system.info.library_name || !strcmp(global->system.info.library_name,"No Core")) @@ -1668,10 +1668,11 @@ bool config_load_override(void) return false; } - /* Config directory: config_directory. */ - if (settings->menu_config_directory) /* Try RGUI path setting first */ + // Config directory: config_directory. + // Try config directory setting first, fallback to the location of the current configuration file + if (settings->menu_config_directory) strlcpy(config_directory, settings->menu_config_directory, PATH_MAX_LENGTH); - else if (global->config_path) /* If that setting is default, use the directory that retroarch.cfg is in */ + else if (global->config_path) fill_pathname_basedir(config_directory, global->config_path, PATH_MAX_LENGTH); else { @@ -1680,14 +1681,10 @@ bool config_load_override(void) } RARCH_LOG("Config directory: %s\n", config_directory); - // core name: core_name core_name = global->system.info.library_name; game_name = path_basename(global->basename); - // content basename: game_name - game_name = path_basename(global->basename); - - /* Concat strings into full paths: core_path, game_path */ + // Concatenate strings into full paths for core_path, game_path fill_pathname_join(core_path, config_directory, core_name, PATH_MAX_LENGTH); fill_pathname_join(core_path, core_path, core_name, PATH_MAX_LENGTH); strlcat(core_path, ".cfg", PATH_MAX_LENGTH); @@ -1696,12 +1693,12 @@ bool config_load_override(void) fill_pathname_join(game_path, game_path, game_name, PATH_MAX_LENGTH); strlcat(game_path, ".cfg", PATH_MAX_LENGTH); - /* Create a new config file from core_path */ + // Create a new config file from core_path config_file_t *new_conf = config_file_new(core_path); bool should_append = false; - /* Append core-specific */ + // If a core override exists, add it's location to append_config_path if (new_conf) { RARCH_LOG("Core-specific overrides found at %s. Appending.\n", core_path); @@ -1713,10 +1710,10 @@ bool config_load_override(void) new_conf = NULL; - /* Create a new config file from game_path */ + // Create a new config file from game_path new_conf = config_file_new(game_path); - /* Append game-specific */ + // If a game override exists, add it's location to append_config_path if (new_conf) { RARCH_LOG("Game-specific overrides found at %s. Appending.\n", game_path); @@ -1733,6 +1730,7 @@ bool config_load_override(void) else RARCH_LOG("No game-specific overrides found at %s.\n", game_path); + // Re-load the configuration with any overrides that might have been found if(should_append) { if(config_load_file(global->config_path, false)) @@ -1776,7 +1774,7 @@ bool config_load_override(void) * core-specific: $REMAP_DIR/$CORE_NAME/$CORE_NAME.cfg * game-specific: $REMAP_DIR/$CORE_NAME/$GAME_NAME.cfg * - * Returns: false if there was an error. + * Returns: false if there was an error or no action was performed. */ bool config_load_remap(void) { @@ -1789,31 +1787,26 @@ bool config_load_remap(void) //early return in case a library isn't loaded or remapping is disabled if(!global->system.info.library_name || !strcmp(global->system.info.library_name,"No Core")) - return true; + return false; RARCH_LOG("Game name: %s\n",global->basename); RARCH_LOG("Core name: %s\n",global->system.info.library_name); - /* Config directory: remap_directory. */ - if (settings->input_remapping_directory) /* Try config file path setting first */ + // Remap directory: remap_directory. + // Try remap directory setting, no fallbacks defined + if (settings->input_remapping_directory) strlcpy(remap_directory, settings->input_remapping_directory, PATH_MAX_LENGTH); else { RARCH_WARN("No remap directory set.\n"); - return true; + return false; } RARCH_LOG("Remap directory: %s\n", remap_directory); - /* Core name: core_name - * i.e. Mupen64plus */ core_name = global->system.info.library_name; game_name = path_basename(global->basename); - /* ROM basename: game_name - * no extension or leading directory i.e. "Super Mario 64 (USA)" */ - game_name = path_basename(global->basename); - - /* Concat strings into full paths: core_path, game_path */ + // Concatenate strings into full paths for core_path, game_path fill_pathname_join(core_path, remap_directory, core_name, PATH_MAX_LENGTH); fill_pathname_join(core_path, core_path, core_name, PATH_MAX_LENGTH); strlcat(core_path, ".rmp", PATH_MAX_LENGTH); @@ -1822,35 +1815,35 @@ bool config_load_remap(void) fill_pathname_join(game_path, game_path, game_name, PATH_MAX_LENGTH); strlcat(game_path, ".rmp", PATH_MAX_LENGTH); - /* Create a new config file from core_path */ +// Create a new config file from core_path config_file_t *new_conf = config_file_new(core_path); - /* Append core-specific */ + // If a core remap file exists, load it if (new_conf) { RARCH_LOG("Core-specific remap found at %s. Loading.\n", core_path); - if(!input_remapping_load_file(core_path)) - return false; + if(input_remapping_load_file(core_path)) + return true; } else RARCH_LOG("No core-specific remap found at %s.\n", core_path); new_conf = NULL; - /* Create a new config file from game_path */ + // Create a new config file from game_path new_conf = config_file_new(game_path); - /* Append game-specific */ + // If a game remap file exists, load it if (new_conf) { RARCH_LOG("Game-specific remap found at %s. Appending.\n", game_path); - if(!input_remapping_load_file(game_path)) - return false; + if(input_remapping_load_file(game_path)) + return true; } else RARCH_LOG("No game-specific remap found at %s.\n", game_path); - return true; /* only means no errors were caught */ + return false; } static void parse_config_file(void) diff --git a/configuration.h b/configuration.h index bddced4a04..051fdb96d2 100644 --- a/configuration.h +++ b/configuration.h @@ -407,7 +407,7 @@ void config_load(void); * These settings will always have precedence, thus this feature * can be used to enforce overrides. * - * Returns: false if there was an error. + * Returns: false if there was an error or no action was performed. * */ bool config_load_override(void); @@ -427,7 +427,7 @@ bool config_unload_override(void); * * Tries to append game-specific and core-specific remap files. * - * Returns: false if there was an error. + * Returns: false if there was an error or no action was performed. * */ bool config_load_remap(void); From 45040cd29b383d4f11600cdb8ac652c561b30afd Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 20:22:33 -0500 Subject: [PATCH 06/12] fix some warnings --- configuration.c | 4 ++-- retroarch.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configuration.c b/configuration.c index b470df838b..8e3544a253 100644 --- a/configuration.c +++ b/configuration.c @@ -1748,12 +1748,12 @@ bool config_load_override(void) * * Returns: false if there was an error. */ - bool core_unload_override(void) + bool config_unload_override(void) { global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); - *global->append_config_path = NULL; + *global->append_config_path = '\0'; if (config_load_file(global->config_path, false)) { RARCH_LOG("Configuration overrides unloaded, original configuration reset\n"); diff --git a/retroarch.c b/retroarch.c index db79751d10..cb562399e7 100644 --- a/retroarch.c +++ b/retroarch.c @@ -24,6 +24,7 @@ #include "libretro_version_1.h" #include "dynamic.h" #include "content.h" +#include "configuration.h" #include #include #include "general.h" @@ -1857,7 +1858,7 @@ static void deinit_core(bool reinit) if(global->overrides_active) { - core_unload_override(); + config_unload_override(); pretro_set_environment(rarch_environment_cb); } @@ -1906,8 +1907,7 @@ static bool init_core(void) pretro_set_environment(rarch_environment_cb); - if (!config_load_remap()) - RARCH_ERR("Error loading remap files\n"); + config_load_remap(); verify_api_version(); pretro_init(); From b83f9f8811518c2dfcbca6613386e8c3e590db3d Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 20:30:47 -0500 Subject: [PATCH 07/12] game remaps should take precedence over core remaps --- configuration.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/configuration.c b/configuration.c index 8e3544a253..1ed1e108ff 100644 --- a/configuration.c +++ b/configuration.c @@ -1815,8 +1815,23 @@ bool config_load_remap(void) fill_pathname_join(game_path, game_path, game_name, PATH_MAX_LENGTH); strlcat(game_path, ".rmp", PATH_MAX_LENGTH); -// Create a new config file from core_path - config_file_t *new_conf = config_file_new(core_path); + // Create a new config file from game_path + config_file_t * new_conf = config_file_new(game_path); + + // If a game remap file exists, load it + if (new_conf) + { + RARCH_LOG("Game-specific remap found at %s. Appending.\n", game_path); + if(input_remapping_load_file(game_path)) + return true; + } + else + RARCH_LOG("No game-specific remap found at %s.\n", game_path); + + new_conf = NULL; + + // Create a new config file from core_path + new_conf = config_file_new(core_path); // If a core remap file exists, load it if (new_conf) @@ -1830,19 +1845,6 @@ bool config_load_remap(void) new_conf = NULL; - // Create a new config file from game_path - new_conf = config_file_new(game_path); - - // If a game remap file exists, load it - if (new_conf) - { - RARCH_LOG("Game-specific remap found at %s. Appending.\n", game_path); - if(input_remapping_load_file(game_path)) - return true; - } - else - RARCH_LOG("No game-specific remap found at %s.\n", game_path); - return false; } From 4030a5d53a340ffa77ae81cbd93241e2fbf0d3e6 Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 20:35:37 -0500 Subject: [PATCH 08/12] enable saving for core options --- configuration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/configuration.c b/configuration.c index 1ed1e108ff..840e8de9c8 100644 --- a/configuration.c +++ b/configuration.c @@ -2124,6 +2124,7 @@ bool config_save_file(const char *path) config_set_path(conf, "libretro_path", settings->libretro); config_set_path(conf, "libretro_directory", settings->libretro_directory); config_set_path(conf, "libretro_info_path", settings->libretro_info_path); + config_set_path(conf, "core_options_path", settings->core_options_path); config_set_path(conf, "content_database_path", settings->content_database); config_set_path(conf, "cheat_database_path", settings->cheat_database); config_set_path(conf, "cursor_directory", settings->cursor_directory); From 70a54e6fcb252510b0aa37a1ad75546a0ab3544a Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 21:54:59 -0500 Subject: [PATCH 09/12] make sure remap path is cleared if an auto remap file is not found --- configuration.c | 15 ++++++++++++--- dynamic.c | 1 - retroarch.c | 10 +++++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/configuration.c b/configuration.c index 840e8de9c8..9c429f4de5 100644 --- a/configuration.c +++ b/configuration.c @@ -1753,7 +1753,7 @@ bool config_load_override(void) global_t *global = global_get_ptr(); settings_t *settings = config_get_ptr(); - *global->append_config_path = '\0'; + *global->append_config_path = NULL; if (config_load_file(global->config_path, false)) { RARCH_LOG("Configuration overrides unloaded, original configuration reset\n"); @@ -1825,8 +1825,12 @@ bool config_load_remap(void) if(input_remapping_load_file(game_path)) return true; } - else - RARCH_LOG("No game-specific remap found at %s.\n", game_path); + else + { + RARCH_LOG("No core-specific remap found at %s.\n", core_path); + *settings->input.remapping_path= '\0'; + input_remapping_set_defaults(); + } new_conf = NULL; @@ -1841,7 +1845,12 @@ bool config_load_remap(void) return true; } else + { RARCH_LOG("No core-specific remap found at %s.\n", core_path); + *settings->input.remapping_path= '\0'; + input_remapping_set_defaults(); + } + new_conf = NULL; diff --git a/dynamic.c b/dynamic.c index db4f0b746f..7c4b0d287d 100644 --- a/dynamic.c +++ b/dynamic.c @@ -664,7 +664,6 @@ bool rarch_environment_cb(unsigned cmd, void *data) if (global->system.core_options) { - core_option_flush(global->system.core_options); core_option_free(global->system.core_options); } diff --git a/retroarch.c b/retroarch.c index cb562399e7..04572fc4ae 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1853,15 +1853,15 @@ static void deinit_core(bool reinit) if (reinit) rarch_main_command(RARCH_CMD_DRIVERS_DEINIT); - + if(global->system.core_options) + core_option_flush(global->system.core_options); if(global->overrides_active) - { - config_unload_override(); - pretro_set_environment(rarch_environment_cb); + { + config_unload_override(); } - + pretro_set_environment(rarch_environment_cb); uninit_libretro_sym(); } From e71940ff341aee98b66eb5d0ac6c597789bc69d5 Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 22:31:07 -0500 Subject: [PATCH 10/12] revert saving the core_options_path since it was causing a lot of incosistencies --- configuration.c | 2 -- retroarch.c | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/configuration.c b/configuration.c index 9c429f4de5..540d21a618 100644 --- a/configuration.c +++ b/configuration.c @@ -2130,10 +2130,8 @@ bool config_save_file(const char *path) config_set_bool(conf, "fps_show", settings->fps_show); config_set_bool(conf, "ui_menubar_enable", settings->ui.menubar_enable); config_set_bool(conf, "suspend_screensaver_enable", settings->ui.suspend_screensaver_enable); - config_set_path(conf, "libretro_path", settings->libretro); config_set_path(conf, "libretro_directory", settings->libretro_directory); config_set_path(conf, "libretro_info_path", settings->libretro_info_path); - config_set_path(conf, "core_options_path", settings->core_options_path); config_set_path(conf, "content_database_path", settings->content_database); config_set_path(conf, "cheat_database_path", settings->cheat_database); config_set_path(conf, "cursor_directory", settings->cursor_directory); diff --git a/retroarch.c b/retroarch.c index 04572fc4ae..7c97c37433 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1859,7 +1859,8 @@ static void deinit_core(bool reinit) if(global->overrides_active) { - config_unload_override(); + config_unload_override(); + global->overrides_active = false; } pretro_set_environment(rarch_environment_cb); uninit_libretro_sym(); From 948449823296601450f130a1c242cf7e70ab1715 Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 22:37:26 -0500 Subject: [PATCH 11/12] revert this since it's not needed --- dynamic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dynamic.c b/dynamic.c index 7c4b0d287d..db4f0b746f 100644 --- a/dynamic.c +++ b/dynamic.c @@ -664,6 +664,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) if (global->system.core_options) { + core_option_flush(global->system.core_options); core_option_free(global->system.core_options); } From 3dc163f8855d8df27b4eda4a13bdb5ca9b4adfa3 Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 6 Apr 2015 22:41:33 -0500 Subject: [PATCH 12/12] revert this since it's not needed --- retroarch.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/retroarch.c b/retroarch.c index 7c97c37433..71ddcd819c 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1853,10 +1853,7 @@ static void deinit_core(bool reinit) if (reinit) rarch_main_command(RARCH_CMD_DRIVERS_DEINIT); - - if(global->system.core_options) - core_option_flush(global->system.core_options); - + if(global->overrides_active) { config_unload_override();