Default directories are now shown in the directory configuration dialog.

This commit is contained in:
rheiny 2007-02-11 14:25:05 +00:00
parent bca418ff84
commit 2a4e33a08c
2 changed files with 39 additions and 6 deletions

View File

@ -95,6 +95,12 @@ int eoptions = EO_BGRUN | EO_FORCEISCALE;
int soundoptions = SO_SECONDARY | SO_GFOCUS;
/**
* Contains the names of the overridden standard directories
* in the order cheats, misc, nonvol, states, snaps, ..., base
**/
char *directory_names[6] = {0, 0, 0, 0, 0, 0};
/**
* Handle of the main window.
**/
@ -158,7 +164,7 @@ void SetDirs()
for(x=0; x < sizeof(jlist) / sizeof(*jlist); x++)
{
FCEUI_SetDirOverride(jlist[x], directory_names[x]);
FCEUI_SetDirOverride(jlist[x], directory_names[x]);
}
if(directory_names[5])
@ -495,6 +501,35 @@ void do_exit()
FCEUI_Kill();
}
/**
* Puts the default directory names into the elements of the directory_names array
* that aren't already defined.
**/
void initDirectories()
{
for (unsigned int i = 0; i < NUMBER_OF_DEFAULT_DIRECTORIES; i++)
{
if (directory_names[i] == 0)
{
sprintf(
TempArray,
"%s\\%s",
directory_names[NUMBER_OF_DEFAULT_DIRECTORIES] ? directory_names[NUMBER_OF_DEFAULT_DIRECTORIES] : BaseDirectory,
default_directory_names[i]
);
directory_names[i] = (char*)malloc(strlen(TempArray) + 1);
strcpy(directory_names[i], TempArray);
}
}
if (directory_names[NUMBER_OF_DIRECTORIES - 1] == 0)
{
directory_names[NUMBER_OF_DIRECTORIES - 1] = (char*)malloc(strlen(BaseDirectory) + 1);
strcpy(directory_names[NUMBER_OF_DIRECTORIES - 1], BaseDirectory);
}
}
int main(int argc,char *argv[])
{
char *t;
@ -525,6 +560,8 @@ int main(int argc,char *argv[])
sprintf(TempArray,"%s\\fceu98.cfg",BaseDirectory);
LoadConfig(TempArray);
initDirectories();
// Parse the commandline arguments
t = ParseArgies(argc, argv);

View File

@ -39,11 +39,7 @@ static int status_icon = 1;
static int vmod = 0;
static char *gfsdir=0;
/**
* Contains the names of the overridden standard directories
* in the order cheats, misc, nonvol, states, snaps, ..., base
**/
static char *directory_names[6] = {0, 0, 0, 0, 0, 0};
extern char* directory_names[6];
/**
* Contains the names of the default directories.