From 4f4b14dd4dca722ea12931c41bf7a3713b192fe3 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 12 Mar 2022 23:57:10 +1000 Subject: [PATCH] GameList: Add GetEntryByCRC() --- pcsx2/Frontend/GameList.cpp | 11 +++++++++++ pcsx2/Frontend/GameList.h | 1 + 2 files changed, 12 insertions(+) diff --git a/pcsx2/Frontend/GameList.cpp b/pcsx2/Frontend/GameList.cpp index 64b35e6ab7..ed2735ea4c 100644 --- a/pcsx2/Frontend/GameList.cpp +++ b/pcsx2/Frontend/GameList.cpp @@ -568,6 +568,17 @@ const GameList::Entry* GameList::GetEntryForPath(const char* path) 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) { for (const Entry& entry : m_entries) diff --git a/pcsx2/Frontend/GameList.h b/pcsx2/Frontend/GameList.h index 3912f0e19b..ba07f4e0ec 100644 --- a/pcsx2/Frontend/GameList.h +++ b/pcsx2/Frontend/GameList.h @@ -80,6 +80,7 @@ namespace GameList std::unique_lock GetLock(); const Entry* GetEntryByIndex(u32 index); const Entry* GetEntryForPath(const char* path); + const Entry* GetEntryByCRC(u32 crc); const Entry* GetEntryBySerialAndCRC(const std::string_view& serial, u32 crc); u32 GetEntryCount();