[Project64] Add some logging to RomList.cpp

This commit is contained in:
zilmar 2016-04-14 22:18:21 +10:00
parent e4e1fa04f7
commit e339b7d787
3 changed files with 167 additions and 141 deletions

View File

@ -20,5 +20,6 @@ enum TraceModuleProject64
TraceTLB,
TraceProtectedMem,
TraceUserInterface,
TraceRomList,
MaxTraceModuleProject64,
};

View File

@ -295,10 +295,10 @@ void CRomBrowser::AllocateBrushs(void)
void CRomBrowser::RomListReset(void)
{
WriteTrace(TraceUserInterface, TraceDebug, "1");
ListView_DeleteAllItems((HWND)m_hRomList);
ListView_DeleteAllItems(m_hRomList);
DeallocateBrushs();
WriteTrace(TraceUserInterface, TraceDebug, "2");
InvalidateRect((HWND)m_hRomList, NULL, TRUE);
InvalidateRect(m_hRomList, NULL, TRUE);
Sleep(100);
WriteTrace(TraceUserInterface, TraceDebug, "3");
m_LastRom = UISettingsLoadStringIndex(File_RecentGameFileIndex, 0);

View File

@ -12,7 +12,19 @@
static const char* ROM_extensions[] =
{
"zip", "7z", "v64", "z64", "n64", "rom", "jap", "pal", "usa", "eur", "bin",
#ifdef _WIN32
"7z",
#endif
"zip",
"v64",
"z64",
"n64",
"rom",
"jap",
"pal",
"usa",
"eur",
"bin",
};
CRomList::CRomList() :
@ -126,9 +138,11 @@ void CRomList::FillRomList(strlist & FileList, const CPath & BaseDirectory, cons
CPath SearchPath(BaseDirectory, "*");
SearchPath.AppendDirectory(Directory);
WriteTrace(TraceUserInterface, TraceDebug, "1 %s", (const char *)SearchPath);
WriteTrace(TraceRomList, TraceVerbose, "SearchPath: %s", (const char *)SearchPath);
if (!SearchPath.FindFirst(CPath::FIND_ATTRIBUTE_ALLFILES))
{
WriteTrace(TraceRomList, TraceVerbose, "No files found");
WriteTrace(TraceRomList, TraceDebug, "Done (Directory: %s)",Directory);
return;
}
@ -138,8 +152,12 @@ void CRomList::FillRomList(strlist & FileList, const CPath & BaseDirectory, cons
int8_t new_list_entry = 0;
const uint8_t exts = sizeof(ROM_extensions) / sizeof(ROM_extensions[0]);
WriteTrace(TraceUserInterface, TraceDebug, ": 2 %s m_StopRefresh = %d", (const char *)SearchPath, m_StopRefresh);
if (m_StopRefresh) { break; }
WriteTrace(TraceRomList, TraceVerbose, "Found: \"%s\" m_StopRefresh = %s", (const char *)SearchPath, m_StopRefresh ? "true" : "false");
if (m_StopRefresh)
{
WriteTrace(TraceRomList, TraceVerbose, "stop refresh set, stopping");
break;
}
if (SearchPath.IsDirectory())
{
@ -155,23 +173,27 @@ void CRomList::FillRomList(strlist & FileList, const CPath & BaseDirectory, cons
AddFileNameToList(FileList, Directory, SearchPath);
stdstr Extension = stdstr(SearchPath.GetExtension()).ToLower();
for (ext_ID = 0; ext_ID < exts; ext_ID++)
for (uint8_t i = 0; i < sizeof(ROM_extensions) / sizeof(ROM_extensions[0]); i++)
{
if (Extension == ROM_extensions[ext_ID] && Extension != "7z")
if (Extension != ROM_extensions[i])
{
new_list_entry = 1;
break;
}
}
if (new_list_entry)
{
AddRomToList(SearchPath);
continue;
}
if (Extension == "7z")
WriteTrace(TraceRomList, TraceVerbose, "File has matching extension: \"%s\"", ROM_extensions[i]);
if (FileList.size() <= 3000)
{
stdstr file = stdstr(Directory + SearchPath.GetNameExtension()).ToLower();
WriteTrace(TraceRomList, TraceVerbose, "Adding: \"%s\" to FileList", file.c_str());
FileList.push_back(file);
}
if (Extension != "7z")
{
AddRomToList(SearchPath);
}
#ifdef _WIN32
else
{
WriteTrace(TraceRomList, TraceVerbose, "Looking at contents of 7z file");
try
{
C7zip ZipFile(SearchPath);
@ -261,6 +283,7 @@ void CRomList::FillRomList(strlist & FileList, const CPath & BaseDirectory, cons
*(uint32_t *)&RomData[x] = strtoul(&szHeader[2 * x], NULL, 16);
szHeader[2 * x + delimit_offset] = backup_character;
}
WriteTrace(TraceUserInterface, TraceDebug, "14");
{
char InternalName[22];
@ -309,10 +332,15 @@ void CRomList::FillRomList(strlist & FileList, const CPath & BaseDirectory, cons
{
WriteTrace(TraceUserInterface, TraceError, "execpetion processing %s", (LPCSTR)SearchPath);
}
continue;
}
#endif
break;
}
} while (SearchPath.FindNext());
#ifdef _WIN32
m_ZipIniFile->FlushChanges();
#endif
WriteTrace(TraceRomList, TraceDebug, "Done (Directory: %s)",Directory);
}
void CRomList::NotificationCB(const char * Status, CRomList * /*_this*/)
@ -410,11 +438,7 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
int32_t count;
uint8_t RomData[0x1000];
if (!LoadDataFromRomFile(pRomInfo->szFullFileName, RomData, sizeof(RomData), &pRomInfo->RomSize, pRomInfo->FileFormat))
{
return false;
}
else
if (LoadDataFromRomFile(pRomInfo->szFullFileName, RomData, sizeof(RomData), &pRomInfo->RomSize, pRomInfo->FileFormat))
{
if (strstr(pRomInfo->szFullFileName, "?") != NULL)
{
@ -459,6 +483,7 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
return true;
}
return false;
}
void CRomList::FillRomExtensionInfo(ROM_INFO * pRomInfo)