From 5336f7d1ece2b4e3685272bc83ddb3ab8ef80593 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Sun, 29 Sep 2024 02:27:14 +0200 Subject: [PATCH] make sure we don't get a blackscreen if device doesn't support StretchDIBits --- src/render_gdi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/render_gdi.c b/src/render_gdi.c index 5ad3586715..c7292ed471 100644 --- a/src/render_gdi.c +++ b/src/render_gdi.c @@ -99,14 +99,17 @@ DWORD WINAPI gdi_render_main(void) FillRect(g_ddraw.render.hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); } + int lines_copied = 0; + if (g_ddraw.bnet_active) { RECT rc = { 0, 0, g_ddraw.render.width, g_ddraw.render.height }; FillRect(g_ddraw.render.hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); + lines_copied = 1; } else if (upscale_hack) { - real_StretchDIBits( + lines_copied = real_StretchDIBits( g_ddraw.render.hdc, g_ddraw.render.viewport.x, g_ddraw.render.viewport.y, @@ -124,7 +127,7 @@ DWORD WINAPI gdi_render_main(void) else if (!g_ddraw.child_window_exists && (g_ddraw.render.width != g_ddraw.width || g_ddraw.render.height != g_ddraw.height)) { - real_StretchDIBits( + lines_copied = real_StretchDIBits( g_ddraw.render.hdc, g_ddraw.render.viewport.x, g_ddraw.render.viewport.y, @@ -139,7 +142,8 @@ DWORD WINAPI gdi_render_main(void) DIB_RGB_COLORS, SRCCOPY); } - else + + if (lines_copied == 0 || lines_copied == GDI_ERROR) { real_SetDIBitsToDevice( g_ddraw.render.hdc,