summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Debug/MemoryPatches.cpp
diff options
context:
space:
mode:
authorJoshuaMK <60854312+JoshuaMKW@users.noreply.github.com>2022-10-23 18:44:12 -0500
committerJoshuaMK <60854312+JoshuaMKW@users.noreply.github.com>2022-10-26 22:46:49 -0500
commite2f4400f4941def98af3e2b30696f531baada7a7 (patch)
tree6035c82e6be71481058d7aa07b9a0dab83fd3202 /Source/Core/Common/Debug/MemoryPatches.cpp
parent2594447c2589a2575d71129291151fb99b9a1f3f (diff)
Make SetPatch responsible for overwriting old patches
Diffstat (limited to 'Source/Core/Common/Debug/MemoryPatches.cpp')
-rw-r--r--Source/Core/Common/Debug/MemoryPatches.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/Core/Common/Debug/MemoryPatches.cpp b/Source/Core/Common/Debug/MemoryPatches.cpp
index 43ed9efd49..8dd9b5716d 100644
--- a/Source/Core/Common/Debug/MemoryPatches.cpp
+++ b/Source/Core/Common/Debug/MemoryPatches.cpp
@@ -32,6 +32,7 @@ void MemoryPatches::SetPatch(u32 address, u32 value)
void MemoryPatches::SetPatch(u32 address, std::vector<u8> value)
{
+ UnsetPatch(address);
const std::size_t index = m_patches.size();
m_patches.emplace_back(address, std::move(value));
Patch(index);
@@ -45,7 +46,7 @@ const std::vector<MemoryPatch>& MemoryPatches::GetPatches() const
void MemoryPatches::UnsetPatch(u32 address)
{
const auto it = std::find_if(m_patches.begin(), m_patches.end(),
- [address](const auto& patch) { return patch.address == address; });
+ [address](const auto& patch) { return patch.address == address; });
if (it == m_patches.end())
return;