commit 8edbbe8acfc2ac01a9e2d202692cf37eeee5c325
Author: Jonathan Dowland <jon+github@alcopop.org>
AuthorDate: Mon Feb 20 18:16:13 2017 +0000
Commit: Jonathan Dowland <jon+github@alcopop.org>
CommitDate: Mon Feb 20 18:16:13 2017 +0000
VGA porch emulation: make optional
Based on feedback.
---
src/i_video.c | 17 +++++++++++++----
src/i_video.h | 1 +
src/m_config.c | 7 +++++++
src/setup/display.c | 4 ++++
4 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/i_video.c b/src/i_video.c
index 759d9776..73707f9a 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -126,6 +126,10 @@ int fullscreen = true;
int aspect_ratio_correct = true;
+// VGA Porch palette change emulation
+
+int vga_porch_flash = false;
+
// Force software rendering, for systems which lack effective hardware
// acceleration
@@ -740,11 +744,15 @@ void I_FinishUpdate (void)
if (palette_to_set)
{
SDL_SetPaletteColors(screenbuffer->format->palette, palette, 0, 256);
- // "flash" the pillars/letterboxes with palette changes, emulating
- // VGA "porch" behaviour (GitHub issue #832)
- SDL_SetRenderDrawColor(renderer, palette[0].r, palette[0].g,
- palette[0].b, SDL_ALPHA_OPAQUE);
palette_to_set = false;
+
+ if (vga_porch_flash)
+ {
+ // "flash" the pillars/letterboxes with palette changes, emulating
+ // VGA "porch" behaviour (GitHub issue #832)
+ SDL_SetRenderDrawColor(renderer, palette[0].r, palette[0].g,
+ palette[0].b, SDL_ALPHA_OPAQUE);
+ }
}
// Blit from the paletted 8-bit screen buffer to the intermediate
@@ -1393,6 +1401,7 @@ void I_BindVideoVariables(void)
M_BindIntVariable("fullscreen", &fullscreen);
M_BindIntVariable("video_display", &video_display);
M_BindIntVariable("aspect_ratio_correct", &aspect_ratio_correct);
+ M_BindIntVariable("vga_porch_flash", &vga_porch_flash);
M_BindIntVariable("startup_delay", &startup_delay);
M_BindIntVariable("fullscreen_width", &fullscreen_width);
M_BindIntVariable("fullscreen_height", &fullscreen_height);
diff --git a/src/i_video.h b/src/i_video.h
index a4ac1a79..3184bae3 100644
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -90,6 +90,7 @@ extern int screen_width;
extern int screen_height;
extern int fullscreen;
extern int aspect_ratio_correct;
+extern int vga_porch_flash;
extern int force_software_renderer;
#endif
diff --git a/src/m_config.c b/src/m_config.c
index bf215e27..9bc96782 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -727,6 +727,13 @@ static default_t extra_defaults_list[] =
CONFIG_VARIABLE_INT(aspect_ratio_correct),
+ //!
+ // If non-zero, any pillar/letter boxes drawn around the game area
+ // will "flash" when the game palette changes, simulating the VGA
+ // "porch"
+
+ CONFIG_VARIABLE_INT(vga_porch_flash),
+
//!
// Window width when running in windowed mode.
//
diff --git a/src/setup/display.c b/src/setup/display.c
index 9db3cc57..e9533c89 100644
--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -66,6 +66,7 @@ static window_size_t window_sizes_scaled[] =
static char *video_driver = "";
static char *window_position = "";
static int aspect_ratio_correct = 1;
+static int vga_porch_flash = 0;
static int force_software_renderer = 0;
static int fullscreen = 1;
static int fullscreen_width = 0, fullscreen_height = 0;
@@ -205,6 +206,8 @@ static void AdvancedDisplayConfig(TXT_UNCAST_ARG(widget),
TXT_NewCheckBox("Save screenshots in PNG format",
&png_screenshots),
#endif
+ TXT_NewCheckBox("Flash borders (VGA porch emulation)",
+ &vga_porch_flash),
NULL);
TXT_SignalConnect(ar_checkbox, "changed", GenerateSizesTable, sizes_table);
@@ -260,6 +263,7 @@ void BindDisplayVariables(void)
M_BindStringVariable("window_position", &window_position);
M_BindIntVariable("usegamma", &usegamma);
M_BindIntVariable("png_screenshots", &png_screenshots);
+ M_BindIntVariable("vga_porch_flash", &vga_porch_flash);
M_BindIntVariable("force_software_renderer", &force_software_renderer);
M_BindIntVariable("max_scaling_buffer_pixels", &max_scaling_buffer_pixels);