fix directories configuration stuff

This commit is contained in:
mauzus 2008-05-24 16:25:15 +00:00
parent 437c1f65ec
commit 2dcd90fc6c
11 changed files with 445 additions and 394 deletions

View File

@ -240,17 +240,20 @@ int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare
void FCEUI_CheatSearchShowExcluded(void);
void FCEUI_CheatSearchSetCurrentAsOriginal(void);
#define FCEUIOD_STATE 0
#define FCEUIOD_SNAPS 1
#define FCEUIOD_NV 2
#define FCEUIOD_CHEATS 3
#define FCEUIOD_MISC 4
#define FCEUIOD_MEMW 5
#define FCEUIOD_BBOT 6
#define FCEUIOD_MACRO 7
#define FCEUIOD_FDSROM 8
#define FCEUIOD_ROMS 0
#define FCEUIOD_NV 1
#define FCEUIOD_STATES 2
#define FCEUIOD_FDSROM 3
#define FCEUIOD_SNAPS 4
#define FCEUIOD_CHEATS 5
#define FCEUIOD_MOVIES 6
#define FCEUIOD_MEMW 7
#define FCEUIOD_BBOT 8
#define FCEUIOD_MACRO 9
#define FCEUIOD_INPUT 10
#define FCEUIOD_LUA 11
#define FCEUIOD__COUNT 9
#define FCEUIOD__COUNT 12
void FCEUI_SetDirOverride(int which, char *n);

View File

@ -108,16 +108,19 @@ static CFGSTRUCT fceuconfig[] = {
ACS(gfsdir),
NACS("odcheats",directory_names[0]),
NACS("odmisc",directory_names[1]),
NACS("odnonvol",directory_names[2]),
NACS("odstates",directory_names[3]),
NACS("odroms",directory_names[0]),
NACS("odnonvol",directory_names[1]),
NACS("odstates",directory_names[2]),
NACS("odfdsrom",directory_names[3]),
NACS("odsnaps",directory_names[4]),
NACS("odmemwatch",directory_names[5]),
NACS("odbasicbot",directory_names[6]),
NACS("odmacro",directory_names[7]),
NACS("odfdsrom",directory_names[8]),
NACS("odbase",directory_names[9]),
NACS("odcheats",directory_names[5]),
NACS("odmovies",directory_names[6]),
NACS("odmemwatch",directory_names[7]),
NACS("odbasicbot",directory_names[8]),
NACS("odmacro",directory_names[9]),
NACS("odinput",directory_names[10]),
NACS("odlua",directory_names[11]),
NACS("odbase",directory_names[12]),
AC(winspecial),
AC(winsizemulx),

View File

@ -28,7 +28,7 @@ void CloseDirectoriesDialog(HWND hwndDlg)
for(unsigned int curr_dir = 0; curr_dir < NUMBER_OF_DIRECTORIES; curr_dir++)
{
LONG len;
len = SendDlgItemMessage(hwndDlg, EDIT_CHEATS + curr_dir, WM_GETTEXTLENGTH, 0, 0);
len = SendDlgItemMessage(hwndDlg, EDIT_ROMS + curr_dir, WM_GETTEXTLENGTH, 0, 0);
if(len <= 0)
{
@ -48,7 +48,7 @@ void CloseDirectoriesDialog(HWND hwndDlg)
continue;
}
if(!GetDlgItemText(hwndDlg, EDIT_CHEATS + curr_dir, directory_names[curr_dir], len))
if(!GetDlgItemText(hwndDlg, EDIT_ROMS + curr_dir, directory_names[curr_dir], len))
{
free(directory_names[curr_dir]);
directory_names[curr_dir] = 0;
@ -102,7 +102,7 @@ static BOOL CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
// Initialize the directories textboxes
for(unsigned int curr_dir = 0; curr_dir < NUMBER_OF_DIRECTORIES; curr_dir++)
{
SetDlgItemText(hwndDlg, EDIT_CHEATS + curr_dir, directory_names[curr_dir]);
SetDlgItemText(hwndDlg, EDIT_ROMS + curr_dir, directory_names[curr_dir]);
}
// Check the screenshot naming checkbox if necessary
@ -123,25 +123,32 @@ static BOOL CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
case WM_COMMAND:
if( !(wParam >> 16) )
{
if( (wParam & 0xFFFF) >= BUTTON_CHEATS && (wParam & 0xFFFF) <= BUTTON_CHEATS + NUMBER_OF_DIRECTORIES)
if( (wParam & 0xFFFF) >= BUTTON_ROMS && (wParam & 0xFFFF) <= BUTTON_ROMS + NUMBER_OF_DIRECTORIES)
{
// If a directory selection button was pressed, ask the
// user for a directory.
static char *helpert[6] = {
"Cheats",
"Miscellaneous",
"Nonvolatile Game Data",
static char *helpert[13] = {
"Roms",
"Battery Saves",
"Save States",
"Screen Snapshots",
"FDS Bios Rom",
"Screenshots",
"Cheats",
"Movies",
"Memory Watch",
"Basic Bot",
"Macro files",
"Input Presets",
"Lua Scripts",
"Base Directory"
};
char name[MAX_PATH];
if(BrowseForFolder(hwndDlg, helpert[ ( (wParam & 0xFFFF) - BUTTON_CHEATS)], name))
if(BrowseForFolder(hwndDlg, helpert[ ( (wParam & 0xFFFF) - BUTTON_ROMS)], name))
{
SetDlgItemText(hwndDlg, EDIT_CHEATS + ((wParam & 0xFFFF) - BUTTON_CHEATS), name);
SetDlgItemText(hwndDlg, EDIT_ROMS + ((wParam & 0xFFFF) - BUTTON_ROMS), name);
}
}
else switch(wParam & 0xFFFF)

View File

@ -1533,7 +1533,7 @@ static void PresetExport(int preset)
ofn.lpstrFile=nameo;
ofn.nMaxFile=256;
ofn.Flags=OFN_EXPLORER|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT;
ofn.lpstrInitialDir=InputPresetDir;
ofn.lpstrInitialDir=FCEU_GetPath(FCEUMKF_INPUT);
if(GetSaveFileName(&ofn))
{
int i;
@ -1590,7 +1590,7 @@ static void PresetImport(int preset)
ofn.lpstrFile=nameo;
ofn.nMaxFile=256;
ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
ofn.lpstrInitialDir=InputPresetDir;
ofn.lpstrInitialDir=FCEU_GetPath(FCEUMKF_INPUT);
if(GetOpenFileName(&ofn))
{

View File

@ -106,8 +106,8 @@ double winsizemulx = 1, winsizemuly = 1;
// Contains the names of the overridden standard directories
// in the order cheats, misc, nonvol, states, snaps, memwatch, basicbot, macro, fds,..., base
char *directory_names[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// in the order roms, nonvol, states, fdsrom, snaps, cheats, movies, memwatch, basicbot, macro, input presets, lua scripts, base
char *directory_names[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
/**
* Handle of the main window.
@ -160,16 +160,19 @@ void SetDirs()
{
int x;
static int jlist[10]= {
FCEUIOD_CHEATS,
FCEUIOD_MISC,
static int jlist[13]= {
FCEUIOD_ROMS,
FCEUIOD_NV,
FCEUIOD_STATE,
FCEUIOD_STATES,
FCEUIOD_FDSROM,
FCEUIOD_SNAPS,
FCEUIOD_CHEATS,
FCEUIOD_MOVIES,
FCEUIOD_MEMW,
FCEUIOD_BBOT,
FCEUIOD_MACRO,
FCEUIOD_FDSROM,
FCEUIOD_INPUT,
FCEUIOD_LUA,
FCEUIOD__COUNT};
FCEUI_SetSnapName(eoptions & EO_SNAPNAME);
@ -179,9 +182,9 @@ void SetDirs()
FCEUI_SetDirOverride(jlist[x], directory_names[x]);
}
if(directory_names[10])
if(directory_names[12])
{
FCEUI_SetBaseDirectory(directory_names[10]);
FCEUI_SetBaseDirectory(directory_names[12]);
}
else
{

View File

@ -39,12 +39,25 @@ static int status_icon = 1;
static int vmod = 0;
static char *gfsdir=0;
extern char* directory_names[10];
extern char* directory_names[13];
/**
* Contains the names of the default directories.
**/
static const char *default_directory_names[9] = {"cheats", "movie", "sav", "fcs", "snaps", "memwatch", "basicbot", "macro", ""};
static const char *default_directory_names[12] = {
"", // roms
"sav", // nonvol
"fcs", // states
"", // fdsrom
"snaps", // snaps
"cheats", // cheats
"movies", // movies
"tools", // memwatch
"tools", // basicbot
"tools", // macro
"tools", // input presets
"tools" // lua scripts
};
#define NUMBER_OF_DIRECTORIES sizeof(directory_names) / sizeof(*directory_names)
#define NUMBER_OF_DEFAULT_DIRECTORIES sizeof(default_directory_names) / sizeof(*default_directory_names)

Binary file not shown.

View File

@ -9,7 +9,7 @@
#define GUI_BOT_VALUES 2
#define BTN_CANCEL 2
#define MENU_OPEN_FILE 100
#define EDIT_CHEATS 100
#define EDIT_ROMS 100
#define MENU_CLOSE_FILE 101
#define IDI_ICON1 101
#define CB_DISABLE_SPEED_THROTTLING 101
@ -42,7 +42,7 @@
#define MENU_STOP_AVI 152
#define MENU_EXIT 153
#define MENU_RESET 200
#define BUTTON_CHEATS 200
#define BUTTON_ROMS 200
#define TXT_PAD1 200
#define BTN_RESTORE_DEFAULTS 200
#define BTN_CLEAR 200

View File

@ -520,7 +520,7 @@ 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;
ofn.lpstrInitialDir = initialdir ? initialdir : gfsdir;
ofn.lpstrInitialDir = initialdir ? initialdir : FCEU_GetPath(FCEUMKF_ROMS);
// Show the Open File dialog
if(GetOpenFileName(&ofn))

View File

@ -599,7 +599,7 @@ void FCEUI_SetBaseDirectory(const char *dir)
BaseDirectory[2047] = 0;
}
static char *odirs[FCEUIOD__COUNT]={0,0,0,0,0}; // odirs, odors. ^_^
static char *odirs[FCEUIOD__COUNT]={0,0,0,0,0,0,0,0,0,0,0,0}; // odirs, odors. ^_^
void FCEUI_SetDirOverride(int which, char *n)
{
@ -611,7 +611,7 @@ void FCEUI_SetDirOverride(int which, char *n)
if(GameInfo) /* Rebuild cache of present states/movies. */
{
if(which==FCEUIOD_STATE)
if(which==FCEUIOD_STATES)
{
FCEUSS_CheckStates();
}
@ -638,25 +638,47 @@ char* FCEU_GetPath(int type)
char *ret=0;
switch(type)
{
case FCEUMKF_STATE:if(odirs[FCEUIOD_STATE])
ret=strdup(odirs[FCEUIOD_STATE]);
case FCEUMKF_STATE:
if(odirs[FCEUIOD_STATES])
ret=strdup(odirs[FCEUIOD_STATES]);
else
asprintf(&ret,"%s"PSS"fcs",BaseDirectory);
break;
case FCEUMKF_MOVIE:if(odirs[FCEUIOD_MISC])
ret=strdup(odirs[FCEUIOD_MISC]);
case FCEUMKF_MOVIE:
if(odirs[FCEUIOD_MOVIES])
ret=strdup(odirs[FCEUIOD_MOVIES]);
else
asprintf(&ret,"%s"PSS"movie",BaseDirectory);
asprintf(&ret,"%s"PSS"movies",BaseDirectory);
break;
case FCEUMKF_MEMW:if(odirs[FCEUIOD_MEMW])
case FCEUMKF_MEMW:
if(odirs[FCEUIOD_MEMW])
ret=strdup(odirs[FCEUIOD_MEMW]);
else
asprintf(&ret,"%s"PSS"memwatch",BaseDirectory);
asprintf(&ret,"%s"PSS"tools",BaseDirectory);
break;
case FCEUMKF_BBOT:if(odirs[FCEUIOD_BBOT])
case FCEUMKF_BBOT:
if(odirs[FCEUIOD_BBOT])
ret=strdup(odirs[FCEUIOD_BBOT]);
else
asprintf(&ret,"%s"PSS"basicbot",BaseDirectory);
asprintf(&ret,"%s"PSS"tools",BaseDirectory);
break;
case FCEUMKF_ROMS:
if(odirs[FCEUIOD_ROMS])
ret=strdup(odirs[FCEUIOD_ROMS]);
else
asprintf(&ret,"%s",BaseDirectory);
break;
case FCEUMKF_INPUT:
if(odirs[FCEUIOD_INPUT])
ret=strdup(odirs[FCEUIOD_INPUT]);
else
asprintf(&ret,"%s"PSS"tools",BaseDirectory);
break;
case FCEUMKF_LUA:
if(odirs[FCEUIOD_LUA])
ret=strdup(odirs[FCEUIOD_LUA]);
else
asprintf(&ret,"%s"PSS"tools",BaseDirectory);
break;
}
return(ret);
@ -668,13 +690,15 @@ char *FCEU_MakePath(int type, const char* filebase)
switch(type)
{
case FCEUMKF_MOVIE:if(odirs[FCEUIOD_MISC])
asprintf(&ret,"%s"PSS"%s",odirs[FCEUIOD_MISC],filebase);
case FCEUMKF_MOVIE:
if(odirs[FCEUIOD_MOVIES])
asprintf(&ret,"%s"PSS"%s",odirs[FCEUIOD_MOVIES],filebase);
else
asprintf(&ret,"%s"PSS"movie"PSS"%s",BaseDirectory,filebase);
asprintf(&ret,"%s"PSS"movies"PSS"%s",BaseDirectory,filebase);
break;
case FCEUMKF_STATE:if(odirs[FCEUIOD_STATE])
asprintf(&ret,"%s"PSS"%s",odirs[FCEUIOD_STATE],filebase);
case FCEUMKF_STATE:
if(odirs[FCEUIOD_STATES])
asprintf(&ret,"%s"PSS"%s",odirs[FCEUIOD_STATES],filebase);
else
asprintf(&ret,"%s"PSS"fcs"PSS"%s",BaseDirectory,filebase);
break;
@ -690,32 +714,33 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
switch(type)
{
case FCEUMKF_NPTEMP: asprintf(&ret,"%s"PSS"m590plqd94fo.tmp",BaseDirectory);break;
case FCEUMKF_MOVIE:if(id1>=0)
case FCEUMKF_MOVIE:
if(id1>=0)
{
if(odirs[FCEUIOD_MISC])
asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MISC],FileBase,id1);
if(odirs[FCEUIOD_MOVIES])
asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MOVIES],FileBase,id1);
else
asprintf(&ret,"%s"PSS"movie"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
asprintf(&ret,"%s"PSS"movies"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
if(stat(ret,&tmpstat)==-1)
{
if(odirs[FCEUIOD_MISC])
asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MISC],FileBase,id1);
if(odirs[FCEUIOD_MOVIES])
asprintf(&ret,"%s"PSS"%s.%d.fcm",odirs[FCEUIOD_MOVIES],FileBase,id1);
else
asprintf(&ret,"%s"PSS"movie"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
asprintf(&ret,"%s"PSS"movies"PSS"%s.%d.fcm",BaseDirectory,FileBase,id1);
}
}
else
{
if(odirs[FCEUIOD_MISC])
asprintf(&ret,"%s"PSS"%s.fcm",odirs[FCEUIOD_MISC],FileBase);
if(odirs[FCEUIOD_MOVIES])
asprintf(&ret,"%s"PSS"%s.fcm",odirs[FCEUIOD_MOVIES],FileBase);
else
asprintf(&ret,"%s"PSS"movie"PSS"%s.fcm",BaseDirectory,FileBase);
asprintf(&ret,"%s"PSS"movies"PSS"%s.fcm",BaseDirectory,FileBase);
}
break;
case FCEUMKF_STATE:
if(odirs[FCEUIOD_STATE])
if(odirs[FCEUIOD_STATES])
{
asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATE],FileBase,id1);
asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATES],FileBase,id1);
}
else
{
@ -723,9 +748,9 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
}
if(stat(ret,&tmpstat)==-1)
{
if(odirs[FCEUIOD_STATE])
if(odirs[FCEUIOD_STATES])
{
asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATE],FileBase,id1);
asprintf(&ret,"%s"PSS"%s.fc%d",odirs[FCEUIOD_STATES],FileBase,id1);
}
else
{
@ -749,12 +774,14 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
asprintf(&ret,"%s"PSS"snaps"PSS"%d.%s",BaseDirectory,id1,cd1);
}
break;
case FCEUMKF_FDS:if(odirs[FCEUIOD_NV])
case FCEUMKF_FDS:
if(odirs[FCEUIOD_NV])
asprintf(&ret,"%s"PSS"%s.fds",odirs[FCEUIOD_NV],FileBase);
else
asprintf(&ret,"%s"PSS"sav"PSS"%s.fds",BaseDirectory,FileBase);
break;
case FCEUMKF_SAV:if(odirs[FCEUIOD_NV])
case FCEUMKF_SAV:
if(odirs[FCEUIOD_NV])
asprintf(&ret,"%s"PSS"%s.%s",odirs[FCEUIOD_NV],FileBase,cd1);
else
asprintf(&ret,"%s"PSS"sav"PSS"%s.%s",BaseDirectory,FileBase,cd1);
@ -767,9 +794,9 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
}
break;
case FCEUMKF_REWINDSTATE:
if(odirs[FCEUIOD_STATE])
if(odirs[FCEUIOD_STATES])
{
asprintf(&ret,"%s"PSS"rewind%d.fcs",odirs[FCEUIOD_STATE],id1);
asprintf(&ret,"%s"PSS"rewind%d.fcs",odirs[FCEUIOD_STATES],id1);
}
else
{
@ -777,9 +804,9 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
}
if(stat(ret,&tmpstat)==-1)
{
if(odirs[FCEUIOD_STATE])
if(odirs[FCEUIOD_STATES])
{
asprintf(&ret,"%s"PSS"rewind%d.fcs",odirs[FCEUIOD_STATE],id1);
asprintf(&ret,"%s"PSS"rewind%d.fcs",odirs[FCEUIOD_STATES],id1);
}
else
{
@ -793,8 +820,7 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
else
asprintf(&ret,"%s"PSS"cheats"PSS"%s.cht",BaseDirectory,FileBase);
break;
case FCEUMKF_IPS: asprintf(&ret,"%s"PSS"%s%s.ips",FileBaseDirectory,FileBase,FileExt);
break;
case FCEUMKF_IPS:asprintf(&ret,"%s"PSS"%s%s.ips",FileBaseDirectory,FileBase,FileExt);break;
case FCEUMKF_GGROM:asprintf(&ret,"%s"PSS"gg.rom",BaseDirectory);break;
case FCEUMKF_FDSROM:
if(odirs[FCEUIOD_FDSROM])
@ -802,26 +828,19 @@ char *FCEU_MakeFName(int type, int id1, char *cd1)
else
asprintf(&ret,"%s"PSS"disksys.rom",BaseDirectory,FileBase);
break;
case FCEUMKF_PALETTE:
if(odirs[FCEUIOD_MISC])
asprintf(&ret,"%s"PSS"%s.pal",odirs[FCEUIOD_MISC],FileBase);
else
asprintf(&ret,"%s"PSS"%s.pal",BaseDirectory,FileBase);
break;
case FCEUMKF_PALETTE:asprintf(&ret,"%s"PSS"%s.pal",BaseDirectory,FileBase);break;
case FCEUMKF_MOVIEGLOB:
if(odirs[FCEUIOD_MISC])
// asprintf(&ret,"%s"PSS"%s*.fcm",odirs[FCEUIOD_MISC],FileBase);
asprintf(&ret,"%s"PSS"*.???",odirs[FCEUIOD_MISC]);
if(odirs[FCEUIOD_MOVIES])
// asprintf(&ret,"%s"PSS"%s*.fcm",odirs[FCEUIOD_MOVIES],FileBase);
asprintf(&ret,"%s"PSS"*.???",odirs[FCEUIOD_MOVIES]);
else
// asprintf(&ret,"%s"PSS"fcs"PSS"%s*.fcm",BaseDirectory,FileBase);
asprintf(&ret,"%s"PSS"movie"PSS"*.???",BaseDirectory);
break;
case FCEUMKF_MOVIEGLOB2:
asprintf(&ret,"%s"PSS"*.???",BaseDirectory);
asprintf(&ret,"%s"PSS"movies"PSS"*.???",BaseDirectory);
break;
case FCEUMKF_MOVIEGLOB2:asprintf(&ret,"%s"PSS"*.???",BaseDirectory);break;
case FCEUMKF_STATEGLOB:
if(odirs[FCEUIOD_STATE])
asprintf(&ret,"%s"PSS"%s*.fc?",odirs[FCEUIOD_STATE],FileBase);
if(odirs[FCEUIOD_STATES])
asprintf(&ret,"%s"PSS"%s*.fc?",odirs[FCEUIOD_STATES],FileBase);
else
asprintf(&ret,"%s"PSS"fcs"PSS"%s*.fc?",BaseDirectory,FileBase);
break;

View File

@ -43,5 +43,8 @@ char *FCEU_MakeFName(int type, int id1, char *cd1);
#define FCEUMKF_REWINDSTATE 15
#define FCEUMKF_MEMW 16
#define FCEUMKF_BBOT 17
#define FCEUMKF_ROMS 18
#define FCEUMKF_INPUT 19
#define FCEUMKF_LUA 20
#endif