hook DefWindowProcA
This commit is contained in:
parent
34250bf224
commit
f70f67857e
7 changed files with 28 additions and 19 deletions
|
@ -87,7 +87,6 @@ void cfg_load()
|
|||
GET_BOOL(g_config.no_dinput_hook, "no_dinput_hook", FALSE);
|
||||
GET_BOOL(g_config.direct3d_passthrough, "direct3d_passthrough", FALSE);
|
||||
GET_BOOL(g_config.center_cursor_fix, "center_cursor_fix", FALSE);
|
||||
GET_BOOL(g_config.allow_wm_nchittest, "allow_wm_nchittest", FALSE);
|
||||
GET_STRING("fake_mode", "", g_config.fake_mode, sizeof(g_config.fake_mode));
|
||||
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));
|
||||
|
@ -395,7 +394,6 @@ static void cfg_create_ini()
|
|||
"; 7th Legion\n"
|
||||
"[legion]\n"
|
||||
"maxgameticks=25\n"
|
||||
"allow_wm_nchittest=true\n"
|
||||
"singlecpu=false\n"
|
||||
"\n"
|
||||
"; Atrox\n"
|
||||
|
@ -1331,10 +1329,6 @@ static void cfg_create_ini()
|
|||
"checkfile=.\\nox.cfg\n"
|
||||
"maxgameticks=125\n"
|
||||
"\n"
|
||||
"; Nightlong - Union City Conspiracy\n"
|
||||
"[NL]\n"
|
||||
"allow_wm_nchittest=true\n"
|
||||
"\n"
|
||||
"; Outlaws\n"
|
||||
"[olwin]\n"
|
||||
"noactivateapp=true\n"
|
||||
|
|
|
@ -53,6 +53,7 @@ GETMESSAGEAPROC real_GetMessageA = GetMessageA;
|
|||
GETWINDOWPLACEMENTPROC real_GetWindowPlacement = GetWindowPlacement;
|
||||
SETWINDOWPLACEMENTPROC real_SetWindowPlacement = SetWindowPlacement;
|
||||
ENUMDISPLAYSETTINGSAPROC real_EnumDisplaySettingsA = EnumDisplaySettingsA;
|
||||
DEFWINDOWPROCAPROC real_DefWindowProcA = DefWindowProcA;
|
||||
GETKEYSTATEPROC real_GetKeyState = GetKeyState;
|
||||
GETASYNCKEYSTATEPROC real_GetAsyncKeyState = GetAsyncKeyState;
|
||||
GETDEVICECAPSPROC real_GetDeviceCaps = GetDeviceCaps;
|
||||
|
@ -108,6 +109,7 @@ HOOKLIST g_hook_hooklist[] =
|
|||
{ "GetWindowPlacement", (PROC)fake_GetWindowPlacement, (PROC*)&real_GetWindowPlacement, 0 },
|
||||
{ "SetWindowPlacement", (PROC)fake_SetWindowPlacement, (PROC*)&real_SetWindowPlacement, 0 },
|
||||
{ "EnumDisplaySettingsA", (PROC)fake_EnumDisplaySettingsA, (PROC*)&real_EnumDisplaySettingsA, 0 },
|
||||
{ "DefWindowProcA", (PROC)fake_DefWindowProcA, (PROC*)&real_DefWindowProcA, 0 },
|
||||
{ "GetKeyState", (PROC)fake_GetKeyState, (PROC*)&real_GetKeyState, 0 },
|
||||
{ "GetAsyncKeyState", (PROC)fake_GetAsyncKeyState, (PROC*)&real_GetAsyncKeyState, 0 },
|
||||
{ "SetForegroundWindow", (PROC)fake_SetForegroundWindow, (PROC*)&real_SetForegroundWindow, 0 },
|
||||
|
|
|
@ -855,6 +855,17 @@ BOOL WINAPI fake_EnumDisplaySettingsA(LPCSTR lpszDeviceName, DWORD iModeNum, DEV
|
|||
return result;
|
||||
}
|
||||
|
||||
LRESULT WINAPI fake_DefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (g_ddraw.ref && g_ddraw.hwnd && g_ddraw.hwnd == hWnd)
|
||||
{
|
||||
if (Msg == WM_NCHITTEST)
|
||||
return HTCLIENT;
|
||||
}
|
||||
|
||||
return real_DefWindowProcA(hWnd, Msg, wParam, lParam);
|
||||
}
|
||||
|
||||
SHORT WINAPI fake_GetKeyState(int nVirtKey)
|
||||
{
|
||||
if (g_config.windowed && g_ddraw.ref && g_ddraw.hwnd && !util_in_foreground())
|
||||
|
|
|
@ -50,7 +50,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
case WM_CANCELMODE:
|
||||
case WM_DISPLAYCHANGE:
|
||||
{
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
|
@ -88,20 +88,20 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
return 0;
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
case WM_NCACTIVATE:
|
||||
{
|
||||
if (g_config.noactivateapp)
|
||||
{
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case WM_NCHITTEST:
|
||||
{
|
||||
if (g_config.allow_wm_nchittest && (g_mouse_locked || g_config.devmode))
|
||||
if (g_mouse_locked || g_config.devmode)
|
||||
{
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
|
||||
|
@ -128,7 +128,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
CallWindowProcA(g_ddraw.wndproc, hWnd, uMsg, wParam, MAKELPARAM(pt.x, pt.y));
|
||||
}
|
||||
|
||||
LRESULT result = DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
LRESULT result = real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
if (!g_config.resizable)
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
case HTTOP:
|
||||
case HTTOPLEFT:
|
||||
case HTTOPRIGHT:
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
case HTCLIENT:
|
||||
if (!g_mouse_locked && !g_config.devmode)
|
||||
{
|
||||
|
@ -548,7 +548,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
|
||||
}
|
||||
case WM_MOVE:
|
||||
{
|
||||
|
@ -575,7 +575,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
if (g_ddraw.got_child_windows)
|
||||
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam); /* Carmageddon fix */
|
||||
}
|
||||
case WM_RESTORE_STYLE:
|
||||
{
|
||||
|
@ -606,7 +606,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
if (wParam == SC_MAXIMIZE)
|
||||
{
|
||||
if (IsWine())
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
if (g_config.resizable)
|
||||
{
|
||||
|
@ -626,7 +626,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
return 0;
|
||||
|
||||
if (!GameHandlesClose)
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
{
|
||||
if (wParam == VK_TAB || (wParam && wParam == g_config.hotkeys.toggle_fullscreen))
|
||||
{
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return real_DefWindowProcA(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue