From 5e4fa4a371fe0d1849d79679b316c7e585bfac7a Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 4 Oct 2012 11:44:32 +1000 Subject: [PATCH] Do not refresh rom browser if failed to get rom list --- .../Project64/User Interface/Rom Browser Class.cpp | 14 +++++++++----- Source/Project64/User Interface/Rom Browser.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/Project64/User Interface/Rom Browser Class.cpp b/Source/Project64/User Interface/Rom Browser Class.cpp index 45e7132fa..13b90d086 100644 --- a/Source/Project64/User Interface/Rom Browser Class.cpp +++ b/Source/Project64/User Interface/Rom Browser Class.cpp @@ -503,21 +503,21 @@ bool CRomBrowser::FillRomInfo(ROM_INFO * pRomInfo) { return true; } } -void CRomBrowser::GetRomFileNames( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, bool InWatchThread ) -{ +bool CRomBrowser::GetRomFileNames( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, bool InWatchThread ) +{ CPath SearchPath((const stdstr&)BaseDirectory,"*.*"); SearchPath.AppendDirectory(Directory.c_str()); if (!SearchPath.FindFirst(CPath::_A_ALLFILES)) { - return; + return false; } do { if (InWatchThread && WaitForSingleObject(m_WatchStopEvent,0) != WAIT_TIMEOUT) { - return; + return false; } if (SearchPath.IsDirectory()) @@ -531,6 +531,7 @@ void CRomBrowser::GetRomFileNames( strlist & FileList, CPath & BaseDirectory, st AddFileNameToList(FileList, Directory, SearchPath); } } while (SearchPath.FindNext()); + return true; } void CRomBrowser::NotificationCB ( LPCSTR Status, CRomBrowser * _this ) @@ -1659,7 +1660,10 @@ bool CRomBrowser::RomDirNeedsRefresh ( void ) //Get Current MD5 of file names strlist FileNames; - GetRomFileNames(FileNames,CPath(_Settings->LoadString(Directory_Game)),stdstr(""), InWatchThread ); + if (!GetRomFileNames(FileNames,CPath(_Settings->LoadString(Directory_Game)),stdstr(""), InWatchThread )) + { + return false; + } FileNames.sort(); MD5 NewMd5 = RomListHash(FileNames); diff --git a/Source/Project64/User Interface/Rom Browser.h b/Source/Project64/User Interface/Rom Browser.h index 18d45774e..29ae92b52 100644 --- a/Source/Project64/User Interface/Rom Browser.h +++ b/Source/Project64/User Interface/Rom Browser.h @@ -158,7 +158,7 @@ class CRomBrowser void RomList_OpenRom ( DWORD pnmh ); void RomList_PopupMenu ( DWORD pnmh ); void RomList_SortList ( void ); - void GetRomFileNames ( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, bool InWatchThread ); + bool GetRomFileNames ( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, bool InWatchThread ); MD5 RomListHash ( strlist & FileList ); static void __stdcall NotificationCB ( LPCSTR Status, CRomBrowser * _this );