diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index faae0e704d..1e1f9d993b 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -592,7 +592,7 @@ bool CBoot::EmulatedBS2_Wii(Core::System& system, const Core::CPUThreadGuard& gu return false; // The Apploader probably just overwrote values needed for RAM Override. Run this again! - IOS::HLE::RAMOverrideForIOSMemoryValues(IOS::HLE::MemorySetupType::IOSReload); + IOS::HLE::RAMOverrideForIOSMemoryValues(memory, IOS::HLE::MemorySetupType::IOSReload); // Warning: This call will set incorrect running game metadata if our volume parameter // doesn't point to the same disc as the one that's inserted in the emulated disc drive! diff --git a/Source/Core/Core/IOS/IOS.cpp b/Source/Core/Core/IOS/IOS.cpp index 67aa1037c6..d1f6b9d661 100644 --- a/Source/Core/Core/IOS/IOS.cpp +++ b/Source/Core/Core/IOS/IOS.cpp @@ -140,8 +140,7 @@ static bool SetupMemory(Memory::MemoryManager& memory, u64 ios_title_id, MemoryS memory.Write_U32(target_imv->ios_reserved_begin, ADDR_IOS_RESERVED_BEGIN); memory.Write_U32(target_imv->ios_reserved_end, ADDR_IOS_RESERVED_END); - RAMOverrideForIOSMemoryValues(setup_type); - + RAMOverrideForIOSMemoryValues(memory, setup_type); return true; } @@ -184,8 +183,7 @@ static bool SetupMemory(Memory::MemoryManager& memory, u64 ios_title_id, MemoryS memory.Write_U32(target_imv->mem1_arena_end, ADDR_LEGACY_ARENA_HIGH); memory.Write_U32(target_imv->mem1_simulated_size, ADDR_LEGACY_MEM_SIM_SIZE); - RAMOverrideForIOSMemoryValues(setup_type); - + RAMOverrideForIOSMemoryValues(memory, setup_type); return true; } @@ -225,15 +223,12 @@ static void ReleasePPCAncast(Core::System& system) system.GetPPCState().pc = ESPRESSO_ANCAST_LOCATION_VIRT + sizeof(EspressoAncastHeader); } -void RAMOverrideForIOSMemoryValues(MemorySetupType setup_type) +void RAMOverrideForIOSMemoryValues(Memory::MemoryManager& memory, MemorySetupType setup_type) { // Don't touch anything if the feature isn't enabled. if (!Config::Get(Config::MAIN_RAM_OVERRIDE_ENABLE)) return; - auto& system = Core::System::GetInstance(); - auto& memory = system.GetMemory(); - // Some unstated constants that can be inferred. const u32 ipc_buffer_size = memory.Read_U32(ADDR_IPC_BUFFER_END) - memory.Read_U32(ADDR_IPC_BUFFER_BEGIN); diff --git a/Source/Core/Core/IOS/IOS.h b/Source/Core/Core/IOS/IOS.h index e3ebbfb99e..04da1459cb 100644 --- a/Source/Core/Core/IOS/IOS.h +++ b/Source/Core/Core/IOS/IOS.h @@ -23,6 +23,10 @@ namespace Core { class System; } +namespace Memory +{ +class MemoryManager; +} namespace IOS::HLE { @@ -109,7 +113,7 @@ enum class HangPPC : bool Yes = true, }; -void RAMOverrideForIOSMemoryValues(MemorySetupType setup_type); +void RAMOverrideForIOSMemoryValues(Memory::MemoryManager& memory, MemorySetupType setup_type); void WriteReturnValue(s32 value, u32 address);