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

This commit is contained in:
zeromus 2008-08-18 20:34:59 +00:00
parent 934b92c667
commit f6b541ce2f
2 changed files with 19 additions and 3 deletions

View File

@ -23,6 +23,10 @@
#include "utils/memorystream.h" #include "utils/memorystream.h"
#include "utils/xstring.h" #include "utils/xstring.h"
#ifdef WIN32
#include <windows.h>
#endif
using namespace std; using namespace std;
@ -999,8 +1003,17 @@ bool FCEUMOV_ReadState(std::istream* is, uint32 size)
//handle moviefile mismatch //handle moviefile mismatch
if(tempMovieData.guid != currMovieData.guid) if(tempMovieData.guid != currMovieData.guid)
{ {
//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()); 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; return false;
//#endif
} }
closeRecordingMovie(); closeRecordingMovie();

View File

@ -612,7 +612,10 @@ bool FCEUSS_LoadFP(std::istream* is, ENUM_SSLOADPARAMS params)
x=FCEUMOV_PostLoad(); x=FCEUMOV_PostLoad();
} }
if(!x && backup) FCEUSS_LoadFP(&msBackupSavestate,SSLOADPARAM_NOBACKUP); if(!x && backup) {
msBackupSavestate.sync();
FCEUSS_LoadFP(&msBackupSavestate,SSLOADPARAM_NOBACKUP);
}
return x; return x;
} }