From 856ce8a3af14a11c77ee49f6450ecfde8b1381af Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Fri, 18 Oct 2024 18:42:46 +0200 Subject: [PATCH] add preset for Hooligans: Storm over Europe --- inc/config.h | 1 + src/config.c | 6 ++++++ src/ddsurface.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/inc/config.h b/inc/config.h index a736411..60c6eea 100644 --- a/inc/config.h +++ b/inc/config.h @@ -78,6 +78,7 @@ typedef struct CNCDDRAWCONFIG BOOL lock_mouse_top_left; char win_version[32]; int hook; + BOOL limit_gdi_handles; BOOL remove_menu; int refresh_rate; diff --git a/src/config.c b/src/config.c index f323d29..63d04cf 100644 --- a/src/config.c +++ b/src/config.c @@ -91,6 +91,7 @@ void cfg_load() GET_BOOL(g_config.lock_mouse_top_left, "lock_mouse_top_left", FALSE); GET_STRING("win_version", "", g_config.win_version, sizeof(g_config.win_version)); GET_INT(g_config.hook, "hook", 4); + GET_BOOL(g_config.limit_gdi_handles, "limit_gdi_handles", FALSE); GET_BOOL(g_config.remove_menu, "remove_menu", FALSE); GET_INT(g_config.refresh_rate, "refresh_rate", 0); @@ -334,6 +335,7 @@ static void cfg_create_ini() "lock_mouse_top_left=false\n" ";win_version=95\n" "hook=4\n" + "limit_gdi_handles=false\n" "remove_menu=false\n" "refresh_rate=0\n" "\n" @@ -1028,6 +1030,10 @@ static void cfg_create_ini() "renderer=opengl\n" "noactivateapp=true\n" "\n" + "; Hooligans: Storm over Europe\n" + "[hooligans]\n" + "limit_gdi_handles=true\n" + "\n" "; Icewind Dale 2\n" "; Note: 'Full Screen' must be enabled in Config.exe\n" "; Note: 1070x602 is the lowest possible 16:9 resolution for the Widescreen patch (600/601 height will crash)\n" diff --git a/src/ddsurface.c b/src/ddsurface.c index 20ddd4f..b073f6d 100644 --- a/src/ddsurface.c +++ b/src/ddsurface.c @@ -1500,7 +1500,7 @@ HRESULT dd_CreateSurface( } /* Claw hack: 128x128 surfaces need a DC for custom levels to work properly */ - if (InterlockedExchangeAdd(&g_dds_gdi_handles, 0) < 4000 || + if ((!g_config.limit_gdi_handles && InterlockedExchangeAdd(&g_dds_gdi_handles, 0) < 9000) || (dst_surface->width == g_ddraw.width && dst_surface->height == g_ddraw.height) || (dst_surface->width == 128 && dst_surface->height == 128)) {