Cleaned up some code.

This commit is contained in:
rheiny 2007-02-06 19:15:24 +00:00
parent 62efccb998
commit 379136451f
5 changed files with 61 additions and 42 deletions

View File

@ -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)

Binary file not shown.

View File

@ -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

View File

@ -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;
}

View File

@ -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