mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 15:40:28 +00:00
(configuration.c) Cleanups
This commit is contained in:
parent
e24f58361c
commit
8a258d2511
@ -610,10 +610,6 @@ static int populate_settings_path(settings_t *settings, struct config_path_setti
|
||||
SETTING_PATH("netplay_password", settings->netplay.password, false, NULL, true);
|
||||
SETTING_PATH("netplay_spectate_password", settings->netplay.spectate_password, false, NULL, true);
|
||||
#endif
|
||||
SETTING_PATH("recording_output_directory",
|
||||
global->record.output_dir, false, NULL, true);
|
||||
SETTING_PATH("recording_config_directory",
|
||||
global->record.config_dir, false, NULL, true);
|
||||
SETTING_PATH("libretro_directory",
|
||||
settings->directory.libretro, false, NULL, false);
|
||||
SETTING_PATH("core_options_path",
|
||||
@ -698,6 +694,14 @@ static int populate_settings_path(settings_t *settings, struct config_path_setti
|
||||
"screenshot_directory",
|
||||
settings->directory.screenshot, true, NULL, false);
|
||||
|
||||
if (global)
|
||||
{
|
||||
SETTING_PATH("recording_output_directory",
|
||||
global->record.output_dir, false, NULL, true);
|
||||
SETTING_PATH("recording_config_directory",
|
||||
global->record.config_dir, false, NULL, true);
|
||||
}
|
||||
|
||||
*out =
|
||||
(struct config_path_setting*) malloc(count * sizeof(struct config_path_setting));
|
||||
memcpy(*out, tmp, sizeof(struct config_path_setting) * count);
|
||||
@ -745,7 +749,6 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti
|
||||
SETTING_BOOL("video_force_aspect", &settings->video.force_aspect, true, force_aspect, false);
|
||||
SETTING_BOOL("video_threaded", &settings->video.threaded, true, video_threaded, false);
|
||||
SETTING_BOOL("video_shared_context", &settings->video.shared_context, true, video_shared_context, false);
|
||||
SETTING_BOOL("custom_bgm_enable", &global->console.sound.system_bgm_enable, true, false, false);
|
||||
SETTING_BOOL("auto_screenshot_filename", &settings->auto_screenshot_filename, true, auto_screenshot_filename, false);
|
||||
SETTING_BOOL("video_force_srgb_disable", &settings->video.force_srgb_disable, true, false, false);
|
||||
SETTING_BOOL("video_fullscreen", &settings->video.fullscreen, true, fullscreen, false);
|
||||
@ -848,6 +851,11 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti
|
||||
SETTING_BOOL("input_autodetect_enable", &settings->input.autodetect_enable, true, input_autodetect_enable, false);
|
||||
SETTING_BOOL("audio_rate_control", &settings->audio.rate_control, true, rate_control, false);
|
||||
|
||||
if (global)
|
||||
{
|
||||
SETTING_BOOL("custom_bgm_enable", &global->console.sound.system_bgm_enable, true, false, false);
|
||||
}
|
||||
|
||||
*out =
|
||||
(struct config_bool_setting*) malloc(count *sizeof(struct config_bool_setting));
|
||||
memcpy(*out, tmp, sizeof(struct config_bool_setting) * count);
|
||||
@ -997,24 +1005,39 @@ static void config_set_defaults(void)
|
||||
unsigned bool_settings_size = populate_settings_bool (settings, &bool_settings);
|
||||
int int_settings_size = populate_settings_int (settings, &int_settings);
|
||||
|
||||
if (bool_settings && (bool_settings_size > 0))
|
||||
{
|
||||
for (i = 0; i < (unsigned)bool_settings_size; i++)
|
||||
{
|
||||
if (bool_settings[i].def_enable)
|
||||
*bool_settings[i].ptr = bool_settings[i].def;
|
||||
}
|
||||
|
||||
free(bool_settings);
|
||||
}
|
||||
|
||||
if (int_settings && (int_settings_size > 0))
|
||||
{
|
||||
for (i = 0; i < (unsigned)int_settings_size; i++)
|
||||
{
|
||||
if (int_settings[i].def_enable)
|
||||
*int_settings[i].ptr = int_settings[i].def;
|
||||
}
|
||||
|
||||
free(int_settings);
|
||||
}
|
||||
|
||||
if (float_settings && (float_settings_size > 0))
|
||||
{
|
||||
for (i = 0; i < (unsigned)float_settings_size; i++)
|
||||
{
|
||||
if (float_settings[i].def_enable)
|
||||
*float_settings[i].ptr = float_settings[i].def;
|
||||
}
|
||||
|
||||
free(float_settings);
|
||||
}
|
||||
|
||||
if (def_camera)
|
||||
strlcpy(settings->camera.driver,
|
||||
def_camera, sizeof(settings->camera.driver));
|
||||
@ -1197,9 +1220,13 @@ static void config_set_defaults(void)
|
||||
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (global)
|
||||
{
|
||||
*global->record.output_dir = '\0';
|
||||
*global->record.config_dir = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
*settings->path.core_options = '\0';
|
||||
*settings->path.content_history = '\0';
|
||||
@ -1351,13 +1378,6 @@ static void config_set_defaults(void)
|
||||
#ifdef HAVE_MENU
|
||||
first_initialized = false;
|
||||
#endif
|
||||
|
||||
if (bool_settings)
|
||||
free(bool_settings);
|
||||
if (float_settings)
|
||||
free(float_settings);
|
||||
if (int_settings)
|
||||
free(int_settings);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1732,7 +1752,6 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
#ifdef HAVE_NETWORKING
|
||||
char *override_netplay_ip_address = NULL;
|
||||
#endif
|
||||
global_t *global = global_get_ptr();
|
||||
int bool_settings_size = populate_settings_bool (settings, &bool_settings);
|
||||
int float_settings_size = populate_settings_float (settings, &float_settings);
|
||||
int int_settings_size = populate_settings_int (settings, &int_settings);
|
||||
@ -2132,8 +2151,12 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
|
||||
else if (path_is_directory(tmp_str))
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
dir_set(RARCH_DIR_SAVEFILE, tmp_str);
|
||||
|
||||
if (global)
|
||||
{
|
||||
strlcpy(global->name.savefile, tmp_str,
|
||||
sizeof(global->name.savefile));
|
||||
fill_pathname_dir(global->name.savefile,
|
||||
@ -2141,6 +2164,7 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
file_path_str(FILE_PATH_SRM_EXTENSION),
|
||||
sizeof(global->name.savefile));
|
||||
}
|
||||
}
|
||||
else
|
||||
RARCH_WARN("savefile_directory is not a directory, ignoring ...\n");
|
||||
}
|
||||
@ -2152,8 +2176,12 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
dir_set(RARCH_DIR_SAVESTATE, g_defaults.dir.savestate);
|
||||
else if (path_is_directory(tmp_str))
|
||||
{
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
dir_set(RARCH_DIR_SAVESTATE, tmp_str);
|
||||
|
||||
if (global)
|
||||
{
|
||||
strlcpy(global->name.savestate, tmp_str,
|
||||
sizeof(global->name.savestate));
|
||||
fill_pathname_dir(global->name.savestate,
|
||||
@ -2161,6 +2189,7 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||
file_path_str(FILE_PATH_STATE_EXTENSION),
|
||||
sizeof(global->name.savestate));
|
||||
}
|
||||
}
|
||||
else
|
||||
RARCH_WARN("savestate_directory is not a directory, ignoring ...\n");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user