add hook logging, update CMakeLists
This commit is contained in:
parent
deb6acbd80
commit
bca4048063
@ -3,6 +3,8 @@
|
|||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type")
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type")
|
||||||
endif()
|
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)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(cathook VERSION 0.0.1 DESCRIPTION "Free Source Engine Trainer")
|
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(GameValues "tf2;hl2dm;dab;tf2c;css;dynamic" CACHE INTERNAL "List of supported game types")
|
||||||
set_property(CACHE Game PROPERTY STRINGS ${GameValues})
|
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(EnableVisuals 1 CACHE BOOL "Enable Visuals")
|
||||||
set(ExternalDrawing 0 CACHE BOOL "External Visuals")
|
set(ExternalDrawing 0 CACHE BOOL "External Visuals")
|
||||||
@ -105,7 +105,7 @@ target_include_directories(cathook SYSTEM PRIVATE
|
|||||||
target_include_directories(cathook PRIVATE "ucccccp")
|
target_include_directories(cathook PRIVATE "ucccccp")
|
||||||
|
|
||||||
if(EnableWarnings)
|
if(EnableWarnings)
|
||||||
target_compile_options(cathook PRIVATE -Wundef -Werror)
|
target_compile_options(cathook PRIVATE -Wundef)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(include)
|
add_subdirectory(include)
|
||||||
@ -118,4 +118,11 @@ add_custom_target(data
|
|||||||
|
|
||||||
# TODO glez_LIBRARIES?
|
# TODO glez_LIBRARIES?
|
||||||
target_link_libraries(cathook ${ValveLibraryTier0} ${ValveLibraryVStdLib} ssl stdc++)
|
target_link_libraries(cathook ${ValveLibraryTier0} ${ValveLibraryVStdLib} ssl stdc++)
|
||||||
set_target_properties(cathook PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
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 "$<TARGET_FILE:cathook>")
|
||||||
|
endif()
|
@ -79,8 +79,8 @@ void *VMTHook::GetMethod(uint32_t idx) const
|
|||||||
|
|
||||||
void VMTHook::HookMethod(ptr_t func, uint32_t idx)
|
void VMTHook::HookMethod(ptr_t func, uint32_t idx)
|
||||||
{
|
{
|
||||||
logging::Info("Hooking method %d of vtable 0x%08x, replacing 0x%08x", idx,
|
logging::Info("Hooking method %d of vtable 0x%08x, replacing 0x%08x with 0x%08x", idx,
|
||||||
vtable_original, GetMethod(idx));
|
vtable_original, GetMethod(idx), func);
|
||||||
vtable_hooked[2 + idx] = func;
|
vtable_hooked[2 + idx] = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user