More efficient if logic in CheckTimlines(). Added a flag for a feature of full copy savestates. This is a VBA/SNES9x type feature where a savestates full movie content can be loaded in read+write. Those emulators perform this option with a bit of trickery by not truncating the movie data until the next frame. Instead we are going to give the user an option to use this mode through the user interface.

This commit is contained in:
adelikat 2010-05-18 12:54:54 +00:00
parent fb579eb4b2
commit 8f222b3c91
2 changed files with 8 additions and 8 deletions

View File

@ -86,6 +86,7 @@ int pauseframe = -1;
bool movie_readonly = true; bool movie_readonly = true;
int input_display = 0; int input_display = 0;
int frame_display = 0; int frame_display = 0;
bool fullSaveStateLoads = false; //Option for loading a savestates full contents in read+write mode instead of up to the frame count in the savestate (useful as a recovery option)
SFORMAT FCEUMOV_STATEINFO[]={ SFORMAT FCEUMOV_STATEINFO[]={
{ &currFrameCounter, 4|FCEUSTATE_RLSB, "FCNT"}, { &currFrameCounter, 4|FCEUSTATE_RLSB, "FCNT"},
@ -1213,15 +1214,12 @@ bool CheckTimelines(MovieData& stateMovie, MovieData& currMovie, int& errorFr)
//First check, make sure we are checking is for a post-movie savestate, we just want to adjust the length for now, we will handle this situation later in another function //First check, make sure we are checking is for a post-movie savestate, we just want to adjust the length for now, we will handle this situation later in another function
if (currFrameCounter <= stateMovie.getNumRecords()) if (currFrameCounter <= stateMovie.getNumRecords())
length = currFrameCounter; length = currFrameCounter; //Note: currFrameCounter corresponds to the framecounter in the savestate
else if (currFrameCounter > currMovie.getNumRecords()) //Now that we know the length of the records of the savestate we plan to load, let's match the length against the movie
length = currMovie.getNumRecords(); //If length < currMovie records then this is a "future" event from the current movie, againt we will handle this situation later, we just want to find the right number of frames to compare
else else
length = stateMovie.getNumRecords(); length = stateMovie.getNumRecords();
//Now that we know the length of the records of the savestate we plan to load, let's match the length against the movie
//If length < currMovie records then this is a "future" event from the current movie, againt we will handle this situation later, we just want to find the right number of frames to compare
if (length > currMovie.getNumRecords())
length = currMovie.getNumRecords();
for (int x = 0; x < length; x++) for (int x = 0; x < length; x++)
{ {
if (!stateMovie.records[x].Compare(currMovie.records[x])) if (!stateMovie.records[x].Compare(currMovie.records[x]))
@ -1357,7 +1355,8 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
} }
else else
{ {
//truncate before we copy, just to save some time //truncate before we copy, just to save some time, unless the user selects a full copy option
if (!fullSaveStateLoads)
tempMovieData.truncateAt(currFrameCounter); //we can only assume this here since we have checked that the frame counter is not greater than the movie data tempMovieData.truncateAt(currFrameCounter); //we can only assume this here since we have checked that the frame counter is not greater than the movie data
currMovieData = tempMovieData; currMovieData = tempMovieData;
#ifdef _S9XLUA_H #ifdef _S9XLUA_H

View File

@ -258,6 +258,7 @@ extern bool freshMovie;
extern bool movie_readonly; extern bool movie_readonly;
extern bool autoMovieBackup; extern bool autoMovieBackup;
extern int pauseframe; extern int pauseframe;
extern bool fullSaveStateLoads;
//-------------------------------------------------- //--------------------------------------------------
void FCEUI_MakeBackupMovie(bool dispMessage); void FCEUI_MakeBackupMovie(bool dispMessage);
void FCEUI_CreateMovieFile(std::string fn); void FCEUI_CreateMovieFile(std::string fn);