mirror of https://github.com/PCSX2/pcsx2.git
Gave the frame limiter some smarts so it can sleep the EEcore a bit if there's nothing to do for a while.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2033 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
950c99f886
commit
54f1409090
|
@ -322,11 +322,22 @@ static __forceinline void frameLimit()
|
|||
|
||||
m_iStart = uExpectedEnd;
|
||||
|
||||
while( sDeltaTime < 0 )
|
||||
// Shortcut for cases where no waiting is needed (they're running slow already,
|
||||
// so don't bog 'em down with extra math...)
|
||||
if( sDeltaTime >= 0 ) return;
|
||||
|
||||
// If we're way ahead then we can afford to sleep the thread a bit.
|
||||
|
||||
s32 msec = (int)((sDeltaTime*-1000) / (s64)GetTickFrequency());
|
||||
if( msec > 2 ) Threading::Sleep( msec - 2 );
|
||||
|
||||
//
|
||||
while( true )
|
||||
{
|
||||
Timeslice();
|
||||
iEnd = GetCPUTicks();
|
||||
sDeltaTime = iEnd - uExpectedEnd;
|
||||
if( sDeltaTime >= 0 ) break;
|
||||
Timeslice();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue