From 07a9ba78db4869752dfb6c56eace604a7d762242 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Mon, 27 May 2024 23:33:47 +0200 Subject: [PATCH] set default values in SetDisplayMode --- src/dd.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/dd.c b/src/dd.c index 53faeec..cd03c7b 100644 --- a/src/dd.c +++ b/src/dd.c @@ -578,6 +578,30 @@ HRESULT dd_RestoreDisplayMode() HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFlags) { + if (!dwWidth) + { + dwWidth = g_ddraw.width; + + if (!dwWidth) + dwWidth = 800; + } + + if (!dwHeight) + { + dwHeight = g_ddraw.height; + + if (!dwHeight) + dwHeight = 600; + } + + if (!dwBPP) + { + dwBPP = g_ddraw.bpp; + + if (!dwBPP) + dwBPP = 16; + } + if (dwBPP != 8 && dwBPP != 16 && dwBPP != 32) return DDERR_INVALIDMODE;