#251 hook GetMessage for Enemy Infestation
This commit is contained in:
parent
43aa290d1e
commit
24a73ccc6d
6 changed files with 32 additions and 7 deletions
|
@ -62,6 +62,7 @@ void cfg_load()
|
|||
GET_INT(g_config.resolutions, "resolutions", RESLIST_NORMAL);
|
||||
GET_INT(g_config.fixchilds, "fixchilds", FIX_CHILDS_DETECT_PAINT);
|
||||
GET_BOOL(g_config.hook_peekmessage, "hook_peekmessage", FALSE);
|
||||
GET_BOOL(g_config.hook_getmessage, "hook_getmessage", FALSE);
|
||||
|
||||
/* Undocumented settings */
|
||||
|
||||
|
@ -264,8 +265,9 @@ static void cfg_create_ini()
|
|||
"; Note: Disables upscaling if a child window was detected (to ensure the game is fully playable, may look weird though)\n"
|
||||
"fixchilds=2\n"
|
||||
"\n"
|
||||
"; Enable the following setting if your cursor doesn't work properly when upscaling is enabled\n"
|
||||
"; Enable one of the following settings if your cursor doesn't work properly when upscaling is enabled\n"
|
||||
"hook_peekmessage=false\n"
|
||||
"hook_getmessage=false\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"; Undocumented settings - You may or may not change these (You should rather focus on the settings above)\n"
|
||||
|
|
|
@ -47,6 +47,7 @@ STRETCHDIBITSPROC real_StretchDIBits = StretchDIBits;
|
|||
SETFOREGROUNDWINDOWPROC real_SetForegroundWindow = SetForegroundWindow;
|
||||
SETWINDOWSHOOKEXAPROC real_SetWindowsHookExA = SetWindowsHookExA;
|
||||
PEEKMESSAGEAPROC real_PeekMessageA = PeekMessageA;
|
||||
GETMESSAGEAPROC real_GetMessageA = GetMessageA;
|
||||
GETDEVICECAPSPROC real_GetDeviceCaps = GetDeviceCaps;
|
||||
CREATEFONTINDIRECTAPROC real_CreateFontIndirectA = CreateFontIndirectA;
|
||||
CREATEFONTAPROC real_CreateFontA = CreateFontA;
|
||||
|
@ -90,6 +91,7 @@ HOOKLIST g_hook_hooklist[] =
|
|||
{ "GetTopWindow", (PROC)fake_GetTopWindow, (PROC*)&real_GetTopWindow, 0 },
|
||||
{ "GetForegroundWindow", (PROC)fake_GetForegroundWindow, (PROC*)&real_GetForegroundWindow, 0 },
|
||||
{ "PeekMessageA", (PROC)fake_PeekMessageA, (PROC*)&real_PeekMessageA, 0 },
|
||||
{ "GetMessageA", (PROC)fake_GetMessageA, (PROC*)&real_GetMessageA, 0 },
|
||||
{ "SetForegroundWindow", (PROC)fake_SetForegroundWindow, (PROC*)&real_SetForegroundWindow, 0 },
|
||||
{ "SetWindowsHookExA", (PROC)fake_SetWindowsHookExA, (PROC*)&real_SetWindowsHookExA, 0 },
|
||||
{ "", NULL, NULL, 0 }
|
||||
|
|
|
@ -593,11 +593,9 @@ HHOOK WINAPI fake_SetWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hmod, D
|
|||
return real_SetWindowsHookExA(idHook, lpfn, hmod, dwThreadId);
|
||||
}
|
||||
|
||||
BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
|
||||
BOOL HandleMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
|
||||
{
|
||||
BOOL result = real_PeekMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
|
||||
|
||||
if (result && g_ddraw && g_ddraw->width && g_config.hook_peekmessage)
|
||||
if (g_ddraw && g_ddraw->width)
|
||||
{
|
||||
switch (lpMsg->message)
|
||||
{
|
||||
|
@ -690,10 +688,30 @@ BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT w
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI fake_GetMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
|
||||
{
|
||||
BOOL result = real_GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
|
||||
|
||||
if (result && g_config.hook_getmessage)
|
||||
HandleMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL WINAPI fake_PeekMessageA(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg)
|
||||
{
|
||||
BOOL result = real_PeekMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
|
||||
|
||||
if (result && g_config.hook_peekmessage)
|
||||
HandleMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue