mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Core: add helper function to apply a memory patch and mark the 'PPCPatches' as final
This commit is contained in:
parent
ce92350140
commit
4743d74985
@ -42,6 +42,7 @@ public:
|
|||||||
bool HasEnabledPatch(u32 address) const;
|
bool HasEnabledPatch(u32 address) const;
|
||||||
void RemovePatch(std::size_t index);
|
void RemovePatch(std::size_t index);
|
||||||
void ClearPatches();
|
void ClearPatches();
|
||||||
|
virtual void ApplyExistingPatch(std::size_t index) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Patch(std::size_t index) = 0;
|
virtual void Patch(std::size_t index) = 0;
|
||||||
|
@ -50,6 +50,7 @@ public:
|
|||||||
virtual bool HasEnabledPatch(u32 address) const = 0;
|
virtual bool HasEnabledPatch(u32 address) const = 0;
|
||||||
virtual void RemovePatch(std::size_t index) = 0;
|
virtual void RemovePatch(std::size_t index) = 0;
|
||||||
virtual void ClearPatches() = 0;
|
virtual void ClearPatches() = 0;
|
||||||
|
virtual void ApplyExistingPatch(std::size_t index) = 0;
|
||||||
|
|
||||||
// Threads
|
// Threads
|
||||||
virtual Debug::Threads GetThreads() const = 0;
|
virtual Debug::Threads GetThreads() const = 0;
|
||||||
|
@ -23,9 +23,8 @@
|
|||||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
|
||||||
void PPCPatches::Patch(std::size_t index)
|
void ApplyMemoryPatch(Common::Debug::MemoryPatch& patch)
|
||||||
{
|
{
|
||||||
auto& patch = m_patches[index];
|
|
||||||
if (patch.value.empty())
|
if (patch.value.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -50,6 +49,18 @@ void PPCPatches::Patch(std::size_t index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PPCPatches::ApplyExistingPatch(std::size_t index)
|
||||||
|
{
|
||||||
|
auto& patch = m_patches[index];
|
||||||
|
ApplyMemoryPatch(patch);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PPCPatches::Patch(std::size_t index)
|
||||||
|
{
|
||||||
|
auto& patch = m_patches[index];
|
||||||
|
ApplyMemoryPatch(patch);
|
||||||
|
}
|
||||||
|
|
||||||
PPCDebugInterface::PPCDebugInterface() = default;
|
PPCDebugInterface::PPCDebugInterface() = default;
|
||||||
PPCDebugInterface::~PPCDebugInterface() = default;
|
PPCDebugInterface::~PPCDebugInterface() = default;
|
||||||
|
|
||||||
@ -168,6 +179,11 @@ void PPCDebugInterface::ClearPatches()
|
|||||||
m_patches.ClearPatches();
|
m_patches.ClearPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PPCDebugInterface::ApplyExistingPatch(std::size_t index)
|
||||||
|
{
|
||||||
|
m_patches.ApplyExistingPatch(index);
|
||||||
|
}
|
||||||
|
|
||||||
Common::Debug::Threads PPCDebugInterface::GetThreads() const
|
Common::Debug::Threads PPCDebugInterface::GetThreads() const
|
||||||
{
|
{
|
||||||
Common::Debug::Threads threads;
|
Common::Debug::Threads threads;
|
||||||
|
@ -12,8 +12,13 @@
|
|||||||
#include "Common/DebugInterface.h"
|
#include "Common/DebugInterface.h"
|
||||||
#include "Core/NetworkCaptureLogger.h"
|
#include "Core/NetworkCaptureLogger.h"
|
||||||
|
|
||||||
class PPCPatches : public Common::Debug::MemoryPatches
|
void ApplyMemoryPatch(Common::Debug::MemoryPatch& patch);
|
||||||
|
|
||||||
|
class PPCPatches final : public Common::Debug::MemoryPatches
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
void ApplyExistingPatch(std::size_t index) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Patch(std::size_t index) override;
|
void Patch(std::size_t index) override;
|
||||||
};
|
};
|
||||||
@ -52,6 +57,7 @@ public:
|
|||||||
bool HasEnabledPatch(u32 address) const override;
|
bool HasEnabledPatch(u32 address) const override;
|
||||||
void RemovePatch(std::size_t index) override;
|
void RemovePatch(std::size_t index) override;
|
||||||
void ClearPatches() override;
|
void ClearPatches() override;
|
||||||
|
void ApplyExistingPatch(std::size_t index) override;
|
||||||
|
|
||||||
// Threads
|
// Threads
|
||||||
Common::Debug::Threads GetThreads() const override;
|
Common::Debug::Threads GetThreads() const override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user