menu_shader.c - cleanups

This commit is contained in:
twinaphex 2015-01-11 18:30:56 +01:00
parent 5c798e6994
commit 3419a1846c

View File

@ -123,43 +123,46 @@ void menu_shader_manager_set_preset(struct gfx_shader *shader,
unsigned type, const char *preset_path)
{
#ifdef HAVE_SHADER_MANAGER
RARCH_LOG("Setting Menu shader: %s.\n", preset_path ? preset_path : "N/A (stock)");
config_file_t *conf = NULL;
g_settings.video.shader_enable = false;
if (driver.video->set_shader && driver.video->set_shader(driver.video_data,
if (!driver.video->set_shader)
return;
if (!driver.video->set_shader(driver.video_data,
(enum rarch_shader_type)type, preset_path))
return;
/* Makes sure that we use Menu Preset shader on driver reinit.
* Only do this when the cgp actually works to avoid potential errors. */
strlcpy(g_settings.video.shader_path, preset_path ? preset_path : "",
sizeof(g_settings.video.shader_path));
g_settings.video.shader_enable = true;
if (!preset_path)
return;
if (!shader)
return;
/* Load stored Preset into menu on success.
* Used when a preset is directly loaded.
* No point in updating when the Preset was
* created from the menu itself. */
conf = config_file_new(preset_path);
if (conf)
{
config_file_t *conf = NULL;
RARCH_LOG("Setting Menu shader: %s.\n", preset_path ? preset_path : "N/A (stock)");
/* Makes sure that we use Menu Preset shader on driver reinit.
* Only do this when the cgp actually works to avoid potential errors. */
strlcpy(g_settings.video.shader_path, preset_path ? preset_path : "",
sizeof(g_settings.video.shader_path));
g_settings.video.shader_enable = true;
if (!preset_path)
return;
if (!shader)
return;
/* Load stored Preset into menu on success.
* Used when a preset is directly loaded.
* No point in updating when the Preset was
* created from the menu itself. */
conf = config_file_new(preset_path);
if (conf)
if (gfx_shader_read_conf_cgp(conf, shader))
{
if (gfx_shader_read_conf_cgp(conf, shader))
{
gfx_shader_resolve_relative(shader, preset_path);
gfx_shader_resolve_parameters(conf, shader);
}
config_file_free(conf);
gfx_shader_resolve_relative(shader, preset_path);
gfx_shader_resolve_parameters(conf, shader);
}
driver.menu->need_refresh = true;
config_file_free(conf);
}
driver.menu->need_refresh = true;
#endif
}