From 6992f76acf49ca991a9738722a962820bee08489 Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Tue, 20 Nov 2018 22:38:47 -0500 Subject: [PATCH] Memory: create MemorySystem class --- src/core/core.cpp | 10 ++++++++++ src/core/core.h | 13 +++++++++++++ src/core/memory.h | 4 ++++ 3 files changed, 27 insertions(+) diff --git a/src/core/core.cpp b/src/core/core.cpp index 295a2d7a8..6d8265db8 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -172,6 +172,8 @@ void System::Reschedule() { System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) { LOG_DEBUG(HW_Memory, "initialized OK"); + memory = std::make_unique(); + timing = std::make_unique(); kernel = std::make_unique(system_mode); @@ -250,6 +252,14 @@ const Timing& System::CoreTiming() const { return *timing; } +Memory::MemorySystem& System::Memory() { + return *memory; +} + +const Memory::MemorySystem& System::Memory() const { + return *memory; +} + Cheats::CheatEngine& System::CheatEngine() { return *cheat_engine; } diff --git a/src/core/core.h b/src/core/core.h index e3b58b620..aba5a2faa 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -16,6 +16,10 @@ class EmuWindow; class ARM_Interface; +namespace Memory { +class MemorySystem; +} + namespace AudioCore { class DspInterface; } @@ -188,6 +192,12 @@ public: /// Gets a const reference to the timing system const Timing& CoreTiming() const; + /// Gets a reference to the memory system + Memory::MemorySystem& Memory(); + + /// Gets a const reference to the memory system + const Memory::MemorySystem& Memory() const; + /// Gets a reference to the cheat engine Cheats::CheatEngine& CheatEngine(); @@ -236,6 +246,9 @@ private: /// AppLoader used to load the current executing application std::unique_ptr app_loader; + /// Memory system + std::unique_ptr memory; + /// ARM11 CPU core std::unique_ptr cpu_core; diff --git a/src/core/memory.h b/src/core/memory.h index dcefb369e..d5c669a26 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -254,4 +254,8 @@ void RasterizerFlushVirtualRegion(VAddr start, u32 size, FlushMode mode); /// Gets offset in FCRAM from a pointer inside FCRAM range u32 GetFCRAMOffset(u8* pointer); +class MemorySystem { + +}; + } // namespace Memory