mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
add back vsync
This commit is contained in:
@ -28,6 +28,11 @@
|
|||||||
#include "ui_VideoSettingsDialog.h"
|
#include "ui_VideoSettingsDialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
inline bool UsesGL()
|
||||||
|
{
|
||||||
|
return (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
||||||
|
}
|
||||||
|
|
||||||
VideoSettingsDialog* VideoSettingsDialog::currentDlg = nullptr;
|
VideoSettingsDialog* VideoSettingsDialog::currentDlg = nullptr;
|
||||||
|
|
||||||
|
|
||||||
@ -88,14 +93,6 @@ VideoSettingsDialog::VideoSettingsDialog(QWidget* parent) : QDialog(parent), ui(
|
|||||||
ui->cbxGLResolution->setEnabled(true);
|
ui->cbxGLResolution->setEnabled(true);
|
||||||
ui->cbBetterPolygons->setEnabled(true);
|
ui->cbBetterPolygons->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// sorry
|
|
||||||
ui->cbVSync->hide();
|
|
||||||
ui->cbVSync->setEnabled(false);
|
|
||||||
ui->sbVSyncInterval->hide();
|
|
||||||
ui->sbVSyncInterval->setEnabled(false);
|
|
||||||
ui->label_2->hide();
|
|
||||||
ui->groupBox->layout()->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoSettingsDialog::~VideoSettingsDialog()
|
VideoSettingsDialog::~VideoSettingsDialog()
|
||||||
@ -112,7 +109,7 @@ void VideoSettingsDialog::on_VideoSettingsDialog_accepted()
|
|||||||
|
|
||||||
void VideoSettingsDialog::on_VideoSettingsDialog_rejected()
|
void VideoSettingsDialog::on_VideoSettingsDialog_rejected()
|
||||||
{
|
{
|
||||||
bool old_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
bool old_gl = UsesGL();
|
||||||
|
|
||||||
Config::_3DRenderer = oldRenderer;
|
Config::_3DRenderer = oldRenderer;
|
||||||
Config::ScreenUseGL = oldGLDisplay;
|
Config::ScreenUseGL = oldGLDisplay;
|
||||||
@ -122,8 +119,7 @@ void VideoSettingsDialog::on_VideoSettingsDialog_rejected()
|
|||||||
Config::GL_ScaleFactor = oldGLScale;
|
Config::GL_ScaleFactor = oldGLScale;
|
||||||
Config::GL_BetterPolygons = oldGLBetterPolygons;
|
Config::GL_BetterPolygons = oldGLBetterPolygons;
|
||||||
|
|
||||||
bool new_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
emit updateVideoSettings(old_gl != UsesGL());
|
||||||
emit updateVideoSettings(old_gl != new_gl);
|
|
||||||
|
|
||||||
closeDlg();
|
closeDlg();
|
||||||
}
|
}
|
||||||
@ -149,8 +145,7 @@ void VideoSettingsDialog::onChange3DRenderer(int renderer)
|
|||||||
ui->cbBetterPolygons->setEnabled(true);
|
ui->cbBetterPolygons->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool new_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
emit updateVideoSettings(old_gl != UsesGL());
|
||||||
emit updateVideoSettings(old_gl != new_gl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoSettingsDialog::on_cbGLDisplay_stateChanged(int state)
|
void VideoSettingsDialog::on_cbGLDisplay_stateChanged(int state)
|
||||||
@ -159,8 +154,7 @@ void VideoSettingsDialog::on_cbGLDisplay_stateChanged(int state)
|
|||||||
|
|
||||||
Config::ScreenUseGL = (state != 0);
|
Config::ScreenUseGL = (state != 0);
|
||||||
|
|
||||||
bool new_gl = (Config::ScreenUseGL != 0) || (Config::_3DRenderer != 0);
|
emit updateVideoSettings(old_gl != UsesGL());
|
||||||
emit updateVideoSettings(old_gl != new_gl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoSettingsDialog::on_cbVSync_stateChanged(int state)
|
void VideoSettingsDialog::on_cbVSync_stateChanged(int state)
|
||||||
@ -168,11 +162,13 @@ void VideoSettingsDialog::on_cbVSync_stateChanged(int state)
|
|||||||
bool vsync = (state != 0);
|
bool vsync = (state != 0);
|
||||||
ui->sbVSyncInterval->setEnabled(vsync);
|
ui->sbVSyncInterval->setEnabled(vsync);
|
||||||
Config::ScreenVSync = vsync;
|
Config::ScreenVSync = vsync;
|
||||||
|
emit updateVideoSettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoSettingsDialog::on_sbVSyncInterval_valueChanged(int val)
|
void VideoSettingsDialog::on_sbVSyncInterval_valueChanged(int val)
|
||||||
{
|
{
|
||||||
Config::ScreenVSyncInterval = val;
|
Config::ScreenVSyncInterval = val;
|
||||||
|
emit updateVideoSettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoSettingsDialog::on_cbSoftwareThreaded_stateChanged(int state)
|
void VideoSettingsDialog::on_cbSoftwareThreaded_stateChanged(int state)
|
||||||
|
@ -426,6 +426,8 @@ void EmuThread::initOpenGL()
|
|||||||
static_cast<ScreenPanelGL*>(mainWindow->panel)->transferLayout(this);
|
static_cast<ScreenPanelGL*>(mainWindow->panel)->transferLayout(this);
|
||||||
|
|
||||||
OSD::Init(true);
|
OSD::Init(true);
|
||||||
|
|
||||||
|
oglContext->SetSwapInterval(Config::ScreenVSync ? Config::ScreenVSyncInterval : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::deinitOpenGL()
|
void EmuThread::deinitOpenGL()
|
||||||
@ -543,7 +545,9 @@ void EmuThread::run()
|
|||||||
videoRenderer = 0;
|
videoRenderer = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
videoRenderer = hasOGL ? Config::_3DRenderer : 0;
|
videoRenderer = hasOGL ? Config::_3DRenderer : 0;
|
||||||
|
}
|
||||||
|
|
||||||
videoSettingsDirty = false;
|
videoSettingsDirty = false;
|
||||||
|
|
||||||
@ -551,6 +555,11 @@ void EmuThread::run()
|
|||||||
videoSettings.GL_ScaleFactor = Config::GL_ScaleFactor;
|
videoSettings.GL_ScaleFactor = Config::GL_ScaleFactor;
|
||||||
videoSettings.GL_BetterPolygons = Config::GL_BetterPolygons;
|
videoSettings.GL_BetterPolygons = Config::GL_BetterPolygons;
|
||||||
|
|
||||||
|
if (hasOGL)
|
||||||
|
{
|
||||||
|
oglContext->SetSwapInterval(Config::ScreenVSync ? Config::ScreenVSyncInterval : 0);
|
||||||
|
}
|
||||||
|
|
||||||
GPU::SetRenderSettings(videoRenderer, videoSettings);
|
GPU::SetRenderSettings(videoRenderer, videoSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user