summaryrefslogtreecommitdiff
path: root/emulators/gens/patches/patch-aq
blob: 365978938206cf9e0f7c5dfeaa29edf3feef8d08 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
$NetBSD: patch-aq,v 1.1 2004/08/15 12:13:53 dillo Exp $

--- src/gens/sdllayer/g_sdldraw.c.orig	2004-08-15 11:46:04.000000000 +0200
+++ src/gens/sdllayer/g_sdldraw.c
@@ -462,7 +462,11 @@ Update_Emulation (void)
 	  Write_Sound_Buffer (NULL);
 	}
 
-      Update_Controllers ();
+      if (MoviePlaying)
+        MoviePlayingStuff();
+      else
+        Update_Controllers();
+      FrameCount++;
 
       if (Frame_Number++ < Frame_Skip)
 	{
@@ -487,7 +491,12 @@ Update_Emulation (void)
 	  //{
 	  Write_Sound_Buffer (NULL);
 	  //WP = (WP + 1) & (Sound_Segs - 1);
-	  Update_Controllers ();
+          if (MoviePlaying)
+            MoviePlayingStuff();
+          else
+            Update_Controllers();
+          FrameCount++;
+
 
 	  //if (WP != RP)
 	  //{
@@ -518,13 +527,21 @@ Update_Emulation (void)
 
 	  for (; Frame_Number > 1; Frame_Number--)
 	    {
-	      Update_Controllers ();
+              if (MoviePlaying)
+                MoviePlayingStuff();
+              else
+                Update_Controllers();
+              FrameCount++;
 	      Update_Frame_Fast ();
 	    }
 
 	  if (Frame_Number)
 	    {
-	      Update_Controllers ();
+              if (MoviePlaying)
+                MoviePlayingStuff();
+              else
+                Update_Controllers();
+              FrameCount++;
 	      Update_Frame ();
 	      Flip ();
 	    }
@@ -540,7 +557,12 @@ Update_Emulation (void)
 int
 Update_Emulation_One (void)
 {
-  Update_Controllers ();
+  if (MoviePlaying)
+    MoviePlayingStuff();
+  else
+   Update_Controllers();
+  FrameCount++;
+ 
   Update_Frame ();
   Flip ();
 
@@ -686,3 +708,42 @@ Take_Shot ()
 	     surface->h, surface->w * 2);
   return 0;
 }
+
+void
+MoviePlayingStuff()
+{
+  char PadData[3]; //Modif
+
+  if(FrameCount >= MovieLastFrame)
+    {
+      MoviePlaying=0;
+      sprintf(Str_Tmp, "Movie finished", Current_State);
+      Put_Info(Str_Tmp, 2000);
+      return;
+    }
+  ReadInMovie(FrameCount,&PadData[0],&PadData[1],&PadData[2]);
+  Controller_1_Up=(PadData[0]&1);
+  Controller_1_Down=(PadData[0]&2)>>1;
+  Controller_1_Left=(PadData[0]&4)>>2;
+  Controller_1_Right=(PadData[0]&8)>>3;
+  Controller_1_A=(PadData[0]&16)>>4;
+  Controller_1_B=(PadData[0]&32)>>5;
+  Controller_1_C=(PadData[0]&64)>>6;
+  Controller_1_Start=(PadData[0]&128)>>7;
+  Controller_2_Up=(PadData[1]&1);
+  Controller_2_Down=(PadData[1]&2)>>1;
+  Controller_2_Left=(PadData[1]&4)>>2;
+  Controller_2_Right=(PadData[1]&8)>>3;
+  Controller_2_A=(PadData[1]&16)>>4;
+  Controller_2_B=(PadData[1]&32)>>5;
+  Controller_2_C=(PadData[1]&64)>>6;
+  Controller_2_Start=(PadData[1]&128)>>7;
+  Controller_1_X=(PadData[2]&1);
+  Controller_1_Y=(PadData[2]&2)>>1;
+  Controller_1_Z=(PadData[2]&4)>>2;
+  Controller_1_Mode=(PadData[2]&8)>>3;
+  Controller_2_X=(PadData[2]&16)>>4;
+  Controller_2_Y=(PadData[2]&32)>>5;
+  Controller_2_Z=(PadData[2]&64)>>6;
+  Controller_2_Mode=(PadData[2]&128)>>7;
+}