From 7dd4152d6711db76fbe2a2acffcc208a524bb25d Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Fri, 26 Jan 2024 13:06:32 +0100 Subject: Add MaxFPS setting --- src/frontend/qt_sdl/Config.cpp | 2 + src/frontend/qt_sdl/Config.h | 1 + src/frontend/qt_sdl/EmuThread.cpp | 2 +- src/frontend/qt_sdl/InterfaceSettingsDialog.cpp | 2 + src/frontend/qt_sdl/InterfaceSettingsDialog.ui | 120 +++++++++++++++++------- 5 files changed, 92 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/frontend/qt_sdl/Config.cpp b/src/frontend/qt_sdl/Config.cpp index b6fca7d..02f43de 100644 --- a/src/frontend/qt_sdl/Config.cpp +++ b/src/frontend/qt_sdl/Config.cpp @@ -61,6 +61,7 @@ int GL_ScaleFactor; bool GL_BetterPolygons; bool LimitFPS; +int MaxFPS; bool AudioSync; bool ShowOSD; @@ -251,6 +252,7 @@ ConfigEntry ConfigFile[] = {"GL_BetterPolygons", 1, &GL_BetterPolygons, false, false}, {"LimitFPS", 1, &LimitFPS, true, false}, + {"MaxFPS", 0, &MaxFPS, 1000, false}, {"AudioSync", 1, &AudioSync, false}, {"ShowOSD", 1, &ShowOSD, true, false}, diff --git a/src/frontend/qt_sdl/Config.h b/src/frontend/qt_sdl/Config.h index 5e3db82..11644dc 100644 --- a/src/frontend/qt_sdl/Config.h +++ b/src/frontend/qt_sdl/Config.h @@ -105,6 +105,7 @@ extern int GL_ScaleFactor; extern bool GL_BetterPolygons; extern bool LimitFPS; +extern int MaxFPS; extern bool AudioSync; extern bool ShowOSD; diff --git a/src/frontend/qt_sdl/EmuThread.cpp b/src/frontend/qt_sdl/EmuThread.cpp index 01431a1..0728a08 100644 --- a/src/frontend/qt_sdl/EmuThread.cpp +++ b/src/frontend/qt_sdl/EmuThread.cpp @@ -576,7 +576,7 @@ void EmuThread::run() { bool limitfps = Config::LimitFPS && !fastforward; - double practicalFramelimit = limitfps ? frametimeStep : 1.0 / 1000.0; + double practicalFramelimit = limitfps ? frametimeStep : 1.0 / Config::MaxFPS; double curtime = SDL_GetPerformanceCounter() * perfCountsSec; diff --git a/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp b/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp index 2f7417f..75497bc 100644 --- a/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp +++ b/src/frontend/qt_sdl/InterfaceSettingsDialog.cpp @@ -34,6 +34,7 @@ InterfaceSettingsDialog::InterfaceSettingsDialog(QWidget* parent) : QDialog(pare ui->spinMouseHideSeconds->setEnabled(Config::MouseHide != 0); ui->spinMouseHideSeconds->setValue(Config::MouseHideSeconds); ui->cbPauseLostFocus->setChecked(Config::PauseLostFocus != 0); + ui->spinMaxFPS->setValue(Config::MaxFPS); } InterfaceSettingsDialog::~InterfaceSettingsDialog() @@ -60,6 +61,7 @@ void InterfaceSettingsDialog::done(int r) Config::MouseHide = ui->cbMouseHide->isChecked() ? 1:0; Config::MouseHideSeconds = ui->spinMouseHideSeconds->value(); Config::PauseLostFocus = ui->cbPauseLostFocus->isChecked() ? 1:0; + Config::MaxFPS = ui->spinMaxFPS->value(); Config::Save(); diff --git a/src/frontend/qt_sdl/InterfaceSettingsDialog.ui b/src/frontend/qt_sdl/InterfaceSettingsDialog.ui index 8ee9fed..01ba4a4 100644 --- a/src/frontend/qt_sdl/InterfaceSettingsDialog.ui +++ b/src/frontend/qt_sdl/InterfaceSettingsDialog.ui @@ -6,8 +6,8 @@ 0 0 - 262 - 113 + 337 + 233 @@ -19,32 +19,96 @@ Interface settings - melonDS - - - - - Hide after + + + + + Main window + + + + + Hide mouse after inactivity + + + + + + + 18 + + + + + After + + + spinMouseHideSeconds + + + + + + + + + + seconds + + + spinMouseHideSeconds + + + + + + + + + Pause emulation when window is not in focus + + + + - - - - Pause emulation when window is not in focus + + + + Framerate + + + + + Fast-forward limit + + + spinMaxFPS + + + + + + + FPS + + + 60 + + + 1000 + + + 1000 + + + + - - - - Hide mouse after inactivity - - - - - - - + Qt::Horizontal @@ -54,20 +118,8 @@ - - - - seconds of inactivity - - - - - cbMouseHide - spinMouseHideSeconds - cbPauseLostFocus - -- cgit v1.2.3