From d90471adedd805d524bf5f7480fe58c53f7ec919 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Mon, 17 Oct 2022 22:21:24 +0200 Subject: [PATCH] stuff Arisotura said --- src/frontend/qt_sdl/VideoSettingsDialog.cpp | 11 +++++++++++ src/frontend/qt_sdl/VideoSettingsDialog.h | 3 ++- src/frontend/qt_sdl/main.cpp | 10 +++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/frontend/qt_sdl/VideoSettingsDialog.cpp b/src/frontend/qt_sdl/VideoSettingsDialog.cpp index 87129428..95ec7d31 100644 --- a/src/frontend/qt_sdl/VideoSettingsDialog.cpp +++ b/src/frontend/qt_sdl/VideoSettingsDialog.cpp @@ -78,6 +78,7 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui( if (!Config::ScreenVSync) ui->sbVSyncInterval->setEnabled(false); + setVsyncControlEnable(UsesGL()); if (Config::_3DRenderer == 0) { @@ -124,6 +125,12 @@ void VideoSettingsDialog::on_VideoSettingsDialog_rejected() closeDlg(); } +void VideoSettingsDialog::setVsyncControlEnable(bool hasOGL) +{ + ui->cbVSync->setEnabled(hasOGL); + ui->sbVSyncInterval->setEnabled(hasOGL); +} + void VideoSettingsDialog::onChange3DRenderer(int renderer) { bool old_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0); @@ -154,6 +161,8 @@ void VideoSettingsDialog::on_cbGLDisplay_stateChanged(int state) Config::ScreenUseGL = (state != 0); + setVsyncControlEnable(UsesGL()); + emit updateVideoSettings(old_gl != UsesGL()); } @@ -185,6 +194,8 @@ void VideoSettingsDialog::on_cbxGLResolution_currentIndexChanged(int idx) Config::GL_ScaleFactor = idx+1; + setVsyncControlEnable(UsesGL()); + emit updateVideoSettings(false); } diff --git a/src/frontend/qt_sdl/VideoSettingsDialog.h b/src/frontend/qt_sdl/VideoSettingsDialog.h index 527cc931..7fee5bb8 100644 --- a/src/frontend/qt_sdl/VideoSettingsDialog.h +++ b/src/frontend/qt_sdl/VideoSettingsDialog.h @@ -67,8 +67,9 @@ private slots: void on_cbBetterPolygons_stateChanged(int state); void on_cbSoftwareThreaded_stateChanged(int state); - private: + void setVsyncControlEnable(bool hasOGL); + Ui::VideoSettingsDialog* ui; QButtonGroup* grp3DRenderer; diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index a8add8ee..cd0ea52d 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -569,7 +569,10 @@ void EmuThread::run() if (EmuRunning == 3) EmuRunning = 2; // update render settings if needed - if (videoSettingsDirty) + // HACK: + // once the fast forward hotkey is released, we need to update vsync + // to the old setting again + if (videoSettingsDirty || Input::HotkeyReleased(HK_FastForward)) { if (oglContext) { @@ -674,6 +677,11 @@ void EmuThread::run() bool fastforward = Input::HotkeyDown(HK_FastForward); + if (fastforward && oglContext && Config::ScreenVSync) + { + oglContext->SetSwapInterval(0); + } + if (Config::AudioSync && !fastforward && audioDevice) { SDL_LockMutex(audioSyncLock);