Code cleanup & refactoring

This commit is contained in:
spacy51 2008-09-09 12:28:15 +00:00
parent a008b39055
commit 89212b8e38
7 changed files with 36 additions and 41 deletions

View File

@ -33,8 +33,9 @@ struct {
const char *command; const char *command;
WORD id; WORD id;
} winAccelCommands[] = { } winAccelCommands[] = {
{ "FileOpen", ID_FILE_OPEN }, { "FileOpenGBA", ID_FILE_OPEN_GBA },
{ "FileOpenGameboy", ID_FILE_OPENGAMEBOY }, { "FileOpenGBC", ID_FILE_OPEN_GBC },
{ "FileOpenGB", ID_FILE_OPEN_GB },
{ "FileLoad", ID_FILE_LOAD }, { "FileLoad", ID_FILE_LOAD },
{ "FileSave", ID_FILE_SAVE }, { "FileSave", ID_FILE_SAVE },
{ "FileLoadGame01", ID_FILE_LOADGAME_SLOT1 }, { "FileLoadGame01", ID_FILE_LOADGAME_SLOT1 },

View File

@ -75,7 +75,9 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_WM_CLOSE() ON_WM_CLOSE()
ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout) ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
ON_COMMAND(ID_HELP_FAQ, OnHelpFaq) ON_COMMAND(ID_HELP_FAQ, OnHelpFaq)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen) ON_COMMAND(ID_FILE_OPEN_GBA, OnFileOpenGBA)
ON_COMMAND(ID_FILE_OPEN_GBC, OnFileOpenGBC)
ON_COMMAND(ID_FILE_OPEN_GB, OnFileOpenGB)
ON_WM_INITMENUPOPUP() ON_WM_INITMENUPOPUP()
ON_COMMAND(ID_FILE_PAUSE, OnFilePause) ON_COMMAND(ID_FILE_PAUSE, OnFilePause)
ON_UPDATE_COMMAND_UI(ID_FILE_PAUSE, OnUpdateFilePause) ON_UPDATE_COMMAND_UI(ID_FILE_PAUSE, OnUpdateFilePause)
@ -87,7 +89,6 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_COMMAND(ID_FILE_EXIT, OnFileExit) ON_COMMAND(ID_FILE_EXIT, OnFileExit)
ON_COMMAND(ID_FILE_CLOSE, OnFileClose) ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
ON_UPDATE_COMMAND_UI(ID_FILE_CLOSE, OnUpdateFileClose) ON_UPDATE_COMMAND_UI(ID_FILE_CLOSE, OnUpdateFileClose)
ON_COMMAND(ID_FILE_OPENGAMEBOY, OnFileOpengameboy)
ON_COMMAND(ID_FILE_LOAD, OnFileLoad) ON_COMMAND(ID_FILE_LOAD, OnFileLoad)
ON_UPDATE_COMMAND_UI(ID_FILE_LOAD, OnUpdateFileLoad) ON_UPDATE_COMMAND_UI(ID_FILE_LOAD, OnUpdateFileLoad)
ON_COMMAND(ID_FILE_SAVE, OnFileSave) ON_COMMAND(ID_FILE_SAVE, OnFileSave)
@ -404,7 +405,6 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_WM_NCLBUTTONDOWN() ON_WM_NCLBUTTONDOWN()
ON_WM_WINDOWPOSCHANGING() ON_WM_WINDOWPOSCHANGING()
ON_COMMAND(ID_EMULATOR_BIOSFILES, &MainWnd::OnEmulatorBiosfiles) ON_COMMAND(ID_EMULATOR_BIOSFILES, &MainWnd::OnEmulatorBiosfiles)
ON_COMMAND(ID_FILE_OPEN_GBC, &MainWnd::OnFileOpenGbc)
ON_WM_NCRBUTTONDOWN() ON_WM_NCRBUTTONDOWN()
ON_COMMAND(ID_OUTPUTAPI_XAUDIO2, &MainWnd::OnOutputapiXaudio2) ON_COMMAND(ID_OUTPUTAPI_XAUDIO2, &MainWnd::OnOutputapiXaudio2)
ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_XAUDIO2, &MainWnd::OnUpdateOutputapiXaudio2) ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_XAUDIO2, &MainWnd::OnUpdateOutputapiXaudio2)
@ -1041,7 +1041,7 @@ bool MainWnd::fileOpenSelect( int system )
if( (selectedFilter < 0) || (selectedFilter > 2) ) { if( (selectedFilter < 0) || (selectedFilter > 2) ) {
selectedFilter = 0; selectedFilter = 0;
} }
filter = winLoadFilter( IDS_FILTER_ROM ); filter = winLoadFilter( IDS_FILTER_GBAROM );
break; break;
case 1: case 1:
// GBC // GBC

View File

@ -78,7 +78,9 @@ protected:
afx_msg void OnClose(); afx_msg void OnClose();
afx_msg void OnHelpAbout(); afx_msg void OnHelpAbout();
afx_msg void OnHelpFaq(); afx_msg void OnHelpFaq();
afx_msg void OnFileOpen(); afx_msg void OnFileOpenGBA();
afx_msg void OnFileOpenGBC();
afx_msg void OnFileOpenGB();
afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu); afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
afx_msg void OnFilePause(); afx_msg void OnFilePause();
afx_msg void OnUpdateFilePause(CCmdUI* pCmdUI); afx_msg void OnUpdateFilePause(CCmdUI* pCmdUI);
@ -90,7 +92,6 @@ protected:
afx_msg void OnFileExit(); afx_msg void OnFileExit();
afx_msg void OnFileClose(); afx_msg void OnFileClose();
afx_msg void OnUpdateFileClose(CCmdUI* pCmdUI); afx_msg void OnUpdateFileClose(CCmdUI* pCmdUI);
afx_msg void OnFileOpengameboy();
afx_msg void OnFileLoad(); afx_msg void OnFileLoad();
afx_msg void OnUpdateFileLoad(CCmdUI* pCmdUI); afx_msg void OnUpdateFileLoad(CCmdUI* pCmdUI);
afx_msg void OnFileSave(); afx_msg void OnFileSave();
@ -375,7 +376,6 @@ protected:
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point); afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos); afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos);
afx_msg void OnEmulatorBiosfiles(); afx_msg void OnEmulatorBiosfiles();
afx_msg void OnFileOpenGbc();
afx_msg void OnNcRButtonDown(UINT nHitTest, CPoint point); afx_msg void OnNcRButtonDown(UINT nHitTest, CPoint point);
afx_msg void OnUpdatePixelfilterMultiThreading(CCmdUI *pCmdUI); afx_msg void OnUpdatePixelfilterMultiThreading(CCmdUI *pCmdUI);
afx_msg void OnUpdateOptionsSelectPlugin(CCmdUI *pCmdUI); afx_msg void OnUpdateOptionsSelectPlugin(CCmdUI *pCmdUI);

View File

@ -37,19 +37,30 @@
#include "../dmg/gbCheats.h" #include "../dmg/gbCheats.h"
#include "../dmg/gbGlobals.h" #include "../dmg/gbGlobals.h"
extern int emulating;
extern void remoteCleanUp(); extern void remoteCleanUp();
extern void InterframeCleanup(); extern void InterframeCleanup();
void MainWnd::OnFileOpen() void MainWnd::OnFileOpenGBA()
{ {
if( fileOpenSelect( 0 ) ) { if( fileOpenSelect( 0 ) ) {
FileRun(); FileRun();
} }
} }
void MainWnd::OnFileOpenGBC()
{
if( fileOpenSelect( 1 ) ) {
FileRun();
}
}
void MainWnd::OnFileOpenGB()
{
if( fileOpenSelect( 2 ) ) {
FileRun();
}
}
void MainWnd::OnFilePause() void MainWnd::OnFilePause()
{ {
@ -163,23 +174,6 @@ void MainWnd::OnUpdateFileClose(CCmdUI* pCmdUI)
pCmdUI->Enable(emulating); pCmdUI->Enable(emulating);
} }
void MainWnd::OnFileOpengameboy()
{
if( fileOpenSelect( 2 ) ) {
FileRun();
}
}
void MainWnd::OnFileOpenGbc()
{
if( fileOpenSelect( 1 ) ) {
FileRun();
}
}
void MainWnd::OnFileLoad() void MainWnd::OnFileLoad()
{ {
CString buffer; CString buffer;

View File

@ -283,8 +283,8 @@ class VBA : public CWinApp
int doProtection(); int doProtection();
}; };
extern VBA theApp; extern VBA theApp;
extern int emulating; extern int emulating;
#ifdef MMX #ifdef MMX
extern "C" bool cpu_mmx; extern "C" bool cpu_mmx;

