From 03eae57166433d7aec37dd64375e1c14a5200d03 Mon Sep 17 00:00:00 2001 From: blattersturm Date: Sat, 18 Dec 2021 23:42:01 +0100 Subject: [PATCH] fix(conhost): don't pass F8 to underlying game code Since we want to use F8 as a 'secure attention' key later on, this should not be captured by any game/user code. --- code/components/conhost-v2/src/ConsoleHost.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/components/conhost-v2/src/ConsoleHost.cpp b/code/components/conhost-v2/src/ConsoleHost.cpp index f8aa4d6859..c84f1732d6 100644 --- a/code/components/conhost-v2/src/ConsoleHost.cpp +++ b/code/components/conhost-v2/src/ConsoleHost.cpp @@ -131,6 +131,16 @@ static InitFunction initFunction([] () InputHook::DeprecatedOnWndProc.Connect([](HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, bool& pass, LRESULT& lresult) { + // prevent the game from knowing we pressed F8 + if (msg == WM_KEYDOWN || msg == WM_KEYUP) + { + if (wParam == VK_F8) + { + pass = false; + } + } + + // save the last console flag hadConsoleFlag = g_consoleFlag; ProcessWndProc(hWnd, msg, wParam, lParam, pass, lresult);