mirror of
https://github.com/libretro/RetroArch
synced 2025-02-26 06:40:39 +00:00
core-specific config files
This commit is contained in:
parent
63302e9404
commit
0a91c528f9
@ -347,6 +347,12 @@ static bool default_block_config_read = true;
|
||||
static bool default_block_config_read = false;
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
static bool default_core_specific_config = true;
|
||||
#else
|
||||
static bool default_core_specific_config = false;
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID)
|
||||
static const char *default_libretro_info_path = "/data/data/com.retroarch/info/";
|
||||
#elif defined(__QNX__)
|
||||
|
@ -284,7 +284,12 @@ void main_exit(args_type() args)
|
||||
menu_free();
|
||||
|
||||
if (g_extern.config_save_on_exit && *g_extern.config_path)
|
||||
{
|
||||
config_save_file(g_extern.config_path);
|
||||
|
||||
if (*g_extern.original_config_path && strcmp(g_extern.config_path, g_extern.original_config_path) != 0)
|
||||
config_save_file(g_extern.original_config_path);
|
||||
}
|
||||
#endif
|
||||
|
||||
rarch_main_deinit();
|
||||
|
@ -301,6 +301,8 @@ struct settings
|
||||
bool rgui_show_start_screen;
|
||||
#endif
|
||||
bool fps_show;
|
||||
|
||||
bool core_specific_config;
|
||||
};
|
||||
|
||||
enum rarch_game_type
|
||||
@ -650,6 +652,8 @@ struct global
|
||||
|
||||
bool libretro_no_rom;
|
||||
bool libretro_dummy;
|
||||
|
||||
char original_config_path[PATH_MAX];
|
||||
};
|
||||
|
||||
struct rarch_main_wrap
|
||||
|
34
settings.c
34
settings.c
@ -383,6 +383,8 @@ void config_set_defaults(void)
|
||||
g_settings.video.msg_pos_y = 0.90f;
|
||||
g_settings.video.aspect_ratio = -1.0f;
|
||||
|
||||
g_settings.core_specific_config = default_core_specific_config;
|
||||
|
||||
// g_extern
|
||||
strlcpy(g_extern.savefile_dir, default_paths.sram_dir, sizeof(g_extern.savefile_dir));
|
||||
g_extern.console.screen.gamma_correction = DEFAULT_GAMMA;
|
||||
@ -443,6 +445,36 @@ void config_load(void)
|
||||
config_set_defaults();
|
||||
parse_config_file();
|
||||
}
|
||||
|
||||
if (!*g_extern.original_config_path)
|
||||
{
|
||||
path_resolve_realpath(g_extern.config_path, sizeof(g_extern.config_path));
|
||||
strlcpy(g_extern.original_config_path, g_extern.config_path, sizeof(g_extern.original_config_path));
|
||||
|
||||
if (g_settings.core_specific_config && *g_settings.libretro)
|
||||
{
|
||||
char new_path[PATH_MAX];
|
||||
|
||||
if (*g_settings.rgui_config_directory)
|
||||
{
|
||||
path_resolve_realpath(g_settings.rgui_config_directory, sizeof(g_settings.rgui_config_directory));
|
||||
strlcpy(new_path, g_settings.rgui_config_directory, sizeof(new_path));
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(new_path, g_extern.config_path, sizeof(new_path));
|
||||
path_basedir(new_path);
|
||||
}
|
||||
|
||||
fill_pathname_dir(new_path, g_settings.libretro, ".cfg", sizeof(new_path));
|
||||
strlcpy(g_extern.config_path, new_path, sizeof(g_extern.config_path));
|
||||
|
||||
RARCH_LOG("Loading core-specific config from: %s.\n", g_extern.config_path);
|
||||
|
||||
if (!config_load_file(g_extern.config_path))
|
||||
RARCH_WARN("Core-specific config not found, reusing last config.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static config_file_t *open_default_config_file(void)
|
||||
@ -931,6 +963,8 @@ bool config_load_file(const char *path)
|
||||
|
||||
config_read_keybinds_conf(conf);
|
||||
|
||||
CONFIG_GET_BOOL(core_specific_config, "core_specific_config");
|
||||
|
||||
config_file_free(conf);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user