diff options
Diffstat (limited to 'src/core/tools/freezer.cpp')
| -rw-r--r-- | src/core/tools/freezer.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/tools/freezer.cpp b/src/core/tools/freezer.cpp index 19b531ecb..c7f42388f 100644 --- a/src/core/tools/freezer.cpp +++ b/src/core/tools/freezer.cpp | |||
| @@ -11,12 +11,11 @@ | |||
| 11 | #include "core/tools/freezer.h" | 11 | #include "core/tools/freezer.h" |
| 12 | 12 | ||
| 13 | namespace Tools { | 13 | namespace Tools { |
| 14 | |||
| 15 | namespace { | 14 | namespace { |
| 16 | 15 | ||
| 17 | constexpr s64 MEMORY_FREEZER_TICKS = static_cast<s64>(Core::Timing::BASE_CLOCK_RATE / 60); | 16 | constexpr s64 MEMORY_FREEZER_TICKS = static_cast<s64>(Core::Timing::BASE_CLOCK_RATE / 60); |
| 18 | 17 | ||
| 19 | u64 MemoryReadWidth(u32 width, VAddr addr) { | 18 | u64 MemoryReadWidth(Memory::Memory& memory, u32 width, VAddr addr) { |
| 20 | switch (width) { | 19 | switch (width) { |
| 21 | case 1: | 20 | case 1: |
| 22 | return Memory::Read8(addr); | 21 | return Memory::Read8(addr); |
| @@ -32,7 +31,7 @@ u64 MemoryReadWidth(u32 width, VAddr addr) { | |||
| 32 | } | 31 | } |
| 33 | } | 32 | } |
| 34 | 33 | ||
| 35 | void MemoryWriteWidth(u32 width, VAddr addr, u64 value) { | 34 | void MemoryWriteWidth(Memory::Memory& memory, u32 width, VAddr addr, u64 value) { |
| 36 | switch (width) { | 35 | switch (width) { |
| 37 | case 1: | 36 | case 1: |
| 38 | Memory::Write8(addr, static_cast<u8>(value)); | 37 | Memory::Write8(addr, static_cast<u8>(value)); |
| @@ -53,7 +52,8 @@ void MemoryWriteWidth(u32 width, VAddr addr, u64 value) { | |||
| 53 | 52 | ||
| 54 | } // Anonymous namespace | 53 | } // Anonymous namespace |
| 55 | 54 | ||
| 56 | Freezer::Freezer(Core::Timing::CoreTiming& core_timing) : core_timing(core_timing) { | 55 | Freezer::Freezer(Core::Timing::CoreTiming& core_timing_, Memory::Memory& memory_) |
| 56 | : core_timing{core_timing_}, memory{memory_} { | ||
| 57 | event = Core::Timing::CreateEvent( | 57 | event = Core::Timing::CreateEvent( |
| 58 | "MemoryFreezer::FrameCallback", | 58 | "MemoryFreezer::FrameCallback", |
| 59 | [this](u64 userdata, s64 cycles_late) { FrameCallback(userdata, cycles_late); }); | 59 | [this](u64 userdata, s64 cycles_late) { FrameCallback(userdata, cycles_late); }); |
| @@ -89,7 +89,7 @@ void Freezer::Clear() { | |||
| 89 | u64 Freezer::Freeze(VAddr address, u32 width) { | 89 | u64 Freezer::Freeze(VAddr address, u32 width) { |
| 90 | std::lock_guard lock{entries_mutex}; | 90 | std::lock_guard lock{entries_mutex}; |
| 91 | 91 | ||
| 92 | const auto current_value = MemoryReadWidth(width, address); | 92 | const auto current_value = MemoryReadWidth(memory, width, address); |
| 93 | entries.push_back({address, width, current_value}); | 93 | entries.push_back({address, width, current_value}); |
| 94 | 94 | ||
| 95 | LOG_DEBUG(Common_Memory, | 95 | LOG_DEBUG(Common_Memory, |
| @@ -169,7 +169,7 @@ void Freezer::FrameCallback(u64 userdata, s64 cycles_late) { | |||
| 169 | LOG_DEBUG(Common_Memory, | 169 | LOG_DEBUG(Common_Memory, |
| 170 | "Enforcing memory freeze at address={:016X}, value={:016X}, width={:02X}", | 170 | "Enforcing memory freeze at address={:016X}, value={:016X}, width={:02X}", |
| 171 | entry.address, entry.value, entry.width); | 171 | entry.address, entry.value, entry.width); |
| 172 | MemoryWriteWidth(entry.width, entry.address, entry.value); | 172 | MemoryWriteWidth(memory, entry.width, entry.address, entry.value); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | core_timing.ScheduleEvent(MEMORY_FREEZER_TICKS - cycles_late, event); | 175 | core_timing.ScheduleEvent(MEMORY_FREEZER_TICKS - cycles_late, event); |
| @@ -181,7 +181,7 @@ void Freezer::FillEntryReads() { | |||
| 181 | LOG_DEBUG(Common_Memory, "Updating memory freeze entries to current values."); | 181 | LOG_DEBUG(Common_Memory, "Updating memory freeze entries to current values."); |
| 182 | 182 | ||
| 183 | for (auto& entry : entries) { | 183 | for (auto& entry : entries) { |
| 184 | entry.value = MemoryReadWidth(entry.width, entry.address); | 184 | entry.value = MemoryReadWidth(memory, entry.width, entry.address); |
| 185 | } | 185 | } |
| 186 | } | 186 | } |
| 187 | 187 | ||