mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
397b27e665
Given this is what occurs in both constructors (as one just passes through to another), we can just initialize the member directly. While we're at it, amend the struct to follow the general ordering convention of: <new types> <functions> <variables>
53 lines
1.0 KiB
C++
53 lines
1.0 KiB
C++
// 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
|
|
};
|
|
|
|
MemoryPatch(u32 address, std::vector<u8> value);
|
|
MemoryPatch(u32 address, u32 value);
|
|
|
|
u32 address;
|
|
std::vector<u8> value;
|
|
State is_enabled = State::Enabled;
|
|
};
|
|
|
|
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
|