From: Spacy <sp...@us...> - 2006-06-12 11:09:12
|
Update of /cvsroot/vba/VisualBoyAdvance/src/win32 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv2787/src/win32 Modified Files: MainWnd.cpp MainWnd.h MainWndFile.cpp Log Message: I merged the open file source code for GB and GBA. Index: MainWndFile.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWndFile.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MainWndFile.cpp 6 Jun 2006 21:04:21 -0000 1.16 --- MainWndFile.cpp 12 Jun 2006 11:09:04 -0000 1.17 *************** *** 40,51 **** extern void InterframeCleanup(); void MainWnd::OnFileOpen() { ! theApp.winCheckFullscreen(); ! if(fileOpenSelect()) { ! FileRun(); ! } } void MainWnd::OnFilePause() { --- 40,53 ---- extern void InterframeCleanup(); + void MainWnd::OnFileOpen() { ! theApp.winCheckFullscreen(); ! if( fileOpenSelect( false ) ) { ! FileRun(); ! } } + void MainWnd::OnFilePause() { *************** *** 160,189 **** } void MainWnd::OnFileOpengameboy() { ! theApp.winCheckFullscreen(); ! theApp.dir = ""; ! CString initialDir = regQueryStringValue("gbromdir","."); ! if(!initialDir.IsEmpty()) ! theApp.dir = initialDir; ! ! theApp.szFile = ""; ! ! LPCTSTR exts[] = { "", "", "", "" }; ! CString filter = winLoadFilter(IDS_FILTER_GBROM); ! CString title = winResLoadString(IDS_SELECT_ROM); ! ! FileDlg dlg(this, "", filter, 0, "", exts, initialDir, title, false); ! ! if(dlg.DoModal() == IDOK) { ! theApp.szFile = dlg.GetPathName(); ! theApp.dir = theApp.szFile.Left(dlg.m_ofn.nFileOffset); ! if(theApp.dir.GetLength() > 3 && theApp.dir[theApp.dir.GetLength()-1] == '\\') ! theApp.dir = theApp.dir.Left(theApp.dir.GetLength()-1); ! regSetStringValue("gbromdir", theApp.dir); ! FileRun(); ! } } void MainWnd::OnFileLoad() { --- 162,175 ---- } + void MainWnd::OnFileOpengameboy() { ! theApp.winCheckFullscreen(); ! if( fileOpenSelect( true ) ) { ! FileRun(); ! } } + void MainWnd::OnFileLoad() { Index: MainWnd.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWnd.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MainWnd.cpp 27 May 2006 14:47:33 -0000 1.19 --- MainWnd.cpp 12 Jun 2006 11:09:04 -0000 1.20 *************** *** 992,1026 **** } - bool MainWnd::fileOpenSelect() - { - theApp.dir = ""; - CString initialDir = regQueryStringValue("romdir","."); - if(!initialDir.IsEmpty()) - theApp.dir = initialDir; - - int selectedFilter = regQueryDwordValue("selectedFilter", 0); - if(selectedFilter < 0 || selectedFilter > 2) - selectedFilter = 0; ! theApp.szFile = ""; ! LPCTSTR exts[] = { "", "", "" }; ! CString filter = winLoadFilter(IDS_FILTER_ROM); ! CString title = winResLoadString(IDS_SELECT_ROM); ! FileDlg dlg(this, "", filter, selectedFilter, "", exts, theApp.dir, title, false); ! if(dlg.DoModal() == IDOK) { ! regSetDwordValue("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] == '\\') ! theApp.dir = theApp.dir.Left(theApp.dir.GetLength()-1); ! regSetStringValue("romdir", theApp.dir); ! return true; ! } ! return false; } void MainWnd::OnPaint() { --- 992,1053 ---- } ! bool MainWnd::fileOpenSelect( bool gb ) ! { ! theApp.dir = _T(""); ! CString initialDir; ! if( gb ) { ! initialDir = regQueryStringValue( _T("gbromdir"), _T(".") ); ! } else { ! initialDir = regQueryStringValue( _T("romdir"), _T(".") ); ! } ! ! if( !initialDir.IsEmpty() ) { ! theApp.dir = initialDir; ! } ! int selectedFilter = 0; ! if( !gb ) { ! selectedFilter = regQueryDwordValue( _T("selectedFilter"), 0); ! if( (selectedFilter < 0) || (selectedFilter > 2) ) { ! selectedFilter = 0; ! } ! } ! ! theApp.szFile = _T(""); ! ! LPCTSTR exts[] = { _T(""), _T(""), _T(""), _T("") }; ! CString filter; ! CString title; ! if( gb ) { ! filter = winLoadFilter( IDS_FILTER_GBROM ); ! title = winResLoadString( IDS_SELECT_ROM ); ! } else { ! filter = winLoadFilter( IDS_FILTER_ROM ); ! title = winResLoadString( IDS_SELECT_ROM ); ! } ! FileDlg dlg( this, _T(""), filter, selectedFilter, _T(""), exts, theApp.dir, title, false); ! if( dlg.DoModal() == IDOK ) { ! if( !gb ) { ! 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 ); ! } ! if( gb ) { ! regSetStringValue( _T("gbromdir"), theApp.dir ); ! } else { ! regSetStringValue( _T("romdir"), theApp.dir ); ! } ! return true; ! } ! return false; } + void MainWnd::OnPaint() { Index: MainWnd.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/win32/MainWnd.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MainWnd.h 4 Jan 2006 15:10:33 -0000 1.9 --- MainWnd.h 12 Jun 2006 11:09:04 -0000 1.10 *************** *** 56,60 **** void screenCapture(int captureNumber); HACCEL m_hAccelTable; ! bool fileOpenSelect(); afx_msg LRESULT OnConfirmMode(WPARAM, LPARAM); afx_msg LRESULT OnMySysCommand(WPARAM, LPARAM); --- 56,60 ---- void screenCapture(int captureNumber); HACCEL m_hAccelTable; ! bool fileOpenSelect( bool gb = false ); afx_msg LRESULT OnConfirmMode(WPARAM, LPARAM); afx_msg LRESULT OnMySysCommand(WPARAM, LPARAM); |