mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(menu_shader) use config_file_from_string
This commit is contained in:
parent
319e708738
commit
85fdd5fbd1
@ -20,6 +20,7 @@
|
||||
#include <retro_assert.h>
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
@ -101,20 +102,48 @@ bool menu_shader_manager_init(void)
|
||||
|
||||
fill_pathname_join(preset_path, shader_dir,
|
||||
"menu.glslp", sizeof(preset_path));
|
||||
conf = config_file_new(preset_path);
|
||||
|
||||
{
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
if (filestream_read_file(preset_path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
}
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
fill_pathname_join(preset_path, shader_dir,
|
||||
"menu.cgp", sizeof(preset_path));
|
||||
conf = config_file_new(preset_path);
|
||||
{
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
if (filestream_read_file(preset_path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
fill_pathname_join(preset_path, shader_dir,
|
||||
"menu.slangp", sizeof(preset_path));
|
||||
conf = config_file_new(preset_path);
|
||||
{
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
if (filestream_read_file(preset_path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new_path = strdup(preset_path);
|
||||
@ -149,6 +178,8 @@ bool menu_shader_manager_init(void)
|
||||
bool menu_shader_manager_set_preset(void *data,
|
||||
enum rarch_shader_type type, const char *preset_path)
|
||||
{
|
||||
int64_t length = 0;
|
||||
uint8_t *ret_buf = NULL;
|
||||
struct video_shader *shader = (struct video_shader*)data;
|
||||
config_file_t *conf = NULL;
|
||||
bool refresh = false;
|
||||
@ -174,11 +205,17 @@ bool menu_shader_manager_set_preset(void *data,
|
||||
* 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 (filestream_read_file(preset_path, (void**)&ret_buf, &length))
|
||||
{
|
||||
if (length >= 0)
|
||||
conf = config_file_new_from_string((const char*)ret_buf);
|
||||
free((void*)ret_buf);
|
||||
}
|
||||
|
||||
if (!conf)
|
||||
return false;
|
||||
|
||||
conf->path = strdup(preset_path);
|
||||
RARCH_LOG("Setting Menu shader: %s.\n", preset_path);
|
||||
|
||||
if (video_shader_read_conf_preset(conf, shader))
|
||||
|
Loading…
x
Reference in New Issue
Block a user