View File

@ -1611,9 +1611,9 @@ IDR_MENU MENU
BEGIN BEGIN
POPUP "&File" POPUP "&File"
BEGIN BEGIN
MENUITEM "Open GB...", ID_FILE_OPENGAMEBOY MENUITEM "Open GBA...", ID_FILE_OPEN_GBA
MENUITEM "Open GBC...", ID_FILE_OPEN_GBC MENUITEM "Open GBC...", ID_FILE_OPEN_GBC
MENUITEM "Open GBA...", ID_FILE_OPEN MENUITEM "Open GB...", ID_FILE_OPEN_GB
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Load...", ID_FILE_LOAD MENUITEM "Load...", ID_FILE_LOAD
MENUITEM "Save...", ID_FILE_SAVE MENUITEM "Save...", ID_FILE_SAVE
@ -2023,7 +2023,6 @@ BEGIN
VK_F7, ID_FILE_MRU_FILE7, VIRTKEY, CONTROL, NOINVERT VK_F7, ID_FILE_MRU_FILE7, VIRTKEY, CONTROL, NOINVERT
VK_F8, ID_FILE_MRU_FILE8, VIRTKEY, CONTROL, NOINVERT VK_F8, ID_FILE_MRU_FILE8, VIRTKEY, CONTROL, NOINVERT
VK_F9, ID_FILE_MRU_FILE9, VIRTKEY, CONTROL, NOINVERT VK_F9, ID_FILE_MRU_FILE9, VIRTKEY, CONTROL, NOINVERT
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
"P", ID_FILE_PAUSE, VIRTKEY, CONTROL, NOINVERT "P", ID_FILE_PAUSE, VIRTKEY, CONTROL, NOINVERT
VK_PAUSE, ID_FILE_PAUSE, VIRTKEY, NOINVERT VK_PAUSE, ID_FILE_PAUSE, VIRTKEY, NOINVERT
"R", ID_FILE_RESET, VIRTKEY, CONTROL, NOINVERT "R", ID_FILE_RESET, VIRTKEY, CONTROL, NOINVERT
@ -2187,7 +2186,7 @@ BEGIN
IDS_FAILED_TO_LOAD_LIBRARY "Failed to load library %s" IDS_FAILED_TO_LOAD_LIBRARY "Failed to load library %s"
IDS_FAILED_TO_GET_LOCINFO "Failed to get locale information" IDS_FAILED_TO_GET_LOCINFO "Failed to get locale information"
IDS_SELECT_CHEAT_LIST_NAME "Select cheat list name" IDS_SELECT_CHEAT_LIST_NAME "Select cheat list name"
IDS_FILTER_ROM "Game Boy Advance ROMs_*.GBA;*.AGB;*.BIN;*.ELF;*.MB;*.ZIP;*.7Z;*.Z;*.GZ__" IDS_FILTER_GBAROM "Game Boy Advance ROMs (*.GBA;*.AGB;*.BIN;*.ELF;*.MB;*.ZIP;*.7Z;*.Z;*.GZ)_*.GBA;*.AGB;*.BIN;*.ELF;*.MB;*.ZIP;*.7Z;*.Z;*.GZ__"
IDS_FILTER_SGM "VisualBoyAdvance Save Game_*.SGM__" IDS_FILTER_SGM "VisualBoyAdvance Save Game_*.SGM__"
IDS_FILTER_CHEAT_LIST "VisualBoyAdvance Cheat List_*.CLT__" IDS_FILTER_CHEAT_LIST "VisualBoyAdvance Cheat List_*.CLT__"
IDS_FILTER_PNG "PNG Image_*.PNG_BMP Image_*.BMP__" IDS_FILTER_PNG "PNG Image_*.PNG_BMP Image_*.BMP__"
@ -2231,7 +2230,7 @@ BEGIN
IDS_ADD_CBA_CODE "Add CodeBreakerAdvance code" IDS_ADD_CBA_CODE "Add CodeBreakerAdvance code"
IDS_FILTER_WAV "Wave file_*.WAV__" IDS_FILTER_WAV "Wave file_*.WAV__"
IDS_SELECT_WAV_NAME "Select wave file name" IDS_SELECT_WAV_NAME "Select wave file name"
IDS_FILTER_GBROM "Game Boy ROMs_*.GB;*.SGB;*.ZIP;*.7Z;*.Z;*.GZ__" IDS_FILTER_GBROM "Game Boy ROMs (*.GB;*.SGB;*.ZIP;*.7Z;*.Z;*.GZ)_*.GB;*.SGB;*.ZIP;*.7Z;*.Z;*.GZ__"
IDS_FILTER_PAL "Windows Palette (*.PAL)_*.PAL_PaintShop Palette (*.PAL)_*.PAL_Adobe Color Table (*.ACT)_*.ACT__" IDS_FILTER_PAL "Windows Palette (*.PAL)_*.PAL_PaintShop Palette (*.PAL)_*.PAL_Adobe Color Table (*.ACT)_*.ACT__"
IDS_SELECT_PALETTE_NAME "Select palette name:" IDS_SELECT_PALETTE_NAME "Select palette name:"
IDS_SEARCH_PRODUCED_NO_RESULTS "Search produced no results." IDS_SEARCH_PRODUCED_NO_RESULTS "Search produced no results."
@ -2278,7 +2277,7 @@ BEGIN
IDS_AVI_CANNOT_CREATE_AUDIO "Cannot create audio stream in AVI file." IDS_AVI_CANNOT_CREATE_AUDIO "Cannot create audio stream in AVI file."
IDS_AVI_CANNOT_WRITE_VIDEO "Cannot write video frame to AVI file." IDS_AVI_CANNOT_WRITE_VIDEO "Cannot write video frame to AVI file."
IDS_AVI_CANNOT_WRITE_AUDIO "Cannot write audio frame to AVI file." IDS_AVI_CANNOT_WRITE_AUDIO "Cannot write audio frame to AVI file."
IDS_FILTER_GBCROM "Game Boy Color ROMs_*.GBC;*.CGB;*.ZIP;*.7Z;*.Z;*.GZ__" IDS_FILTER_GBCROM "Game Boy Color ROMs (*.GBC;*.CGB;*.ZIP;*.7Z;*.Z;*.GZ)_*.GBC;*.CGB;*.ZIP;*.7Z;*.Z;*.GZ__"
IDS_COM_FAILURE "The COM (Component Object Model) failed to initialize!" IDS_COM_FAILURE "The COM (Component Object Model) failed to initialize!"
IDS_XAUDIO2_FAILURE "The XAudio2 interface failed to initialize!" IDS_XAUDIO2_FAILURE "The XAudio2 interface failed to initialize!"
IDS_XAUDIO2_CANNOT_CREATE_MASTERINGVOICE IDS_XAUDIO2_CANNOT_CREATE_MASTERINGVOICE

