diff 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
line wrap: on
line diff
     1.1 --- a/src/common/movie.cpp	Mon Mar 05 01:58:52 2012 -0600
     1.2 +++ b/src/common/movie.cpp	Mon Mar 05 14:26:45 2012 -0600
     1.3 @@ -365,12 +365,13 @@
     1.4        gbEchoRAMFixOn = 1;
     1.5  
     1.6        gbNullInputHackTempEnabled = gbNullInputHackEnabled;
     1.7 -
     1.8 +      
     1.9        if (Movie.inputBuffer)
    1.10  	{
    1.11  	  free(Movie.inputBuffer);
    1.12  	  Movie.inputBuffer = NULL;
    1.13  	}
    1.14 +      
    1.15      }
    1.16    else if (new_state == MOVIE_STATE_PLAY)
    1.17      {
    1.18 @@ -510,6 +511,9 @@
    1.19  
    1.20    resetSignaled	  = false;
    1.21    resetSignaledLast = false;
    1.22 +  
    1.23 +  // RLM: should probably add inputBuffer initialization here.
    1.24 +  reserve_buffer_space(90001); 
    1.25  }
    1.26  
    1.27  void VBAMovieGetRomInfo(const SMovie &movieInfo, char romTitle [12], uint32 &romGameCode, uint16 &checksum, uint8 &crc)
    1.28 @@ -1180,7 +1184,9 @@
    1.29        printf("RLM: Movie_STATE_RECORD\n");
    1.30        // use first fseek?
    1.31        //TODO: THis is the problem.
    1.32 -      fwrite(Movie.inputBufferPtr, 1, Movie.bytesPerFrame, Movie.file);
    1.33 +      if (Movie.inputBuffer){
    1.34 +	fwrite(Movie.inputBufferPtr, 1, Movie.bytesPerFrame, Movie.file);
    1.35 +      }
    1.36        printf("RLM: write successful.\n");
    1.37        Movie.header.length_frames = Movie.currentFrame;
    1.38        Movie.inputBufferPtr	 += Movie.bytesPerFrame;