summaryrefslogtreecommitdiff
path: root/emulators/fceu/patches/patch-af
blob: bd5a749fc4229c346b0e72ad858c14a032726417 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
$NetBSD: patch-af,v 1.1 2005/10/30 11:47:56 wiz Exp $

Fix display and sync on sound.  Ignore NoWaiting and the rest for now.

--- src/drivers/pc/main.c.orig	2004-09-16 04:55:00.000000000 +0200
+++ src/drivers/pc/main.c
@@ -466,14 +466,26 @@ void FCEUD_Update(uint8 *XBuf, int32 *Bu
   if(can > Count) can=Count;
   else uflow=0;
 
-  WriteSound(Buffer,can);
+  while (Count > 0) {
+    WriteSound(Buffer,can);
+    Count -= can;
+    Buffer += can;
+    if (Count == 0)
+	break;
+    SDL_Delay(1); 
+    can = GetWriteSound();
+    if(can > Count) can=Count;
+   }
 
+   if(XBuf && (inited&4) && !(NoWaiting & 2))
+    BlitScreen(XBuf);
+   else
+    printf("skipped\n");
+#if 0
   //if(uflow) puts("Underflow");
   tmpcan = GetWriteSound();
   if((tmpcan < Count*0.90) && !uflow)
   {
-   if(XBuf && (inited&4) && !(NoWaiting & 2))
-    BlitScreen(XBuf);
    Buffer+=can;
    Count-=can;
    if(Count)
@@ -499,6 +511,7 @@ void FCEUD_Update(uint8 *XBuf, int32 *Bu
   }
   #endif
 
+#endif
  }
  else
  {