diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 56c1499b..36fb9c9c 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -1581,11 +1581,28 @@ void FCEUD_AviRecordTo(void) char szChoice[MAX_PATH]; //if we are playing a movie, construct the filename from the current movie. - //else construct it from the filename. + //else construct it from the ROM name. if(FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD)) { + std::string aviFilename; extern char curMovieFilename[]; - strcpy(szChoice, curMovieFilename); + + //adelikat - use avi output directory override if specified + std::string aviDirectory = FCEU_GetPath(21); //21 = FCEUMKF_AVI + if (aviDirectory != "") //If directory specified, use it instead + { + if (aviDirectory.find_last_of("\\") != (aviDirectory.size())) + aviDirectory.append("\\"); //if directory override has no / then add one + + std::string tempfilename = GetMfn(); //get movie filename + tempfilename.erase(0,1); //remove dot + + aviFilename = aviDirectory + tempfilename; //concate avi directory and movie filename + } + else + aviFilename = curMovieFilename; //If no avidirectory override, simply default to the same directory as the movie + + strcpy(szChoice, aviFilename.c_str()); char* dot = strrchr(szChoice,'.'); if (dot) diff --git a/src/file.cpp b/src/file.cpp index a14117f9..c06ce5bf 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -554,9 +554,9 @@ std::string FCEU_GetPath(int type) break; case FCEUMKF_AVI: if(odirs[FCEUIOD_AVI]) - return (odirs[FCEUIOD_LUA]); + return (odirs[FCEUIOD_AVI]); else - return BaseDirectory; + return ""; //If avi output directory not specified, return nothing so that avi code can handle it its own way break; } diff --git a/src/file.h b/src/file.h index 9979a08b..2e021742 100644 --- a/src/file.h +++ b/src/file.h @@ -137,6 +137,7 @@ void GetFileBase(const char *f); std::string FCEU_GetPath(int type); std::string FCEU_MakePath(int type, const char* filebase); std::string FCEU_MakeFName(int type, int id1, const char *cd1); +std::string GetMfn(); void FCEU_SplitArchiveFilename(std::string src, std::string& archive, std::string& file, std::string& fileToOpen); #define FCEUMKF_STATE 1