diff options
author | Zach Hilman <zachhilman@gmail.com> | 2019-05-30 14:52:20 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2019-06-21 01:22:04 +0200 |
commit | 1b7d619914c8d132dbffb8b6a5bb3a1aab686f9d (patch) | |
tree | 2ced924df90e1a8c0cbd41ef251733a84b48301e /src/core/memory/freezer.h | |
parent | Merge pull request #2596 from FernandoS27/revert-2590 (diff) | |
download | yuzu-1b7d619914c8d132dbffb8b6a5bb3a1aab686f9d.tar yuzu-1b7d619914c8d132dbffb8b6a5bb3a1aab686f9d.tar.gz yuzu-1b7d619914c8d132dbffb8b6a5bb3a1aab686f9d.tar.bz2 yuzu-1b7d619914c8d132dbffb8b6a5bb3a1aab686f9d.tar.lz yuzu-1b7d619914c8d132dbffb8b6a5bb3a1aab686f9d.tar.xz yuzu-1b7d619914c8d132dbffb8b6a5bb3a1aab686f9d.tar.zst yuzu-1b7d619914c8d132dbffb8b6a5bb3a1aab686f9d.zip |
Diffstat (limited to 'src/core/memory/freezer.h')
-rw-r--r-- | src/core/memory/freezer.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/core/memory/freezer.h b/src/core/memory/freezer.h new file mode 100644 index 000000000..3e271793e --- /dev/null +++ b/src/core/memory/freezer.h @@ -0,0 +1,58 @@ +// Copyright 2019 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <optional> +#include <vector> +#include "common/common_types.h" +#include "core/core_timing.h" + +namespace Core { +class System; +} // namespace Core + +namespace Memory { + +// A class that will effectively freeze memory values. +class Freezer { +public: + struct Entry { + VAddr address; + u8 width; + u64 value; + }; + + Freezer(Core::Timing::CoreTiming& core_timing); + ~Freezer(); + + void SetActive(bool active); + bool IsActive() const; + + void Clear(); + + u64 Freeze(VAddr address, u8 width); + void Unfreeze(VAddr address); + + bool IsFrozen(VAddr address); + void SetFrozenValue(VAddr address, u64 value); + + std::optional<Entry> GetEntry(VAddr address); + + std::vector<Entry> GetEntries(); + +private: + void FrameCallback(u64 userdata, s64 cycles_late); + void FillEntryReads(); + + std::atomic_bool active{false}; + + std::recursive_mutex entries_mutex; + std::vector<Entry> entries; + + Core::Timing::EventType* event; + Core::Timing::CoreTiming& core_timing; +}; + +} // namespace Memory |