* fixed savestates filenaming bug when working with a movie

* updated docs

[[Split portion of a mixed commit.]]
This commit is contained in:
ansstuff 2012-08-30 15:51:19 +00:00
parent a2fb69118b
commit 96de43061d
5 changed files with 18 additions and 13 deletions

View File

@ -1,3 +1,4 @@
30-Aug-2012 - AnS - fixed savestates filenaming bug when working with a movie
29-Aug-2012 - AnS - added "Force Grayscale" checkbox to Palette config 29-Aug-2012 - AnS - added "Force Grayscale" checkbox to Palette config
26-Aug-2012 - AnS - Taseditor: History Log highlights items related to current item 26-Aug-2012 - AnS - Taseditor: History Log highlights items related to current item
25-Aug-2012 - AnS - Taseditor: fixed AdjustLag feature and changed fm3 version to v2 25-Aug-2012 - AnS - Taseditor: fixed AdjustLag feature and changed fm3 version to v2

Binary file not shown.

View File

@ -566,7 +566,7 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
char ret[FILENAME_MAX] = ""; char ret[FILENAME_MAX] = "";
struct stat tmpstat; struct stat tmpstat;
std::string mfnString; std::string mfnString;
const char* mfn; const char* mfn; // the movie filename
switch(type) switch(type)
{ {
@ -582,20 +582,22 @@ std::string FCEU_MakeFName(int type, int id1, const char *cd1)
break; break;
case FCEUMKF_STATE: case FCEUMKF_STATE:
{ {
if (bindSavestate) mfnString = GetMfn(); if (bindSavestate)
else mfnString = ""; mfnString = GetMfn();
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 else
mfnString = "";
if (mfnString.length() <= MAX_MOVIEFILENAME_LEN)
{ {
std::string mfnStringTemp = mfnString.substr(0,60); mfn = mfnString.c_str();
mfn = mfnStringTemp.c_str(); //mfn is the movie filename } else
{
//This caps the movie filename length before adding it to the savestate filename.
//This helps prevent possible crashes from savestate filenames of excessive length.
mfnString = mfnString.substr(0, MAX_MOVIEFILENAME_LEN);
mfn = mfnString.c_str();
} }
if(odirs[FCEUIOD_STATES]) if(odirs[FCEUIOD_STATES])
{ {
sprintf(ret,"%s"PSS"%s%s.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1); sprintf(ret,"%s"PSS"%s%s.fc%d",odirs[FCEUIOD_STATES],FileBase,mfn,id1);

View File

@ -1,6 +1,8 @@
#ifndef _FCEU_FILE_H_ #ifndef _FCEU_FILE_H_
#define _FCEU_FILE_H_ #define _FCEU_FILE_H_
#define MAX_MOVIEFILENAME_LEN 80
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "types.h" #include "types.h"

Binary file not shown.