diff vgmplay.c @ 409:c1bddeadc566

Process events in vgm player so that quitting works
author Mike Pavone <pavone@retrodev.com>
date Mon, 17 Jun 2013 19:34:47 -0700
parents a13a83934ba3
children bc9e0829ffc7
line wrap: on
line diff
--- a/vgmplay.c	Mon Jun 17 00:54:14 2013 -0700
+++ b/vgmplay.c	Mon Jun 17 19:34:47 2013 -0700
@@ -72,16 +72,19 @@
 {
 }
 
+#define CYCLE_LIMIT MCLKS_NTSC/60
+
 void wait(ym2612_context * y_context, psg_context * p_context, uint32_t * current_cycle, uint32_t cycles)
 {
 	*current_cycle += cycles;
 	psg_run(p_context, *current_cycle);
 	ym_run(y_context, *current_cycle);
 	
-	if (*current_cycle > 0x1FFFFFFF) {
-		*current_cycle -= 0x1FFFFFFF;
-		p_context->cycles -= 0x1FFFFFFF;
-		y_context->current_cycle -= 0x1FFFFFFF;
+	if (*current_cycle > CYCLE_LIMIT) {
+		*current_cycle -= CYCLE_LIMIT;
+		p_context->cycles -= CYCLE_LIMIT;
+		y_context->current_cycle -= CYCLE_LIMIT;
+		process_events();
 	}
 }