ADDED "Quick Open ROM..." menu entry

This commit is contained in:
spacy51 2008-09-09 12:48:44 +00:00
parent 89212b8e38
commit 805315a8d1
5 changed files with 32 additions and 23 deletions

View File

@ -418,6 +418,7 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_WM_ENTERSIZEMOVE()
ON_COMMAND(ID_AUDIO_CORE_SETTINGS, &MainWnd::OnAudioCoreSettings)
ON_UPDATE_COMMAND_UI(ID_AUDIO_CORE_SETTINGS, &MainWnd::OnUpdateAudioCoreSettings)
ON_COMMAND(ID_FILE_QUICKOPENROM, &MainWnd::OnFileQuickopenrom)
END_MESSAGE_MAP()
@ -1027,32 +1028,30 @@ bool MainWnd::fileOpenSelect( int system )
{
theApp.dir = _T("");
CString initialDir;
int selectedFilter = 0;
LPCTSTR exts[] = { _T(""), _T(""), _T(""), _T("") };
CString filter;
CString title;
switch( system )
{
case 100:
// Quick Open File
initialDir = regQueryStringValue( _T("QuickOpenFileLastDir"), _T(".") );
filter = winLoadFilter( IDS_FILTER_ALLROM );
break;
case 0:
// GBA
initialDir = regQueryStringValue( _T("romdir"), _T(".") );
selectedFilter = regQueryDwordValue( _T("selectedFilter"), 0);
if( (selectedFilter < 0) || (selectedFilter > 2) ) {
selectedFilter = 0;
}
filter = winLoadFilter( IDS_FILTER_GBAROM );
break;
case 1:
// GBC
initialDir = regQueryStringValue( _T("gbcromdir"), _T(".") );
// TODO: memorize selected filter for GBC as well
filter = winLoadFilter( IDS_FILTER_GBCROM );
break;
case 2:
// GB
initialDir = regQueryStringValue( _T("gbromdir"), _T(".") );
// TODO: memorize selected filter for GB as well
filter = winLoadFilter( IDS_FILTER_GBROM );
break;
}
@ -1077,19 +1076,18 @@ bool MainWnd::fileOpenSelect( int system )
theApp.szFile = _T("");
FileDlg dlg( this, _T(""), filter, selectedFilter, _T(""), exts, theApp.dir, title, false);
FileDlg dlg( this, _T(""), filter, 0, _T(""), exts, theApp.dir, title, false);
if( dlg.DoModal() == IDOK ) {
if( system == 0 ) {
regSetDwordValue( _T("selectedFilter"), dlg.m_ofn.nFilterIndex );
}
theApp.szFile = dlg.GetPathName();
theApp.dir = theApp.szFile.Left( dlg.m_ofn.nFileOffset );
if( (theApp.dir.GetLength() > 3) && (theApp.dir[theApp.dir.GetLength()-1] == _T('\\')) ) {
theApp.dir = theApp.dir.Left( theApp.dir.GetLength() - 1 );
}
SetCurrentDirectory( theApp.dir );
regSetStringValue( _T("lastDir"), theApp.dir );
if( system == 100 ) {
regSetStringValue( _T("QuickOpenFileLastDir"), theApp.dir );
}
return true;
}
return false;

View File

@ -78,6 +78,7 @@ protected:
afx_msg void OnClose();
afx_msg void OnHelpAbout();
afx_msg void OnHelpFaq();
afx_msg void OnFileQuickopenrom();
afx_msg void OnFileOpenGBA();
afx_msg void OnFileOpenGBC();
afx_msg void OnFileOpenGB();

View File

@ -41,6 +41,13 @@ extern void remoteCleanUp();
extern void InterframeCleanup();
void MainWnd::OnFileQuickopenrom()
{
if( fileOpenSelect( 100 ) ) {
FileRun();
}
}
void MainWnd::OnFileOpenGBA()
{
if( fileOpenSelect( 0 ) ) {

View File

@ -1611,9 +1611,19 @@ IDR_MENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "Quick Open ROM...", ID_FILE_QUICKOPENROM
MENUITEM SEPARATOR
MENUITEM "Open GBA...", ID_FILE_OPEN_GBA
MENUITEM "Open GBC...", ID_FILE_OPEN_GBC
MENUITEM "Open GB...", ID_FILE_OPEN_GB
MENUITEM "Close", ID_FILE_CLOSE
MENUITEM SEPARATOR
POPUP "Recent"
BEGIN
MENUITEM "&Reset", ID_FILE_RECENT_RESET
MENUITEM "&Freeze", ID_FILE_RECENT_FREEZE
MENUITEM SEPARATOR
END
MENUITEM SEPARATOR
MENUITEM "Load...", ID_FILE_LOAD
MENUITEM "Save...", ID_FILE_SAVE
@ -1653,13 +1663,6 @@ BEGIN
MENUITEM "Pause", ID_FILE_PAUSE
MENUITEM "Reset", ID_FILE_RESET
MENUITEM SEPARATOR
POPUP "Recent"
BEGIN
MENUITEM "&Reset", ID_FILE_RECENT_RESET
MENUITEM "&Freeze", ID_FILE_RECENT_FREEZE
MENUITEM SEPARATOR
END
MENUITEM SEPARATOR
POPUP "Import"
BEGIN
MENUITEM "&Battery file...", ID_FILE_IMPORT_BATTERYFILE
@ -1676,8 +1679,6 @@ BEGIN
MENUITEM "ROM Information...", ID_FILE_ROMINFORMATION
MENUITEM "Toggle Fullscreen", ID_FILE_TOGGLEMENU
MENUITEM SEPARATOR
MENUITEM "Close", ID_FILE_CLOSE
MENUITEM SEPARATOR
MENUITEM "Exit", ID_FILE_EXIT
END
POPUP "&Options"
@ -2216,6 +2217,7 @@ BEGIN
IDS_TOOLTIP_ENHANCE_SOUND "Enable the following sound enhancements."
IDS_TOOLTIP_SURROUND "Inverts the phase of some channels, making it sound as if sound is coming from behind."
IDS_TOOLTIP_DECLICKING "When enabled, clicks are reduced by using GBA sound hardware. Note that clicks are normal for GB and GBC sound hardware."
IDS_FILTER_ALLROM "All ROMs (*.GBA;*.AGB;*.BIN;*.ELF;*.MB;*.GBC;*.CGB;*.GB;*.SGB;*.ZIP;*.7Z;*.Z;*.GZ)_*.GBA;*.AGB;*.BIN;*.ELF;*.MB;*.GBC;*.CGB;*.GB;*.SGB;*.ZIP;*.7Z;*.Z;*.GZ_All Files (*.*)_*.*__"
END
STRINGTABLE

View File

@ -50,7 +50,7 @@
#define IDS_TOOLTIP_ENHANCE_SOUND 43
#define IDS_TOOLTIP_SURROUND 44
#define IDS_TOOLTIP_DECLICKING 45
#define IDS_FILTER_COMPRESSED_FILES 46
#define IDS_FILTER_ALLROM 46
#define IDI_MAINICON 101
#define IDD_REGISTERS 102
#define IDD_DEBUG 103
@ -866,13 +866,14 @@
#define ID_OUTPUTAPI_XAUDIO2CONFIG 40364
#define ID_AUDIO_CORE_SETTINGS 40365
#define ID_FILE_OPEN_GBA 40366
#define ID_FILE_QUICKOPENROM 40367
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 165
#define _APS_NEXT_COMMAND_VALUE 40367
#define _APS_NEXT_COMMAND_VALUE 40368
#define _APS_NEXT_CONTROL_VALUE 1297
#define _APS_NEXT_SYMED_VALUE 103
#endif