Cleaned up some code

This commit is contained in:
rheiny 2007-02-06 14:14:58 +00:00
parent be3ec4a072
commit e163d2cd87
14 changed files with 46 additions and 69 deletions

View File

@ -2434,12 +2434,10 @@ static BOOL CALLBACK BasicBotCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
FCEU_SetBotMode(p1?0:1);
break;
case GUI_BOT_SAVE:
StopSound(); // required?
FromGUI();
SaveBasicBot();
break;
case GUI_BOT_LOAD:
StopSound(); // required?
LoadBasicBot();
ToGUI();
break;
@ -2461,7 +2459,6 @@ static BOOL CALLBACK BasicBotCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
}
break;
case GUI_BOT_CLEAR:
StopSound();
if(MessageBox(hwndBasicBot, "Clear all text?", "Confirm clear", MB_YESNO)==IDYES)
{
InitVars();

View File

@ -59,7 +59,6 @@ BOOL CALLBACK CDLoggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case WM_CLOSE:
case WM_QUIT:
if((logging) && (logging_options & LOG_NEW_INSTRUCTIONS)){
StopSound();
MessageBox(hCDLogger,
"The Trace logger is currently using this for some of its features.\
Please turn the trace logger off and try again.","Unable to Pause Code/Data Logger",
@ -118,7 +117,6 @@ MB_OK);
}
break;
case WM_MOVING:
StopSound();
break;
}
return FALSE;
@ -130,7 +128,6 @@ void LoadCDLogFile(){
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0";
char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead?
OPENFILENAME ofn;
StopSound();
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;
@ -178,7 +175,6 @@ void SaveCDLogFileAs(){
const char filter[]="Code Data Log File(*.CDL)\0*.cdl\0";
char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead?
OPENFILENAME ofn;
StopSound();
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;
@ -266,7 +262,6 @@ void SaveStrippedRom(){ //this is based off of iNesSave()
MessageBox(NULL, "Unable to Generate Stripped Rom. Get Something Logged and try again.", "Error", MB_OK);
return;
}
StopSound();
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;

View File

@ -135,8 +135,6 @@ void EnableCheatButtons(HWND hwndDlg, int enable) {
EnableWindow(GetDlgItem(hwndDlg,309),enable);
}
extern void StopSound(void);
BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
LOGFONT lf;
RECT wrect;
@ -150,7 +148,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
switch (uMsg) {
case WM_INITDIALOG:
StopSound();
SetWindowPos(hwndDlg,0,ChtPosX,ChtPosY,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER);
//setup font
@ -223,7 +220,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
case WM_VSCROLL:
if (scrollnum > 16) {
StopSound();
switch (LOWORD(wParam)) {
case SB_TOP:
scrollindex=-32768;

View File

@ -27,7 +27,6 @@ extern HINSTANCE fceu_hInstance;
extern int NoWaiting;
void DSMFix(UINT msg);
void StopSound(void);
extern int eoptions;

View File

@ -859,7 +859,6 @@ BOOL CALLBACK PatcherCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
return FALSE;
}
extern void StopSound();
extern char *iNesShortFName();
BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
@ -963,7 +962,6 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
DestroyWindow(hwndDlg);
break;
case WM_MOVING:
StopSound();
break;
case WM_MOVE:
GetWindowRect(hwndDlg,&wrect);
@ -982,7 +980,6 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
//mbg merge 7/18/06 changed pausing check
if (FCEUI_EmulationPaused()) UpdateRegs(hwndDlg);
if (lParam) {
StopSound();
GetScrollInfo((HWND)lParam,SB_CTL,&si);
switch(LOWORD(wParam)) {
case SB_ENDSCROLL:
@ -1106,7 +1103,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
tmp--;
}
ChangeMemViewFocus(2,GetNesFileAddress(i),-1);
} else {StopSound();}
}
break;
case WM_MBUTTONDOWN:
mouse_x = GET_X_LPARAM(lParam);
@ -1125,18 +1122,16 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
tmp--;
}
SetGGConvFocus(i,GetMem(i));
} else {StopSound();}
}
break;
case WM_INITMENUPOPUP:
case WM_INITMENU:
StopSound();
break;
case WM_COMMAND:
switch(HIWORD(wParam)) {
case BN_CLICKED:
switch(LOWORD(wParam)) {
case 101: //Add
StopSound();
childwnd = 1;
if (DialogBox(fceu_hInstance,"ADDBP",hwndDlg,AddbpCallB)) AddBreakList();
childwnd = 0;
@ -1146,7 +1141,6 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
DeleteBreak(SendDlgItemMessage(hwndDlg,302,LB_GETCURSEL,0,0));
break;
case 103: //Edit
StopSound();
WP_edit = SendDlgItemMessage(hwndDlg,302,LB_GETCURSEL,0,0);
if (DialogBox(fceu_hInstance,"ADDBP",hwndDlg,AddbpCallB)) EditBreakList();
WP_edit = -1;
@ -1311,7 +1305,6 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
extern void iNESGI(int h);
void DoPatcher(int address,HWND hParent){
StopSound();
iapoffset=address;
if(GameInterface==iNESGI)DialogBox(fceu_hInstance,"ROMPATCHER",hParent,PatcherCallB);
else MessageBox(hDebug, "Sorry, The Patcher only works on INES rom images", "Error", MB_OK);

View File

@ -282,9 +282,12 @@ char *FCEUD_GetCompilerString() {
return __COMPILER__STRING__;
}
/**
* Displays the about box
**/
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
@ -304,7 +307,6 @@ void DoFCEUExit(void)
if(exiting) /* Eh, oops. I'll need to try to fix this later. */
return;
StopSound();
if(goptions & GOO_CONFIRMEXIT)
if(IDYES != MessageBox(hAppWnd,emsg[rand()&3],"Exit FCE Ultra?",MB_ICONQUESTION|MB_YESNO))
return;
@ -336,7 +338,27 @@ static int changerecursive=0;
#include "sound.cpp"
#include "video.cpp"
//extern int winspecial;
//extern vmdef vmodes[11];
//extern int disvaccel;
//extern int fssync;
//extern int winsync;
//int SetVideoMode(int fs);
//void DoVideoConfigFix(void);
//void FCEUD_BlitScreen(uint8 *XBuf);
#include "window.cpp"
//extern char *rfiles[10];
//extern char *rdirs[10];
//extern int EnableBackgroundInput;
//void ByebyeWindow(void);
//void DoTimingConfigFix();
//void CreateMainWindow();
//void UpdateMenu();
//void ALoad(char *nameo);
//void LoadNewGamey(HWND hParent, char *initialdir);
//void UpdateMenu();
#include "config.cpp"
#include "args.cpp"
@ -574,7 +596,6 @@ doloopy:
}
//xbsave = NULL;
RedrawWindow(hAppWnd,0,0,RDW_ERASE|RDW_INVALIDATE);
StopSound();
}
Sleep(50);
if(!exiting)

View File

@ -223,7 +223,6 @@ int LoadTableFile(){
const char filter[]="Table Files (*.TBL)\0*.tbl\0";
char nameo[2048]; //todo: possibly no need for this? can lpstrfilter point to loadedcdfile instead?
OPENFILENAME ofn;
StopSound();
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;
@ -814,7 +813,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
// ################################## End of SP CODE ###########################
switch (message) {
case WM_ENTERMENULOOP:StopSound();return 0;
case WM_ENTERMENULOOP:return 0;
case WM_INITMENUPOPUP:
if(undo_list != 0)EnableMenuItem(GetMenu(hMemView),200,MF_BYCOMMAND | MF_ENABLED);
else EnableMenuItem(GetMenu(hMemView),200,MF_BYCOMMAND | MF_GRAYED);
@ -864,7 +863,6 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return 0;
case WM_VSCROLL:
StopSound();
ZeroMemory(&si, sizeof(SCROLLINFO));
si.fMask = SIF_ALL;
si.cbSize = sizeof(SCROLLINFO);
@ -1264,7 +1262,6 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return 0;
case WM_SIZE:
StopSound();
ClientHeight = HIWORD (lParam) ;
if(DataAmount != ((ClientHeight/MemFontHeight)*16)){
DataAmount = ((ClientHeight/MemFontHeight)*16);
@ -1287,7 +1284,6 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return 0 ;
case WM_COMMAND:
StopSound();
// ################################## Start of SP CODE ###########################
if (wParam >= 30 && wParam <= 39)
@ -1449,7 +1445,6 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
}
case WM_MOVE:
StopSound();
return 0;
case WM_DESTROY :

View File

@ -403,8 +403,6 @@ void KillNTView() {
NTViewSkip=0;
}
extern void StopSound(void);
BOOL CALLBACK NTViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
RECT wrect;
char str[50];
@ -471,7 +469,6 @@ BOOL CALLBACK NTViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
KillNTView();
break;
case WM_MOVING:
StopSound();
break;
case WM_MOVE:
GetWindowRect(hwndDlg,&wrect);

View File

@ -191,8 +191,6 @@ void KillPPUView() {
PPUViewSkip=0;
}
extern void StopSound(void);
BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
RECT wrect;
char str[20];
@ -257,7 +255,6 @@ BOOL CALLBACK PPUViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
KillPPUView();
break;
case WM_MOVING:
StopSound();
break;
case WM_MOVE:
GetWindowRect(hwndDlg,&wrect);

View File

@ -255,11 +255,6 @@ void win_Throttle() {
player->throttle();
}
void StopSound() {
//dont think this needs to do anything anymore
}
void win_SoundInit(int bits) {
dsout = new OAKRA_Module_OutputDS();
dsout->start(hAppWnd);
@ -357,7 +352,7 @@ BOOL CALLBACK SoundConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
switch(uMsg) {
case WM_NCRBUTTONDOWN:
case WM_NCMBUTTONDOWN:
case WM_NCLBUTTONDOWN:StopSound();break;
case WM_NCLBUTTONDOWN:break;
case WM_INITDIALOG:
/* Volume Trackbar */

View File

@ -4,7 +4,6 @@ void FCEUD_SaveStateAs(void)
char nameo[2048];
OPENFILENAME ofn;
StopSound();
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;
@ -24,7 +23,6 @@ void FCEUD_LoadStateFrom(void)
char nameo[2048];
OPENFILENAME ofn;
StopSound();
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;

View File

@ -166,7 +166,6 @@ BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
case WM_MOVING:
StopSound();
break;
}
@ -181,7 +180,6 @@ BOOL CALLBACK TracerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
if(!FCEUI_EmulationPaused() && !log_update_window) break; //mbg merge 7/19/06 changd to use EmulationPaused()
StopSound();
GetScrollInfo((HWND)lParam,SB_CTL,&tracesi);
switch(LOWORD(wParam)) {
case SB_ENDSCROLL:
@ -530,7 +528,6 @@ void EnableTracerMenuItems(void){
//this returns 1 if the CD logger is activated when needed, or 0 if the user selected no, not to activate it
int PromptForCDLogger(void){
if((logging_options & (LOG_NEW_INSTRUCTIONS|LOG_NEW_DATA)) && (!FCEUI_GetLoggingCD())){
StopSound();
if(MessageBox(hTracer,"In order for some of the features you have selected to take effect,\
the Code/Data Logger must also be running.\
Would you like to Start the Code/Data Logger Now?","Start Code/Data Logger?",
@ -550,7 +547,6 @@ void ShowLogDirDialog(void){
const char filter[]="6502 Trace Log File(*.log,*.txt)\0*.log;*.txt\0";
char nameo[2048];
OPENFILENAME ofn;
StopSound();
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize=sizeof(ofn);
ofn.hInstance=fceu_hInstance;

View File

@ -240,7 +240,6 @@ int SetVideoMode(int fs)
PaletteChanged=1;
ResetVideo();
StopSound();
if(!InitializeDDraw(fs)) return(1); // DirectDraw not initialized

View File

@ -32,7 +32,7 @@ void DSMFix(UINT msg)
case WM_NCRBUTTONDOWN:
case WM_NCMBUTTONDOWN:
case WM_NCLBUTTONDOWN:
case WM_ENTERMENULOOP:StopSound();break;
case WM_ENTERMENULOOP:break;
}
}
static void ConfigGUI(void);
@ -316,8 +316,7 @@ static void ALoad(char *nameo)
if(eoptions&EO_FSAFTERLOAD)
SetFSVideoMode();
}
else
StopSound();
ParseGIInput(GameInfo);
RedoMenuGI(GameInfo);
}
@ -640,13 +639,13 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
UpdateMenu(); break;
case 40002: CreateBasicBot();break;
// case 40028: DoMemmo(0); break; //mbg merge 7/18/06 removed as part of old debugger
case 320:StopSound();ConfigDirectories();break;
case 327:StopSound();ConfigGUI();break;
case 321:StopSound();ConfigInput(hWnd);break;
case 320:ConfigDirectories();break;
case 327:ConfigGUI();break;
case 321:ConfigInput(hWnd);break;
case 322:ConfigTiming();break;
case 323:StopSound();ShowNetplayConsole();break;
case 324:StopSound();ConfigPalette();break;
case 325:StopSound();ConfigSound();break;
case 323:ShowNetplayConsole();break;
case 324:ConfigPalette();break;
case 325:ConfigSound();break;
case 326:ConfigVideo();break;
case 328:MapInput();break;
@ -664,7 +663,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
//case 204:ConfigAddCheat(hWnd);break; //mbg merge TODO 7/17/06 - had to remove this
//mbg merge TODO 7/17/06 - had to remove this
//case 205:CreateMemWatch(hWnd);break;
case 100:StopSound();
case 100:
LoadNewGamey(hWnd, 0);
break;
case 101:if(GameInfo)
@ -685,7 +684,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
MENUITEMINFO mi;
char *str;
StopSound();
if(CreateSoundSave())
str="Stop Sound Logging";
else
@ -710,7 +709,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
case 151:FCEUD_AviRecordTo();break;
case 152:FCEUD_AviStop();break;
case 400:StopSound();ShowAboutBox();break;
case 400:ShowAboutBox();break;
case 401:MakeLogWindow();break;
}
}
@ -892,7 +891,7 @@ void UpdateFCEUWindow(void)
if(!(eoptions&EO_BGRUN))
while(nofocus)
{
StopSound();
Sleep(75);
BlockingCheck();
}
@ -900,7 +899,7 @@ void UpdateFCEUWindow(void)
//mbg merge 7/19/06 removing this since I think its not used
//if(_userpause) //mbg merge 7/18/06 this changed. even though theres nothing setting this..
//{
// StopSound();
//
// while(_userpause) //mbg merge 7/18/06 this changed. even though theres nothing setting this..
// {
// Sleep(50);
@ -1085,7 +1084,7 @@ static BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
{
case 100:ntsccol^=1;FCEUI_SetNTSCTH(ntsccol,ntsctint,ntschue);break;
case 200:
StopSound();
if(LoadPaletteFile())
EnableWindow(GetDlgItem(hwndDlg,201),1);
break;
@ -1929,7 +1928,7 @@ void FCEUD_MovieReplayFrom(void)
{
char* fn;
StopSound();
fn=(char*)DialogBox(fceu_hInstance, "IDD_REPLAYINP", hAppWnd, ReplayDialogProc);
if(fn)
@ -2150,7 +2149,7 @@ void FCEUD_MovieRecordTo(void)
struct CreateMovieParameters p;
p.szFilename=FCEUI_MovieGetCurrentName(0);
StopSound();
if(DialogBoxParam(fceu_hInstance,"IDD_RECORDINP",hAppWnd,RecordDialogProc,(LPARAM)&p))
{
@ -2200,7 +2199,7 @@ void FCEUD_AviRecordTo(void)
sprintf(szChoice, "%s.avi", FileBase);
}
StopSound();
// avi record file browser
memset(&ofn, 0, sizeof(ofn));
@ -2226,7 +2225,7 @@ void FCEUD_AviStop(void)
void FCEUD_CmdOpen(void)
{
StopSound();
LoadNewGamey(hAppWnd, 0);
}