[Project64] Clean up testing around rom list refresh
This commit is contained in:
parent
78b7cfe38f
commit
f5cf17903b
|
@ -312,6 +312,9 @@
|
||||||
<ClCompile Include="N64System\Mips\Transferpak.cpp">
|
<ClCompile Include="N64System\Mips\Transferpak.cpp">
|
||||||
<Filter>Source Files\N64 System\Mips</Filter>
|
<Filter>Source Files\N64 System\Mips</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="RomList\RomList.cpp">
|
||||||
|
<Filter>Source Files\Rom List</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="stdafx.h">
|
<ClInclude Include="stdafx.h">
|
||||||
|
|
|
@ -1098,17 +1098,22 @@ bool CRomBrowser::RomDirNeedsRefresh(void)
|
||||||
|
|
||||||
//Get Old MD5 of file names
|
//Get Old MD5 of file names
|
||||||
stdstr FileName = g_Settings->LoadStringVal(RomList_RomListCache);
|
stdstr FileName = g_Settings->LoadStringVal(RomList_RomListCache);
|
||||||
HANDLE hFile = CreateFile(FileName.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL);
|
if (!CPath(FileName).Exists())
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
|
||||||
{
|
{
|
||||||
//if file does not exist then refresh the data
|
//if file does not exist then refresh the data
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD dwRead;
|
CFile hFile(FileName.c_str(), CFileBase::modeRead);
|
||||||
|
if (!hFile.IsOpen())
|
||||||
|
{
|
||||||
|
//Could not validate, assume it is fine
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char CurrentFileMD5[16];
|
unsigned char CurrentFileMD5[16];
|
||||||
ReadFile(hFile, &CurrentFileMD5, sizeof(CurrentFileMD5), &dwRead, NULL);
|
hFile.Read(&CurrentFileMD5, sizeof(CurrentFileMD5));
|
||||||
CloseHandle(hFile);
|
hFile.Close();
|
||||||
|
|
||||||
//Get Current MD5 of file names
|
//Get Current MD5 of file names
|
||||||
strlist FileNames;
|
strlist FileNames;
|
||||||
|
@ -1176,6 +1181,11 @@ void CRomBrowser::WatchRomDirChanged(CRomBrowser * _this)
|
||||||
|
|
||||||
void CRomBrowser::WatchThreadStart(void)
|
void CRomBrowser::WatchThreadStart(void)
|
||||||
{
|
{
|
||||||
|
if (m_WatchThread != NULL)
|
||||||
|
{
|
||||||
|
// thread already running
|
||||||
|
return;
|
||||||
|
}
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "1");
|
WriteTrace(TraceUserInterface, TraceDebug, "1");
|
||||||
WatchThreadStop();
|
WatchThreadStop();
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "2");
|
WriteTrace(TraceUserInterface, TraceDebug, "2");
|
||||||
|
|
Loading…
Reference in New Issue