diff render_sdl.c @ 338:5c34a9c39394

Re-enable frame limit, but add a command line flag to disable it
author Mike Pavone <pavone@retrodev.com>
date Wed, 15 May 2013 22:37:25 -0700
parents 8e2fa485c0f2
children 80d934369fd5
line wrap: on
line diff
--- a/render_sdl.c	Wed May 15 22:37:04 2013 -0700
+++ b/render_sdl.c	Wed May 15 22:37:25 2013 -0700
@@ -232,7 +232,7 @@
 #define MIN_DELAY 5
 uint32_t frame_counter = 0;
 uint32_t start = 0;
-int wait_render_frame(vdp_context * context)
+int wait_render_frame(vdp_context * context, int frame_limit)
 {
 	FILE * outfile;
 	SDL_Event event;
@@ -358,18 +358,20 @@
 			exit(0);
 		}
 	}
-	//TODO: Adjust frame delay so we actually get 60 FPS rather than 62.5 FPS
-	/*uint32_t current = SDL_GetTicks();
-	uint32_t desired = last_frame + FRAME_DELAY;
-	if (current < desired) {
-		uint32_t delay = last_frame + FRAME_DELAY - current;
-		//TODO: Calculate MIN_DELAY at runtime
-		if (delay > MIN_DELAY) {
-			SDL_Delay((delay/MIN_DELAY)*MIN_DELAY);
+	if (frame_limit) {
+		//TODO: Adjust frame delay so we actually get 60 FPS rather than 62.5 FPS
+		uint32_t current = SDL_GetTicks();
+		uint32_t desired = last_frame + FRAME_DELAY;
+		if (current < desired) {
+			uint32_t delay = last_frame + FRAME_DELAY - current;
+			//TODO: Calculate MIN_DELAY at runtime
+			if (delay > MIN_DELAY) {
+				SDL_Delay((delay/MIN_DELAY)*MIN_DELAY);
+			}
+			while ((desired) >= SDL_GetTicks()) {
+			}
 		}
-		while ((desired) >= SDL_GetTicks()) {
-		}
-	}*/
+	}
 	render_context(context);