From 1a826b27a63f6b6ddaf3b389b9fcc25b7cb5f31d Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Tue, 10 Jan 2023 05:18:34 +0100 Subject: [PATCH] FifoPlayer: Avoid ppcState global. --- Source/Core/Core/FifoPlayer/FifoPlayer.cpp | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp index 4a61a5b886..cacd2cb907 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp @@ -514,6 +514,7 @@ void FifoPlayer::WriteFifo(const u8* data, u32 start, u32 end) auto& system = Core::System::GetInstance(); auto& core_timing = system.GetCoreTiming(); auto& gpfifo = system.GetGPFifo(); + auto& ppc_state = system.GetPPCState(); // Write up to 256 bytes at a time while (written < end) @@ -528,8 +529,8 @@ void FifoPlayer::WriteFifo(const u8* data, u32 start, u32 end) u32 burstEnd = std::min(written + 255, lastBurstEnd); - std::copy(data + written, data + burstEnd, PowerPC::ppcState.gather_pipe_ptr); - PowerPC::ppcState.gather_pipe_ptr += burstEnd - written; + std::copy(data + written, data + burstEnd, ppc_state.gather_pipe_ptr); + ppc_state.gather_pipe_ptr += burstEnd - written; written = burstEnd; gpfifo.Write8(data[written++]); @@ -539,7 +540,7 @@ void FifoPlayer::WriteFifo(const u8* data, u32 start, u32 end) u32 cyclesUsed = elapsedCycles - m_ElapsedCycles; m_ElapsedCycles = elapsedCycles; - PowerPC::ppcState.downcount -= cyclesUsed; + ppc_state.downcount -= cyclesUsed; core_timing.Advance(); } } @@ -629,16 +630,19 @@ void FifoPlayer::ClearEfb() void FifoPlayer::LoadMemory() { + auto& system = Core::System::GetInstance(); + auto& ppc_state = system.GetPPCState(); + UReg_MSR newMSR; newMSR.DR = 1; newMSR.IR = 1; - PowerPC::ppcState.msr.Hex = newMSR.Hex; - PowerPC::ppcState.spr[SPR_IBAT0U] = 0x80001fff; - PowerPC::ppcState.spr[SPR_IBAT0L] = 0x00000002; - PowerPC::ppcState.spr[SPR_DBAT0U] = 0x80001fff; - PowerPC::ppcState.spr[SPR_DBAT0L] = 0x00000002; - PowerPC::ppcState.spr[SPR_DBAT1U] = 0xc0001fff; - PowerPC::ppcState.spr[SPR_DBAT1L] = 0x0000002a; + ppc_state.msr.Hex = newMSR.Hex; + ppc_state.spr[SPR_IBAT0U] = 0x80001fff; + ppc_state.spr[SPR_IBAT0L] = 0x00000002; + ppc_state.spr[SPR_DBAT0U] = 0x80001fff; + ppc_state.spr[SPR_DBAT0L] = 0x00000002; + ppc_state.spr[SPR_DBAT1U] = 0xc0001fff; + ppc_state.spr[SPR_DBAT1L] = 0x0000002a; PowerPC::DBATUpdated(); PowerPC::IBATUpdated();