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())
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<u8>(static_cast<u64>(patch_itr->entries.size())));
for (const auto& entry : patch_itr->entries)
{
context->Update(Common::BitCastToArray<u8>(entry.type));
context->Update(Common::BitCastToArray<u8>(entry.address));
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();
bool verified = false;
if (known_id)
{
auto context = Common::SHA1::CreateContext();
context->Update(Common::BitCastToArray<u8>(static_cast<u64>(patch_itr->entries.size())));
for (const auto& entry : patch_itr->entries)
{
context->Update(Common::BitCastToArray<u8>(entry.type));
context->Update(Common::BitCastToArray<u8>(entry.address));
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)
{
patch_itr = patches.erase(patch_itr);