mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
Add absolute paths to .cgp.
This commit is contained in:
parent
12cf639dfe
commit
6a7144d41c
@ -455,8 +455,8 @@ static bool load_textures(const char *dir_path, config_file_t *conf)
|
|||||||
const char *id = strtok(textures, ";");;
|
const char *id = strtok(textures, ";");;
|
||||||
while (id && lut_textures_num < MAX_TEXTURES)
|
while (id && lut_textures_num < MAX_TEXTURES)
|
||||||
{
|
{
|
||||||
char *path;
|
char path[PATH_MAX];
|
||||||
if (!config_get_string(conf, id, &path))
|
if (!config_get_array(conf, id, path, sizeof(path)))
|
||||||
{
|
{
|
||||||
SSNES_ERR("Cannot find path to texture \"%s\" ...\n", id);
|
SSNES_ERR("Cannot find path to texture \"%s\" ...\n", id);
|
||||||
ret = false;
|
ret = false;
|
||||||
@ -465,11 +465,22 @@ static bool load_textures(const char *dir_path, config_file_t *conf)
|
|||||||
|
|
||||||
char id_filter[64];
|
char id_filter[64];
|
||||||
print_buf(id_filter, "%s_linear", id);
|
print_buf(id_filter, "%s_linear", id);
|
||||||
bool smooth;
|
|
||||||
|
bool smooth = true;
|
||||||
if (!config_get_bool(conf, id_filter, &smooth))
|
if (!config_get_bool(conf, id_filter, &smooth))
|
||||||
smooth = true;
|
smooth = true;
|
||||||
|
|
||||||
|
char id_absolute[64];
|
||||||
|
print_buf(id_absolute, "%s_absolute", id);
|
||||||
|
|
||||||
|
bool absolute = false;
|
||||||
|
if (!config_get_bool(conf, id_absolute, &absolute))
|
||||||
|
absolute = false;
|
||||||
|
|
||||||
char image_path[512];
|
char image_path[512];
|
||||||
|
if (absolute)
|
||||||
|
print_buf(image_path, "%s", path);
|
||||||
|
else
|
||||||
print_buf(image_path, "%s%s", dir_path, path);
|
print_buf(image_path, "%s%s", dir_path, path);
|
||||||
|
|
||||||
SSNES_LOG("Loading image from: \"%s\".\n", image_path);
|
SSNES_LOG("Loading image from: \"%s\".\n", image_path);
|
||||||
@ -477,18 +488,16 @@ static bool load_textures(const char *dir_path, config_file_t *conf)
|
|||||||
if (!texture_image_load(image_path, &img))
|
if (!texture_image_load(image_path, &img))
|
||||||
{
|
{
|
||||||
SSNES_ERR("Failed to load picture ...\n");
|
SSNES_ERR("Failed to load picture ...\n");
|
||||||
free(path);
|
|
||||||
ret = false;
|
ret = false;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(lut_textures_uniform[lut_textures_num], id, sizeof(lut_textures_uniform[lut_textures_num]));
|
strlcpy(lut_textures_uniform[lut_textures_num],
|
||||||
|
id, sizeof(lut_textures_uniform[lut_textures_num]));
|
||||||
|
|
||||||
load_texture_data(&lut_textures[lut_textures_num], &img, smooth);
|
load_texture_data(&lut_textures[lut_textures_num], &img, smooth);
|
||||||
lut_textures_num++;
|
lut_textures_num++;
|
||||||
|
|
||||||
free(path);
|
|
||||||
|
|
||||||
id = strtok(NULL, ";");
|
id = strtok(NULL, ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1217,9 +1226,9 @@ bool gl_cg_save_cgp(const char *path, const struct gl_cg_cgp_info *info)
|
|||||||
unsigned shaders = info->shader[1] && *info->shader[1] ? 2 : 1;
|
unsigned shaders = info->shader[1] && *info->shader[1] ? 2 : 1;
|
||||||
fprintf(file, "shaders = %u\n", shaders);
|
fprintf(file, "shaders = %u\n", shaders);
|
||||||
|
|
||||||
fprintf(file, "shader0 = %s\n", info->shader[0]);
|
fprintf(file, "shader0 = \"%s\"\n", info->shader[0]);
|
||||||
if (shaders == 2)
|
if (shaders == 2)
|
||||||
fprintf(file, "shader1 = %s\n", info->shader[1]);
|
fprintf(file, "shader1 = \"%s\"\n", info->shader[1]);
|
||||||
|
|
||||||
fprintf(file, "filter_linear0 = %s\n", info->filter_linear[0] ? "true" : "false");
|
fprintf(file, "filter_linear0 = %s\n", info->filter_linear[0] ? "true" : "false");
|
||||||
|
|
||||||
@ -1230,6 +1239,17 @@ bool gl_cg_save_cgp(const char *path, const struct gl_cg_cgp_info *info)
|
|||||||
fprintf(file, "scale0 = %.1f\n", info->fbo_scale);
|
fprintf(file, "scale0 = %.1f\n", info->fbo_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info->lut_texture_path && info->lut_texture_id)
|
||||||
|
{
|
||||||
|
fprintf(file, "textures = %s\n", info->lut_texture_id);
|
||||||
|
fprintf(file, "%s = \"%s\"\n",
|
||||||
|
info->lut_texture_id, info->lut_texture_path);
|
||||||
|
|
||||||
|
fprintf(file, "%s_absolute = %s\n",
|
||||||
|
info->lut_texture_id,
|
||||||
|
info->lut_texture_absolute ? "true" : "false");
|
||||||
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,10 @@ struct gl_cg_cgp_info
|
|||||||
bool filter_linear[2];
|
bool filter_linear[2];
|
||||||
bool render_to_texture;
|
bool render_to_texture;
|
||||||
float fbo_scale;
|
float fbo_scale;
|
||||||
|
|
||||||
|
const char *lut_texture_path;
|
||||||
|
const char *lut_texture_id;
|
||||||
|
bool lut_texture_absolute;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool gl_cg_save_cgp(const char *path, const struct gl_cg_cgp_info *info);
|
bool gl_cg_save_cgp(const char *path, const struct gl_cg_cgp_info *info);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user