From c7312c2c07b73958ede09bfa4bc69c6d31a6f680 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Wed, 12 Jun 2024 02:47:31 +0200 Subject: [PATCH] allow to toggle windowed mode with F4 in HoMM games --- inc/config.h | 1 + src/config.c | 7 +++++++ src/wndproc.c | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/inc/config.h b/inc/config.h index f6744a4..f0b8275 100644 --- a/inc/config.h +++ b/inc/config.h @@ -103,6 +103,7 @@ typedef struct CNCDDRAWCONFIG BOOL stronghold_hack; BOOL mgs_hack; BOOL tlc_hack; + BOOL homm_hack; } CNCDDRAWCONFIG; diff --git a/src/config.c b/src/config.c index 79a945d..80c787e 100644 --- a/src/config.c +++ b/src/config.c @@ -113,6 +113,7 @@ void cfg_load() GET_BOOL(g_config.stronghold_hack, "stronghold_hack", FALSE); GET_BOOL(g_config.mgs_hack, "mgs_hack", FALSE); GET_BOOL(g_config.tlc_hack, "tlc_hack", FALSE); + GET_BOOL(g_config.homm_hack, "homm_hack", FALSE); GameHandlesClose = GameHandlesClose || g_config.infantryhack; @@ -874,11 +875,17 @@ static void cfg_create_ini() "[Heroes3]\n" "renderer=opengl\n" "game_handles_close=true\n" + "homm_hack=true\n" "\n" "; Heroes of Might and Magic III HD Mod\n" "[Heroes3 HD]\n" "renderer=opengl\n" "game_handles_close=true\n" + "homm_hack=true\n" + "\n" + "; Heroes of Might and Magic IV\n" + "[heroes4]\n" + "homm_hack=true\n" "\n" "; Hard Truck: Road to Victory\n" "[htruck]\n" diff --git a/src/wndproc.c b/src/wndproc.c index 43abdcf..ebde744 100644 --- a/src/wndproc.c +++ b/src/wndproc.c @@ -777,6 +777,12 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam } case WM_KEYDOWN: { + if (g_config.homm_hack && wParam == VK_F4) /* Heroes of Might and Magic 3 and 4 */ + { + util_toggle_fullscreen(); + return 0; + } + if (g_config.hotkeys.unlock_cursor1 && (wParam == VK_CONTROL || wParam == g_config.hotkeys.unlock_cursor1)) { @@ -808,6 +814,9 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam } case WM_KEYUP: { + if (g_config.homm_hack && wParam == VK_F4) /* Heroes of Might and Magic 3 and 4 */ + return 0; + if (g_config.hotkeys.screenshot && wParam == g_config.hotkeys.screenshot) ss_take_screenshot(g_ddraw.primary);