mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 21:37:42 -07:00
always cap FPS to 1000
This commit is contained in:
parent
906521e7e9
commit
42e083960e
@ -495,16 +495,17 @@ void EmuThread::run()
|
||||
double frametimeStep = nlines / (60.0 * 263.0);
|
||||
|
||||
{
|
||||
bool limitfps = Config::LimitFPS && !fastforward;
|
||||
|
||||
double practicalFramelimit = limitfps ? frametimeStep : 1.0 / 1000.0;
|
||||
|
||||
double curtime = SDL_GetPerformanceCounter() * perfCountsSec;
|
||||
|
||||
bool limitfps = Config::LimitFPS && !fastforward;
|
||||
if (limitfps)
|
||||
{
|
||||
frameLimitError += frametimeStep - (curtime - lastTime);
|
||||
if (frameLimitError < -frametimeStep)
|
||||
frameLimitError = -frametimeStep;
|
||||
if (frameLimitError > frametimeStep)
|
||||
frameLimitError = frametimeStep;
|
||||
frameLimitError += practicalFramelimit - (curtime - lastTime);
|
||||
if (frameLimitError < -practicalFramelimit)
|
||||
frameLimitError = -practicalFramelimit;
|
||||
if (frameLimitError > practicalFramelimit)
|
||||
frameLimitError = practicalFramelimit;
|
||||
|
||||
if (round(frameLimitError * 1000.0) > 0.0)
|
||||
{
|
||||
@ -513,7 +514,6 @@ void EmuThread::run()
|
||||
curtime = SDL_GetPerformanceCounter() * perfCountsSec;
|
||||
frameLimitError -= curtime - timeBeforeSleep;
|
||||
}
|
||||
}
|
||||
|
||||
lastTime = curtime;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user