From fbc9bf23422377153c0c68fc3e958a89e98ff8da Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Tue, 29 Mar 2022 01:16:41 -0500 Subject: [PATCH] Combine InitMMIO and InitMMIOWii --- Source/Core/Core/HW/Memmap.cpp | 52 ++++++++++++++-------------------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp index ed0fc3a2d4..8a2d4897e3 100644 --- a/Source/Core/Core/HW/Memmap.cpp +++ b/Source/Core/Core/HW/Memmap.cpp @@ -127,35 +127,28 @@ u32 GetExRamMask() // MMIO mapping object. std::unique_ptr mmio_mapping; -static std::unique_ptr InitMMIO() +static void InitMMIO(bool is_wii) { - auto mmio = std::make_unique(); + mmio_mapping = std::make_unique(); - CommandProcessor::RegisterMMIO(mmio.get(), 0x0C000000); - PixelEngine::RegisterMMIO(mmio.get(), 0x0C001000); - VideoInterface::RegisterMMIO(mmio.get(), 0x0C002000); - ProcessorInterface::RegisterMMIO(mmio.get(), 0x0C003000); - MemoryInterface::RegisterMMIO(mmio.get(), 0x0C004000); - DSP::RegisterMMIO(mmio.get(), 0x0C005000); - DVDInterface::RegisterMMIO(mmio.get(), 0x0C006000); - SerialInterface::RegisterMMIO(mmio.get(), 0x0C006400); - ExpansionInterface::RegisterMMIO(mmio.get(), 0x0C006800); - AudioInterface::RegisterMMIO(mmio.get(), 0x0C006C00); - - return mmio; -} - -static std::unique_ptr InitMMIOWii() -{ - auto mmio = InitMMIO(); - - IOS::RegisterMMIO(mmio.get(), 0x0D000000); - DVDInterface::RegisterMMIO(mmio.get(), 0x0D006000); - SerialInterface::RegisterMMIO(mmio.get(), 0x0D006400); - ExpansionInterface::RegisterMMIO(mmio.get(), 0x0D006800); - AudioInterface::RegisterMMIO(mmio.get(), 0x0D006C00); - - return mmio; + CommandProcessor::RegisterMMIO(mmio_mapping.get(), 0x0C000000); + PixelEngine::RegisterMMIO(mmio_mapping.get(), 0x0C001000); + VideoInterface::RegisterMMIO(mmio_mapping.get(), 0x0C002000); + ProcessorInterface::RegisterMMIO(mmio_mapping.get(), 0x0C003000); + MemoryInterface::RegisterMMIO(mmio_mapping.get(), 0x0C004000); + DSP::RegisterMMIO(mmio_mapping.get(), 0x0C005000); + DVDInterface::RegisterMMIO(mmio_mapping.get(), 0x0C006000); + SerialInterface::RegisterMMIO(mmio_mapping.get(), 0x0C006400); + ExpansionInterface::RegisterMMIO(mmio_mapping.get(), 0x0C006800); + AudioInterface::RegisterMMIO(mmio_mapping.get(), 0x0C006C00); + if (is_wii) + { + IOS::RegisterMMIO(mmio_mapping.get(), 0x0D000000); + DVDInterface::RegisterMMIO(mmio_mapping.get(), 0x0D006000); + SerialInterface::RegisterMMIO(mmio_mapping.get(), 0x0D006400); + ExpansionInterface::RegisterMMIO(mmio_mapping.get(), 0x0D006800); + AudioInterface::RegisterMMIO(mmio_mapping.get(), 0x0D006C00); + } } bool IsInitialized() @@ -302,10 +295,7 @@ void Init() } } - if (wii) - mmio_mapping = InitMMIOWii(); - else - mmio_mapping = InitMMIO(); + InitMMIO(wii); Clear();