Don't call config_set_bool, call config_set_string directly

This commit is contained in:
libretroadmin 2022-07-18 01:59:32 +02:00
parent 71eb74d256
commit 8f37c2e3c2
3 changed files with 47 additions and 25 deletions

View file

@ -211,8 +211,15 @@ bool cheat_manager_save(
config_set_string(conf, desc_key, cheat_st->cheats[i].code);
config_set_string(conf, code_key, cheat_st->cheats[i].code);
config_set_bool(conf, enable_key, cheat_st->cheats[i].state);
config_set_bool(conf, endian_key, cheat_st->cheats[i].big_endian);
config_set_string(conf, enable_key,
cheat_st->cheats[i].state
? "true"
: "false");
config_set_string(conf, endian_key,
cheat_st->cheats[i].big_endian
? "true"
: "false"
);
data_ptrs[0] = &cheat_st->cheats[i].handler;
data_ptrs[1] = &cheat_st->cheats[i].memory_search_size;

View file

@ -3092,7 +3092,7 @@ static config_file_t *open_default_config_file(void)
* safely use config_save_on_exit. */
fill_pathname_resolve_relative(conf_path, app_path,
FILE_PATH_MAIN_CONFIG, sizeof(conf_path));
config_set_bool(conf, "config_save_on_exit", true);
config_set_string(conf, "config_save_on_exit", "true");
saved = config_file_write(conf, conf_path, true);
}
@ -3127,7 +3127,7 @@ static config_file_t *open_default_config_file(void)
if (conf)
{
config_set_bool(conf, "config_save_on_exit", true);
config_set_string(conf, "config_save_on_exit", "true");
saved = config_file_write(conf, conf_path, true);
}
@ -3200,7 +3200,7 @@ static config_file_t *open_default_config_file(void)
{
/* Since this is a clean config file, we can
* safely use config_save_on_exit. */
config_set_bool(conf, "config_save_on_exit", true);
config_set_string(conf, "config_save_on_exit", "true");
saved = config_file_write(conf, conf_path, true);
}
@ -4208,10 +4208,14 @@ static void video_driver_save_settings(global_t *global, config_file_t *conf)
{
config_set_int(conf, "gamma_correction",
global->console.screen.gamma_correction);
config_set_bool(conf, "flicker_filter_enable",
global->console.flickerfilter_enable);
config_set_bool(conf, "soft_filter_enable",
global->console.softfilter_enable);
config_set_string(conf, "flicker_filter_enable",
global->console.flickerfilter_enable
? "true"
: "false");
config_set_string(conf, "soft_filter_enable",
global->console.softfilter_enable
? "true"
: "false");
config_set_int(conf, "soft_filter_index",
global->console.screen.soft_filter_index);
@ -4736,8 +4740,9 @@ bool config_save_file(const char *path)
for (i = 0; i < (unsigned)bool_settings_size; i++)
if (!bool_settings[i].override ||
!retroarch_override_setting_is_set(bool_settings[i].override, NULL))
config_set_bool(conf, bool_settings[i].ident,
*bool_settings[i].ptr);
config_set_string(conf, bool_settings[i].ident,
*bool_settings[i].ptr
? "true" : "false");
free(bool_settings);
}
@ -4750,16 +4755,19 @@ bool config_save_file(const char *path)
tmp[0] = '\0';
snprintf(tmp, sizeof(tmp), "network_remote_enable_user_p%u", i + 1);
config_set_bool(conf, tmp, settings->bools.network_remote_enable_user[i]);
config_set_string(conf, tmp,
settings->bools.network_remote_enable_user[i]
? "true" : "false");
}
#endif
/* Verbosity isn't in bool_settings since it needs to be loaded differently */
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_VERBOSITY, NULL))
config_set_bool(conf, "log_verbosity",
verbosity_is_enabled());
config_set_bool(conf, "perfcnt_enable",
retroarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL));
config_set_string(conf, "log_verbosity",
verbosity_is_enabled() ? "true" : "false");
config_set_string(conf, "perfcnt_enable",
retroarch_ctl(RARCH_CTL_IS_PERFCNT_ENABLE, NULL)
? "true" : "false");
msg_color = (((int)(settings->floats.video_msg_color_r * 255.0f) & 0xff) << 16) +
(((int)(settings->floats.video_msg_color_g * 255.0f) & 0xff) << 8) +
@ -4919,8 +4927,8 @@ bool config_save_overrides(enum override_type type, void *data)
for (i = 0; i < (unsigned)bool_settings_size; i++)
{
if ((*bool_settings[i].ptr) != (*bool_overrides[i].ptr))
config_set_bool(conf, bool_overrides[i].ident,
(*bool_overrides[i].ptr));
config_set_string(conf, bool_overrides[i].ident,
(*bool_overrides[i].ptr) ? "true" : "false");
}
for (i = 0; i < (unsigned)int_settings_size; i++)
{

View file

@ -725,9 +725,9 @@ static void shader_write_fbo(config_file_t *conf,
key[0] = '\0';
snprintf(key, sizeof(key), "float_framebuffer%u", i);
config_set_bool(conf, key, fbo->fp_fbo);
config_set_string(conf, key, fbo->fp_fbo ? "true" : "false");
snprintf(key, sizeof(key), "srgb_framebuffer%u", i);
config_set_bool(conf, key, fbo->srgb_fbo);
config_set_string(conf, key, fbo->srgb_fbo ? "true" : "false");
if (!fbo->valid)
return;
@ -795,7 +795,10 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
if (pass->filter != RARCH_FILTER_UNSPEC)
{
snprintf(key, sizeof(key), "filter_linear%u", i);
config_set_bool(conf, key, pass->filter == RARCH_FILTER_LINEAR);
config_set_string(conf, key,
(pass->filter == RARCH_FILTER_LINEAR)
? "true"
: "false");
}
snprintf(key, sizeof(key), "wrap_mode%u", i);
@ -808,7 +811,7 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
}
snprintf(key, sizeof(key), "mipmap_input%u", i);
config_set_bool(conf, key, pass->mipmap);
config_set_string(conf, key, pass->mipmap ? "true" : "false");
snprintf(key, sizeof(key), "alias%u", i);
config_set_string(conf, key, pass->alias);
@ -855,8 +858,10 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
k[0] = '\0';
strlcpy(k, shader->lut[i].id, sizeof(k));
strlcat(k, "_linear", sizeof(k));
config_set_bool(conf, k,
shader->lut[i].filter == RARCH_FILTER_LINEAR);
config_set_string(conf, k,
(shader->lut[i].filter == RARCH_FILTER_LINEAR)
? "true"
: "false");
}
/* Wrap Mode */
@ -875,7 +880,9 @@ static bool video_shader_write_root_preset(const struct video_shader *shader,
k[0] = '\0';
strlcpy(k, shader->lut[i].id, sizeof(k));
strlcat(k, "_mipmap", sizeof(k));
config_set_bool(conf, k, shader->lut[i].mipmap);
config_set_string(conf, k, shader->lut[i].mipmap
? "true"
: "false");
}
}
}