mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
Core: add ability to add memory patches to the patch engine that will be executed each frame
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/OSThread.h"
|
||||
#include "Core/HW/DSP.h"
|
||||
#include "Core/PatchEngine.h"
|
||||
#include "Core/PowerPC/MMU.h"
|
||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
@ -58,7 +59,19 @@ void PPCPatches::ApplyExistingPatch(std::size_t index)
|
||||
void PPCPatches::Patch(std::size_t index)
|
||||
{
|
||||
auto& patch = m_patches[index];
|
||||
ApplyMemoryPatch(patch);
|
||||
if (patch.type == Common::Debug::MemoryPatch::ApplyType::Once)
|
||||
ApplyMemoryPatch(patch);
|
||||
else
|
||||
PatchEngine::AddMemoryPatch(index);
|
||||
}
|
||||
|
||||
void PPCPatches::UnPatch(std::size_t index)
|
||||
{
|
||||
auto& patch = m_patches[index];
|
||||
if (patch.type == Common::Debug::MemoryPatch::ApplyType::Once)
|
||||
return;
|
||||
|
||||
PatchEngine::RemoveMemoryPatch(index);
|
||||
}
|
||||
|
||||
PPCDebugInterface::PPCDebugInterface() = default;
|
||||
@ -144,6 +157,16 @@ void PPCDebugInterface::SetPatch(u32 address, std::vector<u8> value)
|
||||
m_patches.SetPatch(address, std::move(value));
|
||||
}
|
||||
|
||||
void PPCDebugInterface::SetFramePatch(u32 address, u32 value)
|
||||
{
|
||||
m_patches.SetFramePatch(address, value);
|
||||
}
|
||||
|
||||
void PPCDebugInterface::SetFramePatch(u32 address, std::vector<u8> value)
|
||||
{
|
||||
m_patches.SetFramePatch(address, std::move(value));
|
||||
}
|
||||
|
||||
const std::vector<Common::Debug::MemoryPatch>& PPCDebugInterface::GetPatches() const
|
||||
{
|
||||
return m_patches.GetPatches();
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
|
||||
private:
|
||||
void Patch(std::size_t index) override;
|
||||
void UnPatch(std::size_t index) override;
|
||||
};
|
||||
|
||||
// wrapper between disasm control and Dolphin debugger
|
||||
@ -50,6 +51,8 @@ public:
|
||||
// Memory Patches
|
||||
void SetPatch(u32 address, u32 value) override;
|
||||
void SetPatch(u32 address, std::vector<u8> value) override;
|
||||
void SetFramePatch(u32 address, u32 value) override;
|
||||
void SetFramePatch(u32 address, std::vector<u8> value) override;
|
||||
const std::vector<Common::Debug::MemoryPatch>& GetPatches() const override;
|
||||
void UnsetPatch(u32 address) override;
|
||||
void EnablePatch(std::size_t index) override;
|
||||
|
Reference in New Issue
Block a user