From bca40480631fc2351c708e171880ecce0e8efe3e Mon Sep 17 00:00:00 2001 From: Jenny White Date: Sat, 28 Apr 2018 19:31:34 +0300 Subject: [PATCH] add hook logging, update CMakeLists --- CMakeLists.txt | 15 +++++++++++---- src/hooks.cpp | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f406c787..bead20b6 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type") endif() +set(CMAKE_BUILD_TYPE_VALUES "Debug;Release" CACHE INTERNAL "List of supported build") +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_BUILD_TYPE_VALUES}) cmake_minimum_required(VERSION 3.0) project(cathook VERSION 0.0.1 DESCRIPTION "Free Source Engine Trainer") @@ -13,8 +15,6 @@ set(Game "tf2" CACHE STRING "Target game") set(GameValues "tf2;hl2dm;dab;tf2c;css;dynamic" CACHE INTERNAL "List of supported game types") set_property(CACHE Game PROPERTY STRINGS ${GameValues}) -set(CMAKE_BUILD_TYPE_VALUES "Debug;Release" CACHE INTERNAL "List of supported build") -set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_BUILD_TYPE_VALUES}) set(EnableVisuals 1 CACHE BOOL "Enable Visuals") set(ExternalDrawing 0 CACHE BOOL "External Visuals") @@ -105,7 +105,7 @@ target_include_directories(cathook SYSTEM PRIVATE target_include_directories(cathook PRIVATE "ucccccp") if(EnableWarnings) - target_compile_options(cathook PRIVATE -Wundef -Werror) + target_compile_options(cathook PRIVATE -Wundef) endif() add_subdirectory(include) @@ -118,4 +118,11 @@ add_custom_target(data # TODO glez_LIBRARIES? target_link_libraries(cathook ${ValveLibraryTier0} ${ValveLibraryVStdLib} ssl stdc++) -set_target_properties(cathook PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) \ No newline at end of file +set_target_properties(cathook PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# Strip +if(CMAKE_BUILD_TYPE STREQUAL "Release") + message("Stripping info from library") + add_custom_command(TARGET cathook POST_BUILD + COMMAND strip --strip-all "$") +endif() \ No newline at end of file diff --git a/src/hooks.cpp b/src/hooks.cpp index 36a525d5..dfca7408 100755 --- a/src/hooks.cpp +++ b/src/hooks.cpp @@ -79,8 +79,8 @@ void *VMTHook::GetMethod(uint32_t idx) const void VMTHook::HookMethod(ptr_t func, uint32_t idx) { - logging::Info("Hooking method %d of vtable 0x%08x, replacing 0x%08x", idx, - vtable_original, GetMethod(idx)); + logging::Info("Hooking method %d of vtable 0x%08x, replacing 0x%08x with 0x%08x", idx, + vtable_original, GetMethod(idx), func); vtable_hooked[2 + idx] = func; }