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:
parent
3f1ad16e21
commit
e75d9e52dc
|
@ -78,8 +78,7 @@ void CloseDirectoriesDialog(HWND hwndDlg)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//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
|
||||||
initDirectories();
|
|
||||||
CreateDirs(); // Create needed directories.
|
CreateDirs(); // Create needed directories.
|
||||||
SetDirs(); // Set the directories in the core.
|
SetDirs(); // Set the directories in the core.
|
||||||
|
|
||||||
|
|
|
@ -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.
|
//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()
|
void initDirectories()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < NUMBER_OF_DEFAULT_DIRECTORIES; i++)
|
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());
|
strcpy(directory_names[NUMBER_OF_DIRECTORIES - 1], BaseDirectory.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
#include "x6502.h"
|
#include "x6502.h"
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -596,11 +599,13 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
if (ConfigToLoad) cfgFile.assign(ConfigToLoad);
|
if (ConfigToLoad) cfgFile.assign(ConfigToLoad);
|
||||||
|
|
||||||
|
//initDirectories();
|
||||||
|
|
||||||
// Load the config information
|
// Load the config information
|
||||||
sprintf(TempArray,"%s\\%s",BaseDirectory.c_str(),cfgFile.c_str());
|
sprintf(TempArray,"%s\\%s",BaseDirectory.c_str(),cfgFile.c_str());
|
||||||
LoadConfig(TempArray);
|
LoadConfig(TempArray);
|
||||||
|
|
||||||
initDirectories();
|
|
||||||
|
|
||||||
//Bleh, need to find a better place for this.
|
//Bleh, need to find a better place for this.
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,6 +118,6 @@ void DoPriority();
|
||||||
void RemoveDirs();
|
void RemoveDirs();
|
||||||
void CreateDirs();
|
void CreateDirs();
|
||||||
void SetDirs();
|
void SetDirs();
|
||||||
void initDirectories();
|
//void initDirectories(); //adelikat 03/02/09 - commenting out reference to a directory that I commented out
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -865,8 +865,12 @@ void LoadNewGamey(HWND hParent, const char *initialdir)
|
||||||
ofn.lpstrFile=nameo;
|
ofn.lpstrFile=nameo;
|
||||||
ofn.nMaxFile=256;
|
ofn.nMaxFile=256;
|
||||||
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; //OFN_EXPLORER|OFN_ENABLETEMPLATE|OFN_ENABLEHOOK;
|
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; //OFN_EXPLORER|OFN_ENABLETEMPLATE|OFN_ENABLEHOOK;
|
||||||
std::string stdinitdir =FCEU_GetPath(FCEUMKF_ROMS);
|
string stdinitdir =FCEU_GetPath(FCEUMKF_ROMS);
|
||||||
ofn.lpstrInitialDir = initialdir ? initialdir : stdinitdir.c_str();
|
|
||||||
|
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
|
// Show the Open File dialog
|
||||||
if(GetOpenFileName(&ofn))
|
if(GetOpenFileName(&ofn))
|
||||||
|
@ -1913,7 +1917,7 @@ void FCEUD_AviRecordTo(void)
|
||||||
|
|
||||||
std::string aviDirectory = FCEU_GetPath(21); //21 = FCEUMKF_AVI
|
std::string aviDirectory = FCEU_GetPath(21); //21 = FCEUMKF_AVI
|
||||||
if (aviDirectory.find_last_of("\\") != (aviDirectory.size()-1))
|
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 we are playing a movie, construct the filename from the current movie.
|
||||||
if(FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD))
|
if(FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD))
|
||||||
|
|
12
src/file.cpp
12
src/file.cpp
|
@ -526,8 +526,10 @@ std::string FCEU_GetPath(int type)
|
||||||
if(odirs[FCEUIOD_MEMW])
|
if(odirs[FCEUIOD_MEMW])
|
||||||
return (odirs[FCEUIOD_MEMW]);
|
return (odirs[FCEUIOD_MEMW]);
|
||||||
else
|
else
|
||||||
return BaseDirectory + PSS + "tools";
|
return ""; //adelikat: 03/02/09 - return null so it defaults to last directory used
|
||||||
|
//return BaseDirectory + PSS + "tools";
|
||||||
break;
|
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:
|
case FCEUMKF_BBOT:
|
||||||
if(odirs[FCEUIOD_BBOT])
|
if(odirs[FCEUIOD_BBOT])
|
||||||
return (odirs[FCEUIOD_BBOT]);
|
return (odirs[FCEUIOD_BBOT]);
|
||||||
|
@ -538,7 +540,7 @@ std::string FCEU_GetPath(int type)
|
||||||
if(odirs[FCEUIOD_ROMS])
|
if(odirs[FCEUIOD_ROMS])
|
||||||
return (odirs[FCEUIOD_ROMS]);
|
return (odirs[FCEUIOD_ROMS]);
|
||||||
else
|
else
|
||||||
return BaseDirectory;
|
return ""; //adelikat: removing base directory return, should return null it goes to last used directory
|
||||||
break;
|
break;
|
||||||
case FCEUMKF_INPUT:
|
case FCEUMKF_INPUT:
|
||||||
if(odirs[FCEUIOD_INPUT])
|
if(odirs[FCEUIOD_INPUT])
|
||||||
|
@ -548,7 +550,8 @@ std::string FCEU_GetPath(int type)
|
||||||
break;
|
break;
|
||||||
case FCEUMKF_LUA:
|
case FCEUMKF_LUA:
|
||||||
if(odirs[FCEUIOD_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
|
else
|
||||||
return BaseDirectory + PSS + "tools";
|
return BaseDirectory + PSS + "tools";
|
||||||
break;
|
break;
|
||||||
|
@ -556,7 +559,8 @@ std::string FCEU_GetPath(int type)
|
||||||
if(odirs[FCEUIOD_AVI])
|
if(odirs[FCEUIOD_AVI])
|
||||||
return (odirs[FCEUIOD_AVI]);
|
return (odirs[FCEUIOD_AVI]);
|
||||||
else
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue