mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 00:59:44 -06:00
HW/GPFifo: Refactor to class, move to Core::System.
This commit is contained in:
@ -511,7 +511,9 @@ void FifoPlayer::WriteFifo(const u8* data, u32 start, u32 end)
|
||||
u32 written = start;
|
||||
u32 lastBurstEnd = end - 1;
|
||||
|
||||
auto& core_timing = Core::System::GetInstance().GetCoreTiming();
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& core_timing = system.GetCoreTiming();
|
||||
auto& gpfifo = system.GetGPFifo();
|
||||
|
||||
// Write up to 256 bytes at a time
|
||||
while (written < end)
|
||||
@ -530,7 +532,7 @@ void FifoPlayer::WriteFifo(const u8* data, u32 start, u32 end)
|
||||
PowerPC::ppcState.gather_pipe_ptr += burstEnd - written;
|
||||
written = burstEnd;
|
||||
|
||||
GPFifo::Write8(data[written++]);
|
||||
gpfifo.Write8(data[written++]);
|
||||
|
||||
// Advance core timing
|
||||
u32 elapsedCycles = u32(((u64)written * m_CyclesPerFrame) / m_FrameFifoSize);
|
||||
@ -706,13 +708,16 @@ void FifoPlayer::WritePI(u32 address, u32 value)
|
||||
|
||||
void FifoPlayer::FlushWGP()
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& gpfifo = system.GetGPFifo();
|
||||
|
||||
// Send 31 0s through the WGP
|
||||
for (int i = 0; i < 7; ++i)
|
||||
GPFifo::Write32(0);
|
||||
GPFifo::Write16(0);
|
||||
GPFifo::Write8(0);
|
||||
gpfifo.Write32(0);
|
||||
gpfifo.Write16(0);
|
||||
gpfifo.Write8(0);
|
||||
|
||||
GPFifo::ResetGatherPipe();
|
||||
gpfifo.ResetGatherPipe();
|
||||
}
|
||||
|
||||
void FifoPlayer::WaitForGPUInactive()
|
||||
@ -729,34 +734,46 @@ void FifoPlayer::WaitForGPUInactive()
|
||||
|
||||
void FifoPlayer::LoadBPReg(u8 reg, u32 value)
|
||||
{
|
||||
GPFifo::Write8(0x61); // load BP reg
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& gpfifo = system.GetGPFifo();
|
||||
|
||||
gpfifo.Write8(0x61); // load BP reg
|
||||
|
||||
u32 cmd = (reg << 24) & 0xff000000;
|
||||
cmd |= (value & 0x00ffffff);
|
||||
GPFifo::Write32(cmd);
|
||||
gpfifo.Write32(cmd);
|
||||
}
|
||||
|
||||
void FifoPlayer::LoadCPReg(u8 reg, u32 value)
|
||||
{
|
||||
GPFifo::Write8(0x08); // load CP reg
|
||||
GPFifo::Write8(reg);
|
||||
GPFifo::Write32(value);
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& gpfifo = system.GetGPFifo();
|
||||
|
||||
gpfifo.Write8(0x08); // load CP reg
|
||||
gpfifo.Write8(reg);
|
||||
gpfifo.Write32(value);
|
||||
}
|
||||
|
||||
void FifoPlayer::LoadXFReg(u16 reg, u32 value)
|
||||
{
|
||||
GPFifo::Write8(0x10); // load XF reg
|
||||
GPFifo::Write32((reg & 0x0fff) | 0x1000); // load 4 bytes into reg
|
||||
GPFifo::Write32(value);
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& gpfifo = system.GetGPFifo();
|
||||
|
||||
gpfifo.Write8(0x10); // load XF reg
|
||||
gpfifo.Write32((reg & 0x0fff) | 0x1000); // load 4 bytes into reg
|
||||
gpfifo.Write32(value);
|
||||
}
|
||||
|
||||
void FifoPlayer::LoadXFMem16(u16 address, const u32* data)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& gpfifo = system.GetGPFifo();
|
||||
|
||||
// Loads 16 * 4 bytes in xf memory starting at address
|
||||
GPFifo::Write8(0x10); // load XF reg
|
||||
GPFifo::Write32(0x000f0000 | (address & 0xffff)); // load 16 * 4 bytes into address
|
||||
gpfifo.Write8(0x10); // load XF reg
|
||||
gpfifo.Write32(0x000f0000 | (address & 0xffff)); // load 16 * 4 bytes into address
|
||||
for (int i = 0; i < 16; ++i)
|
||||
GPFifo::Write32(data[i]);
|
||||
gpfifo.Write32(data[i]);
|
||||
}
|
||||
|
||||
bool FifoPlayer::ShouldLoadBP(u8 address)
|
||||
|
Reference in New Issue
Block a user