From f6b541ce2fd2f51f75404c26fc341335c895292f Mon Sep 17 00:00:00 2001 From: zeromus Date: Mon, 18 Aug 2008 20:34:59 +0000 Subject: [PATCH] fix the issue phil discovered where loading a mismatched movie savestate causes an extra freaky chunk 0 error message. create code which would be helpful for turning mismatch error into ok/cancel, but didn't enable it.. not sure whether we want it --- src/movie.cpp | 17 +++++++++++++++-- src/state.cpp | 5 ++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/movie.cpp b/src/movie.cpp index e28330a9..99790421 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -23,6 +23,10 @@ #include "utils/memorystream.h" #include "utils/xstring.h" +#ifdef WIN32 +#include +#endif + using namespace std; @@ -999,8 +1003,17 @@ bool FCEUMOV_ReadState(std::istream* is, uint32 size) //handle moviefile mismatch if(tempMovieData.guid != currMovieData.guid) { - FCEU_PrintError("Mismatch between savestate's movie and current movie.\ncurrent: %s\nsavestate: %s\n",currMovieData.guid.toString().c_str(),tempMovieData.guid.toString().c_str()); - return false; + //mbg 8/18/08 - this code can be used to turn the error message into an OK/CANCEL + //#ifdef WIN32 + // std::string msg = "There is a mismatch between savestate's movie and current movie.\ncurrent: " + currMovieData.guid.toString() + "\nsavestate: " + tempMovieData.guid.toString() + "\n\nThis means that you have loaded a savestate belonging to a different movie than the one you are playing now.\n\nContinue loading this savestate anyway?"; + // extern HWND pwindow; + // int result = MessageBox(pwindow,msg.c_str(),"Error loading savestate",MB_OKCANCEL); + // if(result == IDCANCEL) + // return false; + //#else + FCEU_PrintError("Mismatch between savestate's movie and current movie.\ncurrent: %s\nsavestate: %s\n",currMovieData.guid.toString().c_str(),tempMovieData.guid.toString().c_str()); + return false; + //#endif } closeRecordingMovie(); diff --git a/src/state.cpp b/src/state.cpp index dedb0bac..4fef6f58 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -612,7 +612,10 @@ bool FCEUSS_LoadFP(std::istream* is, ENUM_SSLOADPARAMS params) x=FCEUMOV_PostLoad(); } - if(!x && backup) FCEUSS_LoadFP(&msBackupSavestate,SSLOADPARAM_NOBACKUP); + if(!x && backup) { + msBackupSavestate.sync(); + FCEUSS_LoadFP(&msBackupSavestate,SSLOADPARAM_NOBACKUP); + } return x; }