mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 05:51:27 +12:00
patch_manager: one patch per group across hashes
This commit is contained in:
parent
e5bb5f02e0
commit
cf2e2a0511
2 changed files with 11 additions and 11 deletions
|
@ -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");
|
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);
|
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);
|
return apply_patch<true>(name, dst, filesz, ls_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool check_local_storage>
|
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())
|
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 serial = Emu.GetTitleID();
|
||||||
const auto app_version = Emu.GetAppVersion();
|
const auto app_version = Emu.GetAppVersion();
|
||||||
|
|
||||||
// Only one patch per patch group is allowed
|
|
||||||
std::set<std::string> applied_groups;
|
|
||||||
|
|
||||||
// Apply modifications sequentially
|
// Apply modifications sequentially
|
||||||
for (const auto& [description, patch] : container.patch_info_map)
|
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 (!patch.patch_group.empty())
|
||||||
{
|
{
|
||||||
if (applied_groups.contains(patch.patch_group))
|
if (m_applied_groups.contains(patch.patch_group))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
applied_groups.insert(patch.patch_group);
|
m_applied_groups.insert(patch.patch_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t applied = 0;
|
size_t applied = 0;
|
||||||
|
|
|
@ -119,10 +119,10 @@ public:
|
||||||
void append_title_patches(const std::string& title_id);
|
void append_title_patches(const std::string& title_id);
|
||||||
|
|
||||||
// Apply patch (returns the number of entries applied)
|
// 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
|
// 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:
|
private:
|
||||||
// Load from file and append to member patches map
|
// Load from file and append to member patches map
|
||||||
|
@ -130,8 +130,11 @@ private:
|
||||||
|
|
||||||
// Internal: Apply patch (returns the number of entries applied)
|
// Internal: Apply patch (returns the number of entries applied)
|
||||||
template <bool check_local_storage>
|
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
|
// Database
|
||||||
patch_map m_map;
|
patch_map m_map;
|
||||||
|
|
||||||
|
// Only one patch per patch group can be applied
|
||||||
|
std::set<std::string> m_applied_groups;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue