From 79040ef9c1734fcd42005e644960eb55249e1d47 Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Thu, 17 Dec 2020 13:12:23 +0600 Subject: [PATCH] Fixed controls getting locked when using menu --- CMakeLists.txt | 10 ++++++++++ src/CMakeLists.txt | 14 +++++++------- src/Hook.cpp | 8 +++++--- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bb57eb..75ed59b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,16 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(CheatMenu CXX) set(PROJECT_NAME CheatMenu) +################################################################################ +# Configure paths +################################################################################ +set(GTA_SA_DIR F:/GTASanAndreas) + +# Can ignore the below paths if you got them (yes by default) in system paths +set(PLUGIN_SDK_DIR $ENV{PLUGIN_SDK_DIR}) +set(DX9_DIR $ENV{DIRECTX9_SDK_DIR}) +################################################################################ + ################################################################################ # This contains the utility functions needed for sub project, src/CMakeLists.txt # Need to clean things up later, maybe switch to original cmake alternatives diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b22ede3..e7965b0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -96,7 +96,7 @@ string(CONCAT "MSVC_RUNTIME_LIBRARY_STR" ) set_target_properties(${PROJECT_NAME} PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "F:/GTASanAndreas/$<0:>/" + RUNTIME_OUTPUT_DIRECTORY "${GTA_SA_DIR}/$<0:>/" SUFFIX ".asi" MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY_STR} ) @@ -105,11 +105,11 @@ set_target_properties(${PROJECT_NAME} PROPERTIES # Include directories ################################################################################ include_directories( - "$ENV{PLUGIN_SDK_DIR}/plugin_sa" - "$ENV{PLUGIN_SDK_DIR}/plugin_sa/game_sa" - "$ENV{PLUGIN_SDK_DIR}/shared" - "$ENV{PLUGIN_SDK_DIR}/shared/game" - "$ENV{DIRECTX9_SDK_DIR}/include" + "${PLUGIN_SDK_DIR}/plugin_sa" + "${PLUGIN_SDK_DIR}/plugin_sa/game_sa" + "${PLUGIN_SDK_DIR}/shared" + "${PLUGIN_SDK_DIR}/shared/game" + "${DX9_DIR}/include" ) ################################################################################ @@ -237,7 +237,7 @@ XInput9_1_0 ) target_link_directories(${PROJECT_NAME} PUBLIC - "$ENV{PLUGIN_SDK_DIR}/output/lib/" + "${PLUGIN_SDK_DIR}/output/lib/" "$ENV{DIRECTX9_SDK_DIR}/lib/x86/" "external/kiero/minhook/lib/" ) diff --git a/src/Hook.cpp b/src/Hook.cpp index fe592af..ca14608 100644 --- a/src/Hook.cpp +++ b/src/Hook.cpp @@ -17,8 +17,11 @@ LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam { ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam); - if (ImGui::GetIO().WantCaptureKeyboard) - return 1; + if (ImGui::GetIO().WantTextInput) + { + Call<0x53F1E0>(); // CPad::ClearKeyboardHistory + return 1; + } else return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam); } @@ -176,7 +179,6 @@ void Hook::ShowMouse(bool state) // Broken in psdk Call<0x541BD0>(); // CPad::ClearMouseHistory - Call<0x53F1E0>(); // CPad::ClearKeyboardHistory Call<0x541DD0>(); // CPad::UpdatePads }