From 1bf12a50c211e091368a453dbcca5662bdf64acc Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 10 Jul 2024 13:16:54 +0200 Subject: [PATCH] RetroAchievements: Show OSD messages also for unverified INI files Currently we're showing OSD messages for unknown patches in known INI files, but not for unknown patches in unknown INI files. I don't think this distinction makes much sense to the user. If there's a patch the user can't use, they probably want to be aware of that fact. --- Source/Core/Core/AchievementManager.cpp | 34 +++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index 7a1837abbc..8b13a5327a 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -372,26 +372,32 @@ void AchievementManager::FilterApprovedPatches(std::vector& if (!IsHardcoreModeActive()) return; - if (!m_ini_root->contains(game_ini_id)) - patches.clear(); + const bool known_id = m_ini_root->contains(game_ini_id); + auto patch_itr = patches.begin(); while (patch_itr != patches.end()) { INFO_LOG_FMT(ACHIEVEMENTS, "Verifying patch {}", patch_itr->name); - auto context = Common::SHA1::CreateContext(); - context->Update(Common::BitCastToArray(static_cast(patch_itr->entries.size()))); - for (const auto& entry : patch_itr->entries) - { - context->Update(Common::BitCastToArray(entry.type)); - context->Update(Common::BitCastToArray(entry.address)); - context->Update(Common::BitCastToArray(entry.value)); - context->Update(Common::BitCastToArray(entry.comparand)); - context->Update(Common::BitCastToArray(entry.conditional)); - } - auto digest = context->Finish(); + bool verified = false; + + if (known_id) + { + auto context = Common::SHA1::CreateContext(); + context->Update(Common::BitCastToArray(static_cast(patch_itr->entries.size()))); + for (const auto& entry : patch_itr->entries) + { + context->Update(Common::BitCastToArray(entry.type)); + context->Update(Common::BitCastToArray(entry.address)); + context->Update(Common::BitCastToArray(entry.value)); + context->Update(Common::BitCastToArray(entry.comparand)); + context->Update(Common::BitCastToArray(entry.conditional)); + } + auto digest = context->Finish(); + + verified = m_ini_root->get(game_ini_id).contains(Common::SHA1::DigestToString(digest)); + } - bool verified = m_ini_root->get(game_ini_id).contains(Common::SHA1::DigestToString(digest)); if (!verified) { patch_itr = patches.erase(patch_itr);