mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
DebugInterface: MemoryPatches methods added
CodeView: Restore instruction added
This commit is contained in:
52
Source/Core/Common/Debug/MemoryPatches.h
Normal file
52
Source/Core/Common/Debug/MemoryPatches.h
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace Common::Debug
|
||||
{
|
||||
struct MemoryPatch
|
||||
{
|
||||
enum class State
|
||||
{
|
||||
Enabled,
|
||||
Disabled
|
||||
};
|
||||
|
||||
u32 address;
|
||||
std::vector<u8> value;
|
||||
State is_enabled;
|
||||
|
||||
MemoryPatch(u32 address, std::vector<u8> value);
|
||||
MemoryPatch(u32 address, u32 value);
|
||||
};
|
||||
|
||||
class MemoryPatches
|
||||
{
|
||||
public:
|
||||
MemoryPatches();
|
||||
virtual ~MemoryPatches();
|
||||
|
||||
void SetPatch(u32 address, u32 value);
|
||||
void SetPatch(u32 address, std::vector<u8> value);
|
||||
const std::vector<MemoryPatch>& GetPatches() const;
|
||||
void UnsetPatch(u32 address);
|
||||
void EnablePatch(std::size_t index);
|
||||
void DisablePatch(std::size_t index);
|
||||
bool HasEnabledPatch(u32 address) const;
|
||||
void RemovePatch(std::size_t index);
|
||||
void ClearPatches();
|
||||
|
||||
protected:
|
||||
virtual void Patch(std::size_t index) = 0;
|
||||
|
||||
std::vector<MemoryPatch> m_patches;
|
||||
};
|
||||
} // namespace Common::Debug
|
Reference in New Issue
Block a user