diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 44c8e60b0..0a8865830 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -306,7 +306,7 @@ public: TTSetTxt(IDC_CMB_WINDOW_RES, "Resolution:\n\nThis option selects the windowed resolution.\n\n[Recommended: 640x480, 800x600, 1024x768]"); m_cbxVSync.Attach(GetDlgItem(IDC_CHK_VERTICAL_SYNC)); - m_cbxVSync.SetCheck(g_settings->vsync ? BST_CHECKED : BST_UNCHECKED); + m_cbxVSync.SetCheck(g_settings->vsync() ? BST_CHECKED : BST_UNCHECKED); TTSetTxt(IDC_CHK_VERTICAL_SYNC, "Vertical sync:\n\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\"."); m_cbxTextureSettings.Attach(GetDlgItem(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT)); @@ -350,7 +350,7 @@ public: m_spinVRAM.GetWindowText(spinVRAM, sizeof(spinVRAM)); CSettings oldsettings = *g_settings; g_settings->SetScreenRes(m_WindowRes.GetCurSel()); - g_settings->vsync = m_cbxVSync.GetCheck() == BST_CHECKED; + g_settings->SetVsync(m_cbxVSync.GetCheck() == BST_CHECKED); g_settings->SetTexenhOptions(m_cbxTextureSettings.GetCheck() == BST_CHECKED); g_settings->wrpResolution = m_cmbFSResolution.GetCurSel(); g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 22f052e49..4ba5a688e 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -1539,7 +1539,7 @@ void newSwapBuffers() grAuxBufferExt(GR_BUFFER_AUXBUFFER); } WriteTrace(TraceGlide64, TraceDebug, "BUFFER SWAPPED"); - grBufferSwap(g_settings->vsync); + grBufferSwap(g_settings->vsync()); if (*gfx.VI_STATUS_REG & 0x08) //gamma correction is used { if (!voodoo.gamma_correction) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 7732e76c5..a8a383544 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -23,7 +23,7 @@ CSettings::CSettings() : m_ScreenRes(GetDefaultScreenRes()), m_advanced_options(false), m_texenh_options(false), -vsync(0), + m_vsync(false), m_rotate(Rotate_None), m_filtering(Filter_Automatic), @@ -120,7 +120,7 @@ void CSettings::RegisterSettings(void) #ifdef _WIN32 general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex()); #endif - general_setting(Set_vsync, "vsync", 1); + general_setting(Set_vsync, "vsync", true); general_setting(Set_texenh_options, "texenh_options", false); general_setting(Set_wrpVRAM, "wrpVRAM", 0); #ifndef ANDROID @@ -281,6 +281,15 @@ void CSettings::SetLODmode(PixelLevelOfDetail_t value) } } +void CSettings::SetVsync(bool value) +{ + if (value != m_vsync) + { + m_vsync = value; + m_dirty = true; + } +} + void CSettings::SetFiltering(Filtering_t value) { if (value != m_filtering) @@ -391,7 +400,7 @@ void CSettings::ReadSettings() #ifndef ANDROID this->wrpResolution = GetSetting(Set_FullScreenRes); #endif - this->vsync = GetSetting(Set_vsync); + m_vsync = GetSetting(Set_vsync) != 0; m_rotate = (ScreenRotate_t)GetSetting(Set_Rotate); m_advanced_options = Set_basic_mode ? GetSystemSetting(Set_basic_mode) == 0 : false; m_texenh_options = GetSetting(Set_texenh_options) != 0; @@ -671,7 +680,7 @@ void CSettings::WriteSettings(void) #ifdef _WIN32 SetSetting(Set_FullScreenRes, g_settings->wrpResolution); #endif - SetSetting(Set_vsync, g_settings->vsync); + SetSetting(Set_vsync, m_vsync ? 1 : 0); SetSetting(Set_Rotate, m_rotate); SetSetting(Set_texenh_options, m_texenh_options); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index fc1c79d85..2fdf30ba4 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -146,9 +146,6 @@ public: }; - int vsync; - - int fog; int buff_clear; @@ -184,7 +181,7 @@ public: inline uint32_t ScreenRes(void) const { return m_ScreenRes; } inline bool advanced_options(void) const { return m_advanced_options; } inline bool texenh_options(void) const { return m_texenh_options; } - inline bool FlushLogs(void) const { return m_FlushLogs; } + inline bool vsync(void) const { return m_vsync; } inline ScreenRotate_t rotate(void) const { return m_rotate; } inline Filtering_t filtering(void) const { return m_filtering; } @@ -255,11 +252,13 @@ public: #endif int wrpVRAM; int wrpFBO; + inline bool FlushLogs(void) const { return m_FlushLogs; } int wrpAnisotropic; void SetTexenhOptions(bool value); void SetScreenRes(uint32_t value); void SetAspectmode(AspectMode_t value); void SetLODmode(PixelLevelOfDetail_t value); + void SetVsync(bool value); void SetFiltering(Filtering_t value); void SetSwapMode(SwapMode_t value); void SetGhqFltr(TextureFilter_t value); @@ -298,6 +297,7 @@ private: PixelLevelOfDetail_t m_lodmode; bool m_advanced_options; bool m_texenh_options; + bool m_vsync; TextureFilter_t m_ghq_fltr; TextureEnhancement_t m_ghq_enht; ucode_t m_ucode;