mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 13:20:57 -06:00
lower window update rate if rendering too fast
This commit is contained in:
@ -415,6 +415,8 @@ void EmuThread::run()
|
|||||||
double frameLimitError = 0.0;
|
double frameLimitError = 0.0;
|
||||||
double lastMeasureTime = lastTime;
|
double lastMeasureTime = lastTime;
|
||||||
|
|
||||||
|
u32 winUpdateCount = 0, winUpdateFreq = 1;
|
||||||
|
|
||||||
char melontitle[100];
|
char melontitle[100];
|
||||||
|
|
||||||
while (EmuRunning != 0)
|
while (EmuRunning != 0)
|
||||||
@ -571,11 +573,16 @@ void EmuThread::run()
|
|||||||
|
|
||||||
if (EmuRunning == 0) break;
|
if (EmuRunning == 0) break;
|
||||||
|
|
||||||
emit windowUpdate();
|
winUpdateCount++;
|
||||||
|
if (winUpdateCount >= winUpdateFreq)
|
||||||
|
{
|
||||||
|
emit windowUpdate();
|
||||||
|
winUpdateCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool fastforward = Input::HotkeyDown(HK_FastForward);
|
bool fastforward = Input::HotkeyDown(HK_FastForward);
|
||||||
|
|
||||||
if (Config::AudioSync && (!fastforward) && audioDevice)
|
if (Config::AudioSync && !fastforward && audioDevice)
|
||||||
{
|
{
|
||||||
SDL_LockMutex(audioSyncLock);
|
SDL_LockMutex(audioSyncLock);
|
||||||
while (SPU::GetOutputSize() > 1024)
|
while (SPU::GetOutputSize() > 1024)
|
||||||
@ -624,6 +631,10 @@ void EmuThread::run()
|
|||||||
|
|
||||||
float fpstarget = 1.0/frametimeStep;
|
float fpstarget = 1.0/frametimeStep;
|
||||||
|
|
||||||
|
winUpdateFreq = fps / (u32)round(fpstarget);
|
||||||
|
if (winUpdateFreq < 1)
|
||||||
|
winUpdateFreq = 1;
|
||||||
|
|
||||||
sprintf(melontitle, "[%d/%.0f] melonDS " MELONDS_VERSION, fps, fpstarget);
|
sprintf(melontitle, "[%d/%.0f] melonDS " MELONDS_VERSION, fps, fpstarget);
|
||||||
changeWindowTitle(melontitle);
|
changeWindowTitle(melontitle);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user