ADDED: Option to always use the last accessed directory instead of any of the default ROM directories.

This commit is contained in:
spacy51 2008-04-15 15:15:36 +00:00
parent 6701ee724b
commit 9a60908f37
8 changed files with 42 additions and 11 deletions

View File

@ -52,19 +52,21 @@ static int CALLBACK browseCallbackProc(HWND hWnd, UINT msg,
Directories::Directories(CWnd* pParent /*=NULL*/)
: CDialog(Directories::IDD, pParent)
, m_alwaysLastRomDir(FALSE)
{
}
void Directories::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SAVE_PATH, m_savePath);
DDX_Control(pDX, IDC_ROM_PATH, m_romPath);
DDX_Control(pDX, IDC_GBCROM_PATH, m_gbcromPath);
DDX_Control(pDX, IDC_GBROM_PATH, m_gbromPath);
DDX_Control(pDX, IDC_CAPTURE_PATH, m_capturePath);
DDX_Control(pDX, IDC_BATTERY_PATH, m_batteryPath);
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SAVE_PATH, m_savePath);
DDX_Control(pDX, IDC_ROM_PATH, m_romPath);
DDX_Control(pDX, IDC_GBCROM_PATH, m_gbcromPath);
DDX_Control(pDX, IDC_GBROM_PATH, m_gbromPath);
DDX_Control(pDX, IDC_CAPTURE_PATH, m_capturePath);
DDX_Control(pDX, IDC_BATTERY_PATH, m_batteryPath);
DDX_Check(pDX, IDC_ALWAYSLASTROMDIR, m_alwaysLastRomDir);
}
@ -169,6 +171,8 @@ void Directories::OnCancel()
void Directories::OnOK()
{
CDialog::OnOK();
char baseDir[MAX_PATH+1];
char temp[MAX_PATH+1];
GetModuleFileName( NULL, baseDir, MAX_PATH );

View File

@ -51,4 +51,7 @@ private:
CString browseForDir(CString title);
bool directoryDoesExist(const char *directory);
public:
BOOL m_alwaysLastRomDir;
};

View File

@ -1056,11 +1056,18 @@ bool MainWnd::fileOpenSelect( int system )
LPCTSTR exts[] = { _T(""), _T(""), _T(""), _T("") };
CString filter;
CString title;
if( theApp.alwaysLastDir ) {
initialDir = regQueryStringValue( _T("lastDir"), _T(".") );
}
switch( system )
{
case 0:
// GBA
initialDir = regQueryStringValue( _T("romdir"), _T(".") );
if( !theApp.alwaysLastDir ) {
initialDir = regQueryStringValue( _T("romdir"), _T(".") );
}
selectedFilter = regQueryDwordValue( _T("selectedFilter"), 0);
if( (selectedFilter < 0) || (selectedFilter > 2) ) {
selectedFilter = 0;
@ -1069,13 +1076,17 @@ bool MainWnd::fileOpenSelect( int system )
break;
case 1:
// GBC
initialDir = regQueryStringValue( _T("gbcromdir"), _T(".") );
if( !theApp.alwaysLastDir ) {
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(".") );
if( !theApp.alwaysLastDir ) {
initialDir = regQueryStringValue( _T("gbromdir"), _T(".") );
}
// TODO: memorize selected filter for GB as well
filter = winLoadFilter( IDS_FILTER_GBROM );
break;
@ -1113,6 +1124,7 @@ bool MainWnd::fileOpenSelect( int system )
theApp.dir = theApp.dir.Left( theApp.dir.GetLength() - 1 );
}
SetCurrentDirectory( theApp.dir );
regSetStringValue( _T("lastDir"), theApp.dir );
return true;
}
return false;

View File

@ -561,7 +561,9 @@ void MainWnd::OnOptionsEmulatorAssociate()
void MainWnd::OnOptionsEmulatorDirectories()
{
Directories dlg;
dlg.m_alwaysLastRomDir = theApp.alwaysLastDir ? BST_CHECKED : BST_UNCHECKED;
dlg.DoModal();
theApp.alwaysLastDir = ( dlg.m_alwaysLastRomDir == BST_CHECKED );
}
void MainWnd::OnOptionsEmulatorDisablestatusmessages()

View File

@ -264,6 +264,7 @@ VBA::VBA()
paused = false;
recentFreeze = false;
autoSaveLoadCheatList = false;
alwaysLastDir = false;
winout = NULL;
removeIntros = false;
autoIPS = true;
@ -1638,6 +1639,9 @@ void VBA::loadSettings()
autoSaveLoadCheatList = regQueryDwordValue("autoSaveCheatList", 0) ?
true : false;
alwaysLastDir =
( regQueryDwordValue( "alwaysUseLastRomDirectory", 0 ) == 1 ) ? true : false;
gbPaletteOption = regQueryDwordValue("gbPaletteOption", 0);
if(gbPaletteOption < 0)
gbPaletteOption = 0;
@ -2557,6 +2561,8 @@ void VBA::saveSettings()
regSetDwordValue("autoSaveCheatList", autoSaveLoadCheatList);
regSetDwordValue("alwaysUseLastRomDirectory", alwaysLastDir ? 1 : 0);
regSetDwordValue("gbPaletteOption", gbPaletteOption);
regSetBinaryValue("gbPalette", (char *)systemGbPalette,

View File

@ -125,6 +125,7 @@ class VBA : public CWinApp
CString recentFiles[10];
bool recentFreeze;
bool autoSaveLoadCheatList;
bool alwaysLastDir;
FILE *winout;
bool removeIntros;
bool autoIPS;

View File

@ -232,6 +232,7 @@ BEGIN
"Static",SS_LEFTNOWORDWRAP | WS_GROUP,12,234,90,24
DEFPUSHBUTTON "OK",IDOK,120,246,48,18
PUSHBUTTON "Cancel",IDCANCEL,168,246,48,18
CONTROL "Always use last ROM dir",IDC_ALWAYSLASTROMDIR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,222,96,8
END
IDD_CONFIG DIALOGEX 0, 0, 448, 102

View File

@ -530,6 +530,8 @@
#define IDC_COMBO_COLOR_DEPTH 1281
#define IDC_COMBO_REFRESH_RATE 1282
#define IDC_COMBO_DEVICE 1283
#define IDC_CHECK1 1284
#define IDC_ALWAYSLASTROMDIR 1284
#define IDS_OAL_NODEVICE 2000
#define IDS_OAL_NODLL 2001
#define IDS_AVI_CANNOT_CREATE_AVI 2002
@ -858,7 +860,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 163
#define _APS_NEXT_COMMAND_VALUE 40361
#define _APS_NEXT_CONTROL_VALUE 1284
#define _APS_NEXT_CONTROL_VALUE 1285
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif