CoreTiming: Trim max slicelength to the given value.

Previously it was underclocking by 50% when there were
no events to schedule.
This commit is contained in:
degasus 2016-03-06 01:42:50 +01:00 committed by Scott Mansell
parent 3df4b09a94
commit 170a7f1a06
1 changed files with 5 additions and 8 deletions

View File

@ -425,7 +425,7 @@ void Advance()
g_globalTimer += cyclesExecuted; g_globalTimer += cyclesExecuted;
s_lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f; s_lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f;
g_lastOCFactor_inverted = 1.0f / s_lastOCFactor; g_lastOCFactor_inverted = 1.0f / s_lastOCFactor;
PowerPC::ppcState.downcount = CyclesToDowncount(g_slicelength); g_slicelength = maxslicelength;
globalTimerIsSane = true; globalTimerIsSane = true;
@ -441,23 +441,20 @@ void Advance()
globalTimerIsSane = false; globalTimerIsSane = false;
if (!first) if (first)
{
WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000");
PowerPC::ppcState.downcount += CyclesToDowncount(10000);
}
else
{ {
g_slicelength = (int)(first->time - g_globalTimer); g_slicelength = (int)(first->time - g_globalTimer);
if (g_slicelength > maxslicelength) if (g_slicelength > maxslicelength)
g_slicelength = maxslicelength; g_slicelength = maxslicelength;
PowerPC::ppcState.downcount = CyclesToDowncount(g_slicelength);
} }
PowerPC::ppcState.downcount = CyclesToDowncount(g_slicelength);
// Check for any external exceptions. // Check for any external exceptions.
// It's important to do this after processing events otherwise any exceptions will be delayed until the next slice: // It's important to do this after processing events otherwise any exceptions will be delayed until the next slice:
// Pokemon Box refuses to boot if the first exception from the audio DMA is received late // Pokemon Box refuses to boot if the first exception from the audio DMA is received late
PowerPC::CheckExternalExceptions(); PowerPC::CheckExternalExceptions();
} }
void LogPendingEvents() void LogPendingEvents()