menu_shader_manager_init - cleanups

This commit is contained in:
twinaphex 2019-07-16 20:29:15 +02:00
parent 5682eee276
commit 22c5cafe6a

View File

@ -78,7 +78,20 @@ bool menu_shader_manager_init(void)
if (is_preset)
{
conf = config_file_new(path_shader);
int64_t length = 0;
uint8_t *ret_buf = NULL;
if (path_is_valid(path_shader))
{
if (filestream_read_file(path_shader, (void**)&ret_buf, &length))
{
if (length >= 0)
if ((conf = config_file_new_from_string((const char*)ret_buf)))
conf->path = strdup(path_shader);
free((void*)ret_buf);
}
}
new_path = strdup(path_shader);
}
else
@ -100,9 +113,11 @@ bool menu_shader_manager_init(void)
preset_path[0] = '\0';
#ifdef HAVE_GLSL
fill_pathname_join(preset_path, shader_dir,
"menu.glslp", sizeof(preset_path));
if (path_is_valid(preset_path))
{
int64_t length = 0;
uint8_t *ret_buf = NULL;
@ -113,11 +128,15 @@ bool menu_shader_manager_init(void)
free((void*)ret_buf);
}
}
#endif
#ifdef HAVE_CG
if (!conf)
{
fill_pathname_join(preset_path, shader_dir,
"menu.cgp", sizeof(preset_path));
if (path_is_valid(preset_path))
{
int64_t length = 0;
uint8_t *ret_buf = NULL;
@ -129,11 +148,15 @@ bool menu_shader_manager_init(void)
}
}
}
#endif
#ifdef HAVE_SLANG
if (!conf)
{
fill_pathname_join(preset_path, shader_dir,
"menu.slangp", sizeof(preset_path));
if (path_is_valid(preset_path))
{
int64_t length = 0;
uint8_t *ret_buf = NULL;
@ -145,6 +168,7 @@ bool menu_shader_manager_init(void)
}
}
}
#endif
new_path = strdup(preset_path);
}