From ee6998fcde6cb633be5211c1fa2377755dd46518 Mon Sep 17 00:00:00 2001 From: Jenny White Date: Fri, 27 Apr 2018 23:44:51 +0300 Subject: [PATCH] compiles --- CMakeLists.txt | 3 ++- include/classinfo/classinfo.hpp | 11 ++++------- include/config.h.in | 4 ++++ include/gameinfo.hpp | 23 ++++++++++++----------- include/ipc.hpp | 9 ++++----- src/classinfo/classinfo.cpp | 2 +- src/hack.cpp | 12 +++--------- 7 files changed, 30 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ecf74de4..9a3e9db9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.0) project(cathook VERSION 0.0.1 DESCRIPTION "Free Source Engine Trainer") +set(GameSpecific 1 CACHE BOOL "Build for specific target game (As opposed to universal, but slower, lib)") 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}) @@ -10,7 +11,7 @@ set_property(CACHE Game PROPERTY STRINGS ${GameValues}) set(EnableVisuals 1 CACHE BOOL "Enable Visuals") set(ExternalDrawing 0 CACHE BOOL "External Visuals") set(EnableGUI 1 CACHE BOOL "Enable GUI") -set(EnableIPC 0 CACHE BOOL "Enable IPC") +set(EnableIPC 1 CACHE BOOL "Enable IPC") set(DataPath "/opt/cathook/data" CACHE STRING "Data location") set(VACBypass 0 CACHE BOOL "Textmode VAC bypass") diff --git a/include/classinfo/classinfo.hpp b/include/classinfo/classinfo.hpp index 444478b2..fe124e32 100755 --- a/include/classinfo/classinfo.hpp +++ b/include/classinfo/classinfo.hpp @@ -5,10 +5,9 @@ * Author: nullifiedcat */ -#ifndef CLASSINFO_HPP_ -#define CLASSINFO_HPP_ +#pragma once -#include "common.hpp" +#include "config.h" #include "dummy.gen.hpp" @@ -27,10 +26,10 @@ void InitClassTable(); extern client_classes::dummy *client_class_list; -#if not defined(BUILD_GAME) or defined(DYNAMIC_CLASSES) +#if not GAME_SPECIFIC #define CL_CLASS(x) (client_class_list->x) #else -#define CL_CLASS(x) (client_classes_constexpr::BUILD_GAME::x) +#define CL_CLASS(x) (client_classes_constexpr::GAME::x) #endif #define RCC_CLASS(tf, hl2dm, css, def) \ @@ -40,5 +39,3 @@ extern client_classes::dummy *client_class_list; #define RCC_PLAYER RCC_CLASS(CTFPlayer, CHL2MP_Player, CCSPlayer, 0) #define RCC_PLAYERRESOURCE \ RCC_CLASS(CTFPlayerResource, CPlayerResource, CCSPlayerResource, 0) - -#endif /* CLASSINFO_HPP_ */ diff --git a/include/config.h.in b/include/config.h.in index 83a31abc..bbb0f1e4 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1,5 +1,9 @@ #pragma once +#define OFF 0 +#define ON 1 + +#define GAME_SPECIFIC @GameSpecific@ #define GAME @Game@ #define ENABLE_VISUALS @EnableVisuals@ #define EXTERNAL_DRAWING @ExternalDrawing@ diff --git a/include/gameinfo.hpp b/include/gameinfo.hpp index 1acafb4d..865ea6e5 100755 --- a/include/gameinfo.hpp +++ b/include/gameinfo.hpp @@ -5,32 +5,34 @@ * Author: nullifiedcat */ -#ifndef GAMEINFO_HPP_ -#define GAMEINFO_HPP_ +#pragma once -#include "common.hpp" +#include "config.h" +#include "macros.hpp" -#ifdef BUILD_GAME +extern int g_AppID; + +#if GAME_SPECIFIC constexpr bool IsTF2() { - return !c_strcmp(TO_STRING(BUILD_GAME), "tf2"); + return !c_strcmp(TO_STRING(GAME), "tf2"); } constexpr bool IsTF2C() { - return !c_strcmp(TO_STRING(BUILD_GAME), "tf2c"); + return !c_strcmp(TO_STRING(GAME), "tf2c"); } constexpr bool IsHL2DM() { - return !c_strcmp(TO_STRING(BUILD_GAME), "hl2dm"); + return !c_strcmp(TO_STRING(GAME), "hl2dm"); } constexpr bool IsCSS() { - return !c_strcmp(TO_STRING(BUILD_GAME), "css"); + return !c_strcmp(TO_STRING(GAME), "css"); } constexpr bool IsDynamic() { - return !c_strcmp(TO_STRING(BUILD_GAME), "dynamic"); + return !c_strcmp(TO_STRING(GAME), "dynamic"); } constexpr bool IsTF() @@ -42,6 +44,7 @@ constexpr bool IsTF() #define IF_GAME(x) if (x) #else + inline bool IsTF2() { return g_AppID == 440; @@ -71,5 +74,3 @@ inline bool IsTF() #define IF_GAME(x) if (x) #endif - -#endif /* GAMEINFO_HPP_ */ diff --git a/include/ipc.hpp b/include/ipc.hpp index 2ab947f0..d6b18b14 100755 --- a/include/ipc.hpp +++ b/include/ipc.hpp @@ -5,10 +5,11 @@ * Author: nullifiedcat */ -#if ENABLE_IPC == 1 +#pragma once -#ifndef IPC_H_ -#define IPC_H_ +#include "config.h" + +#if ENABLE_IPC #include "ipcb.hpp" #include "pthread.h" @@ -112,6 +113,4 @@ void StoreClientData(); void UpdatePlayerlist(); } -#endif /* IPC_H_ */ - #endif diff --git a/src/classinfo/classinfo.cpp b/src/classinfo/classinfo.cpp index bc05cb9b..7dfe41be 100755 --- a/src/classinfo/classinfo.cpp +++ b/src/classinfo/classinfo.cpp @@ -5,7 +5,7 @@ * Author: nullifiedcat */ -#include "classinfo/classinfo.hpp" +#include "common.hpp" client_classes::dummy *client_class_list = nullptr; diff --git a/src/hack.cpp b/src/hack.cpp index 7fcc0c41..4c86f7d0 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -52,8 +52,8 @@ const std::string &hack::GetType() #ifndef DYNAMIC_CLASSES -#ifdef BUILD_GAME - version += " GAME " TO_STRING(BUILD_GAME); +#ifdef GAME_SPECIFIC + version += " GAME " TO_STRING(GAME); #else version += " UNIVERSAL"; #endif @@ -236,13 +236,7 @@ free(logname);*/ #if ENABLE_VISUALS == 1 { - std::vector essential = { "shaders/v2f-c4f.frag", - "shaders/v2f-c4f.vert", - "shaders/v2f-t2f-c4f.frag", - "shaders/v2f-t2f-c4f.vert", - "shaders/v3f-t2f-c4f.frag", - "shaders/v3f-t2f-c4f.vert", - "menu.json", + std::vector essential = { "menu.json", "fonts/tf2build.ttf" }; for (const auto &s : essential) {