-
Notifications
You must be signed in to change notification settings - Fork 12
/
spmod.hpp
137 lines (113 loc) · 3.53 KB
/
spmod.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* Copyright (C) 2018 SPMod Development Team
*
* This file is part of SPMod.
*
* SPMod is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <IHelpers.hpp>
// Metamod & HLSDK
#include <extdll.h>
#include <meta_api.h>
// Supress warning about redefining
#undef MAX_PATH
#if defined SP_POSIX
#undef _vsnprintf
#else
#define _vsnprintf(buffer, count, format, argptr) _vsnprintf_s(buffer, count, count, format, argptr)
#endif
#if defined SP_POSIX
#define ULONG typedefWorkaround
#endif
// ReHLDS
#ifdef SP_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
#elif defined SP_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include <osconfig.h>
#include <usercmd.h>
#include <rehlds_api.h>
#ifdef SP_CLANG
#pragma clang diagnostic pop
#elif defined SP_GCC
#pragma GCC diagnostic pop
#endif
#undef max
#undef min
// SPMod interface
#include <ISPGlobal.hpp>
// STL C++
#include <memory>
#include <vector>
#include <sstream>
#include <unordered_map>
#include <exception>
#include <array>
#include <variant>
#include <string_view>
#include <fstream>
#include <regex>
#if __has_include(<filesystem>)
#include <filesystem>
// As of GCC 8.1, Clang 7 and MSVC 2019 filesystem is no longer part of experimental
#if (defined SP_GCC && __GNUC__ >= 8) || (defined SP_CLANG && __clang_major__ >= 7) || (defined SP_MSVC && _MSC_VER >= 1920)
namespace fs = std::filesystem;
#else // Some compilers still have filesystem within experimental namespace like MSVC 2017
namespace fs = std::experimental::filesystem;
#endif
#elif __has_include(<experimental/filesystem>)
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
#error Filesystem header missing
#endif
// C
#define __STDC_WANT_LIB_EXT1__
#include <cstring>
#include <cstdarg>
extern IRehldsApi *gRehldsApi;
extern const RehldsFuncs_t *gRehldsFuncs;
extern IRehldsHookchains *gRehldsHookchains;
extern IRehldsServerStatic *gRehldsServerStatic;
extern IRehldsServerData *gRehldsServerData;
extern enginefuncs_t *gpEngineFuncs;
bool initRehldsApi();
void installRehldsHooks();
void uninstallRehldsHooks();
// For convenience
using namespace SPMod;
// SPMod specific
#include <SPConfig.hpp>
#include "UtilsSystem.hpp"
#include "LoggingSystem.hpp"
#include "ForwardSystem.hpp"
#include "CvarSystem.hpp"
#include "CmdSystem.hpp"
#include "TimerSystem.hpp"
#include "MenuSystem.hpp"
#include "PlayerSystem.hpp"
#include "ExtensionSystem.hpp"
#include "NativeProxy.hpp"
#include "EngineFuncs.hpp"
#include "SPGlobal.hpp"
constexpr auto gSPModAuthor = "SPMod Development Team";
constexpr const char *APP_COMMIT_URL = "https://github.com/Amaroq7/SPMod/commits/";
extern int gmsgShowMenu;
extern int gmsgVGUIMenu;
// Server command function (SrvCommand.cpp)
void SPModInfoCommand();
void PluginSrvCmd();