mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
Robustness fixes
This commit is contained in:
parent
d9750591d2
commit
7d346d627f
@ -58,9 +58,17 @@ void core_option_free(core_option_manager_t *opt)
|
||||
|
||||
for (i = 0; i < opt->size; i++)
|
||||
{
|
||||
if (opt->opts[i].desc)
|
||||
free(opt->opts[i].desc);
|
||||
if (opt->opts[i].key)
|
||||
free(opt->opts[i].key);
|
||||
|
||||
if (opt->opts[i].vals)
|
||||
string_list_free(opt->opts[i].vals);
|
||||
|
||||
opt->opts[i].desc = NULL;
|
||||
opt->opts[i].key = NULL;
|
||||
opt->opts[i].vals = NULL;
|
||||
}
|
||||
|
||||
if (opt->conf)
|
||||
@ -80,6 +88,9 @@ void core_option_get(core_option_manager_t *opt, struct retro_variable *var)
|
||||
|
||||
for (i = 0; i < opt->size; i++)
|
||||
{
|
||||
if (string_is_empty(opt->opts[i].key))
|
||||
continue;
|
||||
|
||||
if (string_is_equal(opt->opts[i].key, var->key))
|
||||
{
|
||||
var->value = core_option_get_val(opt, i);
|
||||
|
@ -150,7 +150,6 @@ static INLINE bool gl_query_extension(gl_t *gl, const char *ext)
|
||||
}
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
static void gl_render_overlay(void *data);
|
||||
static void gl_overlay_vertex_geom(void *data,
|
||||
unsigned image,
|
||||
float x, float y, float w, float h);
|
||||
@ -1797,6 +1796,10 @@ static INLINE void gl_draw_texture(gl_t *gl)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
static void gl_render_overlay(gl_t *gl);
|
||||
#endif
|
||||
|
||||
static bool gl_frame(void *data, const void *frame,
|
||||
unsigned frame_width, unsigned frame_height,
|
||||
uint64_t frame_count,
|
||||
@ -1999,7 +2002,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
font_driver_render_msg(NULL, msg, NULL);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (gl->overlay_enable)
|
||||
if (gl && gl->overlay_enable)
|
||||
gl_render_overlay(gl);
|
||||
#endif
|
||||
|
||||
@ -3512,15 +3515,12 @@ static void gl_overlay_set_alpha(void *data, unsigned image, float mod)
|
||||
color[12 + 3] = mod;
|
||||
}
|
||||
|
||||
static void gl_render_overlay(void *data)
|
||||
static void gl_render_overlay(gl_t *gl)
|
||||
{
|
||||
video_shader_ctx_mvp_t mvp;
|
||||
video_shader_ctx_coords_t coords;
|
||||
video_shader_ctx_info_t shader_info;
|
||||
unsigned i, width, height;
|
||||
gl_t *gl = (gl_t*)data;
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
|
||||
@ -3552,6 +3552,8 @@ static void gl_render_overlay(void *data)
|
||||
|
||||
for (i = 0; i < gl->overlays; i++)
|
||||
{
|
||||
if (!gl)
|
||||
return;
|
||||
glBindTexture(GL_TEXTURE_2D, gl->overlay_tex[i]);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 4 * i, 4);
|
||||
}
|
||||
|
@ -898,6 +898,9 @@ void config_file_dump(config_file_t *conf, FILE *file)
|
||||
list = (struct config_entry_list*)conf->entries;
|
||||
while (list)
|
||||
{
|
||||
if (!list)
|
||||
break;
|
||||
|
||||
if (!list->readonly && list->key)
|
||||
fprintf(file, "%s = \"%s\"\n", list->key, list->value);
|
||||
list = list->next;
|
||||
|
Loading…
Reference in New Issue
Block a user