From dfe15ec8b049e24cc5479f040c621c9a127a28a2 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Fri, 7 Jul 2023 23:54:59 +0200 Subject: [PATCH] fix for HOMM4 cursor issues --- src/dd.c | 4 +++- src/mouse.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dd.c b/src/dd.c index 119d738..39068c3 100644 --- a/src/dd.c +++ b/src/dd.c @@ -922,7 +922,9 @@ HRESULT dd_SetCooperativeLevel(HWND hwnd, DWORD dwFlags) if (!g_ddraw->devmode) { HCURSOR cursor = real_SetCursor(LoadCursor(NULL, IDC_ARROW)); - InterlockedExchange((LONG*)&g_ddraw->old_cursor, (LONG)cursor); + + if (cursor != LoadCursor(NULL, IDC_WAIT)) + InterlockedExchange((LONG*)&g_ddraw->old_cursor, (LONG)cursor); } int cursor_count = real_ShowCursor(TRUE) - 1; diff --git a/src/mouse.c b/src/mouse.c index d2ead61..e54438d 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -61,6 +61,7 @@ void mouse_unlock() g_mouse_locked = FALSE; real_ClipCursor(NULL); + //ReleaseCapture(); RECT rc = { 0 }; real_GetClientRect(g_ddraw->hwnd, &rc); @@ -74,6 +75,8 @@ void mouse_unlock() (int)(rc.left + (cur_x * g_ddraw->render.scale_w)), (int)(rc.top + (cur_y * g_ddraw->render.scale_h))); + real_SetCursor(LoadCursor(NULL, IDC_ARROW)); + while (real_ShowCursor(TRUE) < 0); } }