1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

add some more checks to fixnotresponding patch

This commit is contained in:
FunkyFr3sh 2024-09-02 13:09:47 +02:00
parent 4e8253e873
commit aac405031e
4 changed files with 29 additions and 6 deletions

View File

@ -153,6 +153,7 @@ typedef struct CNCDDRAW
BOOL child_window_exists;
BOOL got_child_windows;
DWORD last_set_window_pos_tick; /* WINE hack */
DWORD last_msg_pull_tick;
SPEEDLIMITER ticks_limiter;
SPEEDLIMITER flip_limiter;
DWORD minfps_tick_len;

View File

@ -1021,9 +1021,13 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
if (g_config.remove_menu && GetMenu(g_ddraw.hwnd))
SetMenu(g_ddraw.hwnd, NULL);
if (!IsWine())
if (g_ddraw.last_msg_pull_tick + 1000 < timeGetTime() &&
GetCurrentThreadId() == g_ddraw.gui_thread_id &&
!IsWine())
{
MSG msg; /* workaround for "Not Responding" window problem in cnc games */
/* workaround for "Not Responding" window problem in cnc games */
g_ddraw.last_msg_pull_tick = timeGetTime();
MSG msg;
real_PeekMessageA(&msg, g_ddraw.hwnd, 0, 0, PM_NOREMOVE | PM_QS_INPUT);
}

View File

@ -50,9 +50,15 @@ HRESULT dds_Blt(
dbg_dump_dds_blt_flags(dwFlags);
dbg_dump_dds_blt_fx_flags((dwFlags & DDBLT_DDFX) && lpDDBltFx ? lpDDBltFx->dwDDFX : 0);
if (g_ddraw.ref && g_config.fixnotresponding && !IsWine())
if (g_config.fixnotresponding &&
g_ddraw.hwnd &&
g_ddraw.last_msg_pull_tick + 1000 < timeGetTime() &&
GetCurrentThreadId() == g_ddraw.gui_thread_id &&
!IsWine())
{
MSG msg; /* workaround for "Not Responding" window problem */
/* workaround for "Not Responding" window problem */
g_ddraw.last_msg_pull_tick = timeGetTime();
MSG msg;
real_PeekMessageA(&msg, g_ddraw.hwnd, 0, 0, PM_NOREMOVE);
}
@ -988,9 +994,15 @@ HRESULT dds_Lock(
dbg_dump_dds_lock_flags(dwFlags);
if (g_ddraw.ref && g_config.fixnotresponding && !IsWine())
if (g_config.fixnotresponding &&
g_ddraw.hwnd &&
g_ddraw.last_msg_pull_tick + 1000 < timeGetTime() &&
GetCurrentThreadId() == g_ddraw.gui_thread_id &&
!IsWine())
{
MSG msg; /* workaround for "Not Responding" window problem */
/* workaround for "Not Responding" window problem */
g_ddraw.last_msg_pull_tick = timeGetTime();
MSG msg;
real_PeekMessageA(&msg, g_ddraw.hwnd, 0, 0, PM_NOREMOVE);
}

View File

@ -710,6 +710,9 @@ BOOL HandleMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMa
BOOL WINAPI fake_GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
{
if (g_ddraw.ref && hWnd == g_ddraw.hwnd)
g_ddraw.last_msg_pull_tick = timeGetTime();
BOOL result = real_GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
if (result && lpMsg && g_ddraw.ref && g_ddraw.hwnd && g_ddraw.width && !g_config.fixmousehook)
@ -745,6 +748,9 @@ BOOL WINAPI fake_GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wM
BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
{
if (g_ddraw.ref && hWnd == g_ddraw.hwnd)
g_ddraw.last_msg_pull_tick = timeGetTime();
BOOL result = real_PeekMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
if (result && lpMsg && g_ddraw.ref && g_ddraw.hwnd && g_ddraw.width && !g_config.fixmousehook)