From d8e980887f5f47377635a67b96172c72e0bf983b Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 15 May 2023 23:47:22 +1000 Subject: [PATCH] GameList: Add GetEntryBySerialAndHash() --- src/frontend-common/game_list.cpp | 11 +++++++++++ src/frontend-common/game_list.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/frontend-common/game_list.cpp b/src/frontend-common/game_list.cpp index a44d32919..f2c37c731 100644 --- a/src/frontend-common/game_list.cpp +++ b/src/frontend-common/game_list.cpp @@ -590,6 +590,17 @@ const GameList::Entry* GameList::GetEntryBySerial(const std::string_view& serial return nullptr; } +const GameList::Entry* GameList::GetEntryBySerialAndHash(const std::string_view& serial, u64 hash) +{ + for (const Entry& entry : s_entries) + { + if (entry.serial == serial && entry.hash == hash) + return &entry; + } + + return nullptr; +} + u32 GameList::GetEntryCount() { return static_cast(s_entries.size()); diff --git a/src/frontend-common/game_list.h b/src/frontend-common/game_list.h index 61c69a99e..049c5b24b 100644 --- a/src/frontend-common/game_list.h +++ b/src/frontend-common/game_list.h @@ -71,6 +71,7 @@ std::unique_lock GetLock(); const Entry* GetEntryByIndex(u32 index); const Entry* GetEntryForPath(const char* path); const Entry* GetEntryBySerial(const std::string_view& serial); +const Entry* GetEntryBySerialAndHash(const std::string_view& serial, u64 hash); u32 GetEntryCount(); bool IsGameListLoaded();