diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 22008ae139..5d13bcc90a 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -63,7 +63,7 @@ extern bool RunLinuxDialog(); static GSRenderer* s_gs = NULL; static void (*s_irq)() = NULL; static uint8* s_basemem = NULL; -static bool s_vsync = false; +static int s_vsync = 0; static bool s_exclusive = true; static const char *s_renderer_name = ""; static const char *s_renderer_type = ""; @@ -543,7 +543,7 @@ EXPORT_C_(int) GSopen(void** dsp, const char* title, int mt) // Legacy GUI expects to acquire vsync from the configuration files. - s_vsync = !!theApp.GetConfigI("vsync"); + s_vsync = theApp.GetConfigI("vsync"); if(mt == 2) { @@ -965,9 +965,9 @@ EXPORT_C GSsetFrameSkip(int frameskip) s_gs->SetFrameSkip(frameskip); } -EXPORT_C GSsetVsync(int enabled) +EXPORT_C GSsetVsync(int vsync) { - s_vsync = !!enabled; + s_vsync = vsync; if(s_gs) { @@ -1089,7 +1089,7 @@ EXPORT_C GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) std::array regs; GSsetBaseMem(regs.data()); - s_vsync = theApp.GetConfigB("vsync"); + s_vsync = theApp.GetConfigI("vsync"); HWND hWnd = nullptr; @@ -1435,7 +1435,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer) GSsetBaseMem(regs); - s_vsync = theApp.GetConfigB("vsync"); + s_vsync = theApp.GetConfigI("vsync"); int finished = theApp.GetConfigI("linux_replay"); bool repack_dump = (finished < 0); diff --git a/plugins/GSdx/GSDevice.h b/plugins/GSdx/GSDevice.h index 05c435d492..2c48763adf 100644 --- a/plugins/GSdx/GSDevice.h +++ b/plugins/GSdx/GSDevice.h @@ -107,7 +107,7 @@ class GSDevice : public GSAlignedClass<32> protected: std::shared_ptr m_wnd; - bool m_vsync; + int m_vsync; bool m_rbswapped; GSTexture* m_backbuffer; GSTexture* m_merge; @@ -149,7 +149,7 @@ public: virtual void Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, int shader = 0); virtual void Flip() {} - virtual void SetVSync(bool enable) {m_vsync = enable;} + virtual void SetVSync(int vsync) {m_vsync = vsync;} virtual void BeginScene() {} virtual void DrawPrimitive() {}; diff --git a/plugins/GSdx/GSDevice9.cpp b/plugins/GSdx/GSDevice9.cpp index 5e14ddf6fb..9f18ba8682 100644 --- a/plugins/GSdx/GSDevice9.cpp +++ b/plugins/GSdx/GSDevice9.cpp @@ -571,11 +571,11 @@ void GSDevice9::Flip() } } -void GSDevice9::SetVSync(bool enable) +void GSDevice9::SetVSync(int vsync) { - if(m_vsync == enable) return; + if(m_vsync == vsync) return; - __super::SetVSync(enable); + __super::SetVSync(vsync); // Clever trick: Delete the backbuffer, so that the next Present will fail and // cause a DXDevice9::Reset call, which re-creates the backbuffer with current diff --git a/plugins/GSdx/GSDevice9.h b/plugins/GSdx/GSDevice9.h index 2db03059b0..9b72d6f76f 100644 --- a/plugins/GSdx/GSDevice9.h +++ b/plugins/GSdx/GSDevice9.h @@ -190,7 +190,7 @@ public: bool IsLost(bool update); void Flip(); - void SetVSync(bool enable); + void SetVSync(int vsync); void BeginScene(); void DrawPrimitive(); diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index d9876b9d43..256d204372 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -620,9 +620,9 @@ bool GSDeviceOGL::Reset(int w, int h) return true; } -void GSDeviceOGL::SetVSync(bool enable) +void GSDeviceOGL::SetVSync(int vsync) { - m_wnd->SetVSync(enable); + m_wnd->SetVSync(vsync); } void GSDeviceOGL::Flip() diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 99a3eaa56f..ff5d1e2e01 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -523,7 +523,7 @@ public: bool Create(const std::shared_ptr &wnd); bool Reset(int w, int h); void Flip(); - void SetVSync(bool enable); + void SetVSync(int vsync); void DrawPrimitive() final; void DrawPrimitive(int offset, int count); diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index 1ccad3a2b6..5d78bb442b 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -44,7 +44,7 @@ GSRenderer::GSRenderer() m_interlace = theApp.GetConfigI("interlace") % s_interlace_nb; m_aspectratio = theApp.GetConfigI("AspectRatio") % s_aspect_ratio_nb; m_shader = theApp.GetConfigI("TVShader") % s_post_shader_nb; - m_vsync = theApp.GetConfigB("vsync"); + m_vsync = theApp.GetConfigI("vsync"); m_aa1 = theApp.GetConfigB("aa1"); m_fxaa = theApp.GetConfigB("fxaa"); m_shaderfx = theApp.GetConfigB("shaderfx"); @@ -304,9 +304,9 @@ GSVector2i GSRenderer::GetInternalResolution() return m_real_size; } -void GSRenderer::SetVSync(bool enabled) +void GSRenderer::SetVSync(int vsync) { - m_vsync = enabled; + m_vsync = vsync; if(m_dev) m_dev->SetVSync(m_vsync); } diff --git a/plugins/GSdx/GSRenderer.h b/plugins/GSdx/GSRenderer.h index 082f20ad9f..855fcedc5b 100644 --- a/plugins/GSdx/GSRenderer.h +++ b/plugins/GSdx/GSRenderer.h @@ -40,7 +40,7 @@ class GSRenderer : public GSState protected: int m_interlace; int m_aspectratio; - bool m_vsync; + int m_vsync; bool m_aa1; bool m_shaderfx; bool m_fxaa; @@ -69,7 +69,7 @@ public: virtual GSVector2i GetCustomResolution() {return GSVector2i(0,0);} GSVector2i GetInternalResolution(); void SetAspectRatio(int aspect) {m_aspectratio = aspect;} - void SetVSync(bool enabled); + void SetVSync(int vsync); virtual void SetExclusive(bool isExcl) {} virtual bool BeginCapture(); diff --git a/plugins/GSdx/GSWnd.h b/plugins/GSdx/GSWnd.h index fed7a278e2..e05584a00c 100644 --- a/plugins/GSdx/GSWnd.h +++ b/plugins/GSdx/GSWnd.h @@ -52,7 +52,7 @@ public: virtual void HideFrame() = 0; virtual void Flip() {}; - virtual void SetVSync(bool enable) {}; + virtual void SetVSync(int vsync) {}; }; @@ -84,7 +84,7 @@ public: virtual void Hide() = 0; virtual void HideFrame() = 0; virtual void Flip() = 0; - virtual void SetVSync(bool enable) = 0; + virtual void SetVSync(int vsync) = 0; void PopulateGlFunction(); }; diff --git a/plugins/GSdx/GSWndEGL.cpp b/plugins/GSdx/GSWndEGL.cpp index 4716946079..a11e6d991a 100644 --- a/plugins/GSdx/GSWndEGL.cpp +++ b/plugins/GSdx/GSWndEGL.cpp @@ -239,11 +239,11 @@ GSVector4i GSWndEGL::GetClientRect() return GSVector4i(0, 0, w, h); } -void GSWndEGL::SetVSync(bool enable) +void GSWndEGL::SetVSync(int vsync) { // 0 -> disable vsync // n -> wait n frame - eglSwapInterval(m_eglDisplay, enable); + eglSwapInterval(m_eglDisplay, vsync); } void GSWndEGL::Flip() diff --git a/plugins/GSdx/GSWndEGL.h b/plugins/GSdx/GSWndEGL.h index d72c5f15a0..e3edd6b57e 100644 --- a/plugins/GSdx/GSWndEGL.h +++ b/plugins/GSdx/GSWndEGL.h @@ -65,7 +65,7 @@ public: void* GetProcAddress(const char* name, bool opt = false) final; void Flip() final; - void SetVSync(bool enable) final; + void SetVSync(int vsync) final; // Deprecated API void Show() final {}; diff --git a/plugins/GSdx/GSWndOGL.cpp b/plugins/GSdx/GSWndOGL.cpp index 06449a240b..37d3d4bb54 100644 --- a/plugins/GSdx/GSWndOGL.cpp +++ b/plugins/GSdx/GSWndOGL.cpp @@ -243,13 +243,13 @@ bool GSWndOGL::SetWindowText(const char* title) return true; } -void GSWndOGL::SetVSync(bool enable) +void GSWndOGL::SetVSync(int vsync) { // m_swapinterval uses an integer as parameter // 0 -> disable vsync // n -> wait n frame - if (m_swapinterval_ext) m_swapinterval_ext(m_NativeDisplay, m_NativeWindow, (int)enable); - else if (m_swapinterval_mesa) m_swapinterval_mesa((int)enable); + if (m_swapinterval_ext) m_swapinterval_ext(m_NativeDisplay, m_NativeWindow, vsync); + else if (m_swapinterval_mesa) m_swapinterval_mesa(vsync); else fprintf(stderr, "Failed to set VSync\n"); } diff --git a/plugins/GSdx/GSWndOGL.h b/plugins/GSdx/GSWndOGL.h index 923c7aec2a..0d8da9a2d7 100644 --- a/plugins/GSdx/GSWndOGL.h +++ b/plugins/GSdx/GSWndOGL.h @@ -57,7 +57,7 @@ public: void Hide(); void HideFrame(); void Flip(); - void SetVSync(bool enable); + void SetVSync(int vsync); }; #endif diff --git a/plugins/GSdx/GSWndWGL.cpp b/plugins/GSdx/GSWndWGL.cpp index da6432c075..b5cb1d22a7 100644 --- a/plugins/GSdx/GSWndWGL.cpp +++ b/plugins/GSdx/GSWndWGL.cpp @@ -323,12 +323,12 @@ void* GSWndWGL::GetProcAddress(const char* name, bool opt) //TODO: check extensions supported or not //FIXME : extension allocation -void GSWndWGL::SetVSync(bool enable) +void GSWndWGL::SetVSync(int vsync) { // m_swapinterval uses an integer as parameter // 0 -> disable vsync // n -> wait n frame - if (m_swapinterval) m_swapinterval((int)enable); + if (m_swapinterval) m_swapinterval(vsync); } void GSWndWGL::Flip() diff --git a/plugins/GSdx/GSWndWGL.h b/plugins/GSdx/GSWndWGL.h index 70e34594c9..c4ccec4a2d 100644 --- a/plugins/GSdx/GSWndWGL.h +++ b/plugins/GSdx/GSWndWGL.h @@ -59,7 +59,7 @@ public: void Hide(); void HideFrame(); void Flip(); - void SetVSync(bool enable); + void SetVSync(int vsync); }; #endif diff --git a/plugins/GSdx/PSX/GPURenderer.cpp b/plugins/GSdx/PSX/GPURenderer.cpp index d45833775e..83b636f33f 100644 --- a/plugins/GSdx/PSX/GPURenderer.cpp +++ b/plugins/GSdx/PSX/GPURenderer.cpp @@ -35,7 +35,7 @@ GPURenderer::GPURenderer(GSDevice* dev) m_filter = theApp.GetConfigI("filter"); m_dither = theApp.GetConfigI("dithering"); m_aspectratio = theApp.GetConfigI("AspectRatio"); - m_vsync = theApp.GetConfigB("vsync"); + m_vsync = theApp.GetConfigI("vsync"); m_fxaa = theApp.GetConfigB("fxaa"); m_shaderfx = theApp.GetConfigB("shaderfx"); m_scale = m_mem.GetScale(); diff --git a/plugins/GSdx/PSX/GPURenderer.h b/plugins/GSdx/PSX/GPURenderer.h index 0af20af2dd..57188f4e1e 100644 --- a/plugins/GSdx/PSX/GPURenderer.h +++ b/plugins/GSdx/PSX/GPURenderer.h @@ -37,7 +37,7 @@ protected: int m_filter; int m_dither; int m_aspectratio; - bool m_vsync; + int m_vsync; bool m_shaderfx; bool m_fxaa; bool m_shadeboost;