From fb12ad842d1798184519375535641f872e50fdfe Mon Sep 17 00:00:00 2001 From: AnotherSeawhite <52661206+AnotherSeawhite@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:33:50 +0900 Subject: [PATCH 1/4] option --- src/options.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/options.cpp b/src/options.cpp index ffe1c0c269bc7..2675d931d5b99 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -2648,6 +2648,13 @@ void options_manager::add_options_graphics() false, COPT_CURSES_HIDE ); + #if defined(SDL_HINT_RENDER_VSYNC) + add( "VSYNC", graphics, translate_marker( "Use VSync" ), + translate_marker( "Enable vertical synchronization to prevent screen tearing. VSync can slow the game down a lot. Requires restart." ), + false, COPT_CURSES_HIDE + ); +#endif + #if defined(__ANDROID__) get_option( "FRAMEBUFFER_ACCEL" ).setPrerequisite( "SOFTWARE_RENDERING" ); #else From 2080a2011af887a9193613c62e0a5de553f98ab9 Mon Sep 17 00:00:00 2001 From: AnotherSeawhite <52661206+AnotherSeawhite@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:38:34 +0900 Subject: [PATCH 2/4] sdltiles --- src/sdltiles.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sdltiles.cpp b/src/sdltiles.cpp index d99ad5eb431fd..d2f072b524bc3 100644 --- a/src/sdltiles.cpp +++ b/src/sdltiles.cpp @@ -360,8 +360,12 @@ static void WinCreate() if( !software_renderer ) { dbg( D_INFO ) << "Attempting to initialize accelerated SDL renderer."; - renderer.reset( SDL_CreateRenderer( ::window.get(), renderer_id, SDL_RENDERER_ACCELERATED | - SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE ) ); + int init_flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE; + if( get_option( "VSYNC" ) ) { + init_flags |= SDL_RENDERER_PRESENTVSYNC; + } + + renderer.reset( SDL_CreateRenderer( ::window.get(), renderer_id, init_flags ) ); if( printErrorIf( !renderer, "Failed to initialize accelerated renderer, falling back to software rendering" ) ) { software_renderer = true; From 44761adc9322fc5edc9b01cad7bb1eb59a22e2a9 Mon Sep 17 00:00:00 2001 From: AnotherSeawhite <52661206+AnotherSeawhite@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:41:01 +0900 Subject: [PATCH 3/4] Update src/options.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/options.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/options.cpp b/src/options.cpp index 2675d931d5b99..a768432169b63 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -2648,11 +2648,11 @@ void options_manager::add_options_graphics() false, COPT_CURSES_HIDE ); - #if defined(SDL_HINT_RENDER_VSYNC) - add( "VSYNC", graphics, translate_marker( "Use VSync" ), - translate_marker( "Enable vertical synchronization to prevent screen tearing. VSync can slow the game down a lot. Requires restart." ), - false, COPT_CURSES_HIDE - ); +#if defined(SDL_HINT_RENDER_VSYNC) + add( "VSYNC", graphics, translate_marker( "Use VSync" ), + translate_marker( "Enable vertical synchronization to prevent screen tearing. VSync can slow the game down a lot. Requires restart." ), + false, COPT_CURSES_HIDE + ); #endif #if defined(__ANDROID__) From 36464c47b4df02ded0d83b23d0bd0c51963176d3 Mon Sep 17 00:00:00 2001 From: AnotherSeawhite <52661206+AnotherSeawhite@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:41:10 +0900 Subject: [PATCH 4/4] Update src/options.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/options.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/options.cpp b/src/options.cpp index a768432169b63..921364d86a630 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -2654,7 +2654,6 @@ void options_manager::add_options_graphics() false, COPT_CURSES_HIDE ); #endif - #if defined(__ANDROID__) get_option( "FRAMEBUFFER_ACCEL" ).setPrerequisite( "SOFTWARE_RENDERING" ); #else