diff --git a/src/drivers/win/directories.cpp b/src/drivers/win/directories.cpp new file mode 100644 index 00000000..ecc36849 --- /dev/null +++ b/src/drivers/win/directories.cpp @@ -0,0 +1,142 @@ +#include "common.h" +#include "main.h" +#include "window.h" + +/** +* Processes information from the Directories selection dialog after +* the dialog was closed. +* +* @param hwndDlg Handle of the dialog window. +**/ +void CloseDirectoriesDialog(HWND hwndDlg) +{ + int x; + + // Update the information from the screenshot naming checkbox + if(IsDlgButtonChecked(hwndDlg, CHECK_SCREENSHOT_NAMES) == BST_CHECKED) + { + eoptions |= EO_SNAPNAME; + } + else + { + eoptions &= ~EO_SNAPNAME; + } + + RemoveDirs(); // Remove empty directories. + + // Read the information from the edit fields and update the + // necessary variables. + for(x = 0; x < NUMBER_OF_DIRECTORIES; x++) + { + LONG len; + len = SendDlgItemMessage(hwndDlg, EDIT_CHEATS + x, WM_GETTEXTLENGTH, 0, 0); + + if(len <= 0) + { + if(directory_names[x]) + { + free(directory_names[x]); + } + + directory_names[x] = 0; + continue; + } + + len++; // Add 1 for null character. + + if( !(directory_names[x] = (char*)malloc(len))) //mbg merge 7/17/06 added cast + { + continue; + } + + if(!GetDlgItemText(hwndDlg, EDIT_CHEATS + x, directory_names[x], len)) + { + free(directory_names[x]); + directory_names[x]=0; + continue; + } + + } + + CreateDirs(); // Create needed directories. + SetDirs(); // Set the directories in the core. + + EndDialog(hwndDlg, 0); +} + +/** +* Callback function for the directories configuration dialog. +**/ +static BOOL CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + int x; + + switch(uMsg) + { + case WM_INITDIALOG: + + SetDlgItemText(hwndDlg,65508,"The settings in the \"Individual Directory Overrides\" group will override the settings in the \"Base Directory Override\" group. To delete an override, delete the text from the text edit control. Note that the directory the configuration file is in cannot be overridden"); + + // Initialize the directories textboxes + for(x = 0; x < NUMBER_OF_DIRECTORIES; x++) + { + SetDlgItemText(hwndDlg, EDIT_CHEATS + x, directory_names[x]); + } + + // Check the screenshot naming checkbox if necessary + if(eoptions & EO_SNAPNAME) + { + CheckDlgButton(hwndDlg, CHECK_SCREENSHOT_NAMES, BST_CHECKED); + } + break; + + case WM_CLOSE: + case WM_QUIT: + CloseDirectoriesDialog(hwndDlg); + break; + + case WM_COMMAND: + if( !(wParam >> 16) ) + { + if( (wParam & 0xFFFF) >= BUTTON_CHEATS && (wParam & 0xFFFF) <= BUTTON_CHEATS + 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", + "Save States", + "Screen Snapshots", + "Base Directory" + }; + + char name[MAX_PATH]; + + if(BrowseForFolder(hwndDlg, helpert[ ( (wParam & 0xFFFF) - BUTTON_CHEATS)], name)) + { + SetDlgItemText(hwndDlg, EDIT_CHEATS + ((wParam & 0xFFFF) - BUTTON_CHEATS), name); + } + } + else switch(wParam & 0xFFFF) + { + case CLOSE_BUTTON: + CloseDirectoriesDialog(hwndDlg); + break; + } + } + + } + + return 0; +} + +/** +* Shows the dialog for configuring the standard directories. +**/ +void ConfigDirectories() +{ + DialogBox(fceu_hInstance, "DIRCONFIG", hAppWnd, DirConCallB); +} + diff --git a/src/drivers/win/directories.h b/src/drivers/win/directories.h new file mode 100644 index 00000000..000d60c7 --- /dev/null +++ b/src/drivers/win/directories.h @@ -0,0 +1,6 @@ +#ifndef WIN_DIRECTORIES_H +#define WIN_DIRECTORIES_H + +void ConfigDirectories(); + +#endif diff --git a/src/drivers/win/guiconfig.cpp b/src/drivers/win/guiconfig.cpp new file mode 100644 index 00000000..c6deac30 --- /dev/null +++ b/src/drivers/win/guiconfig.cpp @@ -0,0 +1,101 @@ +#include "common.h" +#include "main.h" + +/** +* Processes information from the GUI options dialog after +* the dialog was closed. +* +* @param hwndDlg Handle of the dialog window. +**/ +void CloseGuiDialog(HWND hwndDlg) +{ + if(IsDlgButtonChecked(hwndDlg, CB_LOAD_FILE_OPEN) == BST_CHECKED) + { + eoptions |= EO_FOAFTERSTART; + } + else + { + eoptions &= ~EO_FOAFTERSTART; + } + + if(IsDlgButtonChecked(hwndDlg, CB_AUTO_HIDE_MENU) == BST_CHECKED) + { + eoptions |= EO_HIDEMENU; + } + else + { + eoptions &= ~EO_HIDEMENU; + } + + goptions &= ~(GOO_CONFIRMEXIT | GOO_DISABLESS); + + if(IsDlgButtonChecked(hwndDlg, CB_ASK_EXIT)==BST_CHECKED) + { + goptions |= GOO_CONFIRMEXIT; + } + + if(IsDlgButtonChecked(hwndDlg, CB_DISABLE_SCREEN_SAVER)==BST_CHECKED) + { + goptions |= GOO_DISABLESS; + } + + EndDialog(hwndDlg,0); +} + +/** +* Message loop of the GUI configuration dialog. +**/ +BOOL CALLBACK GUIConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch(uMsg) + { + case WM_INITDIALOG: + + if(eoptions & EO_FOAFTERSTART) + { + CheckDlgButton(hwndDlg, CB_LOAD_FILE_OPEN, BST_CHECKED); + } + + if(eoptions&EO_HIDEMENU) + { + CheckDlgButton(hwndDlg, CB_AUTO_HIDE_MENU, BST_CHECKED); + } + + if(goptions & GOO_CONFIRMEXIT) + { + CheckDlgButton(hwndDlg, CB_ASK_EXIT, BST_CHECKED); + } + + if(goptions & GOO_DISABLESS) + { + CheckDlgButton(hwndDlg, CB_DISABLE_SCREEN_SAVER, BST_CHECKED); + } + + break; + + case WM_CLOSE: + case WM_QUIT: + CloseGuiDialog(hwndDlg); + + case WM_COMMAND: + if(!(wParam>>16)) + { + switch(wParam&0xFFFF) + { + case BUTTON_CLOSE: + CloseGuiDialog(hwndDlg); + } + } + } + + return 0; +} + +/** +* Shows the GUI configuration dialog. +**/ +void ConfigGUI() +{ + DialogBox(fceu_hInstance, "GUICONFIG", hAppWnd, GUIConCallB); +} + diff --git a/src/drivers/win/guiconfig.h b/src/drivers/win/guiconfig.h new file mode 100644 index 00000000..41eb9f76 --- /dev/null +++ b/src/drivers/win/guiconfig.h @@ -0,0 +1,8 @@ +#ifndef WIN_GUICONFIG_H +#define WIN_GUICONFIG_H + +#include "common.h" + +void ConfigGUI(); + +#endif diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index af0e9057..a286c3e6 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -100,6 +100,12 @@ int soundoptions = SO_SECONDARY | SO_GFOCUS; **/ HWND hAppWnd = 0; +uint32 goptions = GOO_DISABLESS; + +/* Some timing-related variables (now ignored). */ +int maxconbskip = 32; /* Maximum consecutive blit skips. */ +int ffbskip = 32; /* Blit skips per blit when FF-ing */ + /** * FCE Ultra Instance **/ diff --git a/src/drivers/win/main.h b/src/drivers/win/main.h index 02eca20c..5eb34b98 100644 --- a/src/drivers/win/main.h +++ b/src/drivers/win/main.h @@ -19,9 +19,8 @@ #define GOO_CONFIRMEXIT 2 /* Confirmation before exiting. */ #define GOO_POWERRESET 4 /* Confirm on power/reset. */ -/* Some timing-related variables (now ignored). */ -static int maxconbskip = 32; /* Maximum consecutive blit skips. */ -static int ffbskip = 32; /* Blit skips per blit when FF-ing */ +extern int maxconbskip; +extern int ffbskip; static int moviereadonly = 1; @@ -55,7 +54,6 @@ static double saspectw = 1, saspecth = 1; static double winsizemulx = 1, winsizemuly = 1; static int winwidth, winheight; static int ismaximized = 0; -static uint32 goptions = GOO_DISABLESS; static int soundrate = 44100; static int soundbuftime = 50; @@ -89,6 +87,7 @@ extern int soundoptions; extern uint8 *xbsave; extern HRESULT ddrval; extern int windowedfailed; +extern uint32 goptions; void FixFL(); void DoFCEUExit(); diff --git a/src/drivers/win/palette.cpp b/src/drivers/win/palette.cpp new file mode 100644 index 00000000..9a0e1c21 --- /dev/null +++ b/src/drivers/win/palette.cpp @@ -0,0 +1,136 @@ +#include "common.h" +#include "main.h" +#include "window.h" + +/** +* Prompts the user for a palette file and opens that file. +* +* @return Flag that indicates failure (0) or success (1) +**/ +int LoadPaletteFile() +{ + const char filter[]="All usable files(*.pal)\0*.pal\0All files (*.*)\0*.*\0"; + + FILE *fp; + char nameo[2048]; + + // Display open file dialog + OPENFILENAME ofn; + memset(&ofn, 0, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hInstance = fceu_hInstance; + ofn.lpstrTitle = "FCE Ultra Open Palette File..."; + ofn.lpstrFilter = filter; + nameo[0] = 0; + ofn.lpstrFile = nameo; + ofn.nMaxFile = 256; + ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + ofn.lpstrInitialDir = 0; + + if(GetOpenFileName(&ofn)) + { + if((fp = FCEUD_UTF8fopen(nameo, "rb"))) + { + fread(cpalette, 1, 192, fp); + fclose(fp); + + FCEUI_SetPaletteArray(cpalette); + + eoptions |= EO_CPALETTE; + return 1; + } + else + { + FCEUD_PrintError("Error opening palette file!"); + } + } + + return 0; +} + +/** +* Callback function for the palette configuration dialog. +**/ +BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch(uMsg) + { + case WM_INITDIALOG: + + if(ntsccol) + { + CheckDlgButton(hwndDlg, 100, BST_CHECKED); + } + + SendDlgItemMessage(hwndDlg, 500, TBM_SETRANGE, 1, MAKELONG(0, 128)); + SendDlgItemMessage(hwndDlg, 501, TBM_SETRANGE, 1, MAKELONG(0, 128)); + + FCEUI_GetNTSCTH(&ntsctint, &ntschue); + + SendDlgItemMessage(hwndDlg, 500, TBM_SETPOS, 1, ntsctint); + SendDlgItemMessage(hwndDlg, 501, TBM_SETPOS, 1, ntschue); + + EnableWindow(GetDlgItem(hwndDlg, 201), (eoptions & EO_CPALETTE) ? 1 : 0); + + break; + + case WM_HSCROLL: + ntsctint = SendDlgItemMessage(hwndDlg, 500, TBM_GETPOS, 0, (LPARAM)(LPSTR)0); + ntschue = SendDlgItemMessage(hwndDlg, 501, TBM_GETPOS, 0, (LPARAM)(LPSTR)0); + FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue); + break; + + case WM_CLOSE: + case WM_QUIT: + goto gornk; + + case WM_COMMAND: + if(!(wParam>>16)) + { + switch(wParam&0xFFFF) + { + case 100: + ntsccol ^= 1; + FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue); + break; + + case 200: + if(LoadPaletteFile()) + { + EnableWindow(GetDlgItem(hwndDlg, 201), 1); + } + break; + + case 201: + FCEUI_SetPaletteArray(0); + eoptions &= ~EO_CPALETTE; + EnableWindow(GetDlgItem(hwndDlg, 201), 0); + break; + + case 1: +gornk: + DestroyWindow(hwndDlg); + pwindow = 0; // Yay for user race conditions. + break; + } + } + } + + return 0; +} + +/** +* Shows palette configuration dialog. +**/ +void ConfigPalette() +{ + if(!pwindow) + { + pwindow=CreateDialog(fceu_hInstance, "PALCONFIG" ,0 , PaletteConCallB); + } + else + { + SetFocus(pwindow); + } +} + diff --git a/src/drivers/win/palette.h b/src/drivers/win/palette.h new file mode 100644 index 00000000..415d9075 --- /dev/null +++ b/src/drivers/win/palette.h @@ -0,0 +1,6 @@ +#ifndef WIN_PALETTE_H +#define WIN_PALETTE_H + +void ConfigPalette(); + +#endif diff --git a/src/drivers/win/timing.cpp b/src/drivers/win/timing.cpp new file mode 100644 index 00000000..e874ac81 --- /dev/null +++ b/src/drivers/win/timing.cpp @@ -0,0 +1,67 @@ +#include "common.h" +#include "main.h" + +/** +* Callback function of the Timing configuration dialog. +**/ +BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + int x; + + switch(uMsg) { + case WM_INITDIALOG: + if(eoptions&EO_HIGHPRIO) + CheckDlgButton(hwndDlg,105,BST_CHECKED); + if(eoptions&EO_NOTHROTTLE) + CheckDlgButton(hwndDlg,101,BST_CHECKED); + for(x=0;x<10;x++) + { + char buf[8]; + sprintf(buf,"%d",x); + SendDlgItemMessage(hwndDlg,110,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); + SendDlgItemMessage(hwndDlg,111,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); + } + SendDlgItemMessage(hwndDlg,110,CB_SETCURSEL,maxconbskip,(LPARAM)(LPSTR)0); + SendDlgItemMessage(hwndDlg,111,CB_SETCURSEL,ffbskip,(LPARAM)(LPSTR)0); + break; + case WM_CLOSE: + case WM_QUIT: goto gornk; + case WM_COMMAND: + if(!(wParam>>16)) + switch(wParam&0xFFFF) + { + case 1: + gornk: + if(IsDlgButtonChecked(hwndDlg,105)==BST_CHECKED) + eoptions|=EO_HIGHPRIO; + else + eoptions&=~EO_HIGHPRIO; + + if(IsDlgButtonChecked(hwndDlg,101)==BST_CHECKED) + eoptions|=EO_NOTHROTTLE; + else + eoptions&=~EO_NOTHROTTLE; + + maxconbskip=SendDlgItemMessage(hwndDlg,110,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); + ffbskip=SendDlgItemMessage(hwndDlg,111,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); + EndDialog(hwndDlg,0); + break; + } + } + return 0; +} + +void DoTimingConfigFix() +{ + DoPriority(); +} + +/** +* Shows the Timing configuration dialog. +**/ +void ConfigTiming() +{ + DialogBox(fceu_hInstance, "TIMINGCONFIG", hAppWnd, TimingConCallB); + DoTimingConfigFix(); +} + diff --git a/src/drivers/win/timing.h b/src/drivers/win/timing.h new file mode 100644 index 00000000..827fbbbf --- /dev/null +++ b/src/drivers/win/timing.h @@ -0,0 +1,6 @@ +#ifndef WIN_TIMING_H +#define WIN_TIMING_H + +void ConfigTiming(); + +#endif diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 7dbc9038..a3534e98 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -18,6 +18,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/** +* File description: Everything relevant for the main window should go here. This +* does not include functions relevant for dialog windows. +**/ + #include "window.h" #include "main.h" #include "state.h" /* Save/Load state AS */ @@ -38,20 +43,10 @@ #include "cdlogger.h" #include "basicbot.h" -// #defines - -#define MAX(x,y) ((x)<(y)?(y):(x)) -#define MIN(x,y) ((x)>(y)?(y):(x)) - -// Type definitions - -struct CreateMovieParameters -{ - char* szFilename; // on Dialog creation, this is the default filename to display. On return, this is the filename that the user chose. - int recordFrom; // 0 = "Power-On", 1 = "Reset", 2 = "Now", 3+ = savestate file in szSavestateFilename - char* szSavestateFilename; - WCHAR metadata[MOVIE_MAX_METADATA]; -}; +#include "guiconfig.h" +#include "timing.h" +#include "palette.h" +#include "directories.h" // Extern variables @@ -63,10 +58,6 @@ extern int movieConvertOffset1, movieConvertOffset2, movieConvertOK; char *md5_asciistr(uint8 digest[16]); -void ConfigGUI(); -void ConfigTiming(); -void ConfigPalette(); -void ConfigDirectories(); void SetAutoFirePattern(int onframes, int offframes); void SetAutoFireOffset(int offset); @@ -91,7 +82,7 @@ const unsigned int MAX_NUMBER_OF_RECENT_DIRS = sizeof(recent_directories)/sizeof static int movieHackType = 3; -static HWND pwindow; +HWND pwindow; /** * Menu handle of the main menu. @@ -143,7 +134,6 @@ void ShowCursorAbs(int set_visible) } } - void CalcWindowSize(RECT *al) { al->left = 0; @@ -1459,300 +1449,6 @@ int GetClientAbsRect(LPRECT lpRect) return 1; } -/** -* Prompts the user for a palette file and opens that file. -* -* @return Flag that indicates failure (0) or success (1) -**/ -int LoadPaletteFile() -{ - const char filter[]="All usable files(*.pal)\0*.pal\0All files (*.*)\0*.*\0"; - - FILE *fp; - char nameo[2048]; - - // Display open file dialog - OPENFILENAME ofn; - memset(&ofn, 0, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hInstance = fceu_hInstance; - ofn.lpstrTitle = "FCE Ultra Open Palette File..."; - ofn.lpstrFilter = filter; - nameo[0] = 0; - ofn.lpstrFile = nameo; - ofn.nMaxFile = 256; - ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.lpstrInitialDir = 0; - - if(GetOpenFileName(&ofn)) - { - if((fp = FCEUD_UTF8fopen(nameo, "rb"))) - { - fread(cpalette, 1, 192, fp); - fclose(fp); - - FCEUI_SetPaletteArray(cpalette); - - eoptions |= EO_CPALETTE; - return 1; - } - else - { - FCEUD_PrintError("Error opening palette file!"); - } - } - - return 0; -} - -/** -* Callback function for the palette configuration dialog. -**/ -BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch(uMsg) - { - case WM_INITDIALOG: - - if(ntsccol) - { - CheckDlgButton(hwndDlg, 100, BST_CHECKED); - } - - SendDlgItemMessage(hwndDlg, 500, TBM_SETRANGE, 1, MAKELONG(0, 128)); - SendDlgItemMessage(hwndDlg, 501, TBM_SETRANGE, 1, MAKELONG(0, 128)); - - FCEUI_GetNTSCTH(&ntsctint, &ntschue); - - SendDlgItemMessage(hwndDlg, 500, TBM_SETPOS, 1, ntsctint); - SendDlgItemMessage(hwndDlg, 501, TBM_SETPOS, 1, ntschue); - - EnableWindow(GetDlgItem(hwndDlg, 201), (eoptions & EO_CPALETTE) ? 1 : 0); - - break; - - case WM_HSCROLL: - ntsctint = SendDlgItemMessage(hwndDlg, 500, TBM_GETPOS, 0, (LPARAM)(LPSTR)0); - ntschue = SendDlgItemMessage(hwndDlg, 501, TBM_GETPOS, 0, (LPARAM)(LPSTR)0); - FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue); - break; - - case WM_CLOSE: - case WM_QUIT: - goto gornk; - - case WM_COMMAND: - if(!(wParam>>16)) - { - switch(wParam&0xFFFF) - { - case 100: - ntsccol ^= 1; - FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue); - break; - - case 200: - if(LoadPaletteFile()) - { - EnableWindow(GetDlgItem(hwndDlg, 201), 1); - } - break; - - case 201: - FCEUI_SetPaletteArray(0); - eoptions &= ~EO_CPALETTE; - EnableWindow(GetDlgItem(hwndDlg, 201), 0); - break; - - case 1: -gornk: - DestroyWindow(hwndDlg); - pwindow = 0; // Yay for user race conditions. - break; - } - } - } - - return 0; -} - -/** -* Shows palette configuration dialog. -**/ -void ConfigPalette(void) -{ - if(!pwindow) - { - pwindow=CreateDialog(fceu_hInstance, "PALCONFIG" ,0 , PaletteConCallB); - } - else - { - SetFocus(pwindow); - } -} - -/** -* Callback function of the Timing configuration dialog. -**/ -BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - int x; - - switch(uMsg) { - case WM_INITDIALOG: - if(eoptions&EO_HIGHPRIO) - CheckDlgButton(hwndDlg,105,BST_CHECKED); - if(eoptions&EO_NOTHROTTLE) - CheckDlgButton(hwndDlg,101,BST_CHECKED); - for(x=0;x<10;x++) - { - char buf[8]; - sprintf(buf,"%d",x); - SendDlgItemMessage(hwndDlg,110,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); - SendDlgItemMessage(hwndDlg,111,CB_ADDSTRING,0,(LPARAM)(LPSTR)buf); - } - SendDlgItemMessage(hwndDlg,110,CB_SETCURSEL,maxconbskip,(LPARAM)(LPSTR)0); - SendDlgItemMessage(hwndDlg,111,CB_SETCURSEL,ffbskip,(LPARAM)(LPSTR)0); - break; - case WM_CLOSE: - case WM_QUIT: goto gornk; - case WM_COMMAND: - if(!(wParam>>16)) - switch(wParam&0xFFFF) - { - case 1: - gornk: - if(IsDlgButtonChecked(hwndDlg,105)==BST_CHECKED) - eoptions|=EO_HIGHPRIO; - else - eoptions&=~EO_HIGHPRIO; - - if(IsDlgButtonChecked(hwndDlg,101)==BST_CHECKED) - eoptions|=EO_NOTHROTTLE; - else - eoptions&=~EO_NOTHROTTLE; - - maxconbskip=SendDlgItemMessage(hwndDlg,110,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); - ffbskip=SendDlgItemMessage(hwndDlg,111,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); - EndDialog(hwndDlg,0); - break; - } - } - return 0; -} - -void DoTimingConfigFix() -{ - DoPriority(); -} - -/** -* Shows the Timing configuration dialog. -**/ -void ConfigTiming(void) -{ - DialogBox(fceu_hInstance, "TIMINGCONFIG", hAppWnd, TimingConCallB); - DoTimingConfigFix(); -} - -/** -* Processes information from the GUI options dialog after -* the dialog was closed. -* -* @param hwndDlg Handle of the dialog window. -**/ -void CloseGuiDialog(HWND hwndDlg) -{ - if(IsDlgButtonChecked(hwndDlg, CB_LOAD_FILE_OPEN) == BST_CHECKED) - { - eoptions |= EO_FOAFTERSTART; - } - else - { - eoptions &= ~EO_FOAFTERSTART; - } - - if(IsDlgButtonChecked(hwndDlg, CB_AUTO_HIDE_MENU) == BST_CHECKED) - { - eoptions |= EO_HIDEMENU; - } - else - { - eoptions &= ~EO_HIDEMENU; - } - - goptions &= ~(GOO_CONFIRMEXIT | GOO_DISABLESS); - - if(IsDlgButtonChecked(hwndDlg, CB_ASK_EXIT)==BST_CHECKED) - { - goptions |= GOO_CONFIRMEXIT; - } - - if(IsDlgButtonChecked(hwndDlg, CB_DISABLE_SCREEN_SAVER)==BST_CHECKED) - { - goptions |= GOO_DISABLESS; - } - - EndDialog(hwndDlg,0); -} - -/** -* Message loop of the GUI configuration dialog. -**/ -BOOL CALLBACK GUIConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch(uMsg) - { - case WM_INITDIALOG: - - if(eoptions & EO_FOAFTERSTART) - { - CheckDlgButton(hwndDlg, CB_LOAD_FILE_OPEN, BST_CHECKED); - } - - if(eoptions&EO_HIDEMENU) - { - CheckDlgButton(hwndDlg, CB_AUTO_HIDE_MENU, BST_CHECKED); - } - - if(goptions & GOO_CONFIRMEXIT) - { - CheckDlgButton(hwndDlg, CB_ASK_EXIT, BST_CHECKED); - } - - if(goptions & GOO_DISABLESS) - { - CheckDlgButton(hwndDlg, CB_DISABLE_SCREEN_SAVER, BST_CHECKED); - } - - break; - - case WM_CLOSE: - case WM_QUIT: - CloseGuiDialog(hwndDlg); - - case WM_COMMAND: - if(!(wParam>>16)) - { - switch(wParam&0xFFFF) - { - case BUTTON_CLOSE: - CloseGuiDialog(hwndDlg); - } - } - } - - return 0; -} - -/** -* Shows the GUI configuration dialog. -**/ -void ConfigGUI(void) -{ - DialogBox(fceu_hInstance, "GUICONFIG", hAppWnd, GUIConCallB); -} - /** * Displays a folder selection dialog. * @@ -1801,144 +1497,6 @@ int BrowseForFolder(HWND hParent, const char *htext, char *buf) return 1; } -/** -* Processes information from the Directories selection dialog after -* the dialog was closed. -* -* @param hwndDlg Handle of the dialog window. -**/ -void CloseDirectoriesDialog(HWND hwndDlg) -{ - int x; - - // Update the information from the screenshot naming checkbox - if(IsDlgButtonChecked(hwndDlg, CHECK_SCREENSHOT_NAMES) == BST_CHECKED) - { - eoptions |= EO_SNAPNAME; - } - else - { - eoptions &= ~EO_SNAPNAME; - } - - RemoveDirs(); // Remove empty directories. - - // Read the information from the edit fields and update the - // necessary variables. - for(x = 0; x < NUMBER_OF_DIRECTORIES; x++) - { - LONG len; - len = SendDlgItemMessage(hwndDlg, EDIT_CHEATS + x, WM_GETTEXTLENGTH, 0, 0); - - if(len <= 0) - { - if(directory_names[x]) - { - free(directory_names[x]); - } - - directory_names[x] = 0; - continue; - } - - len++; // Add 1 for null character. - - if( !(directory_names[x] = (char*)malloc(len))) //mbg merge 7/17/06 added cast - { - continue; - } - - if(!GetDlgItemText(hwndDlg, EDIT_CHEATS + x, directory_names[x], len)) - { - free(directory_names[x]); - directory_names[x]=0; - continue; - } - - } - - CreateDirs(); // Create needed directories. - SetDirs(); // Set the directories in the core. - - EndDialog(hwndDlg, 0); -} - -/** -* Callback function for the directories configuration dialog. -**/ -static BOOL CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - int x; - - switch(uMsg) - { - case WM_INITDIALOG: - - SetDlgItemText(hwndDlg,65508,"The settings in the \"Individual Directory Overrides\" group will override the settings in the \"Base Directory Override\" group. To delete an override, delete the text from the text edit control. Note that the directory the configuration file is in cannot be overridden"); - - // Initialize the directories textboxes - for(x = 0; x < NUMBER_OF_DIRECTORIES; x++) - { - SetDlgItemText(hwndDlg, EDIT_CHEATS + x, directory_names[x]); - } - - // Check the screenshot naming checkbox if necessary - if(eoptions & EO_SNAPNAME) - { - CheckDlgButton(hwndDlg, CHECK_SCREENSHOT_NAMES, BST_CHECKED); - } - break; - - case WM_CLOSE: - case WM_QUIT: - CloseDirectoriesDialog(hwndDlg); - break; - - case WM_COMMAND: - if( !(wParam >> 16) ) - { - if( (wParam & 0xFFFF) >= BUTTON_CHEATS && (wParam & 0xFFFF) <= BUTTON_CHEATS + 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", - "Save States", - "Screen Snapshots", - "Base Directory" - }; - - char name[MAX_PATH]; - - if(BrowseForFolder(hwndDlg, helpert[ ( (wParam & 0xFFFF) - BUTTON_CHEATS)], name)) - { - SetDlgItemText(hwndDlg, EDIT_CHEATS + ((wParam & 0xFFFF) - BUTTON_CHEATS), name); - } - } - else switch(wParam & 0xFFFF) - { - case CLOSE_BUTTON: - CloseDirectoriesDialog(hwndDlg); - break; - } - } - - } - - return 0; -} - -/** -* Shows the dialog for configuring the standard directories. -**/ -void ConfigDirectories(void) -{ - DialogBox(fceu_hInstance, "DIRCONFIG", hAppWnd, DirConCallB); -} - static char* GetReplayPath(HWND hwndDlg) { char* fn=0; diff --git a/src/drivers/win/window.h b/src/drivers/win/window.h index fe838549..149586ed 100644 --- a/src/drivers/win/window.h +++ b/src/drivers/win/window.h @@ -3,10 +3,26 @@ #include "common.h" +// #defines + +#define MAX(x,y) ((x)<(y)?(y):(x)) +#define MIN(x,y) ((x)>(y)?(y):(x)) + +// Type definitions + +struct CreateMovieParameters +{ + char* szFilename; // on Dialog creation, this is the default filename to display. On return, this is the filename that the user chose. + int recordFrom; // 0 = "Power-On", 1 = "Reset", 2 = "Now", 3+ = savestate file in szSavestateFilename + char* szSavestateFilename; + WCHAR metadata[MOVIE_MAX_METADATA]; +}; + static int EnableBackgroundInput = 0; extern char *recent_files[]; extern char *recent_directories[10]; +extern HWND pwindow; void ShowCursorAbs(int set_visible); void HideFWindow(int h); @@ -19,5 +35,6 @@ int CreateMainWindow(); void UpdateCheckedMenuItems(); void ALoad(char *nameo); void LoadNewGamey(HWND hParent, const char *initialdir); +int BrowseForFolder(HWND hParent, const char *htext, char *buf); #endif \ No newline at end of file diff --git a/vc8/fceux.vcproj b/vc8/fceux.vcproj index 61a5b26a..79fd9db9 100644 --- a/vc8/fceux.vcproj +++ b/vc8/fceux.vcproj @@ -830,6 +830,22 @@ RelativePath="..\src\drivers\win\debuggersp.h" > + + + + + + + + @@ -986,6 +1002,32 @@ RelativePath="..\src\drivers\win\OutputDS.cpp" > + + + + + + + + + + @@ -1062,6 +1104,14 @@ RelativePath="..\src\drivers\win\state.h" > + + + +