diff --git a/Utilities/bin_patch.cpp b/Utilities/bin_patch.cpp index 6ba9b0d451..dcd4003551 100644 --- a/Utilities/bin_patch.cpp +++ b/Utilities/bin_patch.cpp @@ -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(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(name, dst, filesz, ls_addr); } template -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 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; diff --git a/Utilities/bin_patch.h b/Utilities/bin_patch.h index 42c6a6da77..9b8967f363 100644 --- a/Utilities/bin_patch.h +++ b/Utilities/bin_patch.h @@ -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 - 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 m_applied_groups; };