From 6dfd22c07a362bef5e534483a5d6c81fcf44812d Mon Sep 17 00:00:00 2001 From: /dev/urandom Date: Sat, 13 Aug 2016 19:20:27 +0200 Subject: [PATCH] New premake flags for debugging anticheat, library loading and forcing unit tests. - --debug-detections sets the "DEBUG_DETECTIONS" define to show whenever a mismatch in the anticheat hashing occurs. - --debug-load-library sets the "DEBUG_LOAD_LIBRARY" define to show libraries as they are loaded during runtime in the debug console. - --force-unit-tests sets the "FORCE_UNIT_TESTS" define to enforce compiling the unit tests into the binary. --- premake5.lua | 26 ++++++++++++++++++++++++++ src/Components/Modules/AntiCheat.hpp | 7 ------- src/STDInclude.hpp | 3 --- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/premake5.lua b/premake5.lua index ddf0573a..97a34af2 100644 --- a/premake5.lua +++ b/premake5.lua @@ -15,6 +15,21 @@ newoption { description = "Copy debug information for binaries as well to the path given via --copy-to." } +newoption { + trigger = "debug-detections", + description = "Log anticheat detections." +} + +newoption { + trigger = "debug-load-library", + description = "Log libraries that get loaded." +} + +newoption { + trigger = "force-unit-tests", + description = "Always compile unit tests." +} + newaction { trigger = "version", description = "Returns the version string for the current commit of the source code.", @@ -134,6 +149,17 @@ workspace "iw4x" "$(ProjectDir)src" -- fix for VS IDE } + -- Debug flags + if _OPTIONS["debug-detections"] then + defines { "DEBUG_DETECTIONS" } + end + if _OPTIONS["debug-load-library"] then + defines { "DEBUG_LOAD_LIBRARY" } + end + if _OPTIONS["force-unit-tests"] then + defines { "FORCE_UNIT_TESTS" } + end + -- Pre-compiled header pchheader "STDInclude.hpp" -- must be exactly same as used in #include directives pchsource "src/STDInclude.cpp" -- real path diff --git a/src/Components/Modules/AntiCheat.hpp b/src/Components/Modules/AntiCheat.hpp index 75ff07c0..4e69b523 100644 --- a/src/Components/Modules/AntiCheat.hpp +++ b/src/Components/Modules/AntiCheat.hpp @@ -1,10 +1,3 @@ -// Uncomment that to see if we are preventing necessary libraries from being loaded -//#define DEBUG_LOAD_LIBRARY - -// Log detections -// Make sure to disable that before releasig! -#define DEBUG_DETECTIONS - namespace Components { class AntiCheat : public Component diff --git a/src/STDInclude.hpp b/src/STDInclude.hpp index d05a997c..77032c80 100644 --- a/src/STDInclude.hpp +++ b/src/STDInclude.hpp @@ -144,9 +144,6 @@ using namespace std::literals; #define Assert_Size(x, size) static_assert(sizeof(x) == size, STRINGIZE(x) " structure has an invalid size.") -// Enable unit-test flag for release builds -//#define FORCE_UNIT_TESTS - // Resource stuff #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS