Win32 - Changes to how directory overrides work. Fixed logic problems that were resulting in directory assignment rather than override.

FCEU_GetPath - changed lua, memw, avi, roms to return null rather than base directory if no overrides are set.
This commit is contained in:
adelikat 2009-03-02 17:37:31 +00:00
parent 3f1ad16e21
commit e75d9e52dc
5 changed files with 25 additions and 13 deletions

View File

@ -78,8 +78,7 @@ void CloseDirectoriesDialog(HWND hwndDlg)
}
}
initDirectories();
//initDirectories(); //adelikat 03/02/09 - commenting out. This function fills in empty directory overrides, which is not what we want, we want the user to have the option of leaving them blank
CreateDirs(); // Create needed directories.
SetDirs(); // Set the directories in the core.

View File

@ -534,6 +534,8 @@ void do_exit()
}
//Puts the default directory names into the elements of the directory_names array that aren't already defined.
//adelikat: commenting out this function, we don't need this. This turns the idea of directory overrides to directory assignment
/*
void initDirectories()
{
for (unsigned int i = 0; i < NUMBER_OF_DEFAULT_DIRECTORIES; i++)
@ -558,6 +560,7 @@ void initDirectories()
strcpy(directory_names[NUMBER_OF_DIRECTORIES - 1], BaseDirectory.c_str());
}
}
*/
#include "x6502.h"
int main(int argc,char *argv[])
{
@ -596,11 +599,13 @@ int main(int argc,char *argv[])
if (ConfigToLoad) cfgFile.assign(ConfigToLoad);
//initDirectories();
// Load the config information
sprintf(TempArray,"%s\\%s",BaseDirectory.c_str(),cfgFile.c_str());
LoadConfig(TempArray);
initDirectories();
//Bleh, need to find a better place for this.
{

View File

@ -118,6 +118,6 @@ void DoPriority();
void RemoveDirs();
void CreateDirs();
void SetDirs();
void initDirectories();
//void initDirectories(); //adelikat 03/02/09 - commenting out reference to a directory that I commented out
#endif

View File

@ -865,8 +865,12 @@ void LoadNewGamey(HWND hParent, const char *initialdir)
ofn.lpstrFile=nameo;
ofn.nMaxFile=256;
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; //OFN_EXPLORER|OFN_ENABLETEMPLATE|OFN_ENABLEHOOK;
std::string stdinitdir =FCEU_GetPath(FCEUMKF_ROMS);
ofn.lpstrInitialDir = initialdir ? initialdir : stdinitdir.c_str();
string stdinitdir =FCEU_GetPath(FCEUMKF_ROMS);
if (initialdir) //adelikat: If a directory is specified in the function parameter, it should take priority
ofn.lpstrInitialDir = initialdir;
else //adelikat: Else just use the override, if no override it will default to 0 - last directory used.
ofn.lpstrInitialDir = stdinitdir.c_str();
// Show the Open File dialog
if(GetOpenFileName(&ofn))
@ -1913,7 +1917,7 @@ void FCEUD_AviRecordTo(void)
std::string aviDirectory = FCEU_GetPath(21); //21 = FCEUMKF_AVI
if (aviDirectory.find_last_of("\\") != (aviDirectory.size()-1))
aviDirectory.append("\\"); //if directory override has no / then add one
aviDirectory.append("\\"); //if directory override has no \ then add one
//if we are playing a movie, construct the filename from the current movie.
if(FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD))

View File

@ -526,8 +526,10 @@ std::string FCEU_GetPath(int type)
if(odirs[FCEUIOD_MEMW])
return (odirs[FCEUIOD_MEMW]);
else
return BaseDirectory + PSS + "tools";
return ""; //adelikat: 03/02/09 - return null so it defaults to last directory used
//return BaseDirectory + PSS + "tools";
break;
//adelikat: TODO: this no longer exist and could be removed (but that would require changing a lot of other directory arrays
case FCEUMKF_BBOT:
if(odirs[FCEUIOD_BBOT])
return (odirs[FCEUIOD_BBOT]);
@ -538,7 +540,7 @@ std::string FCEU_GetPath(int type)
if(odirs[FCEUIOD_ROMS])
return (odirs[FCEUIOD_ROMS]);
else
return BaseDirectory;
return ""; //adelikat: removing base directory return, should return null it goes to last used directory
break;
case FCEUMKF_INPUT:
if(odirs[FCEUIOD_INPUT])
@ -548,7 +550,8 @@ std::string FCEU_GetPath(int type)
break;
case FCEUMKF_LUA:
if(odirs[FCEUIOD_LUA])
return (odirs[FCEUIOD_LUA]);
return ""; //adelikat: 03/02/09 - return null so it defaults to last directory used
//return (odirs[FCEUIOD_LUA]);
else
return BaseDirectory + PSS + "tools";
break;
@ -556,7 +559,8 @@ std::string FCEU_GetPath(int type)
if(odirs[FCEUIOD_AVI])
return (odirs[FCEUIOD_AVI]);
else
return BaseDirectory + PSS + "tools";
return ""; //adelikat - 03/02/09 - if no override, should return null and allow the last directory to be used intead
//return BaseDirectory + PSS + "tools";
break;
}