comparison src/common/movie.cpp @ 36:47a513ea3529

getting something now when recording movies
author Robert McIntyre <rlm@mit.edu>
date Mon, 05 Mar 2012 14:47:45 -0600
parents b82b18185103
children 3e36553d0cbf
comparison
equal deleted inserted replaced
35:b82b18185103 36:47a513ea3529
52 # include "../win32/VBA.h" 52 # include "../win32/VBA.h"
53 # include "../win32/WinMiscUtil.h" 53 # include "../win32/WinMiscUtil.h"
54 #endif 54 #endif
55 55
56 extern int emulating; // from system.cpp 56 extern int emulating; // from system.cpp
57 extern u16 currentButtons[4]; // from System.cpp 57 extern u16 currentButtons[4]; // from SDL.cpp
58 extern u16 lastKeys; 58 extern u16 lastKeys;
59 59
60 SMovie Movie; 60 SMovie Movie;
61 bool loadingMovie = false; 61 bool loadingMovie = false;
62 62
63 // probably bad idea to have so many global variables, but I hate to recompile almost everything after editing VBA.h 63 // probably bad idea to have so many global variables, but I hate to recompile almost everything after editing VBA.h
64 bool autoConvertMovieWhenPlaying = false; 64 bool autoConvertMovieWhenPlaying = false;
65 65
66 static u16 initialInputs[4] = { 0 }; 66 static u16 initialInputs[4] = { 0, 0, 0, 0 };
67 67
68 static bool resetSignaled = false; 68 static bool resetSignaled = false;
69 static bool resetSignaledLast = false; 69 static bool resetSignaledLast = false;
70 70
71 static int prevEmulatorType, prevBorder, prevWinBorder, prevBorderAuto; 71 static int prevEmulatorType, prevBorder, prevWinBorder, prevBorderAuto;
1180 } 1180 }
1181 } 1181 }
1182 else if (Movie.state == MOVIE_STATE_RECORD) 1182 else if (Movie.state == MOVIE_STATE_RECORD)
1183 { 1183 {
1184 printf("RLM: Movie_STATE_RECORD\n"); 1184 printf("RLM: Movie_STATE_RECORD\n");
1185 VBAMovieWrite(0,true);
1185 // use first fseek? 1186 // use first fseek?
1186 //TODO: THis is the problem. 1187 //TODO: THis is the problem.
1187 if (Movie.inputBuffer){ 1188 if (Movie.inputBuffer){
1188 fwrite(Movie.inputBufferPtr, 1, Movie.bytesPerFrame, Movie.file); 1189 fwrite(Movie.inputBufferPtr, 1, Movie.bytesPerFrame, Movie.file);
1189 } 1190 }
1228 if (i < 0 || i >= MOVIE_NUM_OF_POSSIBLE_CONTROLLERS) 1229 if (i < 0 || i >= MOVIE_NUM_OF_POSSIBLE_CONTROLLERS)
1229 return; // not a controller we're recognizing 1230 return; // not a controller we're recognizing
1230 1231
1231 reserve_buffer_space((uint32)((Movie.inputBufferPtr - Movie.inputBuffer) + Movie.bytesPerFrame)); 1232 reserve_buffer_space((uint32)((Movie.inputBufferPtr - Movie.inputBuffer) + Movie.bytesPerFrame));
1232 1233
1233 if (Movie.header.controllerFlags & MOVIE_CONTROLLER(i)) 1234 if (Movie.header.controllerFlags)
1234 { 1235 {
1235 // get the current controller data 1236 // get the current controller data
1236 uint16 buttonData = currentButtons[i]; 1237 uint16 buttonData = currentButtons[i];
1238 printf("RLM: currentButtons %i\n", currentButtons[0]);
1237 1239
1238 // mask away the irrelevent bits 1240 // mask away the irrelevent bits
1239 buttonData &= BUTTON_REGULAR_MASK | BUTTON_MOTION_MASK; 1241 buttonData &= BUTTON_REGULAR_MASK | BUTTON_MOTION_MASK;
1240 1242
1241 // soft-reset "button" for 1 frame if the game is reset while recording 1243 // soft-reset "button" for 1 frame if the game is reset while recording