1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

patch_manager: one patch per group across hashes

This commit is contained in:
Megamouse 2020-06-28 13:26:10 +02:00
parent e5bb5f02e0
commit cf2e2a0511
2 changed files with 11 additions and 11 deletions

View File

@ -548,18 +548,18 @@ void patch_engine::append_title_patches(const std::string& title_id)
load(m_map, fs::get_config_dir() + "patches/" + title_id + "_patch.yml");
}
std::size_t patch_engine::apply(const std::string& name, u8* dst) const
std::size_t patch_engine::apply(const std::string& name, u8* dst)
{
return apply_patch<false>(name, dst, 0, 0);
}
std::size_t patch_engine::apply_with_ls_check(const std::string& name, u8* dst, u32 filesz, u32 ls_addr) const
std::size_t patch_engine::apply_with_ls_check(const std::string& name, u8* dst, u32 filesz, u32 ls_addr)
{
return apply_patch<true>(name, dst, filesz, ls_addr);
}
template <bool check_local_storage>
std::size_t patch_engine::apply_patch(const std::string& name, u8* dst, u32 filesz, u32 ls_addr) const
std::size_t patch_engine::apply_patch(const std::string& name, u8* dst, u32 filesz, u32 ls_addr)
{
if (m_map.find(name) == m_map.cend())
{
@ -571,9 +571,6 @@ std::size_t patch_engine::apply_patch(const std::string& name, u8* dst, u32 file
const auto serial = Emu.GetTitleID();
const auto app_version = Emu.GetAppVersion();
// Only one patch per patch group is allowed
std::set<std::string> applied_groups;
// Apply modifications sequentially
for (const auto& [description, patch] : container.patch_info_map)
{
@ -626,12 +623,12 @@ std::size_t patch_engine::apply_patch(const std::string& name, u8* dst, u32 file
if (!patch.patch_group.empty())
{
if (applied_groups.contains(patch.patch_group))
if (m_applied_groups.contains(patch.patch_group))
{
continue;
}
applied_groups.insert(patch.patch_group);
m_applied_groups.insert(patch.patch_group);
}
size_t applied = 0;

View File

@ -119,10 +119,10 @@ public:
void append_title_patches(const std::string& title_id);
// Apply patch (returns the number of entries applied)
std::size_t apply(const std::string& name, u8* dst) const;
std::size_t apply(const std::string& name, u8* dst);
// Apply patch with a check that the address exists in SPU local storage
std::size_t apply_with_ls_check(const std::string& name, u8* dst, u32 filesz, u32 ls_addr) const;
std::size_t apply_with_ls_check(const std::string& name, u8* dst, u32 filesz, u32 ls_addr);
private:
// Load from file and append to member patches map
@ -130,8 +130,11 @@ private:
// Internal: Apply patch (returns the number of entries applied)
template <bool check_local_storage>
std::size_t apply_patch(const std::string& name, u8* dst, u32 filesz, u32 ls_addr) const;
std::size_t apply_patch(const std::string& name, u8* dst, u32 filesz, u32 ls_addr);
// Database
patch_map m_map;
// Only one patch per patch group can be applied
std::set<std::string> m_applied_groups;
};