patch_manager: prefer serial patches over All

This commit is contained in:
Megamouse 2020-06-27 14:14:08 +02:00
parent 6a486d3402
commit c72a6f8e6f

View File

@ -568,28 +568,28 @@ std::size_t patch_engine::apply_patch(const std::string& name, u8* dst, u32 file
{
std::string found_serial;
if (serials.find(patch_key::all) != serials.end())
{
found_serial = patch_key::all;
}
else if (serials.find(serial) != serials.end())
if (serials.find(serial) != serials.end())
{
found_serial = serial;
}
else if (serials.find(patch_key::all) != serials.end())
{
found_serial = patch_key::all;
}
if (!found_serial.empty())
{
const auto& app_versions = serials.at(found_serial);
std::string found_app_version;
if (app_versions.find(patch_key::all) != app_versions.end())
{
found_app_version = patch_key::all;
}
else if (app_versions.find(app_version) != app_versions.end())
if (app_versions.find(app_version) != app_versions.end())
{
found_app_version = app_version;
}
else if (app_versions.find(patch_key::all) != app_versions.end())
{
found_app_version = patch_key::all;
}
if (!found_app_version.empty() && app_versions.at(found_app_version))
{