aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRSDuck <RSDuck@users.noreply.github.com>2022-02-14 00:25:11 +0100
committerRSDuck <RSDuck@users.noreply.github.com>2022-02-14 00:27:00 +0100
commit03b5c480888c8563230f85864ee30d4cca538e23 (patch)
treecf53b266240f3e4cb6f952c8299c58b43913769c /src
parent0761fe736f1efb633c8c2b947f53176309961dbb (diff)
lower window update rate if rendering too fast
Diffstat (limited to 'src')
-rw-r--r--src/frontend/qt_sdl/main.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp
index 23ab276..4d30dc8 100644
--- a/src/frontend/qt_sdl/main.cpp
+++ b/src/frontend/qt_sdl/main.cpp
@@ -415,6 +415,8 @@ void EmuThread::run()
double frameLimitError = 0.0;
double lastMeasureTime = lastTime;
+ u32 winUpdateCount = 0, winUpdateFreq = 1;
+
char melontitle[100];
while (EmuRunning != 0)
@@ -571,11 +573,16 @@ void EmuThread::run()
if (EmuRunning == 0) break;
- emit windowUpdate();
+ winUpdateCount++;
+ if (winUpdateCount >= winUpdateFreq)
+ {
+ emit windowUpdate();
+ winUpdateCount = 0;
+ }
bool fastforward = Input::HotkeyDown(HK_FastForward);
- if (Config::AudioSync && (!fastforward) && audioDevice)
+ if (Config::AudioSync && !fastforward && audioDevice)
{
SDL_LockMutex(audioSyncLock);
while (SPU::GetOutputSize() > 1024)
@@ -624,6 +631,10 @@ void EmuThread::run()
float fpstarget = 1.0/frametimeStep;
+ winUpdateFreq = fps / (u32)round(fpstarget);
+ if (winUpdateFreq < 1)
+ winUpdateFreq = 1;
+
sprintf(melontitle, "[%d/%.0f] melonDS " MELONDS_VERSION, fps, fpstarget);
changeWindowTitle(melontitle);
}