add VSync toggle

This commit is contained in:
Arisotura
2019-09-01 20:20:22 +02:00
parent 5b51034436
commit abb06269a1
4 changed files with 44 additions and 3 deletions

View File

@ -988,7 +988,8 @@ int EmuThreadFunc(void* burp)
uiAreaQueueRedrawAll(MainDrawArea);
bool limitfps = Config::LimitFPS && !HotkeyDown(HK_FastForward);
SPU::Sync(limitfps);
bool vsync = Config::ScreenVSync && Screen_UseGL;
SPU::Sync(limitfps || vsync);
float framerate = (1000.0f * nlines) / (60.0f * 263.0f);
@ -2260,6 +2261,19 @@ void ApplyNewSettings(int type)
GPU3D::InitRenderer(Screen_UseGL);
if (Screen_UseGL) uiGLMakeContextCurrent(NULL);
}
else if (type == 4) // vsync
{
if (Screen_UseGL)
{
uiGLMakeContextCurrent(GLContext);
uiGLSetVSync(Config::ScreenVSync);
uiGLMakeContextCurrent(NULL);
}
else
{
// TODO eventually: VSync for non-GL screen?
}
}
EmuRunning = prevstatus;
}
@ -2469,7 +2483,7 @@ void CreateMainWindow(bool opengl)
if (opengl_good)
{
uiGLMakeContextCurrent(GLContext);
uiGLSetVSync(0); // TODO: make configurable?
uiGLSetVSync(Config::ScreenVSync);
if (!GLScreen_Init()) opengl_good = false;
if (opengl_good)
{