# HG changeset patch
# User Robert McIntyre <rlm@mit.edu>
# Date 1330980465 21600
# Node ID 47a513ea3529f9a893a27ae7e428bf46bf537960
# Parent  b82b181851033cb8eb93cfc6c31aa80e0d51eae7
getting something now when recording movies

diff -r b82b18185103 -r 47a513ea3529 play-movie.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/play-movie.sh	Mon Mar 05 14:47:45 2012 -0600
@@ -0,0 +1,3 @@
+/home/r/proj/vba-restore/build/artifacts/bin/VisualBAdvance \
+    --playmovie=/home/r/proj/vba-restore/build/movie.vba \
+    /home/r/proj/pokemonscape/roms/yellow.gbc         
diff -r b82b18185103 -r 47a513ea3529 src/common/movie.cpp
--- a/src/common/movie.cpp	Mon Mar 05 14:26:45 2012 -0600
+++ b/src/common/movie.cpp	Mon Mar 05 14:47:45 2012 -0600
@@ -54,7 +54,7 @@
 #endif
 
 extern int emulating; // from system.cpp
-extern u16 currentButtons[4];     // from System.cpp
+extern u16 currentButtons[4];     // from SDL.cpp
 extern u16 lastKeys;
 
 SMovie Movie;
@@ -63,7 +63,7 @@
 // probably bad idea to have so many global variables, but I hate to recompile almost everything after editing VBA.h
 bool autoConvertMovieWhenPlaying = false;
 
-static u16 initialInputs[4] = { 0 };
+static u16 initialInputs[4] = { 0, 0, 0, 0 };
 
 static bool resetSignaled	  = false;
 static bool resetSignaledLast = false;
@@ -1182,6 +1182,7 @@
   else if (Movie.state == MOVIE_STATE_RECORD)
     {
       printf("RLM: Movie_STATE_RECORD\n");
+      VBAMovieWrite(0,true);
       // use first fseek?
       //TODO: THis is the problem.
       if (Movie.inputBuffer){
@@ -1230,10 +1231,11 @@
 
   reserve_buffer_space((uint32)((Movie.inputBufferPtr - Movie.inputBuffer) + Movie.bytesPerFrame));
 
-  if (Movie.header.controllerFlags & MOVIE_CONTROLLER(i))
+  if (Movie.header.controllerFlags)
     {
       // get the current controller data
       uint16 buttonData = currentButtons[i];
+      printf("RLM: currentButtons %i\n", currentButtons[0]);
 
       // mask away the irrelevent bits
       buttonData &= BUTTON_REGULAR_MASK | BUTTON_MOTION_MASK;