diff render_sdl.c @ 884:252dfd29831d

Selecting a second game from the menu now works
author Michael Pavone <pavone@retrodev.com>
date Fri, 13 Nov 2015 22:56:59 -0800
parents b6842dfb8edf
children b9564fb88a5a
line wrap: on
line diff
--- a/render_sdl.c	Fri Nov 13 19:15:37 2015 -0800
+++ b/render_sdl.c	Fri Nov 13 22:56:59 2015 -0800
@@ -115,7 +115,7 @@
 
 GLuint load_shader(char * fname, GLenum shader_type)
 {
-	char * parts[] = {get_home_dir(), "/.config/blastem/shaders/", fname};
+	char const * parts[] = {get_home_dir(), "/.config/blastem/shaders/", fname};
 	char * shader_path = alloc_concat_m(3, parts);
 	FILE * f = fopen(shader_path, "rb");
 	free(shader_path);
@@ -158,10 +158,15 @@
 
 void render_alloc_surfaces(vdp_context * context)
 {
+	static uint8_t texture_init;
 	context->oddbuf = context->framebuf = malloc(512 * 256 * 4 * 2);
 	memset(context->oddbuf, 0, 512 * 256 * 4 * 2);
 	context->evenbuf = ((char *)context->oddbuf) + 512 * 256 * 4;
 
+	if (texture_init) {
+		return;
+	}
+	texture_init = 1;
 #ifndef DISABLE_OPENGL
 	if (render_gl) {
 		glGenTextures(3, textures);
@@ -211,6 +216,11 @@
 #endif
 }
 
+void render_free_surfaces(vdp_context *context)
+{
+	free(context->framebuf);
+}
+
 char * caption = NULL;
 
 static void render_quit()