diff --git a/src/drivers/win/input.cpp b/src/drivers/win/input.cpp index 3d483608..a3eb64d6 100644 --- a/src/drivers/win/input.cpp +++ b/src/drivers/win/input.cpp @@ -1003,187 +1003,281 @@ static void DoTBConfig(HWND hParent, const char *text, char *_template, ButtConf DialogBox(fceu_hInstance,_template,hParent,DoTBCallB); } -static BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +/** +* Callback function of the input configuration dialog. +**/ +BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static const char *strn[6]={"","Gamepad","Zapper","Power Pad A","Power Pad B","Arkanoid Paddle"}; - static const char *strf[14]= - {"","Arkanoid Paddle","Hyper Shot gun","4-Player Adapter", - "Family Keyboard","Subor Keyboard","HyperShot Pads", "Mahjong", "Quiz King Buzzers", - "Family Trainer A","Family Trainer B", "Oeka Kids Tablet", "Barcode World", - "Top Rider"}; - static const int haven[6]={0,1,0,1,1,0}; - static const int havef[14]={0,0,0,0, 1,1,0,0, 1,1,1,0, 0,0}; - int x; - - switch(uMsg) { - case WM_INITDIALOG: - SetDlgItemText(hwndDlg,65488,"Select the device you want to be enabled on input ports 1 and 2, and the Famicom expansion port. You may configure the device listed above each drop-down list by pressing \"Configure\", if applicable. The device currently being emulated on the each port is listed above the drop down list; loading certain games will override your settings, but only temporarily. If you select a device to be on the emulated Famicom Expansion Port, you should probably have emulated gamepads on the emulated NES-style input ports."); - for(x=0;x<2;x++) - { - int y; + const char * const nes_description[6] = { + "", + "Gamepad", + "Zapper", + "Power Pad A", + "Power Pad B", + "Arkanoid Paddle" + }; - for(y=0;y<6;y++) - SendDlgItemMessage(hwndDlg,104+x,CB_ADDSTRING,0,(LPARAM)(LPSTR)strn[y]); + const unsigned int NUMBER_OF_PORTS = 2; + const unsigned int NUMBER_OF_NES_DEVICES = sizeof(nes_description) / sizeof(*nes_description); - SendDlgItemMessage(hwndDlg,104+x,CB_SETCURSEL,UsrInputType[x],(LPARAM)(LPSTR)0); - EnableWindow(GetDlgItem(hwndDlg,106+x),haven[InputType[x]]); - SetDlgItemText(hwndDlg,200+x,(LPTSTR)strn[InputType[x]]); - } + const char * const famicom_description[14] = + { + "", + "Arkanoid Paddle", + "Hyper Shot gun", + "4-Player Adapter", + "Family Keyboard", + "Subor Keyboard", + "HyperShot Pads", + "Mahjong", + "Quiz King Buzzers", + "Family Trainer A", + "Family Trainer B", + "Oeka Kids Tablet", + "Barcode World", + "Top Rider"}; + const static unsigned int NUMBER_OF_FAMICOM_DEVICES = sizeof(famicom_description) / sizeof(*famicom_description); - { - int y; - for(y=0;y<13;y++) - SendDlgItemMessage(hwndDlg,110,CB_ADDSTRING,0,(LPARAM)(LPSTR)strf[y]); - SendDlgItemMessage(hwndDlg,110,CB_SETCURSEL,UsrInputType[2],(LPARAM)(LPSTR)0); - EnableWindow(GetDlgItem(hwndDlg,111),havef[InputType[2]]); - SetDlgItemText(hwndDlg,202,(LPTSTR)strf[InputType[2]]); - } - - extern int autoHoldKey, autoHoldClearKey; - char btext[128]; - if(autoHoldKey) + static const int haven[6]= { 0, 1, 0, 1, 1, 0 }; + + static const int havef[14]= { 0,0,0,0, 1,1,0,0, 1,1,1,0, 0,0 }; + + int port; + + switch(uMsg) + { + case WM_INITDIALOG: + + SetDlgItemText(hwndDlg, LBL_INPUT_HELP, "Select the device you want to be enabled on input ports 1 and 2, and the Famicom expansion port. You may configure the device listed above each drop-down list by pressing \"Configure\", if applicable. The device currently being emulated on the each port is listed above the drop down list; loading certain games will override your settings, but only temporarily. If you select a device to be on the emulated Famicom Expansion Port, you should probably have emulated gamepads on the emulated NES-style input ports."); + + int current_device; + + for(port = 0; port < NUMBER_OF_PORTS; port++) { - if(!GetKeyNameText(autoHoldKey<<16,btext,128)) - sprintf(btext, "KB: %d", autoHoldKey); - } - else - sprintf(btext, "not assigned"); - SetDlgItemText(hwndDlg, 115, btext); + for(current_device = 0; current_device < NUMBER_OF_NES_DEVICES; current_device++) + { + SendDlgItemMessage(hwndDlg, COMBO_PAD1 + port, CB_ADDSTRING, 0, (LPARAM)(LPSTR)nes_description[current_device]); + } - if(autoHoldClearKey) + SendDlgItemMessage(hwndDlg, COMBO_PAD1 + port, CB_SETCURSEL, UsrInputType[port],(LPARAM)(LPSTR)0); + EnableWindow(GetDlgItem(hwndDlg,BTN_PORT1 + port) ,haven[InputType[port]]); + SetDlgItemText(hwndDlg, TXT_PAD1 + port, (LPTSTR)nes_description[InputType[port]]); + } + + for(current_device = 0; current_device < NUMBER_OF_FAMICOM_DEVICES; current_device++) { - if(!GetKeyNameText(autoHoldClearKey<<16,btext,128)) - sprintf(btext, "KB: %d", autoHoldClearKey); + SendDlgItemMessage(hwndDlg, COMBO_FAM, CB_ADDSTRING, 0, (LPARAM)(LPSTR)famicom_description[current_device]); } - else - sprintf(btext, "not assigned"); - SetDlgItemText(hwndDlg, 116, btext); - break; - case WM_CLOSE: - case WM_QUIT: goto gornk; - case WM_COMMAND: - if(HIWORD(wParam)==CBN_SELENDOK) - { - switch(LOWORD(wParam)) - { - case 104: - case 105:UsrInputType[LOWORD(wParam)-104]=InputType[LOWORD(wParam)-104]=SendDlgItemMessage(hwndDlg,LOWORD(wParam),CB_GETCURSEL,0,(LPARAM)(LPSTR)0); - EnableWindow( GetDlgItem(hwndDlg,LOWORD(wParam)+2),haven[InputType[LOWORD(wParam)-104]]); - SetDlgItemText(hwndDlg,200+LOWORD(wParam)-104,(LPTSTR)strn[InputType[LOWORD(wParam)-104]]); - break; - case 110:UsrInputType[2]=InputType[2]=SendDlgItemMessage(hwndDlg,110,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); - EnableWindow(GetDlgItem(hwndDlg,111),havef[InputType[2]]); - SetDlgItemText(hwndDlg,202,(LPTSTR)strf[InputType[2]]); - break; - - } + SendDlgItemMessage(hwndDlg, COMBO_FAM, CB_SETCURSEL, UsrInputType[2], (LPARAM)(LPSTR)0); + EnableWindow(GetDlgItem(hwndDlg, BTN_FAM), havef[InputType[2]]); + SetDlgItemText(hwndDlg, TXT_FAM, (LPTSTR)famicom_description[InputType[2]]); - } - if(!(wParam>>16)) - switch(wParam&0xFFFF) - { - case 111: - { - const char *text = strf[InputType[2]]; - DoTBType=DoTBPort=0; + extern int autoHoldKey, autoHoldClearKey; + char btext[128]; - switch(InputType[2]) - { - case SIFC_FTRAINERA: - case SIFC_FTRAINERB:DoTBConfig(hwndDlg, text, "POWERPADDIALOG", FTrainerButtons, 12); break; - case SIFC_FKB:DoTBConfig(hwndDlg, text, "FKBDIALOG",fkbmap,0x48);break; - case SIFC_SUBORKB:DoTBConfig(hwndDlg, text, "SUBORKBDIALOG",suborkbmap,0x60);break; - case SIFC_QUIZKING:DoTBConfig(hwndDlg, text, "QUIZKINGDIALOG",QuizKingButtons,6);break; - } - } - break; + if(autoHoldKey) + { + if(!GetKeyNameText(autoHoldKey << 16, btext, 128)) + { + sprintf(btext, "KB: %d", autoHoldKey); + } + } + else + { + sprintf(btext, "not assigned"); + } - case 107: - case 106: - { - int which=(wParam&0xFFFF)-106; - const char *text = strn[InputType[which]]; + SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, btext); - DoTBType=DoTBPort=0; - switch(InputType[which]) - { - case SI_GAMEPAD: - { - ButtConfig tmp[10 + 10]; + if(autoHoldClearKey) + { + if(!GetKeyNameText(autoHoldClearKey << 16, btext, 128)) + { + sprintf(btext, "KB: %d", autoHoldClearKey); + } + } + else + { + sprintf(btext, "not assigned"); + } - memcpy(tmp, GamePadConfig[which], 10 * sizeof(ButtConfig)); - memcpy(&tmp[10], GamePadConfig[which+2], 10 * sizeof(ButtConfig)); + SetDlgItemText(hwndDlg, LBL_CLEAR_AH, btext); - DoTBType=SI_GAMEPAD; - DoTBPort=which; - DoTBConfig(hwndDlg, text, "GAMEPADDIALOG", tmp, 10 + 10); + break; - memcpy(GamePadConfig[which], tmp, 10 * sizeof(ButtConfig)); - memcpy(GamePadConfig[which+2], &tmp[10], 10 * sizeof(ButtConfig)); - } - break; + case WM_CLOSE: + case WM_QUIT: + EndDialog(hwndDlg, 0); - case SI_POWERPADA: - case SI_POWERPADB: - DoTBConfig(hwndDlg, text, "POWERPADDIALOG",powerpadsc[which],12); - break; - } - } - break; + case WM_COMMAND: + + if(HIWORD(wParam)==CBN_SELENDOK) + { + switch(LOWORD(wParam)) + { + case COMBO_PAD1: + case COMBO_PAD2: + { + unsigned int sel_input = LOWORD(wParam) - COMBO_PAD1; + UsrInputType[sel_input] = InputType[sel_input] = SendDlgItemMessage(hwndDlg, LOWORD(wParam), CB_GETCURSEL, 0, (LPARAM)(LPSTR)0); + EnableWindow( GetDlgItem(hwndDlg, LOWORD(wParam) + 2), haven[InputType[sel_input]]); + SetDlgItemText(hwndDlg, TXT_PAD1 + sel_input, (LPTSTR)nes_description[InputType[sel_input]]); + } + + break; + + case COMBO_FAM: + UsrInputType[2] = + InputType[2] = + SendDlgItemMessage(hwndDlg, COMBO_FAM, CB_GETCURSEL, 0, (LPARAM)(LPSTR)0); + + EnableWindow(GetDlgItem(hwndDlg, BTN_FAM), havef[InputType[2]]); + SetDlgItemText(hwndDlg, TXT_FAM, (LPTSTR)famicom_description[InputType[2]]); + break; + + } + + } + + if( !(wParam >> 16) ) + { + switch(wParam & 0xFFFF) + { + case BTN_FAM: + { + const char *text = famicom_description[InputType[2]]; + DoTBType = DoTBPort = 0; + + switch(InputType[2]) + { + case SIFC_FTRAINERA: + case SIFC_FTRAINERB: + DoTBConfig(hwndDlg, text, "POWERPADDIALOG", FTrainerButtons, 12); + break; + case SIFC_FKB: + DoTBConfig(hwndDlg, text, "FKBDIALOG", fkbmap, 0x48); + break; + case SIFC_SUBORKB: + DoTBConfig(hwndDlg, text, "SUBORKBDIALOG", suborkbmap, 0x60); + break; + case SIFC_QUIZKING: + DoTBConfig(hwndDlg, text, "QUIZKINGDIALOG", QuizKingButtons, 6); + break; + } + } + break; + + case BTN_PORT2: + case BTN_PORT1: + { + int which = (wParam & 0xFFFF) - BTN_PORT1; + const char *text = nes_description[InputType[which]]; + + DoTBType = DoTBPort = 0; + + switch(InputType[which]) + { + case SI_GAMEPAD: + { + ButtConfig tmp[10 + 10]; + + memcpy(tmp, GamePadConfig[which], 10 * sizeof(ButtConfig)); + memcpy(&tmp[10], GamePadConfig[which + 2], 10 * sizeof(ButtConfig)); + + DoTBType = SI_GAMEPAD; + DoTBPort = which; + DoTBConfig(hwndDlg, text, "GAMEPADDIALOG", tmp, 10 + 10); + + memcpy(GamePadConfig[which], tmp, 10 * sizeof(ButtConfig)); + memcpy(GamePadConfig[which + 2], &tmp[10], 10 * sizeof(ButtConfig)); + } + break; + + case SI_POWERPADA: + case SI_POWERPADB: + DoTBConfig(hwndDlg, text, "POWERPADDIALOG", powerpadsc[which], 12); + break; + } + } + break; + + case BTN_AUTO_HOLD: // auto-hold button + { + char btext[128] = { 0 }; + + GetDlgItemText(hwndDlg, BTN_AUTO_HOLD, btext, sizeof(btext) ); - case 112: // auto-hold button - { - char btext[128]; - btext[0]=0; - GetDlgItemText(hwndDlg, 112, btext, 128); int button = DWaitSimpleButton(hwndDlg, (uint8*)btext); //mbg merge 7/17/06 + if(button) { - if(!GetKeyNameText(button<<16,btext,128)) + if(!GetKeyNameText(button << 16, btext, 128)) + { sprintf(btext, "KB: %d", button); + } } else + { sprintf(btext, "not assigned"); + } + extern int autoHoldKey; autoHoldKey = button; - SetDlgItemText(hwndDlg, 115, btext); - } - break; - case 114: // auto-hold clear button - { - char btext[128]; - btext[0]=0; - GetDlgItemText(hwndDlg, 114, btext, 128); + SetDlgItemText(hwndDlg, LBL_AUTO_HOLD, btext); + } + break; + case BTN_CLEAR_AH: // auto-hold clear button + { + char btext[128] = { 0 }; + + GetDlgItemText(hwndDlg, BTN_CLEAR_AH, btext, 128); + int button = DWaitSimpleButton(hwndDlg, (uint8*)btext); //mbg merge 7/17/06 added cast + if(button) { - if(!GetKeyNameText(button<<16,btext,128)) + if( !GetKeyNameText(button << 16, btext, sizeof(btext))) + { sprintf(btext, "KB: %d", button); + } } else + { sprintf(btext, "not assigned"); + } + extern int autoHoldClearKey; autoHoldClearKey = button; - SetDlgItemText(hwndDlg, 116, btext); - } - break; - case 1: - gornk: - EndDialog(hwndDlg,0); - break; - } - } - return 0; + SetDlgItemText(hwndDlg, LBL_CLEAR_AH, btext); + } + break; + + case BTN_CLOSE: + EndDialog(hwndDlg, 0); + break; + } + } + } + + return 0; } +/** +* Shows the input configuration dialog. +* +* @param hParent Handle of the parent window. +**/ void ConfigInput(HWND hParent) { - DialogBox(fceu_hInstance,"INPUTCONFIG",hParent,InputConCallB); - if(GameInfo) - InitOtherInput(); + DialogBox(fceu_hInstance, "INPUTCONFIG", hParent, InputConCallB); + + if(GameInfo) + { + InitOtherInput(); + } } @@ -1816,16 +1910,21 @@ static BOOL CALLBACK MapInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, return FALSE; } +/** +* Show input mapping configuration dialog. +**/ void MapInput(void) { - // Make a backup of the current mappings, in case the user changes their mind. - int* backupmapping = (int*)malloc(sizeof(FCEUD_CommandMapping)); - memcpy(backupmapping, FCEUD_CommandMapping, sizeof(FCEUD_CommandMapping)); + // Make a backup of the current mappings, in case the user changes their mind. + int* backupmapping = (int*)malloc(sizeof(FCEUD_CommandMapping)); + memcpy(backupmapping, FCEUD_CommandMapping, sizeof(FCEUD_CommandMapping)); - if(!DialogBox(fceu_hInstance,"MAPINPUT",hAppWnd,MapInputDialogProc)) - memcpy(FCEUD_CommandMapping, backupmapping, sizeof(FCEUD_CommandMapping)); + if(!DialogBox(fceu_hInstance, "MAPINPUT", hAppWnd, MapInputDialogProc)) + { + memcpy(FCEUD_CommandMapping, backupmapping, sizeof(FCEUD_CommandMapping)); + } - free(backupmapping); + free(backupmapping); } void FCEUD_TurboOn(void) diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 4d002b70..f147ce0f 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -306,7 +306,7 @@ char *FCEUD_GetCompilerString() { **/ void ShowAboutBox(void) { - MessageBox(hAppWnd,FCEUI_GetAboutString(),FCEU_NAME,MB_OK); + MessageBox(hAppWnd, FCEUI_GetAboutString(), FCEU_NAME, MB_OK); } //mbg 6/30/06 - indicates that the main loop should close the game as soon as it can diff --git a/src/drivers/win/netplay.cpp b/src/drivers/win/netplay.cpp index f59ac1c8..2cedab57 100644 --- a/src/drivers/win/netplay.cpp +++ b/src/drivers/win/netplay.cpp @@ -486,9 +486,13 @@ static BOOL CALLBACK NetCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara return 0; } - +/** +* Shows Netplay dialog. +**/ void ShowNetplayConsole(void) { - if(!netwin) - netwin=CreateDialog(fceu_hInstance,"NETMOO",0,NetCon); + if(!netwin) + { + netwin = CreateDialog(fceu_hInstance, "NETMOO", 0, NetCon); + } } diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 37115285..3bc92907 100644 Binary files a/src/drivers/win/res.rc and b/src/drivers/win/res.rc differ diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index cb2f244b..c7e85795 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -5,6 +5,7 @@ #define GUI_BOT_CLOSE 1 #define CLOSE_BUTTON 1 #define BUTTON_CLOSE 1 +#define BTN_CLOSE 1 #define GUI_BOT_VALUES 2 #define MENU_OPEN_FILE 100 #define EDIT_CHEATS 100 @@ -14,10 +15,20 @@ #define MENU_RECENT_FILES 102 #define CB_LOAD_FILE_OPEN 102 #define CB_AUTO_HIDE_MENU 104 +#define COMBO_PAD1 104 +#define COMBO_PAD2 105 +#define BTN_PORT1 106 +#define BTN_PORT2 107 #define MENU_SAVE_STATE 110 #define CB_ASK_EXIT 110 +#define COMBO_FAM 110 #define MENU_LOAD_STATE 111 #define CB_DISABLE_SCREEN_SAVER 111 +#define BTN_FAM 111 +#define BTN_AUTO_HOLD 112 +#define BTN_CLEAR_AH 114 +#define LBL_AUTO_HOLD 115 +#define LBL_CLEAR_AH 116 #define MENU_RECORD_MOVIE 141 #define MENU_REPLAY_MOVIE 142 #define MENU_STOP_MOVIE 143 @@ -26,8 +37,11 @@ #define MENU_EXIT 153 #define MENU_RESET 200 #define BUTTON_CHEATS 200 +#define TXT_PAD1 200 #define MENU_POWER 201 +#define TXT_PAD2 201 #define MENU_EJECT_DISK 202 +#define TXT_FAM 202 #define MENU_SWITCH_DISK 203 #define MENU_INSERT_COIN 204 #define MENU_HIDE_MENU 300 @@ -39,6 +53,7 @@ #define MENU_GAME_GENIE 310 #define MENU_PAL 311 #define MENU_DIRECTORIES 320 +#define MENU_INPUT 321 #define MENU_GUI_OPTIONS 327 #define GUI_BOT_A_1 1000 #define GUI_BOT_B_1 1001 @@ -160,6 +175,14 @@ #define GUI_BOT_TITLEL5 1112 #define GUI_BOT_TITLEL6 1113 #define GUI_BOT_COUNTERS 1114 +#define MENU_NETWORK 40040 +#define MENU_PALETTE 40041 +#define MENU_SOUND 40042 +#define MENU_TIMING 40043 +#define MENU_VIDEO 40044 +#define MENU_HOTKEYS 40045 +#define MENU_ABOUT 40046 +#define MENU_MSGLOG 40047 #define ID_DEBUG_DEBUGGER 40053 #define ID_DEBUG_PPUVIEWER 40054 #define ID_DEBUG_NAMETABLEVIEWER 40055 @@ -170,13 +193,14 @@ #define MENU_LOG_SOUND 40120 #define GUI_BOT_DEBUG 65436 #define GUI_BOT_ERROR 65438 +#define LBL_INPUT_HELP 65488 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40039 +#define _APS_NEXT_COMMAND_VALUE 40048 #define _APS_NEXT_CONTROL_VALUE 1117 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/src/drivers/win/sound.cpp b/src/drivers/win/sound.cpp index b42a3bd8..1c3d62f6 100644 --- a/src/drivers/win/sound.cpp +++ b/src/drivers/win/sound.cpp @@ -499,13 +499,19 @@ BOOL CALLBACK SoundConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara return 0; } - +/** +* Shows the sounds configuration dialog. +**/ void ConfigSound(void) { - if(!uug) - uug=CreateDialog(fceu_hInstance,"SOUNDCONFIG",0,SoundConCallB); - else - SetFocus(uug); + if(!uug) + { + uug = CreateDialog(fceu_hInstance, "SOUNDCONFIG", 0, SoundConCallB); + } + else + { + SetFocus(uug); + } } void FCEUD_SoundToggle(void) diff --git a/src/drivers/win/video.cpp b/src/drivers/win/video.cpp index bfa4155b..37a9c79a 100644 --- a/src/drivers/win/video.cpp +++ b/src/drivers/win/video.cpp @@ -1115,18 +1115,24 @@ void DoVideoConfigFix(void) UpdateRendBounds(); } +/** +* Shows the Video configuration dialog. +**/ void ConfigVideo(void) { - DialogBox(fceu_hInstance,"VIDEOCONFIG",hAppWnd,VideoConCallB); - DoVideoConfigFix(); - if(fullscreen) - SetFSVideoMode(); - else - { - changerecursive=1; - SetVideoMode(0); - changerecursive=0; - } - //SetMainWindowStuff(); + DialogBox(fceu_hInstance, "VIDEOCONFIG", hAppWnd, VideoConCallB); + DoVideoConfigFix(); + + if(fullscreen) + { + SetFSVideoMode(); + } + else + { + changerecursive = 1; + SetVideoMode(0); + changerecursive = 0; + } + //SetMainWindowStuff(); } diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 3535c683..142cfed0 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -856,13 +856,40 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) ConfigGUI(); break; - case 321:ConfigInput(hWnd);break; - case 322:ConfigTiming();break; - case 323:ShowNetplayConsole();break; - case 324:ConfigPalette();break; - case 325:ConfigSound();break; - case 326:ConfigVideo();break; - case 328:MapInput();break; + case MENU_INPUT: + // Input menu was selected + ConfigInput(hWnd); + break; + + case MENU_TIMING: + // Timing menu was selected + ConfigTiming(); + break; + + case MENU_NETWORK: + // Network Play menu was selected + ShowNetplayConsole(); + break; + + case MENU_PALETTE: + // Palette menu was selected + ConfigPalette(); + break; + + case MENU_SOUND: + // Sound menu was selected + ConfigSound(); + break; + + case MENU_VIDEO: + // Video menu was selected + ConfigVideo(); + break; + + case MENU_HOTKEYS: + // Hotkeys menu was selected + MapInput(); + break; case MENU_RESET: // The reset menu was selected @@ -972,8 +999,15 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) FCEUD_AviStop(); break; - case 400:ShowAboutBox();break; - case 401:MakeLogWindow();break; + case MENU_ABOUT: + // About menu was selected + ShowAboutBox(); + break; + + case MENU_MSGLOG: + // Message Log menu was selected + MakeLogWindow(); + break; } } break; @@ -1329,61 +1363,99 @@ int LoadPaletteFile(void) return(0); } static HWND pwindow; -static BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) + +/** +* Callback function for the palette configuration dialog. +**/ +BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - DSMFix(uMsg); - 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; + DSMFix(uMsg); + + 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; } -static void ConfigPalette(void) +/** +* Shows palette configuration dialog. +**/ +void ConfigPalette(void) { - if(!pwindow) - pwindow=CreateDialog(fceu_hInstance,"PALCONFIG",0,PaletteConCallB); - else - SetFocus(pwindow); + if(!pwindow) + { + pwindow=CreateDialog(fceu_hInstance, "PALCONFIG" ,0 , PaletteConCallB); + } + else + { + SetFocus(pwindow); + } } - -static BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +/** +* Callback function of the Timing configuration dialog. +**/ +BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { int x; @@ -1435,10 +1507,13 @@ void DoTimingConfigFix(void) DoPriority(); } -static void ConfigTiming(void) +/** +* Shows the Timing configuration dialog. +**/ +void ConfigTiming(void) { - DialogBox(fceu_hInstance,"TIMINGCONFIG",hAppWnd,TimingConCallB); - DoTimingConfigFix(); + DialogBox(fceu_hInstance, "TIMINGCONFIG", hAppWnd, TimingConCallB); + DoTimingConfigFix(); } /**