add explicit binary mode data path support
The next cathook-gui update will automatically set some systems (mainly ubuntu 18.04 and not officially supported distros) to binary mode. The old method would have preferred the out of date /opt/cathook/data directory. enable binary mode
This commit is contained in:
parent
1d5c30b2df
commit
84db34b24b
@ -10,7 +10,7 @@ stages:
|
||||
pages:
|
||||
script:
|
||||
# Build cathook
|
||||
- mkdir build_cathook && pushd build_cathook && cmake .. && make && popd
|
||||
- mkdir build_cathook && pushd build_cathook && cmake -DInternal_Binarymode=true .. && make && popd
|
||||
# Create the "package" containing everything needed
|
||||
- mkdir package && mv ./bin/libcathook.so ./package/libcathook.so && mv ./data ./package/data && mv ./config_data ./package/config_data && mv ./scripts/binarypackage/install ./package/install && mv ./scripts/binarypackage/attach ./package/attach
|
||||
# Build a static gdb
|
||||
|
@ -32,6 +32,10 @@ if (EnableCotire)
|
||||
set(ignore_files ${ignore_files} CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Config stuff
|
||||
#
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type")
|
||||
endif()
|
||||
@ -90,11 +94,23 @@ set(EnableNullNexus 1 CACHE BOOL "Enable NullNexus chat and other features")
|
||||
set(EnableLogging 1 CACHE BOOL "Enable logging to /tmp/")
|
||||
set(EnableClip 1 CACHE BOOL "Enable anti electron/chromium freezing")
|
||||
set(Unity_ZeroKernel 1 CACHE BOOL "Use a unity build for zerokernel files")
|
||||
|
||||
if(NOT EnableVisuals)
|
||||
set(EnableGUI 0)
|
||||
endif()
|
||||
|
||||
# Internal variables
|
||||
# INTERNAL implies "FORCE" by default, so don't set if already set
|
||||
if (NOT DEFINED Internal_Binarymode)
|
||||
set(Internal_Binarymode 0 CACHE INTERNAL "Build cathook to be used in 'binary mode'")
|
||||
endif()
|
||||
if (NOT DEFINED Internal_Symbolized)
|
||||
set(Internal_Symbolized 0 CACHE INTERNAL "Build cathook with symbols so crashes can be sent")
|
||||
endif()
|
||||
|
||||
#
|
||||
# End of config stuff
|
||||
#
|
||||
|
||||
if (EnableVisuals)
|
||||
set(OpenGL_GL_PREFERENCE "LEGACY")
|
||||
if (EnableImGuiDrawing)
|
||||
@ -167,7 +183,7 @@ configure_file(include/version.h.in ${CMAKE_SOURCE_DIR}/include/version.h @ONLY)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-m32 -march=native -fexceptions -fno-gnu-unique -DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-rdynamic -ggdb -Og")
|
||||
if (symbolize)
|
||||
if (Internal_Symbolized)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ggdb -fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -s -fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
@ -231,12 +247,12 @@ elseif(EnablePrecompiledHeaders AND NativePrecompiledHeaders)
|
||||
target_precompile_headers(cathook PRIVATE "${CMAKE_SOURCE_DIR}/include/common.hpp")
|
||||
endif()
|
||||
|
||||
if (NOT symbolize)
|
||||
if (NOT Internal_Symbolized)
|
||||
add_custom_command(TARGET cathook POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:cathook> "${CMAKE_SOURCE_DIR}/bin/$<TARGET_FILE_NAME:cathook>")
|
||||
else()
|
||||
message("Symbolized build")
|
||||
unset(symbolize CACHE)
|
||||
set(Internal_Symbolized 0 CACHE INTERNAL "Build cathook with symbols so crashes can be sent" FORCE)
|
||||
endif()
|
||||
if (EnableCotire)
|
||||
add_custom_command(TARGET cathook_unity POST_BUILD
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define ENABLE_VAC_BYPASS @VACBypass@
|
||||
#define ENABLE_TEXTMODE_STDIN @EnableTextmodeStdin@
|
||||
#define ENABLE_TEXTMODE @Textmode@
|
||||
#define ENABLE_BINARYMODE @Internal_Binarymode@
|
||||
#define ENABLE_PROFILER @EnableProfiler@
|
||||
#define ENABLE_NULLNEXUS @EnableNullNexus@
|
||||
#define ENABLE_LOGGING @EnableLogging@
|
||||
|
@ -80,7 +80,7 @@ if [ $SYMBOLS == false ]; then
|
||||
proccount=$(grep -c '^processor' /proc/cpuinfo)
|
||||
\cp ./build/CMakeCache.txt ./scripts/CMakeCacheBackup.txt
|
||||
pushd build
|
||||
cmake -Dsymbolize=true .. && cmake --build . --target cathook -- -j$proccount
|
||||
cmake -DInternal_Symbolized=true .. && cmake --build . --target cathook -- -j$proccount
|
||||
popd
|
||||
fi
|
||||
|
||||
|
@ -19,27 +19,25 @@ std::string getDataPath(std::string subpath)
|
||||
{
|
||||
if (!cached_data_path)
|
||||
{
|
||||
DIR *dir;
|
||||
if (std::getenv("CH_DATA_PATH"))
|
||||
{
|
||||
cached_data_path = std::getenv("CH_DATA_PATH");
|
||||
}
|
||||
else if ((dir = opendir(DATA_PATH)))
|
||||
{
|
||||
cached_data_path = DATA_PATH;
|
||||
closedir(dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if ENABLE_BINARYMODE
|
||||
std::string xdg_data_dir;
|
||||
if (std::getenv("XDG_DATA_HOME"))
|
||||
xdg_data_dir = std::getenv("XDG_DATA_HOME");
|
||||
else if (std::getenv("HOME"))
|
||||
xdg_data_dir = std::string(std::getenv("HOME")) + "/.local/share";
|
||||
if (xdg_data_dir.empty())
|
||||
cached_data_path = DATA_PATH;
|
||||
else
|
||||
xdg_data_dir = DATA_PATH;
|
||||
cached_data_path = xdg_data_dir + "/cathook/data";
|
||||
logging::Info("Data path: %s", cached_data_path->c_str());
|
||||
cached_data_path = xdg_data_dir + "/cathook/data";
|
||||
#else
|
||||
cached_data_path = DATA_PATH;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return *cached_data_path + subpath;
|
||||
|
Reference in New Issue
Block a user