diff --git a/stella/src/win32/StellaX/MainDlg.cxx b/stella/src/win32/StellaX/MainDlg.cxx index 0d922d40d..5bed4534b 100644 --- a/stella/src/win32/StellaX/MainDlg.cxx +++ b/stella/src/win32/StellaX/MainDlg.cxx @@ -14,7 +14,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: MainDlg.cxx,v 1.5 2004-07-11 22:04:22 stephena Exp $ +// $Id: MainDlg.cxx,v 1.6 2004-07-15 00:11:06 stephena Exp $ //============================================================================ #include "pch.hxx" @@ -103,7 +103,7 @@ MainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam ) break; case WM_INITDIALOG: - return OnInitDialog( ); + return OnInitDialog(); case WM_NOTIFY: return OnNotify( (int)wParam, (LPNMHDR)lParam ); @@ -118,7 +118,7 @@ MainDlg::DialogFunc( UINT uMsg, WPARAM wParam, LPARAM lParam ) // Cool caption handlers case WM_DESTROY: - OnDestroy( ); + OnDestroy(); break; case WM_DRAWITEM: @@ -179,7 +179,7 @@ BOOL MainDlg::OnInitDialog( void ) ::SendMessage( hwndCtrl, WM_SETFONT, (WPARAM)m_hfontRomNote, 0 ); // Do subclassing - m_CoolCaption.OnInitDialog( hwnd ); + myCoolCaption.OnInitDialog( hwnd ); myHeader.SubclassDlgItem( hwnd, IDC_ROMLIST ); myAppTitle.SubclassDlgItem( hwnd, IDC_TITLE ); myPlayButton.SubclassDlgItem( hwnd, IDC_PLAY ); @@ -487,8 +487,7 @@ void MainDlg::UpdateRomList( void ) HWND hwndText; RECT rc; - if ( !PopulateRomList() ) - MessageBoxFromWinError( 0, _T("PopulateRomList") ); + PopulateRomList(); // if items added, select first item and enable play button int nCount = ListView_GetItemCount( myHwndList ); @@ -521,12 +520,26 @@ bool MainDlg::PopulateRomList( void ) { bool result = false; bool cacheFileExists = myGlobalData.settings().fileExists("stellax.cache"); - bool cacheIsStale = false; // FIXME + bool cacheIsStale = false; // FIXME - add romdir status checking - if(cacheFileExists && !cacheIsStale) + if (cacheFileExists && !cacheIsStale) + { result = LoadRomListFromCache(); + if (!result) + { + MessageBox( myHInstance, myHwnd, IDS_CORRUPT_CACHE_FILE ); + result = LoadRomListFromDisk(); + } + } else + { + if (!cacheFileExists) + MessageBox( myHInstance, myHwnd, IDS_NO_CACHE_FILE ); + else if (cacheIsStale) + MessageBox( myHInstance, myHwnd, IDS_ROMDIR_CHANGED ); + result = LoadRomListFromDisk(); + } ListView_SortByColumn( myHwndList, myGlobalData.settings().getInt("sortcol") ); return result; @@ -718,42 +731,33 @@ bool MainDlg::LoadRomListFromCache() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Cool caption message handlers -void MainDlg::OnDestroy( - void - ) +void MainDlg::OnDestroy( void ) { - m_CoolCaption.OnDestroy(); + myCoolCaption.OnDestroy(); - if ( m_hfontRomNote ) - { - ::DeleteObject( m_hfontRomNote ); - m_hfontRomNote = NULL; - } + if ( m_hfontRomNote ) + { + DeleteObject( m_hfontRomNote ); + m_hfontRomNote = NULL; + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::OnNcPaint( - HRGN hrgn - ) +void MainDlg::OnNcPaint( HRGN hrgn ) { - m_CoolCaption.OnNcPaint( hrgn ); + myCoolCaption.OnNcPaint( hrgn ); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void MainDlg::OnNcActivate( - BOOL fActive - ) +void MainDlg::OnNcActivate( BOOL fActive ) { - m_CoolCaption.OnNcActivate( fActive ); + myCoolCaption.OnNcActivate( fActive ); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BOOL MainDlg::OnNcLButtonDown( - INT nHitTest, - POINTS pts - ) +BOOL MainDlg::OnNcLButtonDown( INT nHitTest, POINTS pts ) { - return m_CoolCaption.OnNCLButtonDown( nHitTest, pts ); + return myCoolCaption.OnNCLButtonDown( nHitTest, pts ); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/win32/StellaX/MainDlg.hxx b/stella/src/win32/StellaX/MainDlg.hxx index 6c3e5f5e6..92b25f97f 100644 --- a/stella/src/win32/StellaX/MainDlg.hxx +++ b/stella/src/win32/StellaX/MainDlg.hxx @@ -14,7 +14,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: MainDlg.hxx,v 1.4 2004-07-11 22:04:22 stephena Exp $ +// $Id: MainDlg.hxx,v 1.5 2004-07-15 00:11:07 stephena Exp $ //============================================================================ #ifndef __MAINDLG_H_ @@ -46,7 +46,7 @@ class MainDlg private: HWND myHwnd; - CCoolCaption m_CoolCaption; + CCoolCaption myCoolCaption; CTextButton3d myAppTitle; CHeaderCtrl myHeader; CRoundButton myPlayButton; diff --git a/stella/src/win32/StellaX/StellaX.aps b/stella/src/win32/StellaX/StellaX.aps index fe3ac7577..63ed383de 100644 Binary files a/stella/src/win32/StellaX/StellaX.aps and b/stella/src/win32/StellaX/StellaX.aps differ diff --git a/stella/src/win32/StellaX/StellaX.rc b/stella/src/win32/StellaX/StellaX.rc index 033fee433..4ee8adba9 100644 --- a/stella/src/win32/StellaX/StellaX.rc +++ b/stella/src/win32/StellaX/StellaX.rc @@ -259,6 +259,9 @@ STRINGTABLE BEGIN IDS_STATUSTEXT "%d files found" IDS_STELLA "StellaX" + IDS_NO_CACHE_FILE "No ROM cache file was found. Regenerating the cache will take some time." + IDS_CORRUPT_CACHE_FILE "The ROM cache file was corrupt. Regenerating the cache will take some time." + IDS_ROMDIR_CHANGED "The ROM directory has changed. The ROM cache will be regenerated." END STRINGTABLE diff --git a/stella/src/win32/StellaX/resource.h b/stella/src/win32/StellaX/resource.h index 9e9646905..131aaa262 100644 --- a/stella/src/win32/StellaX/resource.h +++ b/stella/src/win32/StellaX/resource.h @@ -20,7 +20,10 @@ #define IDS_STATUSTEXT 289 #define IDS_STELLA 290 #define IDS_UNKNOWNERROR 291 +#define IDS_NO_CACHE_FILE 291 #define IDS_DEBUGBUILD 292 +#define IDS_CORRUPT_CACHE_FILE 292 +#define IDS_ROMDIR_CHANGED 293 #define IDS_COINIT_FAILED 296 #define IDS_ASS_FAILED 297 #define IDS_PAS_FAILED 298