Added better syncing of timing between Interpreter and recompiler
This commit is contained in:
parent
86397d912c
commit
cb46a4cc6b
|
@ -281,4 +281,56 @@ void CSystemTimer::LoadData ( void * file )
|
|||
unzReadCurrentFile(file,(void *)&m_LastUpdate,sizeof(m_LastUpdate));
|
||||
unzReadCurrentFile(file,&m_NextTimer,sizeof(m_NextTimer));
|
||||
unzReadCurrentFile(file,(void *)&m_Current,sizeof(m_Current));
|
||||
}
|
||||
}
|
||||
|
||||
void CSystemTimer::RecordDifference( CLog &LogFile, const CSystemTimer& rSystemTimer)
|
||||
{
|
||||
if (m_LastUpdate != rSystemTimer.m_LastUpdate)
|
||||
{
|
||||
LogFile.LogF("Timer-LastUpdate: %X %X\r\n",m_LastUpdate,rSystemTimer.m_LastUpdate);
|
||||
}
|
||||
if (m_NextTimer != rSystemTimer.m_NextTimer)
|
||||
{
|
||||
LogFile.LogF("Timer-NextTimer: %X %X\r\n",m_NextTimer,rSystemTimer.m_NextTimer);
|
||||
}
|
||||
if (m_Current != rSystemTimer.m_Current)
|
||||
{
|
||||
LogFile.LogF("Timer-Current %X %X\r\n",m_Current,rSystemTimer.m_Current);
|
||||
}
|
||||
if (m_inFixTimer != rSystemTimer.m_inFixTimer)
|
||||
{
|
||||
LogFile.LogF("Timer-inFixTimer %X %X\r\n",(int)m_inFixTimer,(int)rSystemTimer.m_inFixTimer);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MaxTimer; i++)
|
||||
{
|
||||
if (m_TimerDetatils[i].Active != rSystemTimer.m_TimerDetatils[i].Active)
|
||||
{
|
||||
LogFile.LogF("Timer-m_TimerDetatils[%d] %X %X\r\n",i,(int)m_TimerDetatils[i].Active,(int)rSystemTimer.m_TimerDetatils[i].Active);
|
||||
}
|
||||
if (m_TimerDetatils[i].CyclesToTimer != rSystemTimer.m_TimerDetatils[i].CyclesToTimer)
|
||||
{
|
||||
LogFile.LogF("Timer-m_TimerDetatils[%d] 0x%08X, 0x%08X\r\n",i,(DWORD)m_TimerDetatils[i].CyclesToTimer,(DWORD)rSystemTimer.m_TimerDetatils[i].CyclesToTimer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CSystemTimer::operator == (const CSystemTimer& rSystemTimer) const
|
||||
{
|
||||
if (m_LastUpdate != rSystemTimer.m_LastUpdate) { return false; }
|
||||
if (m_NextTimer != rSystemTimer.m_NextTimer) { return false; }
|
||||
if (m_Current != rSystemTimer.m_Current) { return false; }
|
||||
if (m_inFixTimer != rSystemTimer.m_inFixTimer) { return false; }
|
||||
|
||||
for (int i = 0; i < MaxTimer; i++)
|
||||
{
|
||||
if (m_TimerDetatils[i].Active != rSystemTimer.m_TimerDetatils[i].Active) { return false; }
|
||||
if (m_TimerDetatils[i].CyclesToTimer != rSystemTimer.m_TimerDetatils[i].CyclesToTimer) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSystemTimer::operator != (const CSystemTimer& rSystemTimer) const
|
||||
{
|
||||
return !(*this == rSystemTimer);
|
||||
}
|
||||
|
|
|
@ -38,8 +38,13 @@ public:
|
|||
void SaveData ( void * file ) const;
|
||||
void LoadData ( void * file );
|
||||
|
||||
void RecordDifference( CLog &LogFile, const CSystemTimer& rSystemTimer);
|
||||
|
||||
inline TimerType CurrentType ( void ) const { return m_Current; }
|
||||
|
||||
bool operator == (const CSystemTimer& rSystemTimer) const;
|
||||
bool operator != (const CSystemTimer& rSystemTimer) const;
|
||||
|
||||
private:
|
||||
TIMER_DETAILS m_TimerDetatils[MaxTimer];
|
||||
int m_LastUpdate; //Timer at last update
|
||||
|
|
|
@ -933,8 +933,8 @@ void CN64System::SyncCPU (CN64System * const SecondCPU) {
|
|||
}
|
||||
}
|
||||
|
||||
if (m_SystemTimer.CurrentType() != SecondCPU->m_SystemTimer.CurrentType()) { ErrorFound = true; }
|
||||
if (m_NextTimer != SecondCPU->m_NextTimer) { ErrorFound = true; }
|
||||
if (m_SystemTimer != SecondCPU->m_SystemTimer) { ErrorFound = true; }
|
||||
if (m_NextTimer != SecondCPU->m_NextTimer) { ErrorFound = true; }
|
||||
if (m_Reg.m_RoundingModel != SecondCPU->m_Reg.m_RoundingModel) { ErrorFound = true; }
|
||||
|
||||
if (ErrorFound) { DumpSyncErrors(SecondCPU); }
|
||||
|
@ -1016,10 +1016,7 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU) {
|
|||
{
|
||||
Error.LogF("Current Time: %X %X\r\n",(DWORD)m_NextTimer,(DWORD)SecondCPU->m_NextTimer);
|
||||
}
|
||||
if (m_SystemTimer.CurrentType() != SecondCPU->m_SystemTimer.CurrentType())
|
||||
{
|
||||
Error.LogF("Current Time Type: %X %X\r\n",m_SystemTimer.CurrentType(),SecondCPU->m_SystemTimer.CurrentType());
|
||||
}
|
||||
m_SystemTimer.RecordDifference(Error,SecondCPU->m_SystemTimer);
|
||||
if (m_Reg.m_RoundingModel != SecondCPU->m_Reg.m_RoundingModel)
|
||||
{
|
||||
Error.LogF("RoundingModel: %X %X\r\n",m_Reg.m_RoundingModel,SecondCPU->m_Reg.m_RoundingModel);
|
||||
|
|
Loading…
Reference in New Issue