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.
This commit is contained in:
JosJuice 2024-07-10 13:16:54 +02:00
parent bb03fc04cc
commit 1bf12a50c2
1 changed files with 20 additions and 14 deletions

View File

@ -372,26 +372,32 @@ void AchievementManager::FilterApprovedPatches(std::vector<PatchEngine::Patch>&
if (!IsHardcoreModeActive()) if (!IsHardcoreModeActive())
return; return;
if (!m_ini_root->contains(game_ini_id)) const bool known_id = m_ini_root->contains(game_ini_id);
patches.clear();
auto patch_itr = patches.begin(); auto patch_itr = patches.begin();
while (patch_itr != patches.end()) while (patch_itr != patches.end())
{ {
INFO_LOG_FMT(ACHIEVEMENTS, "Verifying patch {}", patch_itr->name); INFO_LOG_FMT(ACHIEVEMENTS, "Verifying patch {}", patch_itr->name);
auto context = Common::SHA1::CreateContext(); bool verified = false;
context->Update(Common::BitCastToArray<u8>(static_cast<u64>(patch_itr->entries.size())));
for (const auto& entry : patch_itr->entries) if (known_id)
{ {
context->Update(Common::BitCastToArray<u8>(entry.type)); auto context = Common::SHA1::CreateContext();
context->Update(Common::BitCastToArray<u8>(entry.address)); context->Update(Common::BitCastToArray<u8>(static_cast<u64>(patch_itr->entries.size())));
context->Update(Common::BitCastToArray<u8>(entry.value)); for (const auto& entry : patch_itr->entries)
context->Update(Common::BitCastToArray<u8>(entry.comparand)); {
context->Update(Common::BitCastToArray<u8>(entry.conditional)); context->Update(Common::BitCastToArray<u8>(entry.type));
} context->Update(Common::BitCastToArray<u8>(entry.address));
auto digest = context->Finish(); context->Update(Common::BitCastToArray<u8>(entry.value));
context->Update(Common::BitCastToArray<u8>(entry.comparand));
context->Update(Common::BitCastToArray<u8>(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) if (!verified)
{ {
patch_itr = patches.erase(patch_itr); patch_itr = patches.erase(patch_itr);