This commit is contained in:
Jenny White 2018-04-27 23:44:51 +03:00
parent 13f571c28d
commit ee6998fcde
7 changed files with 30 additions and 34 deletions

View File

@ -3,6 +3,7 @@
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")
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(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})
@ -10,7 +11,7 @@ set_property(CACHE Game PROPERTY STRINGS ${GameValues})
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")
set(EnableGUI 1 CACHE BOOL "Enable GUI") 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(DataPath "/opt/cathook/data" CACHE STRING "Data location")
set(VACBypass 0 CACHE BOOL "Textmode VAC bypass") set(VACBypass 0 CACHE BOOL "Textmode VAC bypass")

View File

@ -5,10 +5,9 @@
* Author: nullifiedcat * Author: nullifiedcat
*/ */
#ifndef CLASSINFO_HPP_ #pragma once
#define CLASSINFO_HPP_
#include "common.hpp" #include "config.h"
#include "dummy.gen.hpp" #include "dummy.gen.hpp"
@ -27,10 +26,10 @@ void InitClassTable();
extern client_classes::dummy *client_class_list; 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) #define CL_CLASS(x) (client_class_list->x)
#else #else
#define CL_CLASS(x) (client_classes_constexpr::BUILD_GAME::x) #define CL_CLASS(x) (client_classes_constexpr::GAME::x)
#endif #endif
#define RCC_CLASS(tf, hl2dm, css, def) \ #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_PLAYER RCC_CLASS(CTFPlayer, CHL2MP_Player, CCSPlayer, 0)
#define RCC_PLAYERRESOURCE \ #define RCC_PLAYERRESOURCE \
RCC_CLASS(CTFPlayerResource, CPlayerResource, CCSPlayerResource, 0) RCC_CLASS(CTFPlayerResource, CPlayerResource, CCSPlayerResource, 0)
#endif /* CLASSINFO_HPP_ */

View File

@ -1,5 +1,9 @@
#pragma once #pragma once
#define OFF 0
#define ON 1
#define GAME_SPECIFIC @GameSpecific@
#define GAME @Game@ #define GAME @Game@
#define ENABLE_VISUALS @EnableVisuals@ #define ENABLE_VISUALS @EnableVisuals@
#define EXTERNAL_DRAWING @ExternalDrawing@ #define EXTERNAL_DRAWING @ExternalDrawing@

View File

@ -5,32 +5,34 @@
* Author: nullifiedcat * Author: nullifiedcat
*/ */
#ifndef GAMEINFO_HPP_ #pragma once
#define GAMEINFO_HPP_
#include "common.hpp" #include "config.h"
#include "macros.hpp"
#ifdef BUILD_GAME extern int g_AppID;
#if GAME_SPECIFIC
constexpr bool IsTF2() constexpr bool IsTF2()
{ {
return !c_strcmp(TO_STRING(BUILD_GAME), "tf2"); return !c_strcmp(TO_STRING(GAME), "tf2");
} }
constexpr bool IsTF2C() constexpr bool IsTF2C()
{ {
return !c_strcmp(TO_STRING(BUILD_GAME), "tf2c"); return !c_strcmp(TO_STRING(GAME), "tf2c");
} }
constexpr bool IsHL2DM() constexpr bool IsHL2DM()
{ {
return !c_strcmp(TO_STRING(BUILD_GAME), "hl2dm"); return !c_strcmp(TO_STRING(GAME), "hl2dm");
} }
constexpr bool IsCSS() constexpr bool IsCSS()
{ {
return !c_strcmp(TO_STRING(BUILD_GAME), "css"); return !c_strcmp(TO_STRING(GAME), "css");
} }
constexpr bool IsDynamic() constexpr bool IsDynamic()
{ {
return !c_strcmp(TO_STRING(BUILD_GAME), "dynamic"); return !c_strcmp(TO_STRING(GAME), "dynamic");
} }
constexpr bool IsTF() constexpr bool IsTF()
@ -42,6 +44,7 @@ constexpr bool IsTF()
#define IF_GAME(x) if (x) #define IF_GAME(x) if (x)
#else #else
inline bool IsTF2() inline bool IsTF2()
{ {
return g_AppID == 440; return g_AppID == 440;
@ -71,5 +74,3 @@ inline bool IsTF()
#define IF_GAME(x) if (x) #define IF_GAME(x) if (x)
#endif #endif
#endif /* GAMEINFO_HPP_ */

View File

@ -5,10 +5,11 @@
* Author: nullifiedcat * Author: nullifiedcat
*/ */
#if ENABLE_IPC == 1 #pragma once
#ifndef IPC_H_ #include "config.h"
#define IPC_H_
#if ENABLE_IPC
#include "ipcb.hpp" #include "ipcb.hpp"
#include "pthread.h" #include "pthread.h"
@ -112,6 +113,4 @@ void StoreClientData();
void UpdatePlayerlist(); void UpdatePlayerlist();
} }
#endif /* IPC_H_ */
#endif #endif

View File

@ -5,7 +5,7 @@
* Author: nullifiedcat * Author: nullifiedcat
*/ */
#include "classinfo/classinfo.hpp" #include "common.hpp"
client_classes::dummy *client_class_list = nullptr; client_classes::dummy *client_class_list = nullptr;

View File

@ -52,8 +52,8 @@ const std::string &hack::GetType()
#ifndef DYNAMIC_CLASSES #ifndef DYNAMIC_CLASSES
#ifdef BUILD_GAME #ifdef GAME_SPECIFIC
version += " GAME " TO_STRING(BUILD_GAME); version += " GAME " TO_STRING(GAME);
#else #else
version += " UNIVERSAL"; version += " UNIVERSAL";
#endif #endif
@ -236,13 +236,7 @@ free(logname);*/
#if ENABLE_VISUALS == 1 #if ENABLE_VISUALS == 1
{ {
std::vector<std::string> essential = { "shaders/v2f-c4f.frag", std::vector<std::string> essential = { "menu.json",
"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",
"fonts/tf2build.ttf" }; "fonts/tf2build.ttf" };
for (const auto &s : essential) for (const auto &s : essential)
{ {