summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Debug/MemoryPatches.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2023-01-09 18:41:28 +0100
committerGitHub <noreply@github.com>2023-01-09 18:41:28 +0100
commit653e0ccf280768e8474952767ee4da06b7e9b607 (patch)
tree1a73b75401b7d663306159314d1bdf023736e094 /Source/Core/Common/Debug/MemoryPatches.cpp
parent21c29bad6bcb7b3750818e0a3417b96def28c4f0 (diff)
parent993d2ab173f0e262465b4420e5746bb55a2c9ff1 (diff)
Merge pull request #11365 from iwubcode/cheat_manager_freeze_value
DolphinQt: add ability to lock / freeze values in the watches window
Diffstat (limited to 'Source/Core/Common/Debug/MemoryPatches.cpp')
-rw-r--r--Source/Core/Common/Debug/MemoryPatches.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/Core/Common/Debug/MemoryPatches.cpp b/Source/Core/Common/Debug/MemoryPatches.cpp
index 8dd9b5716d..f48e6e5bb5 100644
--- a/Source/Core/Common/Debug/MemoryPatches.cpp
+++ b/Source/Core/Common/Debug/MemoryPatches.cpp
@@ -38,6 +38,23 @@ void MemoryPatches::SetPatch(u32 address, std::vector<u8> value)
Patch(index);
}
+void MemoryPatches::SetFramePatch(u32 address, u32 value)
+{
+ const std::size_t index = m_patches.size();
+ m_patches.emplace_back(address, value);
+ m_patches.back().type = MemoryPatch::ApplyType::EachFrame;
+ Patch(index);
+}
+
+void MemoryPatches::SetFramePatch(u32 address, std::vector<u8> value)
+{
+ UnsetPatch(address);
+ const std::size_t index = m_patches.size();
+ m_patches.emplace_back(address, std::move(value));
+ m_patches.back().type = MemoryPatch::ApplyType::EachFrame;
+ Patch(index);
+}
+
const std::vector<MemoryPatch>& MemoryPatches::GetPatches() const
{
return m_patches;
@@ -81,6 +98,7 @@ bool MemoryPatches::HasEnabledPatch(u32 address) const
void MemoryPatches::RemovePatch(std::size_t index)
{
DisablePatch(index);
+ UnPatch(index);
m_patches.erase(m_patches.begin() + index);
}
@@ -88,7 +106,10 @@ void MemoryPatches::ClearPatches()
{
const std::size_t size = m_patches.size();
for (std::size_t index = 0; index < size; ++index)
+ {
DisablePatch(index);
+ UnPatch(index);
+ }
m_patches.clear();
}
} // namespace Common::Debug