View File

@ -50,6 +50,7 @@
#define IDS_TOOLTIP_ENHANCE_SOUND 43 #define IDS_TOOLTIP_ENHANCE_SOUND 43
#define IDS_TOOLTIP_SURROUND 44 #define IDS_TOOLTIP_SURROUND 44
#define IDS_TOOLTIP_DECLICKING 45 #define IDS_TOOLTIP_DECLICKING 45
#define IDS_FILTER_COMPRESSED_FILES 46
#define IDI_MAINICON 101 #define IDI_MAINICON 101
#define IDD_REGISTERS 102 #define IDD_REGISTERS 102
#define IDD_DEBUG 103 #define IDD_DEBUG 103
@ -316,7 +317,7 @@
#define IDC_3X 1092 #define IDC_3X 1092
#define IDS_FILTER_BIOS 1092 #define IDS_FILTER_BIOS 1092
#define IDC_4X 1093 #define IDC_4X 1093
#define IDS_FILTER_ROM 1093 #define IDS_FILTER_GBAROM 1093
#define IDC_ROM_MAKER_NAME2 1093 #define IDC_ROM_MAKER_NAME2 1093
#define ID_PRINT 1094 #define ID_PRINT 1094
#define IDS_FILTER_SGM 1094 #define IDS_FILTER_SGM 1094
@ -682,7 +683,7 @@
#define ID_OPTIONS_VIDEO_LAYERS_WIN0 40132 #define ID_OPTIONS_VIDEO_LAYERS_WIN0 40132
#define ID_OPTIONS_VIDEO_LAYERS_WIN1 40133 #define ID_OPTIONS_VIDEO_LAYERS_WIN1 40133
#define ID_OPTIONS_VIDEO_LAYERS_OBJWIN 40134 #define ID_OPTIONS_VIDEO_LAYERS_OBJWIN 40134
#define ID_FILE_OPENGAMEBOY 40135 #define ID_FILE_OPEN_GB 40135
#define ID_DEBUG_NEXTFRAME 40137 #define ID_DEBUG_NEXTFRAME 40137
#define ID_TOOLS_MAPVIEW 40138 #define ID_TOOLS_MAPVIEW 40138
#define ID_TOOLS_PALETTEVIEW 40139 #define ID_TOOLS_PALETTEVIEW 40139
@ -856,7 +857,6 @@
#define ID_RENDERAPI_MOTIONBLUR 40354 #define ID_RENDERAPI_MOTIONBLUR 40354
#define ID_RENDERAPI_D3DMOTIONBLUR 40355 #define ID_RENDERAPI_D3DMOTIONBLUR 40355
#define ID_EMULATOR_BIOSFILES 40356 #define ID_EMULATOR_BIOSFILES 40356
#define ID_FILE_OPENGBC 40357
#define ID_FILE_OPEN_GBC 40358 #define ID_FILE_OPEN_GBC 40358
#define ID_OUTPUTAPI_XAUDIO2 40359 #define ID_OUTPUTAPI_XAUDIO2 40359
#define ID_PIXELFILTER_MULTI 40360 #define ID_PIXELFILTER_MULTI 40360
@ -865,13 +865,14 @@
#define ID_OUTPUTAPI_CONFIGURATION40363 40363 #define ID_OUTPUTAPI_CONFIGURATION40363 40363
#define ID_OUTPUTAPI_XAUDIO2CONFIG 40364 #define ID_OUTPUTAPI_XAUDIO2CONFIG 40364
#define ID_AUDIO_CORE_SETTINGS 40365 #define ID_AUDIO_CORE_SETTINGS 40365
#define ID_FILE_OPEN_GBA 40366
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 165 #define _APS_NEXT_RESOURCE_VALUE 165
#define _APS_NEXT_COMMAND_VALUE 40366 #define _APS_NEXT_COMMAND_VALUE 40367
#define _APS_NEXT_CONTROL_VALUE 1297 #define _APS_NEXT_CONTROL_VALUE 1297
#define _APS_NEXT_SYMED_VALUE 103 #define _APS_NEXT_SYMED_VALUE 103
#endif #endif