HW/Memmap: Store reference to System in MemoryManager.
This commit is contained in:
parent
026b6a3e0f
commit
ba852a7812
|
@ -41,31 +41,33 @@
|
||||||
|
|
||||||
namespace Memory
|
namespace Memory
|
||||||
{
|
{
|
||||||
MemoryManager::MemoryManager() = default;
|
MemoryManager::MemoryManager(Core::System& system) : m_system(system)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
MemoryManager::~MemoryManager() = default;
|
MemoryManager::~MemoryManager() = default;
|
||||||
|
|
||||||
void MemoryManager::InitMMIO(bool is_wii)
|
void MemoryManager::InitMMIO(bool is_wii)
|
||||||
{
|
{
|
||||||
m_mmio_mapping = std::make_unique<MMIO::Mapping>();
|
m_mmio_mapping = std::make_unique<MMIO::Mapping>();
|
||||||
|
|
||||||
auto& system = Core::System::GetInstance();
|
m_system.GetCommandProcessor().RegisterMMIO(m_system, m_mmio_mapping.get(), 0x0C000000);
|
||||||
system.GetCommandProcessor().RegisterMMIO(system, m_mmio_mapping.get(), 0x0C000000);
|
m_system.GetPixelEngine().RegisterMMIO(m_mmio_mapping.get(), 0x0C001000);
|
||||||
system.GetPixelEngine().RegisterMMIO(m_mmio_mapping.get(), 0x0C001000);
|
m_system.GetVideoInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C002000);
|
||||||
system.GetVideoInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C002000);
|
m_system.GetProcessorInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C003000);
|
||||||
system.GetProcessorInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C003000);
|
m_system.GetMemoryInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C004000);
|
||||||
system.GetMemoryInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C004000);
|
m_system.GetDSP().RegisterMMIO(m_mmio_mapping.get(), 0x0C005000);
|
||||||
system.GetDSP().RegisterMMIO(m_mmio_mapping.get(), 0x0C005000);
|
m_system.GetDVDInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C006000, false);
|
||||||
system.GetDVDInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C006000, false);
|
m_system.GetSerialInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C006400);
|
||||||
system.GetSerialInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C006400);
|
m_system.GetExpansionInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C006800);
|
||||||
system.GetExpansionInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C006800);
|
m_system.GetAudioInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C006C00);
|
||||||
system.GetAudioInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0C006C00);
|
|
||||||
if (is_wii)
|
if (is_wii)
|
||||||
{
|
{
|
||||||
IOS::RegisterMMIO(m_mmio_mapping.get(), 0x0D000000);
|
IOS::RegisterMMIO(m_mmio_mapping.get(), 0x0D000000);
|
||||||
system.GetDVDInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0D006000, true);
|
m_system.GetDVDInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0D006000, true);
|
||||||
system.GetSerialInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0D006400);
|
m_system.GetSerialInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0D006400);
|
||||||
system.GetExpansionInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0D006800);
|
m_system.GetExpansionInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0D006800);
|
||||||
system.GetAudioInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0D006C00);
|
m_system.GetAudioInterface().RegisterMMIO(m_mmio_mapping.get(), 0x0D006C00);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +104,7 @@ void MemoryManager::Init()
|
||||||
&m_exram, 0x10000000, GetExRamSize(), PhysicalMemoryRegion::WII_ONLY, 0, false};
|
&m_exram, 0x10000000, GetExRamSize(), PhysicalMemoryRegion::WII_ONLY, 0, false};
|
||||||
|
|
||||||
const bool wii = SConfig::GetInstance().bWii;
|
const bool wii = SConfig::GetInstance().bWii;
|
||||||
const bool mmu = Core::System::GetInstance().IsMMUMode();
|
const bool mmu = m_system.IsMMUMode();
|
||||||
|
|
||||||
// If MMU is turned off in GameCube mode, turn on fake VMEM hack.
|
// If MMU is turned off in GameCube mode, turn on fake VMEM hack.
|
||||||
const bool fake_vmem = !wii && !mmu;
|
const bool fake_vmem = !wii && !mmu;
|
||||||
|
@ -490,7 +492,7 @@ u8* MemoryManager::GetPointer(u32 address) const
|
||||||
return m_exram + (address & GetExRamMask());
|
return m_exram + (address & GetExRamMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& ppc_state = Core::System::GetInstance().GetPPCState();
|
auto& ppc_state = m_system.GetPPCState();
|
||||||
PanicAlertFmt("Unknown Pointer {:#010x} PC {:#010x} LR {:#010x}", address, ppc_state.pc,
|
PanicAlertFmt("Unknown Pointer {:#010x} PC {:#010x} LR {:#010x}", address, ppc_state.pc,
|
||||||
LR(ppc_state));
|
LR(ppc_state));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
|
|
||||||
// Global declarations
|
// Global declarations
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
class System;
|
||||||
|
}
|
||||||
namespace MMIO
|
namespace MMIO
|
||||||
{
|
{
|
||||||
class Mapping;
|
class Mapping;
|
||||||
|
@ -54,7 +58,7 @@ struct LogicalMemoryView
|
||||||
class MemoryManager
|
class MemoryManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MemoryManager();
|
explicit MemoryManager(Core::System& system);
|
||||||
MemoryManager(const MemoryManager& other) = delete;
|
MemoryManager(const MemoryManager& other) = delete;
|
||||||
MemoryManager(MemoryManager&& other) = delete;
|
MemoryManager(MemoryManager&& other) = delete;
|
||||||
MemoryManager& operator=(const MemoryManager& other) = delete;
|
MemoryManager& operator=(const MemoryManager& other) = delete;
|
||||||
|
@ -239,6 +243,8 @@ private:
|
||||||
std::array<void*, PowerPC::BAT_PAGE_COUNT> m_physical_page_mappings{};
|
std::array<void*, PowerPC::BAT_PAGE_COUNT> m_physical_page_mappings{};
|
||||||
std::array<void*, PowerPC::BAT_PAGE_COUNT> m_logical_page_mappings{};
|
std::array<void*, PowerPC::BAT_PAGE_COUNT> m_logical_page_mappings{};
|
||||||
|
|
||||||
|
Core::System& m_system;
|
||||||
|
|
||||||
void InitMMIO(bool is_wii);
|
void InitMMIO(bool is_wii);
|
||||||
};
|
};
|
||||||
} // namespace Memory
|
} // namespace Memory
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct System::Impl
|
||||||
{
|
{
|
||||||
explicit Impl(System& system)
|
explicit Impl(System& system)
|
||||||
: m_audio_interface(system), m_core_timing(system), m_dsp(system), m_dvd_interface(system),
|
: m_audio_interface(system), m_core_timing(system), m_dsp(system), m_dvd_interface(system),
|
||||||
m_dvd_thread(system), m_expansion_interface(system), m_gp_fifo(system),
|
m_dvd_thread(system), m_expansion_interface(system), m_gp_fifo(system), m_memory(system),
|
||||||
m_ppc_state(PowerPC::ppcState), m_serial_interface(system), m_video_interface(system)
|
m_ppc_state(PowerPC::ppcState), m_serial_interface(system), m_video_interface(system)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue