From fc99383f2149ee3d446c2d015a5ad02cde337165 Mon Sep 17 00:00:00 2001
From: FunkyFr3sh <cc.red.alert.1@googlemail.com>
Date: Fri, 30 Aug 2024 10:25:38 +0200
Subject: [PATCH] lie about SIZEPALETTE and NUMCOLORS in GetDeviceCaps

---
 src/winapi_hooks.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/winapi_hooks.c b/src/winapi_hooks.c
index 40a4c96..86e95b2 100644
--- a/src/winapi_hooks.c
+++ b/src/winapi_hooks.c
@@ -856,13 +856,18 @@ int WINAPI fake_GetDeviceCaps(HDC hdc, int index)
     {
         return g_ddraw.bpp;
     }
-    
-    if (g_ddraw.ref &&
-        g_ddraw.bpp == 8 &&
-        index == RASTERCAPS &&
-        (g_config.hook != 2 || g_ddraw.renderer == gdi_render_main))
+
+    if (g_ddraw.ref && g_ddraw.bpp == 8 && (g_config.hook != 2 || g_ddraw.renderer == gdi_render_main))
     {
-        return RC_PALETTE | real_GetDeviceCaps(hdc, index);
+        if (index == RASTERCAPS)
+        {
+            return RC_PALETTE | real_GetDeviceCaps(hdc, index);
+        }
+
+        if (index == SIZEPALETTE || index == NUMCOLORS)
+        {
+            return 256;
+        }
     }
 
     return real_GetDeviceCaps(hdc, index);