limited number of characters the movie filename can be when including in savestate filenames. (To help prevent insanely long savestate filenames)

This commit is contained in:
adelikat 2008-10-19 04:01:21 +00:00
parent 57692f5492
commit de92a9a9ba
2 changed files with 12 additions and 2 deletions

View File

@ -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)
{

View File

@ -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);