FifoPlayer: Reload initial state when looping back to first frame

This should ensure that when playing with loop enabled, the first frame is
in the same state each time. There is potentially still issues when the
start frame is set to something other than zero, but I'm not sure how we
could work around this without capturing the entire state on each frame.
This commit is contained in:
Stenzek 2017-01-03 17:10:22 +10:00
parent cbb0f78dd1
commit 5b315b7bb4
2 changed files with 11 additions and 2 deletions

View File

@ -122,7 +122,12 @@ int FifoPlayer::AdvanceFrame()
if (m_FrameRangeStart >= m_FrameRangeEnd)
return CPU::CPU_STEPPING;
// When looping, reload the contents of all the BP/CP/CF registers.
// This ensures that each time the first frame is played back, the state of the
// GPU is the same for each playback loop.
m_CurrentFrame = m_FrameRangeStart;
LoadRegisters();
FlushWGP();
}
if (m_FrameWrittenCb)
@ -414,7 +419,12 @@ void FifoPlayer::LoadMemory()
PowerPC::IBATUpdated();
SetupFifo();
LoadRegisters();
FlushWGP();
}
void FifoPlayer::LoadRegisters()
{
const u32* regs = m_File->GetBPMem();
for (int i = 0; i < FifoDataFile::BP_MEM_SIZE; ++i)
{
@ -448,8 +458,6 @@ void FifoPlayer::LoadMemory()
regs = m_File->GetXFRegs();
for (int i = 0; i < FifoDataFile::XF_REGS_SIZE; ++i)
LoadXFReg(i, regs[i]);
FlushWGP();
}
void FifoPlayer::WriteCP(u32 address, u16 value)

View File

@ -110,6 +110,7 @@ private:
void SetupFifo();
void LoadMemory();
void LoadRegisters();
void WriteCP(u32 address, u16 value);
void WritePI(u32 address, u32 value);