comparison src/common/movie.cpp @ 35:b82b18185103

fixed Segfault but the recorded movie now lacks keypresses
author Robert McIntyre <rlm@mit.edu>
date Mon, 05 Mar 2012 14:26:45 -0600
parents 6bde5b67a2b8
children 47a513ea3529
comparison
equal deleted inserted replaced
34:6bde5b67a2b8 35:b82b18185103
363 363
364 extern int32 gbEchoRAMFixOn; 364 extern int32 gbEchoRAMFixOn;
365 gbEchoRAMFixOn = 1; 365 gbEchoRAMFixOn = 1;
366 366
367 gbNullInputHackTempEnabled = gbNullInputHackEnabled; 367 gbNullInputHackTempEnabled = gbNullInputHackEnabled;
368 368
369 if (Movie.inputBuffer) 369 if (Movie.inputBuffer)
370 { 370 {
371 free(Movie.inputBuffer); 371 free(Movie.inputBuffer);
372 Movie.inputBuffer = NULL; 372 Movie.inputBuffer = NULL;
373 } 373 }
374
374 } 375 }
375 else if (new_state == MOVIE_STATE_PLAY) 376 else if (new_state == MOVIE_STATE_PLAY)
376 { 377 {
377 assert(Movie.file); 378 assert(Movie.file);
378 379
508 Movie.state = MOVIE_STATE_NONE; 509 Movie.state = MOVIE_STATE_NONE;
509 Movie.pauseFrame = -1; 510 Movie.pauseFrame = -1;
510 511
511 resetSignaled = false; 512 resetSignaled = false;
512 resetSignaledLast = false; 513 resetSignaledLast = false;
514
515 // RLM: should probably add inputBuffer initialization here.
516 reserve_buffer_space(90001);
513 } 517 }
514 518
515 void VBAMovieGetRomInfo(const SMovie &movieInfo, char romTitle [12], uint32 &romGameCode, uint16 &checksum, uint8 &crc) 519 void VBAMovieGetRomInfo(const SMovie &movieInfo, char romTitle [12], uint32 &romGameCode, uint16 &checksum, uint8 &crc)
516 { 520 {
517 if (systemCartridgeType == 0) // GBA 521 if (systemCartridgeType == 0) // GBA
1178 else if (Movie.state == MOVIE_STATE_RECORD) 1182 else if (Movie.state == MOVIE_STATE_RECORD)
1179 { 1183 {
1180 printf("RLM: Movie_STATE_RECORD\n"); 1184 printf("RLM: Movie_STATE_RECORD\n");
1181 // use first fseek? 1185 // use first fseek?
1182 //TODO: THis is the problem. 1186 //TODO: THis is the problem.
1183 fwrite(Movie.inputBufferPtr, 1, Movie.bytesPerFrame, Movie.file); 1187 if (Movie.inputBuffer){
1188 fwrite(Movie.inputBufferPtr, 1, Movie.bytesPerFrame, Movie.file);
1189 }
1184 printf("RLM: write successful.\n"); 1190 printf("RLM: write successful.\n");
1185 Movie.header.length_frames = Movie.currentFrame; 1191 Movie.header.length_frames = Movie.currentFrame;
1186 Movie.inputBufferPtr += Movie.bytesPerFrame; 1192 Movie.inputBufferPtr += Movie.bytesPerFrame;
1187 Movie.RecordedThisSession = true; 1193 Movie.RecordedThisSession = true;
1188 flush_movie_header(); 1194 flush_movie_header();