From 170a7f1a06d191dc51b8e76d8bffb227dfe69e13 Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 6 Mar 2016 01:42:50 +0100 Subject: [PATCH] CoreTiming: Trim max slicelength to the given value. Previously it was underclocking by 50% when there were no events to schedule. --- Source/Core/Core/CoreTiming.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp index db3c084840..b879161262 100644 --- a/Source/Core/Core/CoreTiming.cpp +++ b/Source/Core/Core/CoreTiming.cpp @@ -425,7 +425,7 @@ void Advance() g_globalTimer += cyclesExecuted; s_lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f; g_lastOCFactor_inverted = 1.0f / s_lastOCFactor; - PowerPC::ppcState.downcount = CyclesToDowncount(g_slicelength); + g_slicelength = maxslicelength; globalTimerIsSane = true; @@ -441,23 +441,20 @@ void Advance() globalTimerIsSane = false; - if (!first) - { - WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000"); - PowerPC::ppcState.downcount += CyclesToDowncount(10000); - } - else + if (first) { g_slicelength = (int)(first->time - g_globalTimer); if (g_slicelength > maxslicelength) g_slicelength = maxslicelength; - PowerPC::ppcState.downcount = CyclesToDowncount(g_slicelength); } + PowerPC::ppcState.downcount = CyclesToDowncount(g_slicelength); + // Check for any external exceptions. // 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 PowerPC::CheckExternalExceptions(); + } void LogPendingEvents()