From 379136451f2427ab576873d7cdb13507deaa936d Mon Sep 17 00:00:00 2001 From: rheiny Date: Tue, 6 Feb 2007 19:15:24 +0000 Subject: [PATCH] Cleaned up some code. --- src/drivers/win/main.cpp | 41 ++++++++++++++++++++++--------------- src/drivers/win/res.rc | Bin 131770 -> 131826 bytes src/drivers/win/resource.h | 4 +++- src/drivers/win/wave.cpp | 41 ++++++++++++++++++++++--------------- src/drivers/win/window.cpp | 17 +++++++-------- 5 files changed, 61 insertions(+), 42 deletions(-) diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index c7c9a486..597d7a26 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -293,29 +293,36 @@ void ShowAboutBox(void) //mbg 6/30/06 - indicates that the main loop should close the game as soon as it can int closeGame = 0; -void DoFCEUExit(void) +/** +* Exits FCE Ultra +**/ +void DoFCEUExit() { - /* Wolfenstein 3D had cute exit messages. */ - char *emsg[4]={"Are you sure you want to leave? I'll become lonely!", - "If you exit, I'll... EAT YOUR MOUSE.", - "You can never really exit, you know.", - "E-x-i-t?" - }; + /* Wolfenstein 3D had cute exit messages. */ + char *emsg[4]={"Are you sure you want to leave? I'll become lonely!", + "If you exit, I'll... EAT YOUR MOUSE.", + "You can never really exit, you know.", + "E-x-i-t?" + }; - KillDebugger(); //mbg merge 7/19/06 added + KillDebugger(); //mbg merge 7/19/06 added - if(exiting) /* Eh, oops. I'll need to try to fix this later. */ - return; + if(exiting) /* Eh, oops. I'll need to try to fix this later. */ + return; - if(goptions & GOO_CONFIRMEXIT) - if(IDYES != MessageBox(hAppWnd,emsg[rand()&3],"Exit FCE Ultra?",MB_ICONQUESTION|MB_YESNO)) - return; + if(goptions & GOO_CONFIRMEXIT) + { + if(IDYES != MessageBox(hAppWnd, emsg[rand() & 3], "Exit FCE Ultra?", MB_ICONQUESTION | MB_YESNO) ) + { + return; + } + } - FCEUI_StopMovie(); - FCEUD_AviStop(); + FCEUI_StopMovie(); + FCEUD_AviStop(); - exiting=1; - closeGame = 1;//mbg 6/30/06 - for housekeeping purposes we need to exit after the emulation cycle finishes + exiting = 1; + closeGame = 1;//mbg 6/30/06 - for housekeeping purposes we need to exit after the emulation cycle finishes } void DoPriority(void) diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 9ac5a6d4672a1ef4cc0f4a0acf54d12557f4a8fb..150012956f6824018e3194f8d73887d5276b1d07 100644 GIT binary patch delta 127 zcmdnh%JHd{V}l6)WCZ~Z{&)r-27d;3hIocxARRjSqMG*P1>9DX>-cRz@|^Jut_%?j vo(v(A6?ODCzvJ%{!m3SBS#t6MHV&Yi$mDHG=vp^&i#7`=Zx>KzTy-A+GF%{Q delta 83 zcmey=%CW1JV}l6)%YkUS>?5Jb~Ya*^t3_@~Na3zQj~?gIels2#rm diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 69b5bf81..79429140 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -16,6 +16,7 @@ #define MENU_STOP_MOVIE 143 #define MENU_RECORD_AVI 151 #define MENU_STOP_AVI 152 +#define MENU_EXIT 153 #define GUI_BOT_A_1 1000 #define GUI_BOT_B_1 1001 #define GUI_BOT_SELECT_1 1002 @@ -143,6 +144,7 @@ #define ID_DEBUG_TRACELOGGER 40057 #define ID_DEBUG_GAMEGENIEDECODER 40059 #define ID_DEBUG_CDLOGGER 40060 +#define MENU_LOG_SOUND 40120 #define GUI_BOT_DEBUG 65436 #define GUI_BOT_ERROR 65438 @@ -151,7 +153,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40023 +#define _APS_NEXT_COMMAND_VALUE 40025 #define _APS_NEXT_CONTROL_VALUE 1117 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/src/drivers/win/wave.cpp b/src/drivers/win/wave.cpp index ea2ee022..411170f1 100644 --- a/src/drivers/win/wave.cpp +++ b/src/drivers/win/wave.cpp @@ -24,24 +24,33 @@ int CloseWave(void) return(FCEUI_EndWaveRecord()); } +/** +* Shows a Open File dialog and starts logging sound. +* +* @return Flag that indicates failure (0) or success (1). +**/ int CreateSoundSave(void) { - const char filter[]="MS WAVE(*.wav)\0*.wav\0"; - char nameo[2048]; - OPENFILENAME ofn; + const char filter[]="MS WAVE(*.wav)\0*.wav\0"; + char nameo[2048]; + OPENFILENAME ofn; - FCEUI_EndWaveRecord(); + FCEUI_EndWaveRecord(); - memset(&ofn,0,sizeof(ofn)); - ofn.lStructSize=sizeof(ofn); - ofn.hInstance=fceu_hInstance; - ofn.lpstrTitle="Log Sound As..."; - ofn.lpstrFilter=filter; - nameo[0]=0; - ofn.lpstrFile=nameo; - ofn.nMaxFile=256; - ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; - if(GetSaveFileName(&ofn)) - return FCEUI_BeginWaveRecord(nameo); - return 0; + memset(&ofn,0,sizeof(ofn)); + ofn.lStructSize=sizeof(ofn); + ofn.hInstance=fceu_hInstance; + ofn.lpstrTitle="Log Sound As..."; + ofn.lpstrFilter=filter; + nameo[0]=0; + ofn.lpstrFile=nameo; + ofn.nMaxFile=256; + ofn.Flags=OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; + + if(GetSaveFileName(&ofn)) + { + return FCEUI_BeginWaveRecord(nameo); + } + + return 0; } diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 0fd834c5..6c583a44 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -809,16 +809,13 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) FCEUD_LoadStateFrom(); break; - case 40120: //mbg merge 7/18/06 changed ID from 120 + case MENU_LOG_SOUND: //mbg merge 7/18/06 changed ID from 120 + // Record sound menu was selected + // TODO: Proper stop logging { MENUITEMINFO mi; - char *str; + char *str = CreateSoundSave() ? "Stop Sound Logging" : "Log Sound As..."; - - if(CreateSoundSave()) - str="Stop Sound Logging"; - else - str="Log Sound As..."; memset(&mi,0,sizeof(mi)); mi.fMask=MIIM_DATA|MIIM_TYPE; mi.cbSize=sizeof(mi); @@ -830,7 +827,11 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) SetMenuItemInfo(fceumenu,120,0,&mi); } break; - case 130:DoFCEUExit();break; + + case MENU_EXIT: + // Exit menu was selected + DoFCEUExit(); + break; case MENU_RECORD_MOVIE: // Record movie menu was selected