Move video_driver_load/save_settings functions to configuration.c

This commit is contained in:
twinaphex 2020-06-23 22:27:40 +02:00
parent 2c185fe7e2
commit d0e426011d
3 changed files with 69 additions and 74 deletions

View File

@ -1979,6 +1979,20 @@ static struct config_int_setting *populate_settings_int(
return tmp;
}
static void video_driver_default_settings(void)
{
global_t *global = global_get_ptr();
if (!global)
return;
global->console.screen.gamma_correction = DEFAULT_GAMMA;
global->console.flickerfilter_enable = false;
global->console.softfilter_enable = false;
global->console.screen.resolutions.current.id = 0;
}
/**
* config_set_defaults:
*
@ -2758,6 +2772,39 @@ error:
free(app_path);
return NULL;
}
#ifdef RARCH_CONSOLE
static void video_driver_load_settings(config_file_t *conf)
{
bool tmp_bool = false;
global_t *global = global_get_ptr();
if (!conf)
return;
CONFIG_GET_INT_BASE(conf, global,
console.screen.gamma_correction, "gamma_correction");
if (config_get_bool(conf, "flicker_filter_enable",
&tmp_bool))
global->console.flickerfilter_enable = tmp_bool;
if (config_get_bool(conf, "soft_filter_enable",
&tmp_bool))
global->console.softfilter_enable = tmp_bool;
CONFIG_GET_INT_BASE(conf, global,
console.screen.soft_filter_index,
"soft_filter_index");
CONFIG_GET_INT_BASE(conf, global,
console.screen.resolutions.current.id,
"current_resolution_id");
CONFIG_GET_INT_BASE(conf, global,
console.screen.flicker_filter_index,
"flicker_filter_index");
}
#endif
/**
* config_load:
* @path : path to be read from.
@ -3688,6 +3735,28 @@ static void config_parse_file(global_t *global)
}
}
}
static void video_driver_save_settings(config_file_t *conf)
{
global_t *global = global_get_ptr();
if (!conf)
return;
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_int(conf, "soft_filter_index",
global->console.screen.soft_filter_index);
config_set_int(conf, "current_resolution_id",
global->console.screen.resolutions.current.id);
config_set_int(conf, "flicker_filter_index",
global->console.screen.flicker_filter_index);
}
/**
* config_save_autoconf_profile:
* @path : Path that shall be written to.

View File

@ -31036,74 +31036,6 @@ bool video_driver_read_viewport(uint8_t *buffer, bool is_idle)
return false;
}
void video_driver_default_settings(void)
{
struct rarch_state *p_rarch = &rarch_st;
global_t *global = &p_rarch->g_extern;
if (!global)
return;
global->console.screen.gamma_correction = DEFAULT_GAMMA;
global->console.flickerfilter_enable = false;
global->console.softfilter_enable = false;
global->console.screen.resolutions.current.id = 0;
}
void video_driver_load_settings(config_file_t *conf)
{
bool tmp_bool = false;
struct rarch_state *p_rarch = &rarch_st;
global_t *global = &p_rarch->g_extern;
if (!conf)
return;
CONFIG_GET_INT_BASE(conf, global,
console.screen.gamma_correction, "gamma_correction");
if (config_get_bool(conf, "flicker_filter_enable",
&tmp_bool))
global->console.flickerfilter_enable = tmp_bool;
if (config_get_bool(conf, "soft_filter_enable",
&tmp_bool))
global->console.softfilter_enable = tmp_bool;
CONFIG_GET_INT_BASE(conf, global,
console.screen.soft_filter_index,
"soft_filter_index");
CONFIG_GET_INT_BASE(conf, global,
console.screen.resolutions.current.id,
"current_resolution_id");
CONFIG_GET_INT_BASE(conf, global,
console.screen.flicker_filter_index,
"flicker_filter_index");
}
void video_driver_save_settings(config_file_t *conf)
{
struct rarch_state *p_rarch = &rarch_st;
global_t *global = &p_rarch->g_extern;
if (!conf)
return;
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_int(conf, "soft_filter_index",
global->console.screen.soft_filter_index);
config_set_int(conf, "current_resolution_id",
global->console.screen.resolutions.current.id);
config_set_int(conf, "flicker_filter_index",
global->console.screen.flicker_filter_index);
}
static void video_driver_reinit_context(struct rarch_state *p_rarch,
int flags)
{

View File

@ -1538,12 +1538,6 @@ bool video_driver_read_viewport(uint8_t *buffer, bool is_idle);
void video_driver_cached_frame(void);
void video_driver_default_settings(void);
void video_driver_load_settings(config_file_t *conf);
void video_driver_save_settings(config_file_t *conf);
bool video_driver_is_hw_context(void);
struct retro_hw_render_callback *video_driver_get_hw_context(void);