diff --git a/src/fceu.cpp b/src/fceu.cpp index bea543da..e068d5c2 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -618,7 +618,7 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski #endif JustFrameAdvanced = true; } - } //I apologize to anyone who comes in and tries to fgiure this if branching out + } //I apologize to anyone who comes in and tries to figure out this IF branching currMovieData.TryDumpIncremental(); if (lagFlag) { diff --git a/src/file.cpp b/src/file.cpp index f7711553..8e1d1dc6 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -601,7 +601,17 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1) case FCEUMKF_STATE: { mfnString = GetMfn(); - mfn = mfnString.c_str(); + + if (mfnString.length() < 60) //This caps the movie filename length before adding it to the savestate filename. + mfn = mfnString.c_str(); //This helps prevent possible crashes from savestate filenames of excessive length. + + else { + std::string mfnStringTemp = mfnString.substr(0,60); + mfn = mfnStringTemp.c_str(); //mfn is the movie filename + } + + + if(odirs[FCEUIOD_STATES]) { sprintf(ret,"%s"PSS"%s%s.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1);