From 1336d0b2b51f0f93a0e3be06555bf2ca1bc09e29 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Sun, 15 Jan 2023 16:45:00 +0100 Subject: [PATCH] Reset background and dither flags when switching video modes. Fixes flickering background. --- display.c | 16 ++++++++-------- input.c | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/display.c b/display.c index 9d55a46..a91eac9 100644 --- a/display.c +++ b/display.c @@ -57,14 +57,6 @@ void display_init() int screenHeight; display_reset(GetVideoMode(), 0, &screenHeight); - // Set and enable clear color - setRGB0(&draw[0], 49, 77, 121); - setRGB0(&draw[1], 49, 77, 121); - draw[0].isbg = 1; - draw[0].dtd = 1; - draw[1].isbg = 1; - draw[1].dtd = 1; - // Clear double buffer counter db = 0; @@ -134,6 +126,14 @@ void display_reset(int mode, u_char interlaced, int *outScreenHeight) disp[0].screen.y = disp[1].screen.y = yOffset; disp[0].screen.h = disp[1].screen.h = screenHeight; + // Set and enable clear color + setRGB0(&draw[0], 49, 77, 121); + setRGB0(&draw[1], 49, 77, 121); + draw[0].isbg = 1; + draw[0].dtd = 1; + draw[1].isbg = 1; + draw[1].dtd = 1; + gte_SetGeomOffset(SCREENWIDTH >> 1, screenHeight >> 1); if (outScreenHeight != NULL) diff --git a/input.c b/input.c index 8dd5d80..a75241c 100644 --- a/input.c +++ b/input.c @@ -11,7 +11,7 @@ static const int moveSpeed = 1024; static const short rotSpeed = 1024; static const char deadZone = 0x30; -static u_char disp_interlace = 0; +static u_char dispmode = 0; static u_char dispmode_held = 0; void input_init() @@ -106,7 +106,8 @@ void input_process() if (!dispmode_held) { dispmode_held = 1; - disp_interlace = !disp_interlace; + //dispmode = (dispmode + 1) & 0x3; + //display_reset(!!(dispmode & 2), !!(dispmode & 1), NULL); display_reset(!GetVideoMode(), 0, NULL); } }