From b8632698a48bac1b9cefa20b54dd425a38524879 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Wed, 8 May 2024 09:04:19 +0200 Subject: [PATCH] tweak low res function checks --- src/utils.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/utils.c b/src/utils.c index 52a1ff7114..9afa97151e 100644 --- a/src/utils.c +++ b/src/utils.c @@ -685,12 +685,15 @@ BOOL util_detect_low_res_screen() } else if (g_ddraw.isworms2) { - if (*pW2DS && (*pW2DS)->RenderWidth && (*pW2DS)->RenderWidth < g_ddraw.width && (*pW2DS)->RenderHeight < g_ddraw.height) + DWORD w2_width = *pW2DS ? (*pW2DS)->RenderWidth : 0; + DWORD w2_height = *pW2DS ? (*pW2DS)->RenderHeight : 0; + + if (w2_width && w2_width < g_ddraw.width && w2_height && w2_height < g_ddraw.height) { - if (g_ddraw.upscale_hack_width != (*pW2DS)->RenderWidth || g_ddraw.upscale_hack_height != (*pW2DS)->RenderHeight) + if (g_ddraw.upscale_hack_width != w2_width || g_ddraw.upscale_hack_height != w2_height) { - g_ddraw.upscale_hack_width = (*pW2DS)->RenderWidth; - g_ddraw.upscale_hack_height = (*pW2DS)->RenderHeight; + g_ddraw.upscale_hack_width = w2_width; + g_ddraw.upscale_hack_height = w2_height; InterlockedExchange(&g_ddraw.upscale_hack_active, FALSE); }