add timing correction for GB games

This commit is contained in:
dborth 2008-10-25 18:41:40 +00:00
parent 0ae30cfd17
commit 4e0ff85b3f

View File

@ -132,9 +132,6 @@ static u32 autoFrameSkipLastTime = 0;
void system10Frames(int rate)
{
if (cartridgeType == 1)
return;
u32 time = systemGetClock();
u32 diff = time - autoFrameSkipLastTime;
@ -146,6 +143,8 @@ void system10Frames(int rate)
else
timeOff = 0; // timeoff was not valid
if (cartridgeType == 2) // GBA games require frameskipping
{
// consider increasing skip
if(diff >= 270)
systemFrameSkip += 4;
@ -169,6 +168,7 @@ void system10Frames(int rate)
systemFrameSkip = 20;
else if(systemFrameSkip < 0)
systemFrameSkip = 0;
}
autoFrameSkipLastTime = time + timeOff; // total time = processing time + sleep time