GameList: Add GetEntryByCRC()

This commit is contained in:
Connor McLaughlin 2022-03-12 23:57:10 +10:00 committed by refractionpcsx2
parent 444e650711
commit 4f4b14dd4d
2 changed files with 12 additions and 0 deletions

View File

@ -568,6 +568,17 @@ const GameList::Entry* GameList::GetEntryForPath(const char* path)
return nullptr; return nullptr;
} }
const GameList::Entry* GameList::GetEntryByCRC(u32 crc)
{
for (const Entry& entry : m_entries)
{
if (entry.crc == crc)
return &entry;
}
return nullptr;
}
const GameList::Entry* GameList::GetEntryBySerialAndCRC(const std::string_view& serial, u32 crc) const GameList::Entry* GameList::GetEntryBySerialAndCRC(const std::string_view& serial, u32 crc)
{ {
for (const Entry& entry : m_entries) for (const Entry& entry : m_entries)

View File

@ -80,6 +80,7 @@ namespace GameList
std::unique_lock<std::recursive_mutex> GetLock(); std::unique_lock<std::recursive_mutex> GetLock();
const Entry* GetEntryByIndex(u32 index); const Entry* GetEntryByIndex(u32 index);
const Entry* GetEntryForPath(const char* path); const Entry* GetEntryForPath(const char* path);
const Entry* GetEntryByCRC(u32 crc);
const Entry* GetEntryBySerialAndCRC(const std::string_view& serial, u32 crc); const Entry* GetEntryBySerialAndCRC(const std::string_view& serial, u32 crc);
u32 GetEntryCount(); u32 GetEntryCount();