From 41f635869a6d84f23c87b75b9934c77529418f00 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 16 Apr 2021 00:35:45 +0700 Subject: [PATCH] Remove hookers stuff --- rehlds/HLTV/Core/msvc/Core.vcxproj | 20 - rehlds/HLTV/Core/msvc/Core.vcxproj.filters | 18 - rehlds/HLTV/Core/src/Delta.cpp | 4 - rehlds/HLTV/Core/src/Delta.h | 6 - rehlds/HLTV/Core/src/Network.cpp | 2 - rehlds/HLTV/Core/src/Server.cpp | 2 - rehlds/HLTV/Core/src/World.cpp | 2 - rehlds/HLTV/Core/src/World.h | 8 +- rehlds/HLTV/Core/src/precompiled.h | 3 - .../HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj | 12 - .../msvc/DemoPlayer.vcxproj.filters | 12 - rehlds/HLTV/DemoPlayer/src/DemoPlayer.h | 2 - rehlds/HLTV/DemoPlayer/src/precompiled.h | 3 - rehlds/HLTV/Proxy/msvc/Proxy.vcxproj | 12 - rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters | 12 - rehlds/HLTV/Proxy/src/Proxy.cpp | 2 - rehlds/HLTV/Proxy/src/precompiled.h | 3 - .../msvc/filesystem_stdio.vcxproj | 12 - .../msvc/filesystem_stdio.vcxproj.filters | 12 - .../FileSystem_Stdio/src/FileSystem_Stdio.cpp | 2 - .../FileSystem_Stdio/src/precompiled.h | 3 - rehlds/hookers/HLTV/Core/DeltaEx.cpp | 1533 ----------------- rehlds/hookers/HLTV/Core/DeltaEx.h | 163 -- rehlds/hookers/HLTV/Core/hooklist.cpp | 617 ------- rehlds/hookers/HLTV/Core/hooklist.h | 18 - rehlds/hookers/HLTV/Core/main.cpp | 102 -- rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp | 152 -- rehlds/hookers/HLTV/DemoPlayer/hooklist.h | 11 - rehlds/hookers/HLTV/DemoPlayer/main.cpp | 55 - rehlds/hookers/HLTV/Proxy/hooklist.cpp | 649 ------- rehlds/hookers/HLTV/Proxy/hooklist.h | 11 - rehlds/hookers/HLTV/Proxy/main.cpp | 55 - rehlds/hookers/filesystem/hooklist.cpp | 182 -- rehlds/hookers/filesystem/hooklist.h | 42 - rehlds/hookers/filesystem/main.cpp | 86 - rehlds/hookers/helper.h | 163 -- rehlds/hookers/hooker.cpp | 207 --- rehlds/hookers/hooker.h | 25 - rehlds/msvc/ReHLDS.vcxproj | 30 +- rehlds/msvc/ReHLDS.vcxproj.filters | 16 +- rehlds/public/rehlds/custom.h | 6 - rehlds/rehlds/precompiled.h | 2 - rehlds/{hookers => testsuite}/memory.cpp | 0 rehlds/{hookers => testsuite}/memory.h | 0 rehlds/testsuite/testsuite.h | 2 +- 45 files changed, 14 insertions(+), 4265 deletions(-) delete mode 100644 rehlds/hookers/HLTV/Core/DeltaEx.cpp delete mode 100644 rehlds/hookers/HLTV/Core/DeltaEx.h delete mode 100644 rehlds/hookers/HLTV/Core/hooklist.cpp delete mode 100644 rehlds/hookers/HLTV/Core/hooklist.h delete mode 100644 rehlds/hookers/HLTV/Core/main.cpp delete mode 100644 rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp delete mode 100644 rehlds/hookers/HLTV/DemoPlayer/hooklist.h delete mode 100644 rehlds/hookers/HLTV/DemoPlayer/main.cpp delete mode 100644 rehlds/hookers/HLTV/Proxy/hooklist.cpp delete mode 100644 rehlds/hookers/HLTV/Proxy/hooklist.h delete mode 100644 rehlds/hookers/HLTV/Proxy/main.cpp delete mode 100644 rehlds/hookers/filesystem/hooklist.cpp delete mode 100644 rehlds/hookers/filesystem/hooklist.h delete mode 100644 rehlds/hookers/filesystem/main.cpp delete mode 100644 rehlds/hookers/helper.h delete mode 100644 rehlds/hookers/hooker.cpp delete mode 100644 rehlds/hookers/hooker.h rename rehlds/{hookers => testsuite}/memory.cpp (100%) rename rehlds/{hookers => testsuite}/memory.h (100%) diff --git a/rehlds/HLTV/Core/msvc/Core.vcxproj b/rehlds/HLTV/Core/msvc/Core.vcxproj index 0ae9902..b40addc 100644 --- a/rehlds/HLTV/Core/msvc/Core.vcxproj +++ b/rehlds/HLTV/Core/msvc/Core.vcxproj @@ -128,18 +128,6 @@ - - true - true - - - true - true - - - true - true - @@ -202,14 +190,6 @@ - - true - true - - - true - true - diff --git a/rehlds/HLTV/Core/msvc/Core.vcxproj.filters b/rehlds/HLTV/Core/msvc/Core.vcxproj.filters index 1a7689c..13f76ef 100644 --- a/rehlds/HLTV/Core/msvc/Core.vcxproj.filters +++ b/rehlds/HLTV/Core/msvc/Core.vcxproj.filters @@ -10,9 +10,6 @@ {664fe3c6-46ae-4fa5-bf0c-f70873228f5e} - - {fb482bcd-a131-4e66-be87-c7b0ffe6a4cf} - {0997bc0d-a67f-47eb-abc1-3c7ebb128beb} @@ -78,12 +75,6 @@ src - - src\hookers - - - src\hookers - common @@ -99,9 +90,6 @@ HLTV\common - - src\hookers - engine @@ -164,9 +152,6 @@ src - - src\hookers - common @@ -182,9 +167,6 @@ HLTV\common - - src\hookers - engine diff --git a/rehlds/HLTV/Core/src/Delta.cpp b/rehlds/HLTV/Core/src/Delta.cpp index 54b96c2..fc66263 100644 --- a/rehlds/HLTV/Core/src/Delta.cpp +++ b/rehlds/HLTV/Core/src/Delta.cpp @@ -28,8 +28,6 @@ #include "precompiled.h" -#ifndef HOOK_HLTV - delta_t *Delta::m_EntityDelta = nullptr; delta_t *Delta::m_PlayerDelta = nullptr; delta_t *Delta::m_ClientDelta = nullptr; @@ -1510,5 +1508,3 @@ void Delta::SetLargeTimeBufferSize(bool bigBuffers) { m_LargeTime_Buffers = bigBuffers; } - -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/Delta.h b/rehlds/HLTV/Core/src/Delta.h index 17a540a..56fb3e4 100644 --- a/rehlds/HLTV/Core/src/Delta.h +++ b/rehlds/HLTV/Core/src/Delta.h @@ -95,10 +95,6 @@ typedef struct delta_s delta_description_t *pdd; } delta_t; -#include "hookers/HLTV/Core/DeltaEx.h" - -#ifndef HOOK_HLTV - class Delta { public: void Init(IBaseSystem *system); @@ -204,5 +200,3 @@ private: double m_Time; bool m_LargeTime_Buffers; }; - -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/Network.cpp b/rehlds/HLTV/Core/src/Network.cpp index cf087d1..d089d2e 100644 --- a/rehlds/HLTV/Core/src/Network.cpp +++ b/rehlds/HLTV/Core/src/Network.cpp @@ -449,6 +449,4 @@ IBaseInterface *CreateNetwork() return (IBaseInterface *)pNetwork; } -#ifndef HOOK_HLTV EXPOSE_INTERFACE_FN(CreateNetwork, Network, NETWORK_INTERFACE_VERSION); -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/Server.cpp b/rehlds/HLTV/Core/src/Server.cpp index 05c0cf1..a2dc5d1 100644 --- a/rehlds/HLTV/Core/src/Server.cpp +++ b/rehlds/HLTV/Core/src/Server.cpp @@ -2411,6 +2411,4 @@ IBaseInterface *CreateServer() return (IBaseInterface *)pServer; } -#ifndef HOOK_HLTV EXPOSE_INTERFACE_FN(CreateServer, Server, SERVER_INTERFACE_VERSION); -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/World.cpp b/rehlds/HLTV/Core/src/World.cpp index 5d8f1fd..b355420 100644 --- a/rehlds/HLTV/Core/src/World.cpp +++ b/rehlds/HLTV/Core/src/World.cpp @@ -2338,7 +2338,6 @@ IBaseInterface *CreateWorld() return (IBaseInterface *)pWorld; } -#ifndef HOOK_HLTV bool World::IsDeltaEncoder() const { if (Delta::m_CustomentityDelta @@ -2379,4 +2378,3 @@ delta_t *World::GetWeaponDelta() const { } EXPOSE_INTERFACE_FN(CreateWorld, World, WORLD_INTERFACE_VERSION); -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/Core/src/World.h b/rehlds/HLTV/Core/src/World.h index 09e98dd..b84b99a 100644 --- a/rehlds/HLTV/Core/src/World.h +++ b/rehlds/HLTV/Core/src/World.h @@ -252,7 +252,7 @@ protected: int m_MaxInstanced_BaseLine; -#if defined(HLTV_FIXES) && !defined(HOOK_HLTV) +#if defined(HLTV_FIXES) char m_Lightstyles[MAX_LIGHTSTYLES][64]; #else char m_Lightstyles[MAX_LIGHTSTYLES][65]; @@ -303,13 +303,7 @@ protected: char m_HostName[255]; NetAddress m_GameServerAddress; - -#ifdef HOOK_HLTV - static DeltaWrapper m_Delta; -#else Delta m_Delta; -#endif // HOOK_HLTV - }; extern char g_DownloadURL[128]; diff --git a/rehlds/HLTV/Core/src/precompiled.h b/rehlds/HLTV/Core/src/precompiled.h index c331350..6c5c428 100644 --- a/rehlds/HLTV/Core/src/precompiled.h +++ b/rehlds/HLTV/Core/src/precompiled.h @@ -10,9 +10,6 @@ #include "mem.h" #include "common.h" -// Hooks stuff -#include "hookers/HLTV/Core/hooklist.h" - #include "common/md5.h" #include "common/random.h" #include "common/byteorder.h" diff --git a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj index 45a7a94..118d3c2 100644 --- a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj +++ b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj @@ -16,14 +16,6 @@ - - true - true - - - true - true - @@ -42,10 +34,6 @@ - - true - true - diff --git a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj.filters b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj.filters index 9d7f4cd..267f18a 100644 --- a/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj.filters +++ b/rehlds/HLTV/DemoPlayer/msvc/DemoPlayer.vcxproj.filters @@ -10,9 +10,6 @@ {ca1c7722-8e65-480d-9e3c-34f7f2524372} - - {1f62aa80-c3f7-4f97-a93e-5b67b153a751} - {8712d29d-6fec-42fb-9f6e-5618302f3203} @@ -45,12 +42,6 @@ HLTV\common - - src\hookers - - - src\hookers - common @@ -89,9 +80,6 @@ HLTV\common - - src\hookers - common diff --git a/rehlds/HLTV/DemoPlayer/src/DemoPlayer.h b/rehlds/HLTV/DemoPlayer/src/DemoPlayer.h index c1eea62..1c41706 100644 --- a/rehlds/HLTV/DemoPlayer/src/DemoPlayer.h +++ b/rehlds/HLTV/DemoPlayer/src/DemoPlayer.h @@ -172,7 +172,6 @@ private: unsigned int m_Outgoing_sequence; }; -#ifndef HOOK_HLTV // Use this to expose a singleton interface. This creates the global variable for you automatically. #define EXPOSE_SINGLE_INTERFACE2(className, interfaceName, versionName) \ static className __g_##className##_singleton;\ @@ -180,4 +179,3 @@ private: static InterfaceReg __g_Create##className##interfaceName##_reg(__Create##className##interfaceName##_interface, versionName); EXPOSE_SINGLE_INTERFACE2(DemoPlayer, IDemoPlayer, DEMOPLAYER_INTERFACE_VERSION); -#endif // HOOK_HLTV diff --git a/rehlds/HLTV/DemoPlayer/src/precompiled.h b/rehlds/HLTV/DemoPlayer/src/precompiled.h index 440fa0e..b2203a8 100644 --- a/rehlds/HLTV/DemoPlayer/src/precompiled.h +++ b/rehlds/HLTV/DemoPlayer/src/precompiled.h @@ -18,6 +18,3 @@ #include "common/DemoFile.h" #include "DemoPlayer.h" - -// Hooks stuff -#include "hookers/HLTV/DemoPlayer/hooklist.h" diff --git a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj index 44bb4d8..0690222 100644 --- a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj +++ b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj @@ -36,14 +36,6 @@ - - true - true - - - true - true - Use Use @@ -213,10 +205,6 @@ - - true - true - diff --git a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters index 5f80d89..71264ae 100644 --- a/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters +++ b/rehlds/HLTV/Proxy/msvc/Proxy.vcxproj.filters @@ -10,9 +10,6 @@ {feda00f0-7c09-4c63-b5a1-e4fbcdfc6b69} - - {199d99ef-8924-48fc-8c8a-2859f8d40c82} - {1777708a-8593-40c0-8caa-9154180854dc} @@ -84,12 +81,6 @@ HLTV\common - - src\hookers - - - src\hookers - src @@ -173,9 +164,6 @@ HLTV\common - - src\hookers - common diff --git a/rehlds/HLTV/Proxy/src/Proxy.cpp b/rehlds/HLTV/Proxy/src/Proxy.cpp index c4d4aa6..c876415 100644 --- a/rehlds/HLTV/Proxy/src/Proxy.cpp +++ b/rehlds/HLTV/Proxy/src/Proxy.cpp @@ -83,9 +83,7 @@ Proxy::LocalCommandID_s Proxy::m_LocalCmdReg[] = { { "chatdelay", CMD_ID_CHATDELAY, &Proxy::CMD_ChatDelay }, }; -#ifndef HOOK_HLTV EXPOSE_SINGLE_INTERFACE(Proxy, IProxy, PROXY_INTERFACE_VERSION); -#endif // HOOK_HLTV bool Proxy::Init(IBaseSystem *system, int serial, char *name) { diff --git a/rehlds/HLTV/Proxy/src/precompiled.h b/rehlds/HLTV/Proxy/src/precompiled.h index a3065cf..a6ee104 100644 --- a/rehlds/HLTV/Proxy/src/precompiled.h +++ b/rehlds/HLTV/Proxy/src/precompiled.h @@ -18,9 +18,6 @@ #include "common/net_internal.h" #include "common/mathlib_internal.h" -// Hooks stuff -#include "hookers/HLTV/Proxy/hooklist.h" - #include "common/DirectorCmd.h" #include "common/NetAddress.h" #include "common/NetChannel.h" diff --git a/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj b/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj index 77a1ecb..a340ff8 100644 --- a/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj +++ b/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj @@ -130,14 +130,6 @@ - - true - true - - - true - true - @@ -156,10 +148,6 @@ - - true - true - diff --git a/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj.filters b/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj.filters index 5f4abdf..c4646a0 100644 --- a/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj.filters +++ b/rehlds/filesystem/FileSystem_Stdio/msvc/filesystem_stdio.vcxproj.filters @@ -4,9 +4,6 @@ {3f7611e3-cf43-4956-a8a1-b6efbcf1a63d} - - {cacc7b07-9ac2-42d5-bba3-14c061a19d11} - @@ -30,12 +27,6 @@ src - - hookers - - - hookers - @@ -50,9 +41,6 @@ src - - hookers - src diff --git a/rehlds/filesystem/FileSystem_Stdio/src/FileSystem_Stdio.cpp b/rehlds/filesystem/FileSystem_Stdio/src/FileSystem_Stdio.cpp index 78d1188..9fde285 100644 --- a/rehlds/filesystem/FileSystem_Stdio/src/FileSystem_Stdio.cpp +++ b/rehlds/filesystem/FileSystem_Stdio/src/FileSystem_Stdio.cpp @@ -227,6 +227,4 @@ bool CFileSystem_Stdio::IsAppReadyForOfflinePlay(int appID) return true; } -#ifndef HOOK_FILESYSTEM EXPOSE_SINGLE_INTERFACE(CFileSystem_Stdio, IFileSystem, FILESYSTEM_INTERFACE_VERSION); -#endif // HOOK_FILESYSTEM diff --git a/rehlds/filesystem/FileSystem_Stdio/src/precompiled.h b/rehlds/filesystem/FileSystem_Stdio/src/precompiled.h index 323af5e..db84c63 100644 --- a/rehlds/filesystem/FileSystem_Stdio/src/precompiled.h +++ b/rehlds/filesystem/FileSystem_Stdio/src/precompiled.h @@ -33,8 +33,5 @@ #include "interface.h" #include "strtools.h" -// Hooks stuff -#include "hookers/filesystem/hooklist.h" - // FileSystem stuff #include "FileSystem_Stdio.h" diff --git a/rehlds/hookers/HLTV/Core/DeltaEx.cpp b/rehlds/hookers/HLTV/Core/DeltaEx.cpp deleted file mode 100644 index 3c2c58c..0000000 --- a/rehlds/hookers/HLTV/Core/DeltaEx.cpp +++ /dev/null @@ -1,1533 +0,0 @@ -/* -* -* This program 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 2 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, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -#ifdef HOOK_HLTV - -DeltaWrapper World::m_Delta; - -delta_definition_list_t *g_defs; -delta_encoder_t *g_encoders; -delta_registry_t *g_deltaregistry; - -double g_delta_Time; -bool g_large_Time_Buffers; - -delta_t *g_pentitydelta; -delta_t *g_pplayerdelta; -delta_t *g_pcustomentitydelta; -delta_t *g_pclientdelta; -delta_t *g_pweapondelta; -delta_t *g_peventdelta; - -#define DELTA_D_DEF(member) #member, offsetof(delta_description_s, member) -#define DELTA_DEF(structname, member) { #member, offsetof(structname, member) } - -delta_definition_t g_DeltaDataDefinition[] = -{ - DELTA_DEF(delta_description_s, fieldType), - DELTA_DEF(delta_description_s, fieldName), - DELTA_DEF(delta_description_s, fieldOffset), - DELTA_DEF(delta_description_s, fieldSize), - DELTA_DEF(delta_description_s, significant_bits), - DELTA_DEF(delta_description_s, premultiply), - DELTA_DEF(delta_description_s, postmultiply), - DELTA_DEF(delta_description_s, flags) -}; - -delta_description_t g_MetaDescription[] = -{ - { DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, {0, 0} }, - { DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, {0, 0} }, - { DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, {0, 0} }, - { DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, {0, 0} }, - { DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, {0, 0} }, - { DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} }, - { DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} } -}; - -namespace Delta { - delta_t g_MetaDelta[] = - { - { 0, ARRAYSIZE(g_MetaDescription), "", NULL, g_MetaDescription }, - }; - -}; // namespace Delta - -delta_definition_t g_EventDataDefinition[] = -{ - DELTA_DEF(event_args_s, entindex), - DELTA_DEF(event_args_s, origin[0]), - DELTA_DEF(event_args_s, origin[1]), - DELTA_DEF(event_args_s, origin[2]), - DELTA_DEF(event_args_s, angles[0]), - DELTA_DEF(event_args_s, angles[1]), - DELTA_DEF(event_args_s, angles[2]), - DELTA_DEF(event_args_s, fparam1), - DELTA_DEF(event_args_s, fparam2), - DELTA_DEF(event_args_s, iparam1), - DELTA_DEF(event_args_s, iparam2), - DELTA_DEF(event_args_s, bparam1), - DELTA_DEF(event_args_s, bparam2), - DELTA_DEF(event_args_s, ducking) -}; - -delta_definition_t g_EntityDataDefinition[] = -{ - DELTA_DEF(entity_state_s, startpos[0]), - DELTA_DEF(entity_state_s, startpos[1]), - DELTA_DEF(entity_state_s, startpos[2]), - DELTA_DEF(entity_state_s, endpos[0]), - DELTA_DEF(entity_state_s, endpos[1]), - DELTA_DEF(entity_state_s, endpos[2]), - DELTA_DEF(entity_state_s, impacttime), - DELTA_DEF(entity_state_s, starttime), - DELTA_DEF(entity_state_s, origin[0]), - DELTA_DEF(entity_state_s, origin[1]), - DELTA_DEF(entity_state_s, origin[2]), - DELTA_DEF(entity_state_s, angles[0]), - DELTA_DEF(entity_state_s, angles[1]), - DELTA_DEF(entity_state_s, angles[2]), - DELTA_DEF(entity_state_s, modelindex), - DELTA_DEF(entity_state_s, frame), - DELTA_DEF(entity_state_s, movetype), - DELTA_DEF(entity_state_s, colormap), - DELTA_DEF(entity_state_s, skin), - DELTA_DEF(entity_state_s, solid), - DELTA_DEF(entity_state_s, scale), - DELTA_DEF(entity_state_s, effects), - DELTA_DEF(entity_state_s, sequence), - DELTA_DEF(entity_state_s, animtime), - DELTA_DEF(entity_state_s, framerate), - DELTA_DEF(entity_state_s, controller[0]), - DELTA_DEF(entity_state_s, controller[1]), - DELTA_DEF(entity_state_s, controller[2]), - DELTA_DEF(entity_state_s, controller[3]), - DELTA_DEF(entity_state_s, blending[0]), - DELTA_DEF(entity_state_s, blending[1]), - DELTA_DEF(entity_state_s, body), - DELTA_DEF(entity_state_s, owner), - DELTA_DEF(entity_state_s, rendermode), - DELTA_DEF(entity_state_s, renderamt), - DELTA_DEF(entity_state_s, renderfx), - DELTA_DEF(entity_state_s, rendercolor.r), - DELTA_DEF(entity_state_s, rendercolor.g), - DELTA_DEF(entity_state_s, rendercolor.b), - DELTA_DEF(entity_state_s, weaponmodel), - DELTA_DEF(entity_state_s, gaitsequence), - DELTA_DEF(entity_state_s, mins[0]), - DELTA_DEF(entity_state_s, mins[1]), - DELTA_DEF(entity_state_s, mins[2]), - DELTA_DEF(entity_state_s, maxs[0]), - DELTA_DEF(entity_state_s, maxs[1]), - DELTA_DEF(entity_state_s, maxs[2]), - DELTA_DEF(entity_state_s, aiment), - DELTA_DEF(entity_state_s, basevelocity[0]), - DELTA_DEF(entity_state_s, basevelocity[1]), - DELTA_DEF(entity_state_s, basevelocity[2]), - DELTA_DEF(entity_state_s, friction), - DELTA_DEF(entity_state_s, gravity), - DELTA_DEF(entity_state_s, spectator), - DELTA_DEF(entity_state_s, velocity[0]), - DELTA_DEF(entity_state_s, velocity[1]), - DELTA_DEF(entity_state_s, velocity[2]), - DELTA_DEF(entity_state_s, team), - DELTA_DEF(entity_state_s, playerclass), - DELTA_DEF(entity_state_s, health), - DELTA_DEF(entity_state_s, usehull), - DELTA_DEF(entity_state_s, oldbuttons), - DELTA_DEF(entity_state_s, onground), - DELTA_DEF(entity_state_s, iStepLeft), - DELTA_DEF(entity_state_s, flFallVelocity), - DELTA_DEF(entity_state_s, weaponanim), - DELTA_DEF(entity_state_s, eflags), - DELTA_DEF(entity_state_s, iuser1), - DELTA_DEF(entity_state_s, iuser2), - DELTA_DEF(entity_state_s, iuser3), - DELTA_DEF(entity_state_s, iuser4), - DELTA_DEF(entity_state_s, fuser1), - DELTA_DEF(entity_state_s, fuser2), - DELTA_DEF(entity_state_s, fuser3), - DELTA_DEF(entity_state_s, fuser4), - DELTA_DEF(entity_state_s, vuser1[0]), - DELTA_DEF(entity_state_s, vuser1[1]), - DELTA_DEF(entity_state_s, vuser1[2]), - DELTA_DEF(entity_state_s, vuser2[0]), - DELTA_DEF(entity_state_s, vuser2[1]), - DELTA_DEF(entity_state_s, vuser2[2]), - DELTA_DEF(entity_state_s, vuser3[0]), - DELTA_DEF(entity_state_s, vuser3[1]), - DELTA_DEF(entity_state_s, vuser3[2]), - DELTA_DEF(entity_state_s, vuser4[0]), - DELTA_DEF(entity_state_s, vuser4[1]), - DELTA_DEF(entity_state_s, vuser4[2]) -}; - -delta_definition_t g_UsercmdDataDefinition[] = -{ - DELTA_DEF(usercmd_s, lerp_msec), - DELTA_DEF(usercmd_s, msec), - DELTA_DEF(usercmd_s, lightlevel), - DELTA_DEF(usercmd_s, viewangles[0]), - DELTA_DEF(usercmd_s, viewangles[1]), - DELTA_DEF(usercmd_s, viewangles[2]), - DELTA_DEF(usercmd_s, buttons), - DELTA_DEF(usercmd_s, forwardmove), - DELTA_DEF(usercmd_s, sidemove), - DELTA_DEF(usercmd_s, upmove), - DELTA_DEF(usercmd_s, impulse), - DELTA_DEF(usercmd_s, weaponselect), - DELTA_DEF(usercmd_s, impact_index), - DELTA_DEF(usercmd_s, impact_position[0]), - DELTA_DEF(usercmd_s, impact_position[1]), - DELTA_DEF(usercmd_s, impact_position[2]) -}; - -delta_definition_t g_WeaponDataDefinition[] = -{ - DELTA_DEF(weapon_data_s, m_iId), - DELTA_DEF(weapon_data_s, m_iClip), - DELTA_DEF(weapon_data_s, m_flNextPrimaryAttack), - DELTA_DEF(weapon_data_s, m_flNextSecondaryAttack), - DELTA_DEF(weapon_data_s, m_flTimeWeaponIdle), - DELTA_DEF(weapon_data_s, m_fInReload), - DELTA_DEF(weapon_data_s, m_fInSpecialReload), - DELTA_DEF(weapon_data_s, m_flNextReload), - DELTA_DEF(weapon_data_s, m_flPumpTime), - DELTA_DEF(weapon_data_s, m_fReloadTime), - DELTA_DEF(weapon_data_s, m_fAimedDamage), - DELTA_DEF(weapon_data_s, m_fNextAimBonus), - DELTA_DEF(weapon_data_s, m_fInZoom), - DELTA_DEF(weapon_data_s, m_iWeaponState), - DELTA_DEF(weapon_data_s, iuser1), - DELTA_DEF(weapon_data_s, iuser2), - DELTA_DEF(weapon_data_s, iuser3), - DELTA_DEF(weapon_data_s, iuser4), - DELTA_DEF(weapon_data_s, fuser1), - DELTA_DEF(weapon_data_s, fuser2), - DELTA_DEF(weapon_data_s, fuser3), - DELTA_DEF(weapon_data_s, fuser4) -}; - -delta_definition_t g_ClientDataDefinition[] = -{ - DELTA_DEF(clientdata_s, origin[0]), - DELTA_DEF(clientdata_s, origin[1]), - DELTA_DEF(clientdata_s, origin[2]), - DELTA_DEF(clientdata_s, velocity[0]), - DELTA_DEF(clientdata_s, velocity[1]), - DELTA_DEF(clientdata_s, velocity[2]), - DELTA_DEF(clientdata_s, viewmodel), - DELTA_DEF(clientdata_s, punchangle[0]), - DELTA_DEF(clientdata_s, punchangle[1]), - DELTA_DEF(clientdata_s, punchangle[2]), - DELTA_DEF(clientdata_s, flags), - DELTA_DEF(clientdata_s, waterlevel), - DELTA_DEF(clientdata_s, watertype), - DELTA_DEF(clientdata_s, view_ofs[0]), - DELTA_DEF(clientdata_s, view_ofs[1]), - DELTA_DEF(clientdata_s, view_ofs[2]), - DELTA_DEF(clientdata_s, health), - DELTA_DEF(clientdata_s, bInDuck), - DELTA_DEF(clientdata_s, weapons), - DELTA_DEF(clientdata_s, flTimeStepSound), - DELTA_DEF(clientdata_s, flDuckTime), - DELTA_DEF(clientdata_s, flSwimTime), - DELTA_DEF(clientdata_s, waterjumptime), - DELTA_DEF(clientdata_s, maxspeed), - DELTA_DEF(clientdata_s, m_iId), - DELTA_DEF(clientdata_s, ammo_nails), - DELTA_DEF(clientdata_s, ammo_shells), - DELTA_DEF(clientdata_s, ammo_cells), - DELTA_DEF(clientdata_s, ammo_rockets), - DELTA_DEF(clientdata_s, m_flNextAttack), - DELTA_DEF(clientdata_s, physinfo), - DELTA_DEF(clientdata_s, fov), - DELTA_DEF(clientdata_s, weaponanim), - DELTA_DEF(clientdata_s, tfstate), - DELTA_DEF(clientdata_s, pushmsec), - DELTA_DEF(clientdata_s, deadflag), - DELTA_DEF(clientdata_s, iuser1), - DELTA_DEF(clientdata_s, iuser2), - DELTA_DEF(clientdata_s, iuser3), - DELTA_DEF(clientdata_s, iuser4), - DELTA_DEF(clientdata_s, fuser1), - DELTA_DEF(clientdata_s, fuser2), - DELTA_DEF(clientdata_s, fuser3), - DELTA_DEF(clientdata_s, fuser4), - DELTA_DEF(clientdata_s, vuser1[0]), - DELTA_DEF(clientdata_s, vuser1[1]), - DELTA_DEF(clientdata_s, vuser1[2]), - DELTA_DEF(clientdata_s, vuser2[0]), - DELTA_DEF(clientdata_s, vuser2[1]), - DELTA_DEF(clientdata_s, vuser2[2]), - DELTA_DEF(clientdata_s, vuser3[0]), - DELTA_DEF(clientdata_s, vuser3[1]), - DELTA_DEF(clientdata_s, vuser3[2]), - DELTA_DEF(clientdata_s, vuser4[0]), - DELTA_DEF(clientdata_s, vuser4[1]), - DELTA_DEF(clientdata_s, vuser4[2]) -}; - -delta_description_t *DELTA_FindField(delta_t *pFields, const char *pszField) -{ - for (int i = 0; i < pFields->fieldCount; i++) - { - if (Q_stricmp(pFields->pdd[i].fieldName, pszField) == 0) { - return &pFields->pdd[i]; - } - } - - return nullptr; -} - -int DELTA_FindFieldIndex(delta_t *pFields, const char *fieldname) -{ - for (int i = 0; i < pFields->fieldCount; i++) - { - if (Q_stricmp(pFields->pdd[i].fieldName, fieldname) == 0) { - return i; - } - } - - return -1; -} - -void DELTA_SetField(delta_t *pFields, const char *fieldname) -{ - delta_description_t *pTest = DELTA_FindField(pFields, fieldname); - if (pTest) { - pTest->flags |= FDT_MARK; - } -} - -void DELTA_UnsetField(delta_t *pFields, const char *fieldname) -{ - delta_description_t *pTest = DELTA_FindField(pFields, fieldname); - if (pTest) { - pTest->flags &= ~FDT_MARK; - } -} - -void DELTA_SetFieldByIndex(delta_t *pFields, int fieldNumber) -{ - pFields->pdd[fieldNumber].flags |= FDT_MARK; -} - -void DELTA_UnsetFieldByIndex(delta_t *pFields, int fieldNumber) -{ - pFields->pdd[fieldNumber].flags &= ~FDT_MARK; -} - -void DELTA_ClearFlags(delta_t *pFields) -{ - for (int i = 0; i < pFields->fieldCount; i++) { - pFields->pdd[i].flags = 0; - } -} - -int DELTA_CountSendFields(delta_t *pFields) -{ - int i, c; - for (i = 0, c = 0; i < pFields->fieldCount; i++) - { - auto pitem = &pFields->pdd[i]; - if (pitem->flags & FDT_MARK) { - pitem->stats.sendcount++; - c++; - } - } - - return c; -} - -void DELTA_MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFields) -{ - int i; - char *st1, *st2; - delta_description_t *pTest; - int fieldType; - int fieldCount = pFields->fieldCount; - - for (i = 0, pTest = pFields->pdd; i < fieldCount; i++, pTest++) - { - fieldType = pTest->fieldType & ~DT_SIGNED; - switch (fieldType) - { - case DT_BYTE: - if (from[pTest->fieldOffset] != to[pTest->fieldOffset]) - pTest->flags |= FDT_MARK; - break; - case DT_SHORT: - if (*(uint16 *)&from[pTest->fieldOffset] != *(uint16 *)&to[pTest->fieldOffset]) - pTest->flags |= FDT_MARK; - break; - case DT_FLOAT: - case DT_INTEGER: - case DT_ANGLE: - if (*(uint32 *)&from[pTest->fieldOffset] != *(uint32 *)&to[pTest->fieldOffset]) - pTest->flags |= FDT_MARK; - break; - case DT_TIMEWINDOW_8: - case DT_TIMEWINDOW_BIG: - if (*(uint32 *)&from[pTest->fieldOffset] != *(uint32 *)&to[pTest->fieldOffset]) - pTest->flags |= FDT_MARK; - break; - case DT_STRING: - st1 = (char *)&from[pTest->fieldOffset]; - st2 = (char *)&to[pTest->fieldOffset]; - - // Not sure why it is case insensitive, but it looks so - if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) { - pTest->flags |= FDT_MARK; - } - break; - default: - break; - } - } - - if (pFields->conditionalencode) { - pFields->conditionalencode(pFields, from, to); - } -} - -void DELTA_SetSendFlagBits(delta_t *pFields, int *bits, int *bytecount) -{ - int i; - int lastbit = -1; - int fieldCount = pFields->fieldCount; - - Q_memset(bits, 0, 8); - - for (i = fieldCount - 1; i >= 0; i--) - { - if (pFields->pdd[i].flags & FDT_MARK) - { - if (lastbit == -1) { - lastbit = i; - } - - bits[i > 31 ? 1 : 0] |= 1 << (i & 0x1f); - } - } - - // fix for bad bytecount when no fields are marked - if (lastbit == -1) { - *bytecount = 0; - return; - } - - *bytecount = (lastbit >> 3) + 1; -} - -void DELTA_WriteMarkedFields(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields) -{ - int i; - delta_description_t *pTest; - int fieldSign; - int fieldType; - - float f2; - int fieldCount = pFields->fieldCount; - - for (i = 0, pTest = pFields->pdd; i < fieldCount; i++, pTest++) - { - if (!(pTest->flags & FDT_MARK)) - continue; - - fieldSign = pTest->fieldType & DT_SIGNED; - fieldType = pTest->fieldType & ~DT_SIGNED; - switch (fieldType) - { - case DT_BYTE: - if (fieldSign) - { - int8 si8 = *(int8 *)&to[pTest->fieldOffset]; - si8 = (int8)((double)si8 * pTest->premultiply); - stream->WriteSBits(si8, pTest->significant_bits); - } - else - { - uint8 i8 = *(uint8 *)&to[pTest->fieldOffset]; - i8 = (uint8)((double)i8 * pTest->premultiply); - stream->WriteBits(i8, pTest->significant_bits); - } - break; - case DT_SHORT: - if (fieldSign) - { - int16 si16 = *(int16 *)&to[pTest->fieldOffset]; - si16 = (int16)((double)si16 * pTest->premultiply); - stream->WriteSBits(si16, pTest->significant_bits); - } - else - { - uint16 i16 = *(uint16 *)&to[pTest->fieldOffset]; - i16 = (uint16)((double)i16 * pTest->premultiply); - stream->WriteBits(i16, pTest->significant_bits); - } - break; - case DT_FLOAT: - { - double val = (double)(*(float *)&to[pTest->fieldOffset]) * pTest->premultiply; - if (fieldSign) - { - stream->WriteSBits((int32)val, pTest->significant_bits); - } - else - { - stream->WriteBits((uint32)val, pTest->significant_bits); - } - break; - } - case DT_INTEGER: - { - if (fieldSign) - { - int32 signedInt = *(int32 *)&to[pTest->fieldOffset]; - if (pTest->premultiply < 0.9999 || pTest->premultiply > 1.0001) { - signedInt = (int32)((double)signedInt * pTest->premultiply); - } - - stream->WriteSBits(signedInt, pTest->significant_bits); - } - else - { - uint32 unsignedInt = *(uint32 *)&to[pTest->fieldOffset]; - if (pTest->premultiply < 0.9999 || pTest->premultiply > 1.0001) { - unsignedInt = (uint32)((double)unsignedInt * pTest->premultiply); - } - - stream->WriteBits(unsignedInt, pTest->significant_bits); - } - break; - } - case DT_ANGLE: - f2 = *(float *)&to[pTest->fieldOffset]; - stream->WriteBitAngle(f2, pTest->significant_bits); - break; - case DT_TIMEWINDOW_8: - { - f2 = *(float *)&to[pTest->fieldOffset]; - if (g_large_Time_Buffers) { - stream->WriteFloat(f2); - } else { - int32 twVal = (int)(g_delta_Time * 100.0) - (int)(f2 * 100.0); - stream->WriteSBits(twVal, 8); - } - break; - } - case DT_TIMEWINDOW_BIG: - { - f2 = *(float *)&to[pTest->fieldOffset]; - if (g_large_Time_Buffers) { - stream->WriteFloat(f2); - } else { - int32 twVal = (int)(g_delta_Time * pTest->premultiply) - (int)(f2 * pTest->premultiply); - stream->WriteSBits((int32)twVal, pTest->significant_bits); - } - break; - } - case DT_STRING: - stream->WriteBitString((const char *)&to[pTest->fieldOffset]); - break; - default: - break; - } - } -} - -int DELTA_CheckDelta(unsigned char *from, unsigned char *to, delta_t *pFields) -{ - DELTA_ClearFlags(pFields); - DELTA_MarkSendFields(from, to, pFields); - - return DELTA_CountSendFields(pFields); -} - -void DELTA_WriteHeader(BitBuffer *stream, deltacallback_t *header) -{ - int delta = header->num - header->numbase; - if (header->full) - { - if (delta == 1) - { - stream->WriteBit(1); - } - else - { - stream->WriteBit(0); - if (delta <= 0 || delta >= 64) - { - stream->WriteBit(1); - stream->WriteBits(header->num, 11); - } - else - { - stream->WriteBit(0); - stream->WriteBits(delta, 6); - } - } - } - else - { - stream->WriteBit(header->remove != 0); - if (delta <= 0 || delta >= 64) - { - stream->WriteBit(1); - stream->WriteBits(header->num, 11); - } - else - { - stream->WriteBit(0); - stream->WriteBits(delta, 6); - } - } - - header->numbase = header->num; - if (!header->remove) - { - stream->WriteBit(header->custom != 0); - if (header->instanced_baseline) - { - if (header->newbl) - { - stream->WriteBit(1); - stream->WriteBits(header->newblindex, 6); - } - else - { - stream->WriteBit(0); - } - } - if (header->full && !header->newbl) - { - if (header->offset) - { - stream->WriteBit(1); - stream->WriteBits(header->offset, 6); - } - else - { - stream->WriteBit(0); - } - } - } -} - -qboolean DELTA_WriteDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, bool force, delta_t *pFields, deltacallback_t *header) -{ - int i; - int bytecount; - int bits[2]; - - if (!DELTA_CheckDelta(from, to, pFields) && !force) { - return FALSE; - } - - DELTA_SetSendFlagBits(pFields, bits, &bytecount); - - if (header) { - DELTA_WriteHeader(stream, header); - } - - stream->WriteBits(bytecount, 3); - for (i = 0; i < bytecount; i++) { - stream->WriteBits(((byte *)bits)[i], 8); - } - - DELTA_WriteMarkedFields(stream, from, to, pFields); - return TRUE; -} - -int DELTA_ParseDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields) -{ - delta_description_t *pTest; - int i; - int bits[2]; // this is a limit with 64 fields max in delta - int nbytes; - int bitfieldnumber; - int fieldCount = pFields->fieldCount; - int fieldType; - int fieldSign; - - double d2; - float t; - int addt; - char *st2; - char c; - int startbit; - - startbit = stream->CurrentBit(); - Q_memset(bits, 0, sizeof(bits)); - - nbytes = stream->ReadBits(3); - for (i = 0; i < nbytes; i++) { - ((byte *)bits)[i] = stream->ReadBits(8); - } - - for (i = 0, pTest = pFields->pdd; i < fieldCount; i++, pTest++) - { - fieldType = pTest->fieldType & ~DT_SIGNED; - - bitfieldnumber = (1 << (i & 0x1F)); - if (!(bitfieldnumber & bits[i > 31])) - { - // Field was not sent to us, just transfer info from the "from" - switch (fieldType) - { - case DT_BYTE: - to[pTest->fieldOffset] = from[pTest->fieldOffset]; - break; - case DT_SHORT: - *(uint16 *)&to[pTest->fieldOffset] = *(uint16 *)&from[pTest->fieldOffset]; - break; - case DT_FLOAT: - case DT_INTEGER: - case DT_ANGLE: - case DT_TIMEWINDOW_8: - case DT_TIMEWINDOW_BIG: - *(uint32 *)&to[pTest->fieldOffset] = *(uint32 *)&from[pTest->fieldOffset]; - break; - case DT_STRING: - Q_strcpy((char *)&to[pTest->fieldOffset], (char *)&from[pTest->fieldOffset]); - break; - default: - break; - } - continue; - } - - pTest->stats.receivedcount++; - fieldSign = pTest->fieldType & DT_SIGNED; - - switch (fieldType) - { - case DT_BYTE: - if (fieldSign) - { - d2 = (double)stream->ReadSBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(int8 *)&to[pTest->fieldOffset] = (int8)d2; - } - else - { - d2 = (double)stream->ReadBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(uint8 *)&to[pTest->fieldOffset] = (uint8)d2; - } - break; - case DT_SHORT: - if (fieldSign) - { - d2 = (double)stream->ReadSBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(int16 *)&to[pTest->fieldOffset] = (int16)d2; - } - else - { - d2 = (double)stream->ReadBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(uint16 *)&to[pTest->fieldOffset] = (uint16)d2; - } - break; - case DT_FLOAT: - if (fieldSign) - { - d2 = (double)stream->ReadSBits(pTest->significant_bits); - } - else - { - d2 = (double)stream->ReadBits(pTest->significant_bits); - } - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(float *)&to[pTest->fieldOffset] = (float)d2; - break; - case DT_INTEGER: - if (fieldSign) - { - d2 = (double)stream->ReadSBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(int32 *)&to[pTest->fieldOffset] = (int32)d2; - } - else - { - d2 = (double)stream->ReadBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - d2 = d2 / pTest->premultiply; - } -#if !defined(HLTV) - if (pTest->postmultiply <= 0.9999 || pTest->postmultiply >= 1.0001) { - d2 = d2 * pTest->postmultiply; - } -#endif - *(uint32 *)&to[pTest->fieldOffset] = (uint32)d2; - } - break; - case DT_ANGLE: - *(float *)&to[pTest->fieldOffset] = stream->ReadBitAngle(pTest->significant_bits); - break; - case DT_TIMEWINDOW_8: - if (g_large_Time_Buffers) { - t = stream->ReadFloat(); - } - else { - addt = stream->ReadSBits(8); - t = (float)((g_delta_Time * 100.0 - addt) / 100.0); - } - *(float *)&to[pTest->fieldOffset] = t; - break; - case DT_TIMEWINDOW_BIG: - if (g_large_Time_Buffers) { - t = stream->ReadFloat(); - } - else { - addt = stream->ReadSBits(pTest->significant_bits); - if (pTest->premultiply <= 0.9999 || pTest->premultiply >= 1.0001) { - t = (float)((g_delta_Time * pTest->premultiply - addt) / pTest->premultiply); - } - else { - t = (float)(g_delta_Time - addt); - } - } - - *(float *)&to[pTest->fieldOffset] = t; - break; - case DT_STRING: - st2 = (char *)&to[pTest->fieldOffset]; - do - { - c = stream->ReadBits(8); - *st2++ = c; - } while (c); - break; - default: - break; - } - } - - return stream->CurrentBit() - startbit; -} - -int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields) -{ - int i; - char *st1, *st2; - delta_description_t *pTest; - int fieldType; - int fieldCount = pFields->fieldCount; - int length = 0; - bool different; - int neededBits = 0; - int highestBit = -1; - - for (i = 0, pTest = pFields->pdd; i < fieldCount; i++, pTest++) - { - different = false; - fieldType = pTest->fieldType & ~DT_SIGNED; - - switch (fieldType) - { - case DT_BYTE: - different = from[pTest->fieldOffset] != to[pTest->fieldOffset]; - break; - case DT_SHORT: - different = *(uint16 *)&from[pTest->fieldOffset] != *(uint16 *)&to[pTest->fieldOffset]; - break; - case DT_FLOAT: - case DT_INTEGER: - case DT_ANGLE: - different = *(uint32 *)&from[pTest->fieldOffset] != *(uint32 *)&to[pTest->fieldOffset]; - break; - // don't use multiplier when checking, to increase performance - // check values binary like it does in jit - case DT_TIMEWINDOW_8: - case DT_TIMEWINDOW_BIG: - different = (*(int32 *)&from[pTest->fieldOffset]) != (*(int32 *)&to[pTest->fieldOffset]); - break; - case DT_STRING: - st1 = (char *)&from[pTest->fieldOffset]; - st2 = (char *)&to[pTest->fieldOffset]; - - // Not sure why it is case insensitive, but it looks so - if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) - { - different = true; - length = Q_strlen(st2) * 8; - pTest->flags |= FDT_MARK; - } - break; - default: - break; - } - - if (different) - { - highestBit = i; - neededBits += (fieldType == DT_STRING) ? length + 8 : pTest->significant_bits; - } - } - - if (highestBit != -1) { - neededBits += highestBit / 8 * 8 + 8; - } - - return neededBits; -} - -void DELTA_AddEncoder(char *name, encoder_t conditionalencode) -{ - delta_encoder_t *delta = (delta_encoder_t *)Mem_ZeroMalloc(sizeof(delta_encoder_t)); - delta->name = Q_strdup(name); - delta->conditionalencode = conditionalencode; - delta->next = g_encoders; - g_encoders = delta; -} - -void DELTA_ClearEncoders() -{ - delta_encoder_t *n, *p = g_encoders; - while (p) - { - n = p->next; - Mem_Free(p->name); - Mem_Free(p); - p = n; - } - - g_encoders = nullptr; -} - -encoder_t DELTA_LookupEncoder(char *name) -{ - delta_encoder_t *p = g_encoders; - while (p) - { - if (Q_stricmp(name, p->name) == 0) { - return p->conditionalencode; - } - - p = p->next; - } - - return nullptr; -} - -int DELTA_CountLinks(delta_link_t *plinks) -{ - delta_link_t *p = plinks; - - int c; - for (c = 0; p; c++) { - p = p->next; - } - - return c; -} - -void DELTA_ReverseLinks(delta_link_t **plinks) -{ - delta_link_t *n, *p = *plinks; - delta_link_t *newlist = nullptr; - - while (p) - { - n = p->next; - p->next = newlist; - newlist = p; - p = n; - } - - *plinks = newlist; -} - -void DELTA_ClearLinks(delta_link_t **plinks) -{ - delta_link_t *n, *p = *plinks; - while (p) - { - n = p->next; - Mem_Free(p); - p = n; - } - *plinks = 0; -} - -delta_t *DELTA_BuildFromLinks(delta_link_t **pplinks) -{ - delta_description_t *pdesc, *pcur; - delta_t *pdelta; - delta_link_t *p; - int count; - - pdelta = (delta_t *)Mem_ZeroMalloc(sizeof(delta_t)); - DELTA_ReverseLinks(pplinks); - count = DELTA_CountLinks(*pplinks); - - if (count > DELTA_MAX_FIELDS) { - return nullptr; - } - - pdesc = (delta_description_t *)Mem_ZeroMalloc(sizeof(delta_description_t) * count); - - for (p = *pplinks, pcur = pdesc; p; p = p->next, pcur++) - { - Q_memcpy(pcur, p->delta, sizeof(delta_description_t)); - Mem_Free(p->delta); - p->delta = nullptr; - } - - DELTA_ClearLinks(pplinks); - - pdelta->dynamic = 1; - pdelta->fieldCount = count; - pdelta->pdd = pdesc; - - return pdelta; -} - -int DELTA_FindOffset(int count, delta_definition_t *pdef, char *fieldname) -{ - for (int i = 0; i < count; i++) - { - if (Q_stricmp(fieldname, pdef[i].fieldName) == 0) { - return pdef[i].fieldOffset; - } - } - - return 0; -} - -bool DELTA_ParseType(delta_description_t *pdelta, char **pstream) -{ - // Read the stream till we hit the end - while (*pstream = COM_Parse(*pstream), com_token[0] != 0) - { - if (!Q_stricmp(com_token, ",")) - return true; // end of type description - - if (!Q_stricmp(com_token, "|")) - continue; // skip | token - - // Determine field type - if (!Q_stricmp(com_token, "DT_SIGNED")) - pdelta->fieldType |= DT_SIGNED; - else if (!Q_stricmp(com_token, "DT_BYTE")) - pdelta->fieldType |= DT_BYTE; - else if (!Q_stricmp(com_token, "DT_SHORT")) - pdelta->fieldType |= DT_SHORT; - else if (!Q_stricmp(com_token, "DT_FLOAT")) - pdelta->fieldType |= DT_FLOAT; - else if (!Q_stricmp(com_token, "DT_INTEGER")) - pdelta->fieldType |= DT_INTEGER; - else if (!Q_stricmp(com_token, "DT_ANGLE")) - pdelta->fieldType |= DT_ANGLE; - else if (!Q_stricmp(com_token, "DT_TIMEWINDOW_8")) - pdelta->fieldType |= DT_TIMEWINDOW_8; - else if (!Q_stricmp(com_token, "DT_TIMEWINDOW_BIG")) - pdelta->fieldType |= DT_TIMEWINDOW_BIG; - else if (!Q_stricmp(com_token, "DT_STRING")) - pdelta->fieldType |= DT_STRING; - else - { - return false; - } - } - - // We are hit the end of the stream - return false; -} - -bool DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link_t *pField, char **pstream) -{ - bool readpost = false; - if (Q_stricmp(com_token, "DEFINE_DELTA")) - { - if (Q_stricmp(com_token, "DEFINE_DELTA_POST") != 0) { - return false; - } - - readpost = true; - } - - *pstream = COM_Parse(*pstream); - if (Q_stricmp(com_token, "(")) - { - return false; - } - - *pstream = COM_Parse(*pstream); - if (com_token[0] == '\0') - { - return false; - } - - Q_strlcpy(pField->delta->fieldName, com_token); - - pField->delta->fieldOffset = DELTA_FindOffset(count, pdefinition, com_token); - - *pstream = COM_Parse(*pstream); - if (!DELTA_ParseType(pField->delta, pstream)) { - return false; - } - - *pstream = COM_Parse(*pstream); - pField->delta->fieldSize = 1; - pField->delta->significant_bits = Q_atoi(com_token); - *pstream = COM_Parse(*pstream); - *pstream = COM_Parse(*pstream); - pField->delta->premultiply = (float)Q_atof(com_token); - - if (readpost) - { - *pstream = COM_Parse(*pstream); - *pstream = COM_Parse(*pstream); - pField->delta->postmultiply = (float)Q_atof(com_token); - } - else - { - pField->delta->postmultiply = 1.0; - } - - *pstream = COM_Parse(*pstream); - if (Q_stricmp(com_token, ")")) - { - return false; - } - - *pstream = COM_Parse(*pstream); - if (Q_stricmp(com_token, ",")) { - COM_UngetToken(); - } - - return true; -} - -void DELTA_FreeDescription(delta_t **ppdesc) -{ - if (ppdesc && *ppdesc) - { - if ((*ppdesc)->dynamic) { - Mem_Free((*ppdesc)->pdd); - } - - Mem_Free(*ppdesc); - *ppdesc = nullptr; - } -} - -void DELTA_AddDefinition(char *name, delta_definition_t *pdef, int numelements) -{ - delta_definition_list_t *p = g_defs; - while (p) - { - if (Q_stricmp(name, p->ptypename) == 0) { - break; - } - - p = p->next; - } - - if (!p) - { - p = (delta_definition_list_t *)Mem_ZeroMalloc(sizeof(delta_definition_list_t)); - p->ptypename = Q_strdup(name); - p->next = g_defs; - g_defs = p; - } - - p->pdefinition = pdef; - p->numelements = numelements; -} - -void DELTA_ClearDefinitions() -{ - delta_definition_list_t *n, *p = g_defs; - while (p) - { - n = p->next; - Mem_Free(p->ptypename); - Mem_Free(p); - p = n; - } - - g_defs = nullptr; -} - -delta_definition_t *DELTA_FindDefinition(char *name, int *count) -{ - *count = 0; - - delta_definition_list_t *p = g_defs; - while (p) - { - if (!Q_stricmp(name, p->ptypename)) - { - *count = p->numelements; - return p->pdefinition; - } - - p = p->next; - } - - return nullptr; -} - -void DELTA_SkipDescription(char **pstream) -{ - *pstream = COM_Parse(*pstream); - do - { - *pstream = COM_Parse(*pstream); - if (com_token[0] == '\0') { - return; - } - } - while (Q_stricmp(com_token, "}")); -} - -bool DELTA_ParseOneField(char **ppstream, delta_link_t **pplist, int count, delta_definition_t *pdefinition) -{ - delta_link_t *newlink; - delta_link_t link; - - while (true) - { - if (!Q_stricmp(com_token, "}")) - { - COM_UngetToken(); - break; - } - - *ppstream = COM_Parse(*ppstream); - if (com_token[0] == '\0') { - break; - } - - Q_memset(&link, 0, sizeof(link)); - link.delta = (delta_description_t *)Mem_ZeroMalloc(sizeof(delta_description_t)); - if (!DELTA_ParseField(count, pdefinition, &link, ppstream)) { - return false; - } - - newlink = (delta_link_t *)Mem_ZeroMalloc(sizeof(delta_link_t)); - newlink->delta = link.delta; - newlink->next = *pplist; - *pplist = newlink; - } - - return true; -} - -bool DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream) -{ - delta_link_t *links = nullptr; - delta_definition_t *pdefinition; - char encoder[32] = ""; - char source[32]; - int count = 0; - - if (!ppdesc) { - return false; - } - - *ppdesc = nullptr; - - if (!pstream) { - return false; - } - - while (true) - { - // Parse delta name - pstream = COM_Parse(pstream); - if (com_token[0] == '\0') { - break; - } - - if (Q_stricmp(com_token, name)) - { - DELTA_SkipDescription(&pstream); - } - else - { - pdefinition = DELTA_FindDefinition(com_token, &count); - if (!pdefinition) { - return false; - } - - // Parse source of conditional encoder - pstream = COM_Parse(pstream); - if (com_token[0] == '\0') { - return false; - } - - if (Q_stricmp(com_token, "none")) - { - Q_strlcpy(source, com_token); - - // Parse custom encoder function name - pstream = COM_Parse(pstream); - if (com_token[0] == '\0') { - return false; - } - - Q_strlcpy(encoder, com_token); - } - - // Parse fields - while (true) - { - pstream = COM_Parse(pstream); - if (com_token[0] == '\0') { - break; - } - - if (!Q_stricmp(com_token, "}")) { - break; - } - - if (Q_stricmp(com_token, "{")) { - return false; - } - - if (!DELTA_ParseOneField(&pstream, &links, count, pdefinition)) { - return false; - } - } - } - } - - *ppdesc = DELTA_BuildFromLinks(&links); - - if (encoder[0]) - { - Q_strlcpy((*ppdesc)->conditionalencodename, encoder1); - (*ppdesc)->conditionalencode = nullptr; - } - - return true; -} - -bool DELTA_Load(char *name, delta_t **ppdesc, char *pszFile) -{ - return false; -} - -void DELTA_RegisterDescription(char *name) -{ - delta_registry_t *p = (delta_registry_t *)Mem_ZeroMalloc(sizeof(delta_registry_t)); - p->next = g_deltaregistry; - g_deltaregistry = p; - p->name = Q_strdup(name); - p->pdesc = 0; -} - -void DELTA_ClearRegistrations() -{ - delta_registry_t *n, *p = g_deltaregistry; - while (p) - { - n = p->next; - Mem_Free(p->name); - - if (p->pdesc) { - DELTA_FreeDescription(&p->pdesc); - } - - Mem_Free(p); - p = n; - } - - g_deltaregistry = nullptr; -} - -delta_t **DELTA_LookupRegistration(char *name) -{ - delta_registry_t *delta = g_deltaregistry; - while (delta) - { - if (Q_stricmp(delta->name, name) == 0) { - return &delta->pdesc; - } - - delta = delta->next; - } - - return nullptr; -} - -void DELTA_ClearStats(delta_t *p) -{ - if (!p) { - return; - } - - for (int i = 0; i < p->fieldCount; i++) - { - p->pdd[i].stats.sendcount = 0; - p->pdd[i].stats.receivedcount = 0; - } -} - -void DELTA_Init() -{ - g_defs = nullptr; - g_encoders = nullptr; - g_deltaregistry = nullptr; - - DELTA_AddDefinition("clientdata_t", g_ClientDataDefinition, ARRAYSIZE(g_ClientDataDefinition)); - DELTA_AddDefinition("weapon_data_t", g_WeaponDataDefinition, ARRAYSIZE(g_WeaponDataDefinition)); - DELTA_AddDefinition("usercmd_t", g_UsercmdDataDefinition, ARRAYSIZE(g_UsercmdDataDefinition)); - DELTA_AddDefinition("entity_state_t", g_EntityDataDefinition, ARRAYSIZE(g_EntityDataDefinition)); - DELTA_AddDefinition("entity_state_player_t", g_EntityDataDefinition, ARRAYSIZE(g_EntityDataDefinition)); - DELTA_AddDefinition("custom_entity_state_t", g_EntityDataDefinition, ARRAYSIZE(g_EntityDataDefinition)); - DELTA_AddDefinition("event_t", g_EventDataDefinition, ARRAYSIZE(g_EventDataDefinition)); - - DELTA_RegisterDescription("clientdata_t"); - DELTA_RegisterDescription("entity_state_t"); - DELTA_RegisterDescription("entity_state_player_t"); - DELTA_RegisterDescription("custom_entity_state_t"); - DELTA_RegisterDescription("usercmd_t"); - DELTA_RegisterDescription("weapon_data_t"); - DELTA_RegisterDescription("event_t"); - - g_large_Time_Buffers = false; -} - -void DELTA_UpdateDescriptions() -{ - g_pplayerdelta = *DELTA_LookupRegistration("entity_state_player_t"); - g_pentitydelta = *DELTA_LookupRegistration("entity_state_t"); - g_pcustomentitydelta = *DELTA_LookupRegistration("custom_entity_state_t"); - g_pclientdelta = *DELTA_LookupRegistration("clientdata_t"); - g_pweapondelta = *DELTA_LookupRegistration("weapon_data_t"); - g_peventdelta = *DELTA_LookupRegistration("event_t"); -} - -void DELTA_Shutdown() -{ - DELTA_ClearEncoders(); - DELTA_ClearDefinitions(); - DELTA_ClearRegistrations(); -} - -void DELTA_SetTime(double time) -{ - g_delta_Time = time; -} - -void DELTA_SetLargeTimeBufferSize(bool bigBuffers) -{ - g_large_Time_Buffers = bigBuffers; -} - -bool World::IsDeltaEncoder() const -{ - if (g_pcustomentitydelta - && g_pentitydelta - && g_pplayerdelta) { - return true; - } - - return false; -} - -delta_t *World::GetDeltaEncoder(int index, bool custom) -{ - if (custom) { - return (delta_t *)g_pcustomentitydelta; - } - else if (IsPlayerIndex(index)) { - return (delta_t *)g_pplayerdelta; - } - - return (delta_t *)g_pentitydelta; -} - -delta_t *World::GetEventDelta() const { - return g_peventdelta; -} - -delta_t *World::GetClientDelta() const { - return g_pclientdelta; -} - -delta_t *World::GetEntityDelta() const { - return g_pentitydelta; -} - -delta_t *World::GetWeaponDelta() const { - return g_pweapondelta; -} - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Core/DeltaEx.h b/rehlds/hookers/HLTV/Core/DeltaEx.h deleted file mode 100644 index 06db8ed..0000000 --- a/rehlds/hookers/HLTV/Core/DeltaEx.h +++ /dev/null @@ -1,163 +0,0 @@ -/* -* -* This program 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 2 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, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#pragma once - -#ifdef HOOK_HLTV - -#include "event_args.h" - -#define g_defs (*pg_defs) -#define g_encoders (*pg_encoders) -#define g_deltaregistry (*pg_deltaregistry) - -#define g_pplayerdelta (*pg_pplayerdelta) -#define g_pentitydelta (*pg_pentitydelta) -#define g_pcustomentitydelta (*pg_pcustomentitydelta) -#define g_pclientdelta (*pg_pclientdelta) -#define g_pweapondelta (*pg_pweapondelta) -#define g_peventdelta (*pg_peventdelta) - -#define g_delta_Time (*pg_delta_Time) -#define g_large_Time_Buffers (*pg_large_Time_Buffers) - -typedef struct delta_link_s -{ - struct delta_link_s *next; - delta_description_t *delta; -} delta_link_t; - -typedef struct delta_definition_s -{ - char *fieldName; - size_t fieldOffset; -} delta_definition_t; - -typedef struct delta_definition_list_s -{ - struct delta_definition_list_s *next; - char *ptypename; - int numelements; - delta_definition_t *pdefinition; -} delta_definition_list_t; - -typedef struct delta_registry_s -{ - struct delta_registry_s *next; - char *name; - delta_t *pdesc; -} delta_registry_t; - -namespace Delta { - #define m_MetaDelta g_MetaDelta - extern delta_t g_MetaDelta[]; -}; - -#define m_EntityDelta g_pentitydelta -#define m_PlayerDelta g_pplayerdelta -#define m_CustomentityDelta g_pcustomentitydelta - -#define m_ClientDelta g_pclientdelta -#define m_WeaponDelta g_pweapondelta -#define m_EventDelta g_peventdelta - -extern delta_definition_list_t *g_defs; -extern delta_encoder_t *g_encoders; -extern delta_registry_t *g_deltaregistry; - -extern delta_t *g_pentitydelta; -extern delta_t *g_pplayerdelta; -extern delta_t *g_pcustomentitydelta; -extern delta_t *g_pclientdelta; -extern delta_t *g_pweapondelta; -extern delta_t *g_peventdelta; - -extern double g_delta_Time; -extern bool g_large_Time_Buffers; - -delta_description_t *DELTA_FindField(delta_t *pFields, const char *pszField); -int DELTA_FindFieldIndex(delta_t *pFields, const char *fieldname); -void DELTA_SetField(delta_t *pFields, const char *fieldname); -void DELTA_UnsetField(delta_t *pFields, const char *fieldname); -void DELTA_SetFieldByIndex(delta_t *pFields, int fieldNumber); -void DELTA_UnsetFieldByIndex(delta_t *pFields, int fieldNumber); -void DELTA_ClearFlags(delta_t *pFields); -int DELTA_CountSendFields(delta_t *pFields); -void DELTA_MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFields); -void DELTA_SetSendFlagBits(delta_t *pFields, int *bits, int *bytecount); -void DELTA_WriteMarkedFields(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields); -int DELTA_CheckDelta(unsigned char *from, unsigned char *to, delta_t *pFields); -void DELTA_WriteHeader(BitBuffer *stream, deltacallback_t *header); -qboolean DELTA_WriteDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, bool force, delta_t *pFields, deltacallback_t *header = nullptr); -int DELTA_ParseDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields); -int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields); -void DELTA_AddEncoder(char *name, encoder_t conditionalencode); -void DELTA_ClearEncoders(); -encoder_t DELTA_LookupEncoder(char *name); -int DELTA_CountLinks(delta_link_t *plinks); -void DELTA_ReverseLinks(delta_link_t **plinks); -void DELTA_ClearLinks(delta_link_t **plinks); -delta_t *DELTA_BuildFromLinks(delta_link_t **pplinks); -int DELTA_FindOffset(int count, delta_definition_t *pdef, char *fieldname); -bool DELTA_ParseType(delta_description_t *pdelta, char **pstream); -bool DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link_t *pField, char **pstream); -void DELTA_FreeDescription(delta_t **ppdesc); -void DELTA_AddDefinition(char *name, delta_definition_t *pdef, int numelements); -void DELTA_ClearDefinitions(); -delta_definition_t *DELTA_FindDefinition(char *name, int *count); -void DELTA_SkipDescription(char **pstream); -bool DELTA_ParseOneField(char **ppstream, delta_link_t **pplist, int count, delta_definition_t *pdefinition); -bool DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream); -bool DELTA_Load(char *name, delta_t **ppdesc, char *pszFile); -void DELTA_RegisterDescription(char *name); -void DELTA_ClearRegistrations(); -delta_t **DELTA_LookupRegistration(char *name); -void DELTA_ClearStats(delta_t *p); -void DELTA_Init(); -void DELTA_UpdateDescriptions(); -void DELTA_Shutdown(); -void DELTA_SetTime(double time); -void DELTA_SetLargeTimeBufferSize(bool bigBuffers); - -class DeltaWrapper { -public: - void Init(IBaseSystem *system) { DELTA_Init(); } - void Shutdown() { DELTA_Shutdown(); } - void UpdateDescriptions() { DELTA_UpdateDescriptions(); } - void WriteHeader(BitBuffer *stream, deltacallback_t *header) { DELTA_WriteHeader(stream, header); } - bool WriteDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, bool force, delta_t *pFields, deltacallback_t *header = nullptr) { return DELTA_WriteDelta(stream, from, to, force, pFields, header) ? true : false; } - int ParseDelta(BitBuffer *stream, unsigned char *from, unsigned char *to, delta_t *pFields) { return DELTA_ParseDelta(stream, from, to, pFields); } - void SetTime(double time) { DELTA_SetTime(time); } - void SetLargeTimeBufferSize(bool bigBuffers) { DELTA_SetLargeTimeBufferSize(bigBuffers); } - int TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields) { return DELTA_TestDelta(from, to, pFields); } - delta_t **LookupRegistration(char *name) { return DELTA_LookupRegistration(name); } - void FreeDescription(delta_t **ppdesc) { DELTA_FreeDescription(ppdesc); } - delta_registry_t *GetRegistry() const { return g_deltaregistry; } -}; - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Core/hooklist.cpp b/rehlds/hookers/HLTV/Core/hooklist.cpp deleted file mode 100644 index d306a03..0000000 --- a/rehlds/hookers/HLTV/Core/hooklist.cpp +++ /dev/null @@ -1,617 +0,0 @@ -/* -* -* This program 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 2 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, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -#ifdef HOOK_HLTV - -// Hooks stuff -#include "hookers/memory.cpp" -#include "hookers/hooker.cpp" - -//#define Mem_region -//#define World_region -//#define Server_region -//#define Network_region -//#define NetSocket_region -//#define BSPModel_region -//#define Delta_region -//#define ObjectDictionary_region -//#define ObjectList_region -//#define BitBuffer_region -//#define Function_References_region -//#define Data_References_region - -FunctionHook g_FunctionHooks[] = -{ - // DO NOT DISABLE, other functions depends on memory allocation routines -#ifndef Mem_region - - HOOK_DEF(0x01D21F5F, malloc_wrapper), - HOOK_DEF(0x01D21E4E, free_wrapper), - HOOK_DEF(0x01D30145, strdup_wrapper), - HOOK_DEF(0x01D21F71, __nh_malloc_wrapper), - - HOOK_DEF(0x01D043C0, Mem_ZeroMalloc), - //HOOK_DEF(0x0, Mem_Malloc), - //HOOK_DEF(0x0, Mem_Realloc), - //HOOK_DEF(0x0, Mem_Calloc), - //HOOK_DEF(0x0, Mem_Strdup), - //HOOK_DEF(0x0, Mem_Free), - - //HOOK_DEF(0x0, realloc_wrapper), - //HOOK_DEF(0x0, calloc_wrapper), - -#endif // Mem_region - -#ifndef World_region - - // World virtual functions - HOOK_VIRTUAL_DEF(0x01D14DA0, World::Init), - HOOK_VIRTUAL_DEF(0x01D15470, World::RunFrame), - HOOK_VIRTUAL_DEF(0x01D154F0, World::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D15490, World::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D15500, World::RegisterListener), - HOOK_VIRTUAL_DEF(0x01D15530, World::RemoveListener), - HOOK_VIRTUAL_DEF(0x01D15570, World::GetSystem), - HOOK_VIRTUAL_DEF(0x01D15580, World::GetSerial), - HOOK_VIRTUAL_DEF(0x01D17380, World::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D17370, World::GetType), - HOOK_VIRTUAL_DEF(0x01D15590, World::GetName), - HOOK_VIRTUAL_DEF(0x01D155C0, World::GetState), - HOOK_VIRTUAL_DEF(0x01D15620, World::GetVersion), - HOOK_VIRTUAL_DEF(0x01D14F70, World::ShutDown), - HOOK_VIRTUAL_DEF(0x01D175D0, World::GetTime), - HOOK_VIRTUAL_DEF(0x01D186A0, World::GetGameServerAddress), - HOOK_VIRTUAL_DEF(0x01D186B0, World::GetLevelName), - HOOK_VIRTUAL_DEF(0x01D186F0, World::GetGameDir), - HOOK_VIRTUAL_DEF(0x01D16470, World::GetFrameByTime), - HOOK_VIRTUAL_DEF(0x01D16420, World::GetFrameBySeqNr), - HOOK_VIRTUAL_DEF(0x01D16450, World::GetLastFrame), - HOOK_VIRTUAL_DEF(0x01D16460, World::GetFirstFrame), - HOOK_VIRTUAL_DEF(0x01D18700, World::GetServerCount), - HOOK_VIRTUAL_DEF(0x01D18670, World::GetSlotNumber), - HOOK_VIRTUAL_DEF(0x01D18710, World::GetMaxClients), - HOOK_VIRTUAL_DEF(0x01D15840, World::GetNumPlayers), - HOOK_VIRTUAL_DEF(0x01D186C0, World::GetWorldModel), - HOOK_VIRTUAL_DEF(0x01D18350, World::GetServerInfoString), - HOOK_VIRTUAL_DEF(0x01D18360, World::GetPlayerInfoString), - HOOK_VIRTUAL_DEF(0x01D15450, World::GetUserMsg), - HOOK_VIRTUAL_DEF(0x01D15A60, World::GetHostName), - HOOK_VIRTUAL_DEF(0x01D189A0, World::GetServerInfo), - HOOK_VIRTUAL_DEF(0x01D15510, World::IsPlayerIndex), - HOOK_VIRTUAL_DEF(0x01D18660, World::IsVoiceEnabled), - HOOK_VIRTUAL_DEF(0x01D15870, World::IsActive), - HOOK_VIRTUAL_DEF(0x01D18190, World::IsPaused), - HOOK_VIRTUAL_DEF(0x01D181A0, World::IsComplete), - HOOK_VIRTUAL_DEF(0x01D18D20, World::IsHLTV), - HOOK_VIRTUAL_DEF(0x01D15010, World::Reset), - HOOK_VIRTUAL_DEF(0x01D158A0, World::SetServerInfoString), - HOOK_VIRTUAL_DEF(0x01D18C30, World::UpdateServerInfo), - HOOK_VIRTUAL_DEF(0x01D18150, World::SetPaused), - HOOK_VIRTUAL_DEF(0x01D15630, World::SetTime), - HOOK_VIRTUAL_DEF(0x01D181B0, World::SetBufferSize), - HOOK_VIRTUAL_DEF(0x01D18690, World::SetVoiceEnabled), - HOOK_VIRTUAL_DEF(0x01D18130, World::SetMoveVars), - HOOK_VIRTUAL_DEF(0x01D18320, World::SetCDInfo), - HOOK_VIRTUAL_DEF(0x01D18D10, World::SetHLTV), - HOOK_VIRTUAL_DEF(0x01D183B0, World::SetExtraInfo), - HOOK_VIRTUAL_DEF(0x01D18680, World::SetViewEntity), - HOOK_VIRTUAL_DEF(0x01D18340, World::SetGameServerAddress), - HOOK_VIRTUAL_DEF(0x01D15680, World::SetHostName), - HOOK_VIRTUAL_DEF(0x01D15760, World::NewGame), - HOOK_VIRTUAL_DEF(0x01D17490, World::FinishGame), - HOOK_VIRTUAL_DEF(0x01D18720, World::SaveAsDemo), - HOOK_VIRTUAL_DEF(0x01D174C0, World::StopGame), - HOOK_VIRTUAL_DEF(0x01D17560, World::FindUserMsgByName), - HOOK_VIRTUAL_DEF(0x01D181F0, World::ParseDeltaDescription), - HOOK_VIRTUAL_DEF(0x01D18420, World::ParseBaseline), - HOOK_VIRTUAL_DEF(0x01D183F0, World::ParseEvent), - HOOK_VIRTUAL_DEF(0x01D16990, World::ParseClientData), - HOOK_VIRTUAL_DEF(0x01D18070, World::SetServerInfo, void(int, CRC32_t, unsigned char *, int, int, int, char *, char *, char *)), - HOOK_VIRTUAL_DEF(0x01D17470, World::SetServerInfo, void(serverinfo_t *)), - HOOK_VIRTUAL_DEF(0x01D16740, World::GetUncompressedFrame, bool(unsigned int, frame_t *)), - HOOK_VIRTUAL_DEF(0x01D17A60, World::UncompressEntitiesFromStream, bool(frame_t *, BitBuffer *)), - HOOK_VIRTUAL_DEF(0x01D175E0, World::UncompressEntitiesFromStream, bool(frame_t *, BitBuffer *, unsigned int)), - HOOK_VIRTUAL_DEF(0x01D167F0, World::GetClientData, bool(frame_t *, clientdata_t *)), - HOOK_VIRTUAL_DEF(0x01D167B0, World::GetClientData, bool(unsigned int, clientdata_t *)), - HOOK_VIRTUAL_DEF(0x01D160A0, World::AddFrame), - HOOK_VIRTUAL_DEF(0x01D153B0, World::AddResource), - HOOK_VIRTUAL_DEF(0x01D156E0, World::AddLightStyle), - HOOK_VIRTUAL_DEF(0x01D17520, World::AddSignonData), - HOOK_VIRTUAL_DEF(0x01D15130, World::AddUserMessage), - HOOK_VIRTUAL_DEF(0x01D154A0, World::AddBaselineEntity), - HOOK_VIRTUAL_DEF(0x01D155D0, World::AddInstancedBaselineEntity), - HOOK_VIRTUAL_DEF(0x01D151F0, World::UpdatePlayer), - HOOK_VIRTUAL_DEF(0x01D164C0, World::WriteFrame), - HOOK_VIRTUAL_DEF(0x01D17CB0, World::WriteNewData), - HOOK_VIRTUAL_DEF(0x01D16030, World::WriteClientUpdate), - HOOK_VIRTUAL_DEF(0x01D15D20, World::WriteMovevars), - HOOK_VIRTUAL_DEF(0x01D174F0, World::WriteSigonData), - HOOK_VIRTUAL_DEF(0x01D15A20, World::WriteLightStyles), - HOOK_VIRTUAL_DEF(0x01D17D80, World::RemoveFrames), - HOOK_VIRTUAL_DEF(0x01D17ED0, World::DuplicateFrames), - HOOK_VIRTUAL_DEF(0x01D17EF0, World::MoveFrames), - HOOK_VIRTUAL_DEF(0x01D17F10, World::RevertFrames), - - // World non-virtual functions - HOOK_DEF(0x01D16BA0, World::CompressFrame), - HOOK_DEF(0x01D16A80, World::ParseDeltaHeader), - HOOK_DEF(0x01D150D0, World::SetMaxClients), - HOOK_DEF(0x01D17D30, World::GetBufferedGameTime), - HOOK_DEF(0x01D15800, World::ConnectionComplete), - HOOK_DEF(0x01D15F00, World::WriteResources), - HOOK_DEF(0x01D15C60, World::WriteDeltaDescriptions), - HOOK_DEF(0x01D15EB0, World::WriteRegisteredUserMessages), - HOOK_DEF(0x01D158B0, World::WriteBaseline), - HOOK_DEF(0x01D15A80, World::WriteServerinfo), - HOOK_DEF(0x01D170E0, World::WritePacketEntities), - HOOK_DEF(0x01D189B0, World::WriteDeltaEntities), - HOOK_DEF(0x01D15790, World::SetState), - HOOK_DEF(0x01D15100, World::ClearUserMessages), - HOOK_DEF(0x01D17430, World::ClearServerInfo), - HOOK_DEF(0x01D15410, World::ClearResources), - HOOK_DEF(0x01D155A0, World::ClearInstancedBaseline), - HOOK_DEF(0x01D15540, World::ClearBaseline), - HOOK_DEF(0x01D156C0, World::ClearLightStyles), - HOOK_DEF(0x01D15880, World::ClearPlayers), - HOOK_DEF(0x01D17F30, World::ClearFrames), - HOOK_DEF(0x01D16E80, World::ClearEntityCache), - HOOK_DEF(0x01D16F30, World::GetFrameFromCache), - HOOK_DEF(0x01D17010, World::GetDeltaFromCache), - HOOK_DEF(0x01D17F90, World::CheckFrameBufferSize), - HOOK_DEF(0x01D18000, World::ReorderFrameTimes), - HOOK_DEF(0x01D16D20, World::FindBestBaseline), - HOOK_DEF(0x01D18A60, World::RearrangeFrame), - HOOK_DEF(0x01D16880, World::GetUncompressedFrame, bool(frame_t *deltaFrame, frame_t *frame)), - - //HOOK_DEF(0x01D17D00, World::SetName), // NOXREF - //HOOK_DEF(0x0, World::SetDirector), // NOXREF - //HOOK_DEF(0x0, World::SetTimeScale), // NOXREF - //HOOK_DEF(0x0, World::SetGameGroupAddress), // NOXREF - //HOOK_DEF(0x0, World::GetDirector), // NOXREF - //HOOK_DEF(0x0, World::WriteCustomDecals), // NOXREF - -#endif // World_region - -#ifndef Server_region - - // IServer virtual functions - HOOK_VIRTUAL_DEF(0x01D106B0, Server::Init), - HOOK_VIRTUAL_DEF(0x01D10C10, Server::RunFrame), - HOOK_VIRTUAL_DEF(0x01D10A90, Server::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D13870, Server::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D137F0, Server::GetType), - HOOK_VIRTUAL_DEF(0x01D10B80, Server::ShutDown), - HOOK_VIRTUAL_DEF(0x01D14220, Server::Connect), - HOOK_VIRTUAL_DEF(0x01D142F0, Server::LoadDemo), - HOOK_VIRTUAL_DEF(0x01D13E40, Server::Reconnect), - HOOK_VIRTUAL_DEF(0x01D13EA0, Server::Disconnect), - HOOK_VIRTUAL_DEF(0x01D14620, Server::Retry), - HOOK_VIRTUAL_DEF(0x01D14680, Server::StopRetry), - HOOK_VIRTUAL_DEF(0x01D14430, Server::SendStringCommand), - HOOK_VIRTUAL_DEF(0x01D14470, Server::SendHLTVCommand), - HOOK_VIRTUAL_DEF(0x01D140C0, Server::IsConnected), - HOOK_VIRTUAL_DEF(0x01D140D0, Server::IsDemoFile), - HOOK_VIRTUAL_DEF(0x01D140E0, Server::IsGameServer), - HOOK_VIRTUAL_DEF(0x01D140F0, Server::IsRelayProxy), - HOOK_VIRTUAL_DEF(0x01D11260, Server::IsVoiceBlocking), - HOOK_VIRTUAL_DEF(0x01D13A70, Server::SetProxy), - HOOK_VIRTUAL_DEF(0x01D13A90, Server::SetDirector), - HOOK_VIRTUAL_DEF(0x01D137A0, Server::SetPlayerName), - HOOK_VIRTUAL_DEF(0x01D146B0, Server::SetDelayReconnect), - HOOK_VIRTUAL_DEF(0x01D14690, Server::SetAutoRetry), - HOOK_VIRTUAL_DEF(0x01D11270, Server::SetVoiceBlocking), - HOOK_VIRTUAL_DEF(0x01D11280, Server::SetRate), - HOOK_VIRTUAL_DEF(0x01D112D0, Server::SetUpdateRate), - HOOK_VIRTUAL_DEF(0x01D14390, Server::SetUserInfo), - HOOK_VIRTUAL_DEF(0x01D13770, Server::SetProtocol), - HOOK_VIRTUAL_DEF(0x01D109C0, Server::SetGameDirectory), - HOOK_VIRTUAL_DEF(0x01D13730, Server::GetRate), - HOOK_VIRTUAL_DEF(0x01D13740, Server::GetUpdateRate), - HOOK_VIRTUAL_DEF(0x01D13720, Server::GetServerInfoString), - HOOK_VIRTUAL_DEF(0x01D137D0, Server::GetPlayerName), - - // Server virtual functions - HOOK_VIRTUAL_DEF(0x01D145A0, Server::GetTime), - HOOK_VIRTUAL_DEF(0x01D13800, Server::GetWorld), - HOOK_VIRTUAL_DEF(0x01D13830, Server::GetDemoFileName), - HOOK_VIRTUAL_DEF(0x01D13810, Server::GetAddress), - HOOK_VIRTUAL_DEF(0x01D13750, Server::GetAutoRetry), - HOOK_VIRTUAL_DEF(0x01D13850, Server::GetHostName), - HOOK_VIRTUAL_DEF(0x01D13860, Server::GetPacketLoss), - HOOK_VIRTUAL_DEF(0x01D13760, Server::GetProtocol), - - // Server non-virtual functions - HOOK_DEF(0x01D14190, Server::CheckAutoRetry), - HOOK_DEF(0x01D145B0, Server::CheckConnection), - HOOK_DEF(0x01D141F0, Server::ScheduleAutoRetry), - HOOK_DEF(0x01D11750, Server::AcceptConnection), - HOOK_DEF(0x01D116C0, Server::AcceptBadPassword), - HOOK_DEF(0x01D11700, Server::AcceptRejection), - HOOK_DEF(0x01D117D0, Server::AcceptRedirect), - HOOK_DEF(0x01D11460, Server::SendConnectPacket), - HOOK_DEF(0x01D132F0, Server::SendServerCommands), - HOOK_DEF(0x01D11320, Server::SetState), - HOOK_DEF(0x01D10AB0, Server::Challenge), - HOOK_DEF(0x01D146C0, Server::Reset), - HOOK_DEF(0x01D11170, Server::AcceptChallenge), - HOOK_DEF(0x01D14050, Server::SendUserVar), - HOOK_DEF(0x01D10F70, Server::ProcessMessage), - HOOK_DEF(0x01D147B0, Server::ProcessEntityUpdate), - HOOK_DEF(0x01D10DA0, Server::ProcessConnectionlessMessage), - HOOK_DEF(0x01D12EF0, Server::ClearFrame), - HOOK_DEF(0x01D139E0, Server::ParseHLTV), - HOOK_DEF(0x01D13AA0, Server::ParseDirector), - HOOK_DEF(0x01D12CA0, Server::ParseFileTransferFailed), - HOOK_DEF(0x01D13B80, Server::ParseInfo), - HOOK_DEF(0x01D136E0, Server::ParseParticle), - HOOK_DEF(0x01D136B0, Server::ParseRoomType), - HOOK_DEF(0x01D13610, Server::ParseSpawnStaticSound), - HOOK_DEF(0x01D13580, Server::ParseEventReliable), - HOOK_DEF(0x01D13510, Server::ParsePings), - HOOK_DEF(0x01D12CE0, Server::ParseSignonNum), - HOOK_DEF(0x01D12FB0, Server::ParseUserMessage), - HOOK_DEF(0x01D134E0, Server::ParseStopSound), - HOOK_DEF(0x01D13410, Server::ParseEvent), - HOOK_DEF(0x01D13340, Server::ParseSound), - HOOK_DEF(0x01D13240, Server::ParseDeltaPacketEntities), - HOOK_DEF(0x01D131A0, Server::ParsePacketEntities), - HOOK_DEF(0x01D12DF0, Server::ParseCustomization), - HOOK_DEF(0x01D12010, Server::ParseCrosshairAngle), - HOOK_DEF(0x01D12050, Server::ParseSoundFade), - HOOK_DEF(0x01D12C10, Server::ParseDisconnect), - HOOK_DEF(0x01D12C00, Server::ParseChoke), - HOOK_DEF(0x01D12AC0, Server::ParseSetAngle), - HOOK_DEF(0x01D12B60, Server::ParseAddAngle), - HOOK_DEF(0x01D12A40, Server::ParseLightStyle), - HOOK_DEF(0x01D12A20, Server::ParseTime), - HOOK_DEF(0x01D129F0, Server::ParseVersion), - HOOK_DEF(0x01D129D0, Server::ParseBaseline), - HOOK_DEF(0x01D12860, Server::ParseTempEntity), - HOOK_DEF(0x01D12650, Server::ParseResourceList), - HOOK_DEF(0x01D12590, Server::ParseUpdateUserInfo), - HOOK_DEF(0x01D12150, Server::ParseStuffText), - HOOK_DEF(0x01D120C0, Server::ParseNewUserMsg), - HOOK_DEF(0x01D11F80, Server::ParseResourceRequest), - HOOK_DEF(0x01D11F00, Server::ParseSetView), - HOOK_DEF(0x01D11E90, Server::ParseCDTrack), - HOOK_DEF(0x01D11EC0, Server::ParseRestore), - HOOK_DEF(0x01D11CC0, Server::ParseMoveVars), - HOOK_DEF(0x01D11C60, Server::ParseDeltaDescription), - HOOK_DEF(0x01D119F0, Server::ParseServerinfo), - HOOK_DEF(0x01D119D0, Server::ParseBad), - HOOK_DEF(0x01D119C0, Server::ParseNop), - HOOK_DEF(0x01D11850, Server::ParsePrint), - HOOK_DEF(0x01D11880, Server::ParseVoiceInit), - HOOK_DEF(0x01D11940, Server::ParseVoiceData), - HOOK_DEF(0x01D144F0, Server::ParseTimeScale), - HOOK_DEF(0x01D144C0, Server::ParseSendExtraInfo), - HOOK_DEF(0x01D14100, Server::ParseCenterPrint), - HOOK_DEF(0x01D143D0, Server::ParseSetPause), - HOOK_DEF(0x01D14020, Server::ParseCutscene), - HOOK_DEF(0x01D12140, Server::ParseWeaponAnim), - HOOK_DEF(0x01D11C80, Server::ParseDecalName), - HOOK_DEF(0x01D13FF0, Server::ParseFinale), - HOOK_DEF(0x01D13FC0, Server::ParseIntermission), - HOOK_DEF(0x01D13F50, Server::ParseClientData), - HOOK_DEF(0x01D14570, Server::ParseResourceLocation), - HOOK_DEF(0x01D14820, Server::ParseSendCvarValue), - HOOK_DEF(0x01D14830, Server::ParseSendCvarValue2), - //HOOK_DEF(0x01D14740, Server::GetCmdName), // NOXREF - -#endif // Server_region - -#ifndef Network_region - - // Network virtual functions - HOOK_VIRTUAL_DEF(0x01D0E040, Network::Init), - HOOK_VIRTUAL_DEF(0x01D0E480, Network::RunFrame), - HOOK_VIRTUAL_DEF(0x01D0E5B0, Network::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D0E210, Network::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D0E5C0, Network::RegisterListener), - HOOK_VIRTUAL_DEF(0x01D0E670, Network::RemoveListener), - HOOK_VIRTUAL_DEF(0x01D0E680, Network::GetSystem), - HOOK_VIRTUAL_DEF(0x01D0E690, Network::GetSerial), - HOOK_VIRTUAL_DEF(0x01D0E4D0, Network::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D0E3B0, Network::GetType), - HOOK_VIRTUAL_DEF(0x01D0E6B0, Network::GetName), - HOOK_VIRTUAL_DEF(0x01D0E810, Network::GetState), - HOOK_VIRTUAL_DEF(0x01D0E820, Network::GetVersion), - HOOK_VIRTUAL_DEF(0x01D0E250, Network::ShutDown), - HOOK_VIRTUAL_DEF(0x01D0E2E0, Network::CreateSocket), - HOOK_VIRTUAL_DEF(0x01D0E3A0, Network::RemoveSocket), - HOOK_VIRTUAL_DEF(0x01D0E4C0, Network::GetLocalAddress), - HOOK_VIRTUAL_DEF(0x01D0E6C0, Network::ResolveAddress), - HOOK_VIRTUAL_DEF(0x01D0E530, Network::GetFlowStats), - HOOK_VIRTUAL_DEF(0x01D0E6A0, Network::GetLastErrorCode), - HOOK_VIRTUAL_DEF(0x01D0E830, Network::GetErrorText), - HOOK_VIRTUAL_DEF(0x01D0E2E0, Network::CreateSocket), - HOOK_VIRTUAL_DEF(0x01D0E3A0, Network::RemoveSocket), - HOOK_VIRTUAL_DEF(0x01D0E4C0, Network::GetLocalAddress), - HOOK_VIRTUAL_DEF(0x01D0E6C0, Network::ResolveAddress), - HOOK_VIRTUAL_DEF(0x01D0E530, Network::GetFlowStats), - HOOK_VIRTUAL_DEF(0x01D0E6A0, Network::GetLastErrorCode), - HOOK_VIRTUAL_DEF(0x01D0E830, Network::GetErrorText), - - // Network non-virtual functions - HOOK_DEF(0x01D0EAE0, Network::UpdateStats), - HOOK_DEF(0x01D0E440, Network::GetSocket), - HOOK_DEF(0x01D0E400, Network::SendData), - HOOK_DEF(0x01D0E3C0, Network::ReceiveData), - -#endif // Network_region - -#ifndef NetSocket_region - - // Network virtual functions - HOOK_VIRTUAL_DEF(0x01D0D940, NetSocket::ReceivePacket), - HOOK_VIRTUAL_DEF(0x01D0D950, NetSocket::FreePacket), - HOOK_VIRTUAL_DEF(0x01D0D980, NetSocket::AddPacket), - HOOK_VIRTUAL_DEF(0x01D0D000, NetSocket::AddChannel), - HOOK_VIRTUAL_DEF(0x01D0D010, NetSocket::RemoveChannel), - HOOK_VIRTUAL_DEF(0x01D0D310, NetSocket::GetNetwork), - HOOK_VIRTUAL_DEF(0x01D0D8D0, NetSocket::OutOfBandPrintf), - HOOK_VIRTUAL_DEF(0x01D0DA30, NetSocket::Flush), - HOOK_VIRTUAL_DEF(0x01D0D8A0, NetSocket::GetFlowStats), - HOOK_VIRTUAL_DEF(0x01D0D610, NetSocket::LeaveGroup), - HOOK_VIRTUAL_DEF(0x01D0D570, NetSocket::JoinGroup), - HOOK_VIRTUAL_DEF(0x01D0D500, NetSocket::Close), - HOOK_VIRTUAL_DEF(0x01D0DCB0, NetSocket::GetPort), - - HOOK_VIRTUAL_DEF(0x01D0D160, NetSocket::SendPacket, bool(NetPacket *)), - HOOK_VIRTUAL_DEF(0x01D0D190, NetSocket::SendPacket, bool(NetAddress *, const void *, int)), - - // Network non-virtual functions - HOOK_DEF(0x01D0DAC0, NetSocket::Create), - HOOK_DEF(0x01D0DCC0, NetSocket::UpdateStats), - HOOK_DEF(0x01D0D6B0, NetSocket::DrainChannels), - HOOK_DEF(0x01D0D020, NetSocket::DispatchIncoming), - HOOK_DEF(0x01D0D330, NetSocket::ReceivePacketIntern), - HOOK_DEF(0x01D0DD50, NetSocket::SendLong), - HOOK_DEF(0x01D0DE70, NetSocket::SendShort), - HOOK_DEF(0x01D0D730, NetSocket::GetLong), - -#endif // NetSocket_region - -#ifndef Delta_region - - HOOK_DEF(0x01D06740, DELTA_Init), - HOOK_DEF(0x01D06810, DELTA_UpdateDescriptions), - HOOK_DEF(0x01D06880, DELTA_Shutdown), - HOOK_DEF(0x01D06890, DELTA_SetTime), - HOOK_DEF(0x01D068B0, DELTA_SetLargeTimeBufferSize), - HOOK_DEF(0x01D04AF0, DELTA_FindField), - HOOK_DEF(0x01D04C10, DELTA_ClearFlags), - HOOK_DEF(0x01D04C40, DELTA_CountSendFields), - HOOK_DEF(0x01D04C80, DELTA_MarkSendFields), - HOOK_DEF(0x01D04E80, DELTA_SetSendFlagBits), - HOOK_DEF(0x01D04EF0, DELTA_WriteMarkedFields), - HOOK_DEF(0x01D052A0, DELTA_WriteHeader), - HOOK_DEF(0x01D053C0, DELTA_WriteDelta), - HOOK_DEF(0x01D05470, DELTA_ParseDelta), - HOOK_DEF(0x01D05A30, DELTA_TestDelta), - HOOK_DEF(0x01D05CA0, DELTA_AddEncoder), - HOOK_DEF(0x01D05CE0, DELTA_ClearEncoders), - HOOK_DEF(0x01D05D60, DELTA_CountLinks), - HOOK_DEF(0x01D05D80, DELTA_ReverseLinks), - HOOK_DEF(0x01D05DA0, DELTA_ClearLinks), - HOOK_DEF(0x01D05DD0, DELTA_BuildFromLinks), - HOOK_DEF(0x01D05E80, DELTA_FindOffset), - HOOK_DEF(0x01D05EC0, DELTA_ParseType), - HOOK_DEF(0x01D06050, DELTA_ParseField), - HOOK_DEF(0x01D06200, DELTA_FreeDescription), - HOOK_DEF(0x01D06240, DELTA_AddDefinition), - HOOK_DEF(0x01D062A0, DELTA_ClearDefinitions), - HOOK_DEF(0x01D062E0, DELTA_FindDefinition), - HOOK_DEF(0x01D06330, DELTA_SkipDescription), - HOOK_DEF(0x01D06380, DELTA_ParseOneField), - HOOK_DEF(0x01D06640, DELTA_RegisterDescription), - HOOK_DEF(0x01D06670, DELTA_ClearRegistrations), - HOOK_DEF(0x01D066C0, DELTA_LookupRegistration), - - //HOOK_DEF(0x01D06700, DELTA_ClearStats), // NOXREF - //HOOK_DEF(0x01D06430, DELTA_ParseDescription), // NOXREF - //HOOK_DEF(0x01D06630, DELTA_Load), // NOXREF - //HOOK_DEF(0x01D04B40, DELTA_FindFieldIndex), // NOXREF - //HOOK_DEF(0x01D04B90, DELTA_SetField), // NOXREF - //HOOK_DEF(0x01D04BB0, DELTA_UnsetField), // NOXREF - //HOOK_DEF(0x01D04BD0, DELTA_SetFieldByIndex), // NOXREF - //HOOK_DEF(0x01D04BF0, DELTA_UnsetFieldByIndex), // NOXREF - //HOOK_DEF(0x01D05270, DELTA_CheckDelta), // NOXREF - //HOOK_DEF(0x01D05D20, DELTA_LookupEncoder), // NOXREF - -#endif // Delta_region - -#ifndef ObjectDictionary_region - - HOOK_DEF(0x01D0ECA0, MethodThunk::Constructor), - HOOK_DEF(0x01D0ECE0, MethodThunk::Destructor), - - HOOK_VIRTUAL_DEF(0x01D0F220, ObjectDictionary::Init, void()), - HOOK_VIRTUAL_DEF(0x01D0F290, ObjectDictionary::Add, bool(void *)), - HOOK_VIRTUAL_DEF(0x01D0F050, ObjectDictionary::Remove), - HOOK_VIRTUAL_DEF(0x01D0ED10, ObjectDictionary::Clear), - HOOK_VIRTUAL_DEF(0x01D0F310, ObjectDictionary::GetFirst), - HOOK_VIRTUAL_DEF(0x01D0F5B0, ObjectDictionary::GetNext), - HOOK_VIRTUAL_DEF(0x01D0F2A0, ObjectDictionary::CountElements), - HOOK_VIRTUAL_DEF(0x01D0F2C0, ObjectDictionary::Contains), - HOOK_VIRTUAL_DEF(0x01D0F2B0, ObjectDictionary::IsEmpty), - - HOOK_DEF(0x01D0F250, ObjectDictionary::Init, void(int)), // NOXREF - HOOK_DEF(0x01D0ED90, ObjectDictionary::Add, bool(void *, float)), - HOOK_DEF(0x01D0F4D0, ObjectDictionary::AddToCache, void(ObjectDictionary::entry_t *, float)), - HOOK_DEF(0x01D0F490, ObjectDictionary::AddToCache, void(ObjectDictionary::entry_t *)), - HOOK_DEF(0x01D0F340, ObjectDictionary::ChangeKey), - HOOK_DEF(0x01D0F0D0, ObjectDictionary::RemoveKey), - HOOK_DEF(0x01D0F590, ObjectDictionary::FindClosestKey), - HOOK_DEF(0x01D0F5D0, ObjectDictionary::FindExactKey), - HOOK_DEF(0x01D0F320, ObjectDictionary::GetLast), - HOOK_DEF(0x01D0F510, ObjectDictionary::FindKeyInCache), - HOOK_DEF(0x01D0F550, ObjectDictionary::FindObjectInCache), - HOOK_DEF(0x01D0EF60, ObjectDictionary::ClearCache), - HOOK_DEF(0x01D0F130, ObjectDictionary::CheckSize), - HOOK_DEF(0x01D0EF80, ObjectDictionary::RemoveIndex), - HOOK_DEF(0x01D0F010, ObjectDictionary::RemoveIndexRange), - HOOK_DEF(0x01D0EE60, ObjectDictionary::FindClosestAsIndex), - //HOOK_DEF(0x0, ObjectDictionary::RemoveRange), // NOXREF - //HOOK_DEF(0x01D0F440, ObjectDictionary::UnsafeChangeKey), // NOXREF - //HOOK_DEF(0x01D0F090, ObjectDictionary::RemoveSingle), // NOXREF - -#endif // ObjectDictionary_region - -#ifndef ObjectList_region - - HOOK_DEF(0x01D0F610, MethodThunk::Constructor), - HOOK_DEF(0x01D0F650, MethodThunk::Destructor), - - HOOK_VIRTUAL_DEF(0x01D0F8D0, ObjectList::Init), - HOOK_VIRTUAL_DEF(0x01D0F920, ObjectList::Add), - HOOK_VIRTUAL_DEF(0x01D0F850, ObjectList::Remove), - HOOK_VIRTUAL_DEF(0x01D0F800, ObjectList::Clear), - HOOK_VIRTUAL_DEF(0x01D0F8E0, ObjectList::GetFirst), - HOOK_VIRTUAL_DEF(0x01D0F900, ObjectList::GetNext), - HOOK_VIRTUAL_DEF(0x01D0F7C0, ObjectList::CountElements), - HOOK_VIRTUAL_DEF(0x01D0F7D0, ObjectList::Contains), - HOOK_VIRTUAL_DEF(0x01D0F7B0, ObjectList::IsEmpty), - - HOOK_DEF(0x01D0F760, ObjectList::RemoveTail), - HOOK_DEF(0x01D0F6C0, ObjectList::RemoveHead), - HOOK_DEF(0x01D0F710, ObjectList::AddTail), - HOOK_DEF(0x01D0F670, ObjectList::AddHead), - -#endif // ObjectList_region - -#ifndef BitBuffer_region - - HOOK_DEF(0x01D015A0, MethodThunk::Destructor), - HOOK_DEF(0x01D01530, (MethodThunk::Constructor), void()), - HOOK_DEF(0x01D015B0, (MethodThunk::Constructor), void(unsigned int)), - HOOK_DEF(0x01D01570, (MethodThunk::Constructor), void(void *, unsigned int)), - - HOOK_DEF(0x01D015E0, BitBuffer::Resize), - HOOK_DEF(0x01D01630, BitBuffer::Clear), - HOOK_DEF(0x01D01670, BitBuffer::Reset), - HOOK_DEF(0x01D01690, BitBuffer::Free), - HOOK_DEF(0x01D01840, BitBuffer::PeekBits), - HOOK_DEF(0x01D01EF0, BitBuffer::CurrentSize), - HOOK_DEF(0x01D02300, BitBuffer::FastClear), - HOOK_DEF(0x01D02350, BitBuffer::ConcatBuffer), - HOOK_DEF(0x01D02210, BitBuffer::SkipBytes), - HOOK_DEF(0x01D01660, BitBuffer::CurrentBit), - HOOK_DEF(0x01D01F10, BitBuffer::SpaceLeft), - HOOK_DEF(0x01D01F20, BitBuffer::AlignByte), - HOOK_DEF(0x01D02090, BitBuffer::StartBitMode), - HOOK_DEF(0x01D020A0, BitBuffer::EndBitMode), - HOOK_DEF(0x01D020E0, BitBuffer::SetBuffer), - HOOK_DEF(0x01D02240, BitBuffer::SkipBits), - HOOK_DEF(0x01D022D0, BitBuffer::SkipString), - - // Read - HOOK_DEF(0x01D016D0, BitBuffer::ReadBits), - HOOK_DEF(0x01D017B0, BitBuffer::ReadBit), - HOOK_DEF(0x01D01870, BitBuffer::ReadChar), - HOOK_DEF(0x01D01880, BitBuffer::ReadByte), - HOOK_DEF(0x01D01890, BitBuffer::ReadShort), - HOOK_DEF(0x01D018A0, BitBuffer::ReadWord), - HOOK_DEF(0x01D018B0, BitBuffer::ReadLong), - HOOK_DEF(0x01D018C0, BitBuffer::ReadFloat), - HOOK_DEF(0x01D018E0, BitBuffer::ReadBuf), - HOOK_DEF(0x01D019C0, BitBuffer::ReadString), - HOOK_DEF(0x01D01A00, BitBuffer::ReadStringLine), // NOXREF - HOOK_DEF(0x01D02020, BitBuffer::ReadBitString), - HOOK_DEF(0x01D020B0, BitBuffer::ReadBitData), - HOOK_DEF(0x01D02110, BitBuffer::ReadBitVec3Coord), - HOOK_DEF(0x01D02170, BitBuffer::ReadBitCoord), - HOOK_DEF(0x01D021F0, BitBuffer::ReadCoord), - HOOK_DEF(0x01D01A40, BitBuffer::ReadAngle), // NOXREF - HOOK_DEF(0x01D01A60, BitBuffer::ReadHiresAngle), // NOXREF - HOOK_DEF(0x01D01F40, BitBuffer::ReadSBits), - HOOK_DEF(0x01D01F70, BitBuffer::ReadBitAngle), - - // Write - HOOK_DEF(0x01D01D90, BitBuffer::WriteBuf, void(const void *, int)), - HOOK_DEF(0x01D01990, BitBuffer::WriteBuf, void(BitBuffer *, int)), - - HOOK_DEF(0x01D01A80, BitBuffer::WriteBit), - HOOK_DEF(0x01D01B50, BitBuffer::WriteBits), - HOOK_DEF(0x01D01C70, BitBuffer::WriteSBits), - HOOK_DEF(0x01D01CD0, BitBuffer::WriteChar), - HOOK_DEF(0x01D01CE0, BitBuffer::WriteByte), - HOOK_DEF(0x01D01CF0, BitBuffer::WriteShort), - HOOK_DEF(0x01D01D00, BitBuffer::WriteWord), - HOOK_DEF(0x01D01D10, BitBuffer::WriteLong), - HOOK_DEF(0x01D01D20, BitBuffer::WriteFloat), - HOOK_DEF(0x01D01D50, BitBuffer::WriteString), - HOOK_DEF(0x01D02370, BitBuffer::WriteCoord), - HOOK_DEF(0x01D01E60, BitBuffer::WriteBitData), - HOOK_DEF(0x01D01E90, BitBuffer::WriteAngle), // NOXREF - HOOK_DEF(0x01D01EC0, BitBuffer::WriteHiresAngle), // NOXREF - HOOK_DEF(0x01D01FB0, BitBuffer::WriteBitAngle), - HOOK_DEF(0x01D02050, BitBuffer::WriteBitString), - -#endif // BitBuffer_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_FunctionRefs[] = -{ -#ifndef Function_References_region - -#endif // Function_References_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_DataRefs[] = -{ -#ifndef Data_References_region - - GLOBALVAR_LINK(0x01D45708, "_ZL6g_defs", pg_defs), - GLOBALVAR_LINK(0x01D4570C, "_ZL10g_encoders", pg_encoders), - GLOBALVAR_LINK(0x01D45710, "g_deltaregistry", pg_deltaregistry), - GLOBALVAR_LINK(0x01D456F0, "g_pplayerdelta", pg_pplayerdelta), - GLOBALVAR_LINK(0x01D456F4, "g_pentitydelta", pg_pentitydelta), - GLOBALVAR_LINK(0x01D456F8, "g_pcustomentitydelta", pg_pcustomentitydelta), - GLOBALVAR_LINK(0x01D456FC, "g_pclientdelta", pg_pclientdelta), - GLOBALVAR_LINK(0x01D45700, "g_pweapondelta", pg_pweapondelta), - GLOBALVAR_LINK(0x01D45704, "g_peventdelta", pg_peventdelta), - GLOBALVAR_LINK(0x01D456E8, "g_delta_Time", pg_delta_Time), - GLOBALVAR_LINK(0x01D456E0, "g_large_Time_Buffers", pg_large_Time_Buffers), - GLOBALVAR_LINK(0x01D46870, "g_DownloadURL", pg_DownloadURL), - - GLOBALVAR_LINK(0x01D442C8, "com_token", pcom_token), - GLOBALVAR_LINK(0x01D456C8, "s_com_token_unget", ps_com_token_unget), - -#endif // Data_References_region - - { NULL, NULL, NULL }, -}; - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Core/hooklist.h b/rehlds/hookers/HLTV/Core/hooklist.h deleted file mode 100644 index fcdf32b..0000000 --- a/rehlds/hookers/HLTV/Core/hooklist.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#ifdef HOOK_HLTV - -#include "hookers/memory.h" -#include "hookers/helper.h" -#include "hookers/hooker.h" - -#define rehlds_syserror HLTV_SysError - -#define com_token (*pcom_token) -#define s_com_token_unget (*ps_com_token_unget) -#define g_DownloadURL (*pg_DownloadURL) - -extern char com_token[COM_TOKEN_LEN]; -extern qboolean s_com_token_unget; - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Core/main.cpp b/rehlds/hookers/HLTV/Core/main.cpp deleted file mode 100644 index 7c4b3a8..0000000 --- a/rehlds/hookers/HLTV/Core/main.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "precompiled.h" - -#if defined(HOOK_HLTV) -#define ORIGINAL_CORE_DLL_NAME "core2.dll" - -CSysModule *g_pOriginalCoreModule = NULL; -CreateInterfaceFn g_OriginalCoreFactory = NULL; -ISystemModule *g_pOriginalServer = NULL; -ISystemModule *g_pOriginalWorld = NULL; -ISystemModule *g_pOriginalNetwork = NULL; - -IBaseInterface *CreateCoreInterface() -{ - if (g_pOriginalServer) { - return g_pOriginalServer; - } - - if (g_pOriginalCoreModule) - { - g_OriginalCoreFactory = Sys_GetFactory(g_pOriginalCoreModule); - if (g_OriginalCoreFactory) - { - int returnCode = 0; - g_pOriginalServer = reinterpret_cast(g_OriginalCoreFactory(SERVER_INTERFACE_VERSION, &returnCode)); - return g_pOriginalServer; - } - } - - return NULL; -} - -IBaseInterface *CreateWorldInterface() -{ - if (g_pOriginalWorld) { - return g_pOriginalWorld; - } - - if (g_pOriginalCoreModule) - { - g_OriginalCoreFactory = Sys_GetFactory(g_pOriginalCoreModule); - if (g_OriginalCoreFactory) - { - int returnCode = 0; - g_pOriginalWorld = reinterpret_cast(g_OriginalCoreFactory(WORLD_INTERFACE_VERSION, &returnCode)); - return g_pOriginalWorld; - } - } - - return NULL; -} - -IBaseInterface *CreateNetworkInterface() -{ - if (g_pOriginalNetwork) { - return g_pOriginalNetwork; - } - - if (g_pOriginalCoreModule) - { - g_OriginalCoreFactory = Sys_GetFactory(g_pOriginalCoreModule); - if (g_OriginalCoreFactory) - { - int returnCode = 0; - g_pOriginalNetwork = reinterpret_cast(g_OriginalCoreFactory(NETWORK_INTERFACE_VERSION, &returnCode)); - return g_pOriginalNetwork; - } - } - - return NULL; -} - -InterfaceReg iface_Server = InterfaceReg(CreateCoreInterface, SERVER_INTERFACE_VERSION); -InterfaceReg iface_World = InterfaceReg(CreateWorldInterface, WORLD_INTERFACE_VERSION); -InterfaceReg iface_Network= InterfaceReg(CreateNetworkInterface, NETWORK_INTERFACE_VERSION); - -// DLL entry point -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - { - g_pOriginalCoreModule = Sys_LoadModule(ORIGINAL_CORE_DLL_NAME); - size_t addr = (size_t)Sys_GetProcAddress(ORIGINAL_CORE_DLL_NAME, CREATEINTERFACE_PROCNAME); - HookModule("hltv.exe", addr); - } - else if (fdwReason == DLL_PROCESS_DETACH) - { - if (g_pOriginalCoreModule) - { - Sys_UnloadModule(g_pOriginalCoreModule); - g_pOriginalCoreModule = NULL; - g_OriginalCoreFactory = NULL; - - g_pOriginalServer = NULL; - g_pOriginalWorld = NULL; - g_pOriginalNetwork = NULL; - } - } - - return TRUE; -} - -#endif // #if defined(HOOK_HLTV) diff --git a/rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp b/rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp deleted file mode 100644 index ad0011e..0000000 --- a/rehlds/hookers/HLTV/DemoPlayer/hooklist.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* -* -* This program 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 2 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, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -// Hooks stuff -#include "hookers/memory.cpp" -#include "hookers/hooker.cpp" - -//#define Mem_region -//#define Function_References_region -//#define Data_References_region - -FunctionHook g_FunctionHooks[] = -{ - // DO NOT DISABLE, other functions depends on memory allocation routines -#ifndef Mem_region - - HOOK_DEF(0x01D07C0F, malloc_wrapper), - HOOK_DEF(0x01D07AFE, free_wrapper), - HOOK_DEF(0x01D14F4D, strdup_wrapper), - HOOK_DEF(0x01D07C21, __nh_malloc_wrapper), - - HOOK_DEF(0x01D02510, Mem_ZeroMalloc), - //HOOK_DEF(0x0, Mem_Malloc), - //HOOK_DEF(0x0, Mem_Realloc), - //HOOK_DEF(0x0, Mem_Calloc), - //HOOK_DEF(0x0, Mem_Strdup), - //HOOK_DEF(0x0, Mem_Free), - - //HOOK_DEF(0x0, realloc_wrapper), - //HOOK_DEF(0x0, calloc_wrapper), - -#endif // Mem_region - -#ifndef DemoPlayer_Region - - // BaseSystemModule virtual function - //HOOK_VIRTUAL_DEF(0x01D032A0, DemoPlayer::RegisterListener), - //HOOK_VIRTUAL_DEF(0x01D03360, DemoPlayer::RemoveListener), - //HOOK_VIRTUAL_DEF(0x1D033700, DemoPlayer::GetSystem), - //HOOK_VIRTUAL_DEF(0x01D03380, DemoPlayer::GetSerial), - //HOOK_VIRTUAL_DEF(0x01D03390, DemoPlayer::GetName), - //HOOK_VIRTUAL_DEF(0x01D033A0, DemoPlayer::GetState), - //HOOK_VIRTUAL_DEF(0x01D033F0, DemoPlayer::GetVersion), - - // DemoPlayer virtual function - HOOK_VIRTUAL_DEF(0x01D03670, DemoPlayer::Init), - HOOK_VIRTUAL_DEF(0x01D04180, DemoPlayer::RunFrame), - HOOK_VIRTUAL_DEF(0x01D042E0, DemoPlayer::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D02FA0, DemoPlayer::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D02F70, DemoPlayer::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D02F60, DemoPlayer::GetType), - HOOK_VIRTUAL_DEF(0x01D04490, DemoPlayer::ShutDown), - HOOK_VIRTUAL_DEF(0x01D04400, DemoPlayer::NewGame), - HOOK_VIRTUAL_DEF(0x01D03410, DemoPlayer::GetModName), - HOOK_VIRTUAL_DEF(0x01D03420, DemoPlayer::WriteCommands), - HOOK_VIRTUAL_DEF(0x01D03570, DemoPlayer::AddCommand), - HOOK_VIRTUAL_DEF(0x01D035F0, DemoPlayer::RemoveCommand), - HOOK_VIRTUAL_DEF(0x01D04640, DemoPlayer::GetLastCommand), - HOOK_VIRTUAL_DEF(0x01D03660, DemoPlayer::GetCommands), - HOOK_VIRTUAL_DEF(0x01D03900, DemoPlayer::SetWorldTime), - HOOK_VIRTUAL_DEF(0x01D03940, DemoPlayer::SetTimeScale), - HOOK_VIRTUAL_DEF(0x01D039B0, DemoPlayer::SetPaused), - HOOK_VIRTUAL_DEF(0x01D039C0, DemoPlayer::SetEditMode), - HOOK_VIRTUAL_DEF(0x01D03A20, DemoPlayer::SetMasterMode), - HOOK_VIRTUAL_DEF(0x01D03A40, DemoPlayer::IsPaused), - HOOK_VIRTUAL_DEF(0x01D02F30, DemoPlayer::IsLoading), - HOOK_VIRTUAL_DEF(0x01D02F50, DemoPlayer::IsActive), - HOOK_VIRTUAL_DEF(0x01D039D0, DemoPlayer::IsEditMode), - HOOK_VIRTUAL_DEF(0x01D03A30, DemoPlayer::IsMasterMode), - HOOK_VIRTUAL_DEF(0x01D04560, DemoPlayer::RemoveFrames), - HOOK_VIRTUAL_DEF(0x01D04570, DemoPlayer::ExecuteDirectorCmd), - HOOK_VIRTUAL_DEF(0x01D02ED0, DemoPlayer::GetWorldTime), - HOOK_VIRTUAL_DEF(0x01D02EE0, DemoPlayer::GetStartTime), - HOOK_VIRTUAL_DEF(0x01D02F00, DemoPlayer::GetEndTime), - HOOK_VIRTUAL_DEF(0x01D03400, DemoPlayer::GetTimeScale), - HOOK_VIRTUAL_DEF(0x01D02F80, DemoPlayer::GetWorld), - HOOK_VIRTUAL_DEF(0x01D04630, DemoPlayer::GetFileName), - HOOK_VIRTUAL_DEF(0x01D02E60, DemoPlayer::SaveGame), - HOOK_VIRTUAL_DEF(0x01D04650, DemoPlayer::LoadGame), - HOOK_VIRTUAL_DEF(0x01D039E0, DemoPlayer::Stop), - HOOK_VIRTUAL_DEF(0x01D03A10, DemoPlayer::ForceHLTV), - HOOK_VIRTUAL_DEF(0x01D03A50, DemoPlayer::GetDemoViewInfo), - HOOK_VIRTUAL_DEF(0x01D03F90, DemoPlayer::ReadDemoMessage), - HOOK_VIRTUAL_DEF(0x01D04130, DemoPlayer::ReadNetchanState), - HOOK_VIRTUAL_DEF(0x01D02F90, DemoPlayer::GetDirector), // NOXREF - - // DemoPlayer non-virtual function - //HOOK_DEF(0x01D02F20, DemoPlayer::GetPlayerTime), // NOXREF - //HOOK_DEF(0x01D04500, DemoPlayer::FormatTime), // NOXREF - HOOK_DEF(0x01D041B0, DemoPlayer::RunClocks), - HOOK_DEF(0x01D046F0, DemoPlayer::WriteDatagram), - HOOK_DEF(0x01D03D30, DemoPlayer::WriteSpawn), - HOOK_DEF(0x01D03F50, DemoPlayer::ReindexCommands), - HOOK_DEF(0x01D03DC0, DemoPlayer::WriteCameraPath), - HOOK_DEF(0x01D04840, DemoPlayer::ExecuteDemoFileCommands), - HOOK_DEF(0x01D03030, DemoPlayer::CMD_Jump), - HOOK_DEF(0x01D030E0, DemoPlayer::CMD_ForceHLTV), - HOOK_DEF(0x01D031F0, DemoPlayer::CMD_Pause), - HOOK_DEF(0x01D032B0, DemoPlayer::CMD_Speed), - HOOK_DEF(0x01D033B0, DemoPlayer::CMD_Start), - HOOK_DEF(0x01D03170, DemoPlayer::CMD_Save), - -#endif // DemoPlayer_Region - - { NULL, NULL, NULL }, -}; - -AddressRef g_FunctionRefs[] = -{ -#ifndef Function_References_region - -#endif // Function_References_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_DataRefs[] = -{ -#ifndef Data_References_region - - -#endif // Data_References_region - - { NULL, NULL, NULL }, -}; diff --git a/rehlds/hookers/HLTV/DemoPlayer/hooklist.h b/rehlds/hookers/HLTV/DemoPlayer/hooklist.h deleted file mode 100644 index d030ec9..0000000 --- a/rehlds/hookers/HLTV/DemoPlayer/hooklist.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#ifdef HOOK_HLTV - -#include "hookers/memory.h" -#include "hookers/helper.h" -#include "hookers/hooker.h" - -#define rehlds_syserror HLTV_SysError - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/DemoPlayer/main.cpp b/rehlds/hookers/HLTV/DemoPlayer/main.cpp deleted file mode 100644 index 0837c3c..0000000 --- a/rehlds/hookers/HLTV/DemoPlayer/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "precompiled.h" - -#if defined(HOOK_HLTV) -#define ORIGINAL_DEMOPLAYER_DLL_NAME "DemoPlayer2.dll" - -CSysModule *g_pOriginalDemoPlayerModule = NULL; -CreateInterfaceFn g_OriginalDemoPlayerFactory = NULL; -ISystemModule *g_pOriginalDemoPlayer = NULL; - -IBaseInterface *CreateDemoPlayerInterface() -{ - if (g_pOriginalDemoPlayer) { - return g_pOriginalDemoPlayer; - } - - if (g_pOriginalDemoPlayerModule) - { - g_OriginalDemoPlayerFactory = Sys_GetFactory(g_pOriginalDemoPlayerModule); - if (g_OriginalDemoPlayerFactory) - { - int returnCode = 0; - g_pOriginalDemoPlayer = reinterpret_cast(g_OriginalDemoPlayerFactory(DEMOPLAYER_INTERFACE_VERSION, &returnCode)); - return g_pOriginalDemoPlayer; - } - } - - return NULL; -} - -InterfaceReg iface = InterfaceReg(CreateDemoPlayerInterface, DEMOPLAYER_INTERFACE_VERSION); - -// DLL entry point -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - { - g_pOriginalDemoPlayerModule = Sys_LoadModule(ORIGINAL_DEMOPLAYER_DLL_NAME); - size_t addr = (size_t)Sys_GetProcAddress(ORIGINAL_DEMOPLAYER_DLL_NAME, CREATEINTERFACE_PROCNAME); - HookModule("hltv.exe", addr); - } - else if (fdwReason == DLL_PROCESS_DETACH) - { - if (g_pOriginalDemoPlayerModule) - { - Sys_UnloadModule(g_pOriginalDemoPlayerModule); - g_pOriginalDemoPlayerModule = NULL; - g_OriginalDemoPlayerFactory = NULL; - g_pOriginalDemoPlayer = NULL; - } - } - - return TRUE; -} - -#endif // #if defined(HOOK_HLTV) diff --git a/rehlds/hookers/HLTV/Proxy/hooklist.cpp b/rehlds/hookers/HLTV/Proxy/hooklist.cpp deleted file mode 100644 index b4a2e59..0000000 --- a/rehlds/hookers/HLTV/Proxy/hooklist.cpp +++ /dev/null @@ -1,649 +0,0 @@ -/* -* -* This program 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 2 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, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -#ifdef HOOK_HLTV - -// Hooks stuff -#include "hookers/memory.cpp" -#include "hookers/hooker.cpp" - -//#define Mem_region -//#define Proxy_region -//#define BaseClient_region -//#define ProxyClient_region -//#define FakeClient_region -//#define DemoFile_region -//#define DemoClient_region -//#define Director_region -//#define DirectorCmd_region -//#define Status_region -//#define InfoString_region -//#define BitBuffer_region -//#define NetChannel_region -//#define Master_region -//#define Function_References_region -//#define Data_References_region - -FunctionHook g_FunctionHooks[] = -{ - // DO NOT DISABLE, other functions depends on memory allocation routines -#ifndef Mem_region - - HOOK_DEF(0x01D20F3F, malloc_wrapper), - HOOK_DEF(0x01D20E2E, free_wrapper), - HOOK_DEF(0x01D3078C, strdup_wrapper), - HOOK_DEF(0x01D20F51, __nh_malloc_wrapper), - - HOOK_DEF(0x01D03EF0, Mem_ZeroMalloc), - //HOOK_DEF(0x0, Mem_Malloc), - //HOOK_DEF(0x0, Mem_Realloc), - //HOOK_DEF(0x0, Mem_Calloc), - //HOOK_DEF(0x0, Mem_Strdup), - //HOOK_DEF(0x0, Mem_Free), - - //HOOK_DEF(0x0, realloc_wrapper), - //HOOK_DEF(0x0, calloc_wrapper), - -#endif // Mem_region - -#ifndef Proxy_region - - // virtual functions - BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D16010, Proxy::Init), - HOOK_VIRTUAL_DEF(0x01D16020, Proxy::RunFrame), - HOOK_VIRTUAL_DEF(0x01D16030, Proxy::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D16040, Proxy::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D16090, Proxy::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D160A0, Proxy::GetType), - HOOK_VIRTUAL_DEF(0x01D160E0, Proxy::ShutDown), - - // virtual functions - Proxy - HOOK_VIRTUAL_DEF(0x01D115D0, Proxy::Reset), - HOOK_VIRTUAL_DEF(0x01D11620, Proxy::Broadcast), - HOOK_VIRTUAL_DEF(0x01D14FE0, Proxy::IncreaseCheering), - HOOK_VIRTUAL_DEF(0x01D11600, Proxy::ParseStatusMsg), - HOOK_VIRTUAL_DEF(0x01D11610, Proxy::ParseStatusReport), - HOOK_VIRTUAL_DEF(0x01D12FF0, Proxy::ProcessConnectionlessMessage), - HOOK_VIRTUAL_DEF(0x01D14780, Proxy::ChatCommentator), - HOOK_VIRTUAL_DEF(0x01D137B0, Proxy::ChatSpectator), - HOOK_VIRTUAL_DEF(0x01D11370, Proxy::CountLocalClients), - HOOK_VIRTUAL_DEF(0x01D143B0, Proxy::AddResource), - HOOK_VIRTUAL_DEF(0x01D11570, Proxy::IsLanOnly), - HOOK_VIRTUAL_DEF(0x01D13A00, Proxy::IsMaster), - HOOK_VIRTUAL_DEF(0x01D11580, Proxy::IsActive), - HOOK_VIRTUAL_DEF(0x01D114F0, Proxy::IsPublicGame), - HOOK_VIRTUAL_DEF(0x01D11500, Proxy::IsPasswordProtected), - HOOK_VIRTUAL_DEF(0x01D11510, Proxy::IsStressed), - HOOK_VIRTUAL_DEF(0x01D154A0, Proxy::SetDelay), - HOOK_VIRTUAL_DEF(0x01D15540, Proxy::SetClientTime), - HOOK_VIRTUAL_DEF(0x01D15580, Proxy::SetClientTimeScale), - HOOK_VIRTUAL_DEF(0x01D15430, Proxy::SetMaxRate), - HOOK_VIRTUAL_DEF(0x01D118D0, Proxy::SetMaxLoss), - HOOK_VIRTUAL_DEF(0x01D15470, Proxy::SetMaxUpdateRate), - HOOK_VIRTUAL_DEF(0x01D11870, Proxy::SetMaxClients), - HOOK_VIRTUAL_DEF(0x01D11930, Proxy::SetRegion), - HOOK_VIRTUAL_DEF(0x01D14FA0, Proxy::GetDelay), - HOOK_VIRTUAL_DEF(0x01D14FC0, Proxy::GetSpectatorTime), - HOOK_VIRTUAL_DEF(0x01D14FD0, Proxy::GetProxyTime), - HOOK_VIRTUAL_DEF(0x01D11920, Proxy::GetMaxClients), - HOOK_VIRTUAL_DEF(0x01D10EF0, Proxy::GetWorld), - HOOK_VIRTUAL_DEF(0x01D10F00, Proxy::GetServer), - HOOK_VIRTUAL_DEF(0x01D10F10, Proxy::GetDirector), - HOOK_VIRTUAL_DEF(0x01D10F20, Proxy::GetSocket), - HOOK_VIRTUAL_DEF(0x01D10F30, Proxy::GetChatMode), - HOOK_VIRTUAL_DEF(0x01D113C0, Proxy::GetStatistics), - HOOK_VIRTUAL_DEF(0x01D113D0, Proxy::GetMaxRate), - HOOK_VIRTUAL_DEF(0x01D113E0, Proxy::GetMaxUpdateRate), - HOOK_VIRTUAL_DEF(0x01D14420, Proxy::GetResource), - HOOK_VIRTUAL_DEF(0x01D11550, Proxy::GetDispatchMode), - HOOK_VIRTUAL_DEF(0x01D115A0, Proxy::GetRegion), - HOOK_VIRTUAL_DEF(0x01D10EE0, Proxy::GetClients), - HOOK_VIRTUAL_DEF(0x01D113F0, Proxy::WriteSignonData), - - // non-virtual functions - Proxy - HOOK_DEF(0x01D12BD0, Proxy::ReplyServiceChallenge), - HOOK_DEF(0x01D115B0, Proxy::ReplyListen), - HOOK_DEF(0x01D10900, Proxy::ReplyConnect), - HOOK_DEF(0x01D10890, Proxy::ReplyRules), - HOOK_DEF(0x01D10820, Proxy::ReplyPlayers), - HOOK_DEF(0x01D10770, Proxy::ReplyInfo), - HOOK_DEF(0x01D10720, Proxy::ReplyInfoString), - HOOK_DEF(0x01D106D0, Proxy::ReplyChallenge), - HOOK_DEF(0x01D105F0, Proxy::ReplyPing), - HOOK_DEF(0x01D12F50, Proxy::ExecuteRcon), - HOOK_DEF(0x01D13B70, Proxy::ReconnectClients), - HOOK_DEF(0x01D129A0, Proxy::SendRcon), - HOOK_DEF(0x01D10DD0, Proxy::RejectConnection), - HOOK_DEF(0x01D10F40, Proxy::UpdateStatusLine), - HOOK_DEF(0x01D14220, Proxy::DispatchClient), - HOOK_DEF(0x01D13FA0, Proxy::IsValidPassword), - HOOK_DEF(0x01D13E50, Proxy::WriteHUDMsg), - HOOK_DEF(0x01D150D0, Proxy::ExecuteLoopCommands), - HOOK_DEF(0x01D12A30, Proxy::GetChallengeNumber), - HOOK_DEF(0x01D12B60, Proxy::CheckChallenge), - HOOK_DEF(0x01D15150, Proxy::CreateServerInfoString), - HOOK_DEF(0x01D13A10, Proxy::CheckDirectorModule), - HOOK_DEF(0x01D158B0, Proxy::RunClocks), - HOOK_DEF(0x01D156B0, Proxy::NewGameStarted), - HOOK_DEF(0x01D12CC0, Proxy::NewServerConnection), - HOOK_DEF(0x01D15620, Proxy::BroadcastPaused), - HOOK_DEF(0x01D12E80, Proxy::BroadcastRetryMessage), - HOOK_DEF(0x01D12EE0, Proxy::StopBroadcast), - HOOK_DEF(0x01D15A10, Proxy::DisconnectClients), - HOOK_DEF(0x01D14350, Proxy::FreeResource), - HOOK_DEF(0x01D14380, Proxy::ClearResources), - HOOK_DEF(0x01D142C0, Proxy::LoadResourceFromFile), - HOOK_DEF(0x01D14800, Proxy::IsBanned), - HOOK_DEF(0x01D15A60, Proxy::UpdateInfoMessages), - - HOOK_DEF(0x01D12860, Proxy::CMD_Rcon), - HOOK_DEF(0x01D11EF0, Proxy::CMD_ServerCmd), - HOOK_DEF(0x01D11F90, Proxy::CMD_ClientCmd), - HOOK_DEF(0x01D127D0, Proxy::CMD_RconPassword), - HOOK_DEF(0x01D12700, Proxy::CMD_RconAddress), - HOOK_DEF(0x01D11700, Proxy::CMD_Say), - HOOK_DEF(0x01D11C10, Proxy::CMD_Msg), - HOOK_DEF(0x01D10D40, Proxy::CMD_Clients), - HOOK_DEF(0x01D13920, Proxy::CMD_Kick), - HOOK_DEF(0x01D13650, Proxy::CMD_ChatMode), - HOOK_DEF(0x01D13DA0, Proxy::CMD_PublicGame), - HOOK_DEF(0x01D13BB0, Proxy::CMD_OffLineText), - HOOK_DEF(0x01D14550, Proxy::CMD_AdminPassword), - HOOK_DEF(0x01D14470, Proxy::CMD_SignOnCommands), - HOOK_DEF(0x01D13EE0, Proxy::CMD_SpectatorPassword), - HOOK_DEF(0x01D140B0, Proxy::CMD_DispatchMode), - HOOK_DEF(0x01D14F00, Proxy::CMD_CheeringThreshold), - HOOK_DEF(0x01D10610, Proxy::CMD_Ping), - HOOK_DEF(0x01D12C00, Proxy::CMD_ProxyPassword), - HOOK_DEF(0x01D11E50, Proxy::CMD_MaxRate), - HOOK_DEF(0x01D12570, Proxy::CMD_LoopCmd), - HOOK_DEF(0x01D117C0, Proxy::CMD_MaxClients), - HOOK_DEF(0x01D14610, Proxy::CMD_LocalMsg), - HOOK_DEF(0x01D11A50, Proxy::CMD_Connect), - HOOK_DEF(0x01D139F0, Proxy::CMD_Disconnect), - HOOK_DEF(0x01D14180, Proxy::CMD_PlayDemo), - HOOK_DEF(0x01D11940, Proxy::CMD_Delay), - HOOK_DEF(0x01D119E0, Proxy::CMD_Stop), - HOOK_DEF(0x01D12480, Proxy::CMD_Record), - HOOK_DEF(0x01D12530, Proxy::CMD_StopRecording), - HOOK_DEF(0x01D123C0, Proxy::CMD_BlockVoice), - HOOK_DEF(0x01D11B20, Proxy::CMD_Name), - HOOK_DEF(0x01D120B0, Proxy::CMD_Rate), - HOOK_DEF(0x01D12300, Proxy::CMD_Updaterate), - HOOK_DEF(0x01D12220, Proxy::CMD_HostName), - HOOK_DEF(0x01D13CC0, Proxy::CMD_AddResource), - HOOK_DEF(0x01D13C60, Proxy::CMD_Resources), - HOOK_DEF(0x01D14DD0, Proxy::CMD_BannerFile), - HOOK_DEF(0x01D14AF0, Proxy::CMD_Bann), - HOOK_DEF(0x01D14850, Proxy::CMD_AddFakeClients), - HOOK_DEF(0x01D14CD0, Proxy::CMD_Retry), - HOOK_DEF(0x01D14D00, Proxy::CMD_AutoRetry), - HOOK_DEF(0x01D14C40, Proxy::CMD_ServerPassword), - HOOK_DEF(0x01D11040, Proxy::CMD_Status), - HOOK_DEF(0x01D13710, Proxy::CMD_MaxQueries), - HOOK_DEF(0x01D12170, Proxy::CMD_Players), - HOOK_DEF(0x01D14C00, Proxy::CMD_ClearBanns), - HOOK_DEF(0x01D149B0, Proxy::CMD_MaxLoss), - HOOK_DEF(0x01D11D80, Proxy::CMD_Protocol), - HOOK_DEF(0x01D14A50, Proxy::CMD_Region), - - //HOOK_DEF(0x01D12E70, Proxy::GetModVersion), // NOXREF - //HOOK_DEF(0x0, Proxy::CMD_InformPlayers), // NOXREF - //HOOK_DEF(0x0, Proxy::CMD_MaxUpdateRate), // NOXREF - -#endif // Proxy_region - -#ifndef ProxyClient_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D16C50, ProxyClient::Init), - HOOK_VIRTUAL_DEF(0x01D16D20, ProxyClient::ShutDown), - - // BaseClient - HOOK_VIRTUAL_DEF(0x01D16A40, ProxyClient::HasChatEnabled), - HOOK_VIRTUAL_DEF(0x01D16B30, ProxyClient::DownloadFile), - HOOK_VIRTUAL_DEF(0x01D16920, ProxyClient::SendDatagram), - HOOK_VIRTUAL_DEF(0x01D168E0, ProxyClient::ReplySpawn), - HOOK_VIRTUAL_DEF(0x01D16770, ProxyClient::UpdateUserInfo), - HOOK_VIRTUAL_DEF(0x01D16A50, ProxyClient::ParseVoiceData), - HOOK_VIRTUAL_DEF(0x01D16310, ProxyClient::ProcessStringCmd), - HOOK_VIRTUAL_DEF(0x01D16850, ProxyClient::ParseHLTV), - -#endif // ProxyClient_region - -#ifndef FakeClient_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D09300, FakeClient::Init), - HOOK_VIRTUAL_DEF(0x01D09310, FakeClient::RunFrame), - HOOK_VIRTUAL_DEF(0x01D09320, FakeClient::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D09380, FakeClient::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D09390, FakeClient::GetType), - HOOK_VIRTUAL_DEF(0x01D093D0, FakeClient::ShutDown), - - // FakeClient - HOOK_DEF(0x01D08EA0, FakeClient::SetRate), - HOOK_DEF(0x01D08EB0, FakeClient::Connect), - HOOK_DEF(0x01D08EE0, FakeClient::Retry), // NOXREF - HOOK_DEF(0x01D08EF0, FakeClient::Say), // NOXREF - HOOK_DEF(0x01D08F50, FakeClient::Disconnect), // NOXREF - -#endif // FakeClient_region - -#ifndef BaseClient_region - - // IClient - HOOK_VIRTUAL_DEF(0x01D01670, BaseClient::Connect), - HOOK_VIRTUAL_DEF(0x01D02790, BaseClient::Send), - HOOK_VIRTUAL_DEF(0x01D01830, BaseClient::Disconnect), - HOOK_VIRTUAL_DEF(0x01D023F0, BaseClient::Reconnect), - HOOK_VIRTUAL_DEF(0x01D023C0, BaseClient::SetWorld), - HOOK_VIRTUAL_DEF(0x01D027D0, BaseClient::GetClientType), - HOOK_VIRTUAL_DEF(0x01D01810, BaseClient::GetClientName), - HOOK_VIRTUAL_DEF(0x01D01820, BaseClient::GetUserInfo), - HOOK_VIRTUAL_DEF(0x01D027C0, BaseClient::GetAddress), - HOOK_VIRTUAL_DEF(0x01D02420, BaseClient::IsActive), - HOOK_VIRTUAL_DEF(0x01D026F0, BaseClient::IsHearingVoices), - HOOK_VIRTUAL_DEF(0x01D02730, BaseClient::HasChatEnabled), - HOOK_VIRTUAL_DEF(0x01D02760, BaseClient::DownloadFailed), - HOOK_VIRTUAL_DEF(0x01D02740, BaseClient::DownloadFile), - HOOK_VIRTUAL_DEF(0x01D025C0, BaseClient::UpdateVoiceMask), - HOOK_VIRTUAL_DEF(0x01D02580, BaseClient::QueryVoiceEnabled), - HOOK_VIRTUAL_DEF(0x01D02470, BaseClient::SetName), - HOOK_VIRTUAL_DEF(0x01D02100, BaseClient::WriteSpawn), - HOOK_VIRTUAL_DEF(0x01D02180, BaseClient::WriteDatagram), - HOOK_VIRTUAL_DEF(0x01D027F0, BaseClient::SendDatagram), - HOOK_VIRTUAL_DEF(0x01D02820, BaseClient::Reset), - HOOK_VIRTUAL_DEF(0x01D02020, BaseClient::SetState), - HOOK_VIRTUAL_DEF(0x01D01F20, BaseClient::ReplyNew), - HOOK_VIRTUAL_DEF(0x01D01E50, BaseClient::ReplySpawn), - HOOK_VIRTUAL_DEF(0x01D01F90, BaseClient::ReplyFullUpdate), - HOOK_VIRTUAL_DEF(0x01D01E10, BaseClient::PrintfToClient), - HOOK_VIRTUAL_DEF(0x01D01D00, BaseClient::UpdateUserInfo), - HOOK_VIRTUAL_DEF(0x01D01900, BaseClient::ParseStringCmd), - HOOK_VIRTUAL_DEF(0x01D018C0, BaseClient::ParseNop), - HOOK_VIRTUAL_DEF(0x01D018D0, BaseClient::ParseBad), - HOOK_VIRTUAL_DEF(0x01D02450, BaseClient::ParseMove), - HOOK_VIRTUAL_DEF(0x01D02430, BaseClient::ParseVoiceData), - HOOK_VIRTUAL_DEF(0x01D02530, BaseClient::ParseHLTV), - HOOK_VIRTUAL_DEF(0x01D022E0, BaseClient::ParseDelta), - HOOK_VIRTUAL_DEF(0x01D02540, BaseClient::ParseCvarValue), - HOOK_VIRTUAL_DEF(0x01D02550, BaseClient::ParseCvarValue2), - HOOK_VIRTUAL_DEF(0x01D01740, BaseClient::ProcessMessage), - HOOK_VIRTUAL_DEF(0x01D01920, BaseClient::ProcessStringCmd), - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D02950, BaseClient::Init), - HOOK_VIRTUAL_DEF(0x01D02960, BaseClient::RunFrame), - HOOK_VIRTUAL_DEF(0x01D02330, BaseClient::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D16CE0, BaseClient::GetType), - HOOK_VIRTUAL_DEF(0x01D02A20, BaseClient::ShutDown), - -#endif // BaseClient_region - -#ifndef BitBuffer_region - - HOOK_DEF(0x01D02F80, MethodThunk::Destructor), - HOOK_DEF(0x01D02F10, (MethodThunk::Constructor), void()), - HOOK_DEF(0x01D02F90, (MethodThunk::Constructor), void(unsigned int)), - HOOK_DEF(0x01D02F50, (MethodThunk::Constructor), void(void *, unsigned int)), - - HOOK_DEF(0x01D02FC0, BitBuffer::Resize), - HOOK_DEF(0x01D03010, BitBuffer::Clear), - HOOK_DEF(0x01D03050, BitBuffer::Reset), - HOOK_DEF(0x01D03070, BitBuffer::Free), - HOOK_DEF(0x01D03220, BitBuffer::PeekBits), - HOOK_DEF(0x01D038D0, BitBuffer::CurrentSize), - HOOK_DEF(0x01D03CE0, BitBuffer::FastClear), - HOOK_DEF(0x01D03D30, BitBuffer::ConcatBuffer), - HOOK_DEF(0x01D03BF0, BitBuffer::SkipBytes), - HOOK_DEF(0x01D03040, BitBuffer::CurrentBit), // NOXREF - HOOK_DEF(0x01D038F0, BitBuffer::SpaceLeft), // NOXREF - HOOK_DEF(0x01D03900, BitBuffer::AlignByte), // NOXREF - HOOK_DEF(0x01D03A70, BitBuffer::StartBitMode), // NOXREF - HOOK_DEF(0x01D03A80, BitBuffer::EndBitMode), // NOXREF - HOOK_DEF(0x01D03AC0, BitBuffer::SetBuffer), // NOXREF - HOOK_DEF(0x01D03C20, BitBuffer::SkipBits), // NOXREF - HOOK_DEF(0x01D03CB0, BitBuffer::SkipString), // NOXREF - - // Read - HOOK_DEF(0x01D030B0, BitBuffer::ReadBits), - HOOK_DEF(0x01D03190, BitBuffer::ReadBit), - HOOK_DEF(0x01D03250, BitBuffer::ReadChar), - HOOK_DEF(0x01D03260, BitBuffer::ReadByte), - HOOK_DEF(0x01D03270, BitBuffer::ReadShort), - HOOK_DEF(0x01D03280, BitBuffer::ReadWord), - HOOK_DEF(0x01D03290, BitBuffer::ReadLong), - HOOK_DEF(0x01D032A0, BitBuffer::ReadFloat), - HOOK_DEF(0x01D032C0, BitBuffer::ReadBuf), - HOOK_DEF(0x01D033A0, BitBuffer::ReadString), - HOOK_DEF(0x01D033E0, BitBuffer::ReadStringLine), - HOOK_DEF(0x01D03A00, BitBuffer::ReadBitString), - HOOK_DEF(0x01D03A90, BitBuffer::ReadBitData), - HOOK_DEF(0x01D03AF0, BitBuffer::ReadBitVec3Coord), - HOOK_DEF(0x01D03B50, BitBuffer::ReadBitCoord), - HOOK_DEF(0x01D03BD0, BitBuffer::ReadCoord), - HOOK_DEF(0x01D03420, BitBuffer::ReadAngle), // NOXREF - HOOK_DEF(0x01D03440, BitBuffer::ReadHiresAngle), // NOXREF - HOOK_DEF(0x01D03920, BitBuffer::ReadSBits), // NOXREF - HOOK_DEF(0x01D03950, BitBuffer::ReadBitAngle), // NOXREF - - // Write - HOOK_DEF(0x01D03770, BitBuffer::WriteBuf, void(const void *, int)), - HOOK_DEF(0x01D03370, BitBuffer::WriteBuf, void(BitBuffer *, int)), - - HOOK_DEF(0x01D03460, BitBuffer::WriteBit), - HOOK_DEF(0x01D03530, BitBuffer::WriteBits), - HOOK_DEF(0x01D03650, BitBuffer::WriteSBits), // NOXREF - HOOK_DEF(0x01D036B0, BitBuffer::WriteChar), - HOOK_DEF(0x01D036C0, BitBuffer::WriteByte), - HOOK_DEF(0x01D036D0, BitBuffer::WriteShort), - HOOK_DEF(0x01D036E0, BitBuffer::WriteWord), - HOOK_DEF(0x01D036F0, BitBuffer::WriteLong), - HOOK_DEF(0x01D03700, BitBuffer::WriteFloat), - HOOK_DEF(0x01D03730, BitBuffer::WriteString), - HOOK_DEF(0x01D03D50, BitBuffer::WriteCoord), - HOOK_DEF(0x01D03840, BitBuffer::WriteBitData), // NOXREF - HOOK_DEF(0x01D03870, BitBuffer::WriteAngle), // NOXREF - HOOK_DEF(0x01D038A0, BitBuffer::WriteHiresAngle), // NOXREF - HOOK_DEF(0x01D03990, BitBuffer::WriteBitAngle), // NOXREF - HOOK_DEF(0x01D03A30, BitBuffer::WriteBitString), // NOXREF - -#endif // BitBuffer_region - -#ifndef NetChannel_region - - // virtual functions - HOOK_VIRTUAL_DEF(0x01D0C7E0, NetChannel::Create), - HOOK_VIRTUAL_DEF(0x01D0DC20, NetChannel::GetTargetAddress), - HOOK_VIRTUAL_DEF(0x01D0C8C0, NetChannel::Close), - HOOK_VIRTUAL_DEF(0x01D0C6E0, NetChannel::Clear), - HOOK_VIRTUAL_DEF(0x01D0C650, NetChannel::Reset), - HOOK_VIRTUAL_DEF(0x01D0DC40, NetChannel::IsConnected), - HOOK_VIRTUAL_DEF(0x01D0C8F0, NetChannel::IsReadyToSend), - HOOK_VIRTUAL_DEF(0x01D0DD60, NetChannel::IsCrashed), - HOOK_VIRTUAL_DEF(0x01D0DC70, NetChannel::IsTimedOut), - HOOK_VIRTUAL_DEF(0x01D0DC30, NetChannel::IsFakeChannel), - HOOK_VIRTUAL_DEF(0x01D0DC10, NetChannel::KeepAlive), - HOOK_VIRTUAL_DEF(0x01D0DB90, NetChannel::SetRate), - - HOOK_VIRTUAL_DEF(0x01D0D9F0, NetChannel::SetUpdateRate), - HOOK_VIRTUAL_DEF(0x01D0DC50, NetChannel::SetTimeOut), - HOOK_VIRTUAL_DEF(0x01D0DC00, NetChannel::SetKeepAlive), - HOOK_VIRTUAL_DEF(0x01D0DCB0, NetChannel::GetIdleTime), - HOOK_VIRTUAL_DEF(0x01D0DCC0, NetChannel::GetRate), - HOOK_VIRTUAL_DEF(0x01D0DCD0, NetChannel::GetUpdateRate), - HOOK_VIRTUAL_DEF(0x01D0DCE0, NetChannel::GetLoss), - - HOOK_VIRTUAL_DEF(0x01D0C9E0, NetChannel::TransmitOutgoing), - HOOK_VIRTUAL_DEF(0x01D0D130, NetChannel::ProcessIncoming), - HOOK_VIRTUAL_DEF(0x01D0DCF0, NetChannel::FakeAcknowledgement), - HOOK_VIRTUAL_DEF(0x01D0C480, NetChannel::OutOfBandPrintf), - - // non-virtual functions - HOOK_DEF(0x01D0C400, NetChannel::UnlinkFragment), - HOOK_DEF(0x01D0C530, NetChannel::ClearFragbufs), - HOOK_DEF(0x01D0C560, NetChannel::ClearFragments), - HOOK_DEF(0x01D0C5D0, NetChannel::FlushIncoming), - HOOK_DEF(0x01D0C910, NetChannel::UpdateFlow), - HOOK_DEF(0x01D0D030, NetChannel::FindBufferById), - HOOK_DEF(0x01D0D090, NetChannel::CheckForCompletion), - HOOK_DEF(0x01D0D620, NetChannel::FragSend), - HOOK_DEF(0x01D0D670, NetChannel::AddBufferToList), - HOOK_DEF(0x01D0D6C0, NetChannel::CreateFragmentsFromBuffer), - HOOK_DEF(0x01D0DD20, NetChannel::CreateFragmentsFromFile), - HOOK_DEF(0x01D0D970, NetChannel::AddFragbufToTail), - HOOK_DEF(0x01D0D9B0, NetChannel::GetPacket), - HOOK_DEF(0x01D0D9C0, NetChannel::FreePacket), - HOOK_DEF(0x01D0DA30, NetChannel::CopyNormalFragments), - HOOK_DEF(0x01D0DBD0, NetChannel::GetFlowStats), - HOOK_DEF(0x01D0DBC0, NetChannel::SetConnected), // NOXREF - HOOK_DEF(0x01D0DD70, NetChannel::CopyFileFragments), // NOXREF - -#endif // NetChannel_region - -#ifndef Master_region - - // virtual functions - HOOK_VIRTUAL_DEF(0x01D0A480, Master::Init), - HOOK_VIRTUAL_DEF(0x01D0A490, Master::RunFrame), - HOOK_VIRTUAL_DEF(0x01D0A4B0, Master::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D0A500, Master::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D0A510, Master::GetType), - HOOK_VIRTUAL_DEF(0x01D0A550, Master::ShutDown), - - //HOOK_DEF(0x0, Master::InitializeSteam), // NOXREF - HOOK_DEF(0x01D0A230, Master::CMD_Heartbeat), - HOOK_DEF(0x01D0A260, Master::CMD_NoMaster), - HOOK_DEF(0x01D0A350, Master::CMD_ListMaster), - HOOK_DEF(0x01D0A3E0, Master::SendShutdown), - -#endif // Master_region - -#ifndef DemoFile_region - - HOOK_DEF(0x01D04F60, MethodThunk::Destructor), - HOOK_DEF(0x01D04F10, MethodThunk::Constructor), - - HOOK_DEF(0x01D06380, DemoFile::Init), - HOOK_DEF(0x01D059D0, DemoFile::LoadDemo), - HOOK_DEF(0x01D05D30, DemoFile::StopPlayBack), - HOOK_DEF(0x01D056B0, DemoFile::StartRecording), - HOOK_DEF(0x01D04FC0, DemoFile::CloseFile), - HOOK_DEF(0x01D04F70, DemoFile::Reset), - HOOK_DEF(0x01D06370, DemoFile::SetContinuous), // NOXREF - HOOK_DEF(0x01D06360, DemoFile::IsContinuous), // NOXREF - HOOK_DEF(0x01D059C0, DemoFile::IsPlaying), - HOOK_DEF(0x01D04FB0, DemoFile::IsRecording), - HOOK_DEF(0x01D06350, DemoFile::GetFileName), - HOOK_DEF(0x01D05D60, DemoFile::ReadDemoPacket), - HOOK_DEF(0x01D053B0, DemoFile::WriteDemoMessage), - HOOK_DEF(0x01D05500, DemoFile::WriteUpdateClientData), - HOOK_DEF(0x01D055B0, DemoFile::GetDemoTime), - HOOK_DEF(0x01D06260, DemoFile::ReadSequenceInfo), - HOOK_DEF(0x01D06220, DemoFile::ReadDemoInfo), - HOOK_DEF(0x01D052B0, DemoFile::WriteDemoStartup), - HOOK_DEF(0x01D051C0, DemoFile::WriteSequenceInfo), - HOOK_DEF(0x01D05190, DemoFile::WriteDemoInfo), - HOOK_DEF(0x01D055D0, DemoFile::WriteSignonData), - -#endif // DemoFile_region - -#ifndef DemoClient_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D04E30, DemoClient::Init), - HOOK_VIRTUAL_DEF(0x01D04E40, DemoClient::RunFrame), - HOOK_VIRTUAL_DEF(0x01D04EB0, DemoClient::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D04EC0, DemoClient::GetType), - HOOK_VIRTUAL_DEF(0x01D04F00, DemoClient::ShutDown), - - // IClient - HOOK_VIRTUAL_DEF(0x01D04810, DemoClient::Connect), - HOOK_VIRTUAL_DEF(0x01D04D30, DemoClient::Send), - HOOK_VIRTUAL_DEF(0x01D04BE0, DemoClient::Disconnect), - HOOK_VIRTUAL_DEF(0x01D04800, DemoClient::Reconnect), - HOOK_VIRTUAL_DEF(0x01D04D90, DemoClient::SetWorld), - HOOK_VIRTUAL_DEF(0x01D047F0, DemoClient::GetClientType), - HOOK_VIRTUAL_DEF(0x01D04D60, DemoClient::GetClientName), - HOOK_VIRTUAL_DEF(0x01D04D70, DemoClient::GetUserInfo), - HOOK_VIRTUAL_DEF(0x01D04CE0, DemoClient::GetAddress), - HOOK_VIRTUAL_DEF(0x01D04BD0, DemoClient::IsActive), - HOOK_VIRTUAL_DEF(0x01D047C0, DemoClient::IsHearingVoices), - HOOK_VIRTUAL_DEF(0x01D047D0, DemoClient::HasChatEnabled), - - HOOK_DEF(0x01D04990, DemoClient::SendDatagram), - HOOK_DEF(0x01D04A30, DemoClient::WriteDatagram), - HOOK_DEF(0x01D04C70, DemoClient::FinishDemo), - HOOK_DEF(0x01D04D80, DemoClient::SetProxy), - HOOK_DEF(0x01D04DA0, DemoClient::SetFileName), - HOOK_DEF(0x01D04DD0, DemoClient::GetDemoFile), - -#endif // DemoClient_region - -#ifndef Director_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D07BC0, Director::Init), - HOOK_VIRTUAL_DEF(0x01D07BD0, Director::RunFrame), - HOOK_VIRTUAL_DEF(0x01D07BE0, Director::ReceiveSignal), - HOOK_VIRTUAL_DEF(0x01D07BF0, Director::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D07C40, Director::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D07C50, Director::GetType), - HOOK_VIRTUAL_DEF(0x01D07C90, Director::ShutDown), - - // IDirector - HOOK_VIRTUAL_DEF(0x01D068C0, Director::NewGame), - HOOK_VIRTUAL_DEF(0x01D068B0, Director::GetModName), - HOOK_VIRTUAL_DEF(0x01D06E10, Director::WriteCommands), - HOOK_VIRTUAL_DEF(0x01D07A60, Director::AddCommand), - HOOK_VIRTUAL_DEF(0x01D07B50, Director::RemoveCommand), - HOOK_VIRTUAL_DEF(0x01D07B60, Director::GetLastCommand), - HOOK_VIRTUAL_DEF(0x01D07B40, Director::GetCommands), - - // Director - HOOK_DEF(0x01D07910, Director::FindBestEvent), - HOOK_DEF(0x01D07690, Director::ExecuteDirectorCommands), - HOOK_DEF(0x01D07420, Director::RandomizeCommand), - HOOK_DEF(0x01D07280, Director::GetClosestPlayer), - HOOK_DEF(0x01D06EC0, Director::AddEvent), - HOOK_DEF(0x01D06B50, Director::SmoothRank), - HOOK_DEF(0x01D06C40, Director::AnalysePlayer), - HOOK_DEF(0x01D06980, Director::AnalyseFrame), - HOOK_DEF(0x01D073E0, Director::ClearDirectorCommands), - HOOK_DEF(0x01D07110, Director::AddBestMODCut), - HOOK_DEF(0x01D06F00, Director::AddBestGenericCut), - HOOK_DEF(0x01D06EA0, Director::WriteSignonData), - //HOOK_DEF(0x0, Director::WriteProxyStatus), // NOXREF - HOOK_DEF(0x01D07830, Director::CMD_SlowMotion), - -#endif // Director_region - -#ifndef DirectorCmd_region - - HOOK_DEF(0x01D07D00, DirectorCmd::GetEventData), - HOOK_DEF(0x01D07D50, DirectorCmd::GetModeData), - HOOK_DEF(0x01D07D80, DirectorCmd::GetChaseData), - HOOK_DEF(0x01D07DD0, DirectorCmd::GetInEyeData), - HOOK_DEF(0x01D07E00, DirectorCmd::GetMapData), - HOOK_DEF(0x01D07E50, DirectorCmd::GetCameraData), - HOOK_DEF(0x01D07EE0, DirectorCmd::GetCamPathData), - HOOK_DEF(0x01D07F70, DirectorCmd::GetSoundData), - HOOK_DEF(0x01D07FB0, DirectorCmd::GetTime), // NOXREF - HOOK_DEF(0x01D07FC0, DirectorCmd::GetType), - HOOK_DEF(0x01D07FD0, DirectorCmd::GetName), // NOXREF - HOOK_DEF(0x01D07FE0, DirectorCmd::GetTimeScaleData), - HOOK_DEF(0x01D08010, DirectorCmd::GetWayPointsData), - HOOK_DEF(0x01D08040, DirectorCmd::GetMessageData), - HOOK_DEF(0x01D080E0, DirectorCmd::GetStatusData), - HOOK_DEF(0x01D08130, DirectorCmd::GetBannerData), - HOOK_DEF(0x01D08170, DirectorCmd::GetStuffTextData), - HOOK_DEF(0x01D081B0, DirectorCmd::SetEventData), - HOOK_DEF(0x01D081F0, DirectorCmd::SetChaseData), // NOXREF - HOOK_DEF(0x01D08240, DirectorCmd::SetInEyeData), // NOXREF - HOOK_DEF(0x01D08270, DirectorCmd::SetMapData), // NOXREF - HOOK_DEF(0x01D082B0, DirectorCmd::SetStartData), // NOXREF - HOOK_DEF(0x01D082C0, DirectorCmd::SetModeData), // NOXREF - HOOK_DEF(0x01D082F0, DirectorCmd::SetCameraData), // NOXREF - HOOK_DEF(0x01D08370, DirectorCmd::SetCamPathData), // NOXREF - HOOK_DEF(0x01D083F0, DirectorCmd::SetSoundData), - HOOK_DEF(0x01D08440, DirectorCmd::SetTimeScaleData), - HOOK_DEF(0x01D08470, DirectorCmd::SetTime), - HOOK_DEF(0x01D08480, DirectorCmd::SetMessageData), - HOOK_DEF(0x01D08520, DirectorCmd::Copy), // NOXREF - HOOK_DEF(0x01D08570, DirectorCmd::SetStatusData), - HOOK_DEF(0x01D085B0, DirectorCmd::SetBannerData), - HOOK_DEF(0x01D085F0, DirectorCmd::SetStuffTextData), // NOXREF - HOOK_DEF(0x01D08630, DirectorCmd::SetWayPoints), // NOXREF - HOOK_DEF(0x01D08660, DirectorCmd::ReadFromStream), // NOXREF - HOOK_DEF(0x01D088C0, DirectorCmd::WriteToStream), - HOOK_DEF(0x01D08920, DirectorCmd::ToString), // NOXREF - HOOK_DEF(0x01D08D50, DirectorCmd::FromString), // NOXREF - HOOK_DEF(0x01D08D60, DirectorCmd::Clear), - HOOK_DEF(0x01D08D70, DirectorCmd::Resize), - -#endif // DirectorCmd_region - -#ifndef Status_region - - // BaseSystemModule - HOOK_VIRTUAL_DEF(0x01D178A0, Status::Init), - HOOK_VIRTUAL_DEF(0x01D178B0, Status::RunFrame), - HOOK_VIRTUAL_DEF(0x01D178D0, Status::ExecuteCommand), - HOOK_VIRTUAL_DEF(0x01D17920, Status::GetStatusLine), - HOOK_VIRTUAL_DEF(0x01D17930, Status::GetType), - HOOK_VIRTUAL_DEF(0x01D17970, Status::ShutDown), - -#endif // Status_region - -#ifndef InfoString_region - - HOOK_DEF(0x01D09590, MethodThunk::Destructor), - HOOK_DEF(0x01D094F0, (MethodThunk::Constructor), void()), - HOOK_DEF(0x01D09510, (MethodThunk::Constructor), void(unsigned int)), - HOOK_DEF(0x01D09540, (MethodThunk::Constructor), void(char *)), - HOOK_DEF(0x01D09480, (MethodThunk::Constructor), void(char *, unsigned int)), - - HOOK_DEF(0x01D095B0, InfoString::SetString), - HOOK_DEF(0x01D09600, InfoString::SetMaxSize), - HOOK_DEF(0x01D09660, InfoString::GetMaxSize), - HOOK_DEF(0x01D09670, InfoString::GetCurrentSize), - HOOK_DEF(0x01D09690, InfoString::Clear), - HOOK_DEF(0x01D096B0, InfoString::GetString), - HOOK_DEF(0x01D096C0, InfoString::ValueForKey), - HOOK_DEF(0x01D097B0, InfoString::RemoveKey), - HOOK_DEF(0x01D09880, InfoString::RemovePrefixedKeys), - HOOK_DEF(0x01D09900, InfoString::SetValueForStarKey), - HOOK_DEF(0x01D09AB0, InfoString::SetValueForKey), - -#endif // InfoString_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_FunctionRefs[] = -{ -#ifndef Function_References_region - -#endif // Function_References_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_DataRefs[] = -{ -#ifndef Data_References_region - -#endif // Data_References_region - - { NULL, NULL, NULL }, -}; - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Proxy/hooklist.h b/rehlds/hookers/HLTV/Proxy/hooklist.h deleted file mode 100644 index d030ec9..0000000 --- a/rehlds/hookers/HLTV/Proxy/hooklist.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#ifdef HOOK_HLTV - -#include "hookers/memory.h" -#include "hookers/helper.h" -#include "hookers/hooker.h" - -#define rehlds_syserror HLTV_SysError - -#endif // HOOK_HLTV diff --git a/rehlds/hookers/HLTV/Proxy/main.cpp b/rehlds/hookers/HLTV/Proxy/main.cpp deleted file mode 100644 index a1528c3..0000000 --- a/rehlds/hookers/HLTV/Proxy/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "precompiled.h" - -#if defined(HOOK_HLTV) -#define ORIGINAL_PROXY_DLL_NAME "proxy2.dll" - -CSysModule *g_pOriginalProxyModule = NULL; -CreateInterfaceFn g_OriginalProxyFactory = NULL; -ISystemModule *g_pOriginalProxy = NULL; - -IBaseInterface *CreateProxyInterface() -{ - if (g_pOriginalProxy) { - return g_pOriginalProxy; - } - - if (g_pOriginalProxyModule) - { - g_OriginalProxyFactory = Sys_GetFactory(g_pOriginalProxyModule); - if (g_OriginalProxyFactory) - { - int returnCode = 0; - g_pOriginalProxy = reinterpret_cast(g_OriginalProxyFactory(PROXY_INTERFACE_VERSION, &returnCode)); - return g_pOriginalProxy; - } - } - - return NULL; -} - -InterfaceReg iface = InterfaceReg(CreateProxyInterface, PROXY_INTERFACE_VERSION); - -// DLL entry point -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - { - g_pOriginalProxyModule = Sys_LoadModule(ORIGINAL_PROXY_DLL_NAME); - size_t addr = (size_t)Sys_GetProcAddress(ORIGINAL_PROXY_DLL_NAME, CREATEINTERFACE_PROCNAME); - HookModule("hltv.exe", addr); - } - else if (fdwReason == DLL_PROCESS_DETACH) - { - if (g_pOriginalProxyModule) - { - Sys_UnloadModule(g_pOriginalProxyModule); - g_pOriginalProxyModule = NULL; - g_OriginalProxyFactory = NULL; - g_pOriginalProxy = NULL; - } - } - - return TRUE; -} - -#endif // #if defined(HOOK_HLTV) diff --git a/rehlds/hookers/filesystem/hooklist.cpp b/rehlds/hookers/filesystem/hooklist.cpp deleted file mode 100644 index 7fb0b2d..0000000 --- a/rehlds/hookers/filesystem/hooklist.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* -* -* This program 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 2 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, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -// Hooks stuff -#include "hookers/memory.cpp" -#include "hookers/hooker.cpp" - -//#define Mem_region -//#define BaseFileSystem_region -//#define CUtlSymbol_Region -//#define Function_References_region -//#define Data_References_region - -FunctionHook g_FunctionHooks[] = -{ - // DO NOT DISABLE, other functions depends on memory allocation routines -#ifndef Mem_region - -#ifdef _WIN32 - HOOK_SYMBOLDEF(0x01D06F5E, "_malloca", malloc_wrapper), - HOOK_SYMBOLDEF(0x01D067CA, "_free", free_wrapper), - HOOK_SYMBOLDEF(0x01D07098, "realloc", realloc_wrapper), - HOOK_SYMBOLDEF(0x01D06F70, "__nh_malloc", __nh_malloc_wrapper), -#endif //_WIN32 - -#endif // Mem_region - -#ifndef BaseFileSystem_region - - HOOK_DEF(0x01D01080, MethodThunk::Destructor), - HOOK_DEF(0x01D01010, (MethodThunk::Constructor)), - - // virtual functions - CFileSystem_Stdio - HOOK_VIRTUAL_DEF(0x01D05340, CFileSystem_Stdio::Mount), - HOOK_VIRTUAL_DEF(0x01D011C0, CFileSystem_Stdio::Unmount), - HOOK_VIRTUAL_DEF(0x01D05510, CFileSystem_Stdio::GetLocalCopy), - HOOK_VIRTUAL_DEF(0x01D05520, CFileSystem_Stdio::LogLevelLoadStarted), - HOOK_VIRTUAL_DEF(0x01D05530, CFileSystem_Stdio::LogLevelLoadFinished), - HOOK_VIRTUAL_DEF(0x01D05540, CFileSystem_Stdio::HintResourceNeed), - HOOK_VIRTUAL_DEF(0x01D05550, CFileSystem_Stdio::PauseResourcePreloading), - HOOK_VIRTUAL_DEF(0x01D05560, CFileSystem_Stdio::ResumeResourcePreloading), - HOOK_VIRTUAL_DEF(0x01D05570, CFileSystem_Stdio::SetVBuf), - HOOK_VIRTUAL_DEF(0x01D055B0, CFileSystem_Stdio::GetInterfaceVersion), - HOOK_VIRTUAL_DEF(0x01D055D0, CFileSystem_Stdio::WaitForResources), - HOOK_VIRTUAL_DEF(0x01D055E0, CFileSystem_Stdio::GetWaitForResourcesProgress), - HOOK_VIRTUAL_DEF(0x01D05600, CFileSystem_Stdio::CancelWaitForResources), - HOOK_VIRTUAL_DEF(0x01D05610, CFileSystem_Stdio::IsAppReadyForOfflinePlay), - - // virtual functions - BaseFileSystem - HOOK_SYMBOL_VIRTUAL_EX(0x01D01AF0, CFileSystem_Stdio, Open), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01CC0, CFileSystem_Stdio, OpenFromCacheForRead), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01D50, CFileSystem_Stdio, Close), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01DD0, CFileSystem_Stdio, Seek), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01EA0, CFileSystem_Stdio, Tell), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01EF0, CFileSystem_Stdio, Size, size_t (FileHandle_t)), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01F30, CFileSystem_Stdio, Size, size_t (const char *)), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02310, CFileSystem_Stdio, IsOk), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02370, CFileSystem_Stdio, Flush), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02150, CFileSystem_Stdio, EndOfFile), - HOOK_SYMBOL_VIRTUAL_EX(0x01D021E0, CFileSystem_Stdio, Read), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02240, CFileSystem_Stdio, Write), - HOOK_SYMBOL_VIRTUAL_EX(0x01D023B0, CFileSystem_Stdio, ReadLine), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02290, CFileSystem_Stdio, FPrintf), - HOOK_SYMBOL_VIRTUAL_EX(0x01D022F0, CFileSystem_Stdio, GetReadBuffer), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02300, CFileSystem_Stdio, ReleaseReadBuffer), - HOOK_SYMBOL_VIRTUAL_EX(0x01D012B0, CFileSystem_Stdio, GetCurrentDirectory), - HOOK_SYMBOL_VIRTUAL_EX(0x01D012B0, CFileSystem_Stdio, GetCurrentDirectory), - HOOK_SYMBOL_VIRTUAL_EX(0x01D011D0, CFileSystem_Stdio, CreateDirHierarchy), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01680, CFileSystem_Stdio, IsDirectory), - HOOK_SYMBOL_VIRTUAL_EX(0x01D024A0, CFileSystem_Stdio, GetLocalPath), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02400, CFileSystem_Stdio, RemoveFile), - HOOK_SYMBOL_VIRTUAL_EX(0x01D042B0, CFileSystem_Stdio, RemoveAllSearchPaths), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01320, CFileSystem_Stdio, AddSearchPath), - HOOK_SYMBOL_VIRTUAL_EX(0x01D014E0, CFileSystem_Stdio, RemoveSearchPath), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01AA0, CFileSystem_Stdio, FileExists), - HOOK_SYMBOL_VIRTUAL_EX(0x01D04000, CFileSystem_Stdio, GetFileTime), - HOOK_SYMBOL_VIRTUAL_EX(0x01D04060, CFileSystem_Stdio, FileTimeToString), - HOOK_SYMBOL_VIRTUAL_EX(0x01D036B0, CFileSystem_Stdio, FindFirst), - HOOK_SYMBOL_VIRTUAL_EX(0x01D03DB0, CFileSystem_Stdio, FindNext), - HOOK_SYMBOL_VIRTUAL_EX(0x01D03DF0, CFileSystem_Stdio, FindIsDirectory), - HOOK_SYMBOL_VIRTUAL_EX(0x01D03E10, CFileSystem_Stdio, FindClose), - HOOK_SYMBOL_VIRTUAL_EX(0x01D03EF0, CFileSystem_Stdio, ParseFile), - HOOK_SYMBOL_VIRTUAL_EX(0x01D04130, CFileSystem_Stdio, FullPathToRelativePath), - HOOK_SYMBOL_VIRTUAL_EX(0x01D012A0, CFileSystem_Stdio, PrintOpenedFiles), - HOOK_SYMBOL_VIRTUAL_EX(0x01D04090, CFileSystem_Stdio, SetWarningFunc), - HOOK_SYMBOL_VIRTUAL_EX(0x01D040A0, CFileSystem_Stdio, SetWarningLevel), - HOOK_SYMBOL_VIRTUAL_EX(0x01D02A20, CFileSystem_Stdio, AddPackFile), - HOOK_SYMBOL_VIRTUAL_EX(0x01D01300, CFileSystem_Stdio, AddSearchPathNoWrite), - - // non-virtual functions - BaseFileSystem - HOOK_DEF(0x01D02780, CBaseFileSystem::Trace_FOpen), - HOOK_DEF(0x01D028A0, CBaseFileSystem::Trace_FClose), - HOOK_DEF(0x01D029E0, CBaseFileSystem::Trace_DumpUnclosedFiles), - HOOK_DEF(0x01D01340, CBaseFileSystem::AddSearchPathInternal), - HOOK_DEF(0x01D040B0, CBaseFileSystem::Warning), - HOOK_DEF(0x01D04350, CBaseFileSystem::FixSlashes), - HOOK_DEF(0x01D04370, CBaseFileSystem::FixPath), - //HOOK_DEF(0x01D04320, CBaseFileSystem::StripFilename), // NOXREF - HOOK_DEF(0x01D01610, CBaseFileSystem::GetWritePath), - HOOK_DEF(0x01D01790, CBaseFileSystem::FindFile), - HOOK_DEF(0x01D01F70, CBaseFileSystem::FastFindFileSize), - //HOOK_DEF(0x01D034B0, CBaseFileSystem::RemoveAllMapSearchPaths), // NOXREF - HOOK_DEF(0x01D033A0, CBaseFileSystem::AddPackFiles), - HOOK_DEF(0x01D02A40, CBaseFileSystem::AddPackFileFromPath), - HOOK_DEF(0x01D02D20, CBaseFileSystem::PreparePackFile), - HOOK_DEF(0x01D03070, CBaseFileSystem::Prepare64BitPackFile), - HOOK_DEF(0x01D03510, CBaseFileSystem::SearchPakFile), - //HOOK_DEF(0x01D039B0, CBaseFileSystem::FileInSearchPaths), // NOXREF - HOOK_DEF(0x01D03B70, CBaseFileSystem::FindNextFileHelper), - HOOK_DEF(0x01D03890, CBaseFileSystem::FindFirstHelper), - -#endif // BaseFileSystem_region - -#ifndef CUtlSymbol_Region - - //HOOK_DEF(0x01D05AA0, MethodThunk::Destructor), // NOXREF - HOOK_DEF(0x01D05A30, (MethodThunk::Constructor), void(int, int, bool)), - HOOK_DEF(0x01D05C50, CUtlSymbolTable::AddString), - HOOK_DEF(0x01D05B10, CUtlSymbolTable::Find), - HOOK_DEF(0x01D05DA0, CUtlSymbolTable::String), - //HOOK_DEF(0x0, CUtlSymbolTable::RemoveAll), // NOXREF - HOOK_DEF(0x01D05960, CUtlSymbolTable::SymLess), - HOOK_DEF(0x01D059E0, CUtlSymbolTable::SymLessi), - - HOOK_DEF(0x01D05890, (MethodThunk::Constructor), void(const char *)), - HOOK_DEF(0x01D05830, CUtlSymbol::Initialize), // Don't touch it - HOOK_DEF(0x01D05880, CUtlSymbol::CurrTable), // Don't touch it - HOOK_DEF(0x01D058C0, CUtlSymbol::String), - //HOOK_DEF(0x01D058E0, CUtlSymbol::operator==, bool (const char *) const), // NOXREF - -#endif // CUtlSymbol_Region - - { NULL, NULL, NULL }, -}; - -AddressRef g_FunctionRefs[] = -{ -#ifndef Function_References_region - -#endif // Function_References_region - - { NULL, NULL, NULL }, -}; - -AddressRef g_DataRefs[] = -{ -#ifndef Data_References_region - - //GLOBALVAR_LINK(0x01D1B020, "CBaseFileSystem::s_pFileSystem", CBaseFileSystem::s_pFileSystem), - GLOBALVAR_LINK(0x01D1B0B8, "g_LessCtx", pg_LessCtx), - -#endif // Data_References_region - - { NULL, NULL, NULL }, -}; diff --git a/rehlds/hookers/filesystem/hooklist.h b/rehlds/hookers/filesystem/hooklist.h deleted file mode 100644 index 7b28577..0000000 --- a/rehlds/hookers/filesystem/hooklist.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -* -* This program 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 2 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, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#pragma once - -#ifdef HOOK_FILESYSTEM - -#define rehlds_syserror FileSystem_SysError -#define g_LessCtx (*pg_LessCtx) - -#include "hookers/memory.h" -#include "hookers/helper.h" -#include "hookers/hooker.h" - -extern struct LessCtx_t g_LessCtx; - -#endif // HOOK_FILESYSTEM diff --git a/rehlds/hookers/filesystem/main.cpp b/rehlds/hookers/filesystem/main.cpp deleted file mode 100644 index 4a9fd7c..0000000 --- a/rehlds/hookers/filesystem/main.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -* -* This program 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 2 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, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -#if defined(HOOK_FILESYSTEM) - -const char *ORIGINAL_FILESYSTEM_DLL_NAME = "filesystem_stdio2.dll"; - -CSysModule *g_pOriginalFileSystemModule = nullptr; -CreateInterfaceFn g_OriginalFileSystemFactory = nullptr; -IFileSystem *g_pOriginalFileSystem = nullptr; - -IBaseInterface *CreateFileSystemInterface() -{ - if (g_pOriginalFileSystem) { - return g_pOriginalFileSystem; - } - - if (g_pOriginalFileSystemModule) - { - g_OriginalFileSystemFactory = (CreateInterfaceFn)Sys_GetFactory(g_pOriginalFileSystemModule); - - if (g_OriginalFileSystemFactory) - { - int returnCode = 0; - g_pOriginalFileSystem = (IFileSystem *)g_OriginalFileSystemFactory(FILESYSTEM_INTERFACE_VERSION, &returnCode); - return g_pOriginalFileSystem; - } - } - - return nullptr; -} - -EXPOSE_INTERFACE_FN(CreateFileSystemInterface, IFileSystem, FILESYSTEM_INTERFACE_VERSION); - -// DLL entry point -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - if (fdwReason == DLL_PROCESS_ATTACH) - { - g_pOriginalFileSystemModule = (CSysModule *)LoadLibrary(ORIGINAL_FILESYSTEM_DLL_NAME); - size_t addr = (size_t)Sys_GetProcAddress(ORIGINAL_FILESYSTEM_DLL_NAME, CREATEINTERFACE_PROCNAME); - HookModule("hlds.exe", addr); - } - else if (fdwReason == DLL_PROCESS_DETACH) - { - if (g_pOriginalFileSystemModule) - { - Sys_UnloadModule(g_pOriginalFileSystemModule); - g_pOriginalFileSystemModule = nullptr; - - g_OriginalFileSystemFactory = nullptr; - g_pOriginalFileSystem = nullptr; - } - } - - return TRUE; -} - -#endif // #if defined(HOOK_FILESYSTEM) diff --git a/rehlds/hookers/helper.h b/rehlds/hookers/helper.h deleted file mode 100644 index 926d551..0000000 --- a/rehlds/hookers/helper.h +++ /dev/null @@ -1,163 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -#if defined(HOOK_HLTV) || defined(HOOK_FILESYSTEM) - -#define private public -#define protected public - -template -class MethodThunk { -public: - void Constructor(TArgs ... args) { - new(this) T(args ...); - } - - void Destructor() { - (*(T *)this).~T(); - } -}; - -namespace MsvcMethod { - namespace Detail { - using Counter = std::size_t(*)(); - - template - std::size_t GetIndex() { - return N; - } - - template - constexpr auto GenerateCounters_Helper(std::index_sequence) { - // There is no make_array (and/or deduction guides), so we need to explicitly define array template params - return std::array { &GetIndex ... }; - } - - template - auto counters = GenerateCounters_Helper(std::make_index_sequence{}); - - struct VIndexGetter {}; - struct ThisGetter { - decltype(auto) GetThis() const { - return this; - } - - decltype(auto) GetThis(...) const { - return this; - } - }; - - template - class Singleton { - public: - static T &GetInstance() { - static T instance = {}; - return instance; - } - }; - - // primary template - template - struct is_variadic_function : std::false_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - template - struct is_variadic_function : std::true_type {}; - - template - constexpr bool is_variadic_function_v = is_variadic_function::value; - - template - constexpr bool is_function_v = std::is_function::value; - } // namespace Detail - - static constexpr auto& counters = Detail::counters<256>; - - template - std::enable_if_t, std::uintptr_t> - GetVirtualIndex(TMethod T::*method) - { - decltype(auto) pcounters = counters.data(); - decltype(auto) vIndexGetter = (Detail::VIndexGetter *)&pcounters; - - using VIndexGetterFunction = std::conditional_t, std::size_t (Detail::VIndexGetter::*)(...) const, std::size_t(Detail::VIndexGetter::*)() const>; - VIndexGetterFunction vIndexGetterFunction; - { - *(std::uintptr_t *)&vIndexGetterFunction = *(std::uintptr_t *)&method; - } - - return (vIndexGetter->*vIndexGetterFunction)(); - } - - template - TMethod &declmethod(TMethod T::*method); - - template - std::enable_if_t, std::uintptr_t> - GetVirtualAddress(TMethod T::*method) - { - using ThisGetterFunction = std::conditional_t, const T *(T::*)(...) const, const T *(T::*)() const>; - ThisGetterFunction thisGetterFunction = *(ThisGetterFunction *)&method; - { - decltype(auto) m = static_cast, const Detail::ThisGetter *(Detail::ThisGetter::*)(...) const, const Detail::ThisGetter *(Detail::ThisGetter::*)() const>>(&Detail::ThisGetter::GetThis); - *(std::uintptr_t *)&thisGetterFunction = *(std::uintptr_t *)&m; - } - - return *(*(std::uintptr_t **)(Detail::Singleton::GetInstance().*thisGetterFunction)() + GetVirtualIndex(method)); - } - - template - std::enable_if_t, std::uintptr_t> - GetAddress(TMethod (T::*method)) { - return (std::uintptr_t &)method; - } - - template - std::enable_if_t, std::uintptr_t> - GetAddress(TMethod (*method)) { - return (std::uintptr_t &)method; - } - -} // namespace MsvcMethod - -#ifdef _MSC_VER - #define GLOBALVAR_LINK(offset, symbol, var, ...) { offset, #symbol, (size_t)&##var, __VA_ARGS__ } - #define HOOK_SYMBOLDEF(offset, symbol, func, ...) { offset, #symbol, MsvcMethod::GetAddress<__VA_ARGS__>(&func) } - #define HOOK_SYMBOL_VIRTUAL_DEF(offset, symbol, func, ...) { offset, #symbol, MsvcMethod::GetVirtualAddress<__VA_ARGS__>(&func) } - #define HOOK_SYMBOL_VIRTUAL_EX(offset, class, func, ...) { offset, #class#func, MsvcMethod::GetVirtualAddress(&class::func))>::type, class>(&class::func) } - - #define HOOK_DEF(offset, func, ...) HOOK_SYMBOLDEF(offset, func, func, __VA_ARGS__) - #define HOOK_VIRTUAL_DEF(offset, func, ...) HOOK_SYMBOL_VIRTUAL_DEF(offset, func, func, __VA_ARGS__) - -#else - #error Hooking stuff is only available using MSVC compiler. -#endif // _MSC_VER - -#endif // #if defined(HOOK_HLTV) || defined(HOOK_FILESYSTEM) diff --git a/rehlds/hookers/hooker.cpp b/rehlds/hookers/hooker.cpp deleted file mode 100644 index 1fce842..0000000 --- a/rehlds/hookers/hooker.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* -* -* This program 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 2 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, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#include "precompiled.h" - -Module g_Module = { NULL, NULL, NULL, NULL }; - -// Offset where module assumed be loaded to ajust hooks offsets. NULL for the Linux to trigger symbols searching. -#ifdef _WIN32 -const size_t g_BaseOffset = 0x01D00000; -#else -const size_t g_BaseOffset = NULL; -#endif - -void *GetOriginalFuncAddrOrDie(const char *funcName) -{ - for (FunctionHook *cfh = &g_FunctionHooks[0]; cfh->symbolName; cfh++) - { - if (!strcmp(cfh->symbolName, funcName)) - return (void*) cfh->originalAddress; - } - - rehlds_syserror("%s: Could not find function '%s'", __func__, funcName); -} - -void *GetOriginalFuncAddrOrDefault(const char *funcName, void *def) -{ - for (FunctionHook *cfh = &g_FunctionHooks[0]; cfh->symbolName; cfh++) - { - if (!strcmp(cfh->symbolName, funcName)) - return (void*)cfh->originalAddress; - } - - return def; -} - -void *GetFuncRefAddrOrDie(const char *funcName) -{ - for (AddressRef *cfh = &g_FunctionRefs[0]; cfh->symbolName; cfh++) - { - if (!strcmp(cfh->symbolName, funcName)) - return (void*)cfh->originalAddress; - } - - rehlds_syserror("%s: Could not find function '%s'", __func__, funcName); -} - -void *GetFuncRefAddrOrDefault(const char *funcName, void *def) -{ - for (AddressRef *cfh = &g_FunctionRefs[0]; cfh->symbolName; cfh++) - { - if (!strcmp(cfh->symbolName, funcName)) - return (void*)cfh->originalAddress; - } - - return def; -} - -int HookModule(const char *pszAppName, size_t addr) -{ - if (addr == NULL || !FindModuleByAddress(addr, &g_Module)) { - return (FALSE); - } - - // Find all addresses - bool success = true; - - AddressRef *refData = g_DataRefs; - while (refData->symbolName != NULL) - { - if (!GetAddress(&g_Module, (Address*)refData, g_BaseOffset)) - { -#if _DEBUG - printf("%s: symbol not found \"%s\", symbol index: %i\n", __func__, refData->symbolName, refData->symbolIndex); - success = false; -#endif - } - refData++; - } - - AddressRef *refFunc = g_FunctionRefs; - while (refFunc->symbolName != NULL) - { - if (!GetAddress(&g_Module, (Address*)refFunc, g_BaseOffset)) - { -#if _DEBUG - printf("%s: symbol not found \"%s\", symbol index: %i\n", __func__, refData->symbolName, refData->symbolIndex); - success = false; -#endif - } - refFunc++; - } - - FunctionHook *hookFunc = g_FunctionHooks; - while (hookFunc->handlerFunc != NULL) - { - if (!GetAddress(&g_Module, (Address*)hookFunc, g_BaseOffset)) - { -#if _DEBUG - printf("%s: symbol not found \"%s\", symbol index: %i\n", __func__, refData->symbolName, refData->symbolIndex); - success = false; -#endif - } - hookFunc++; - } - - if (!success) - { -#if _DEBUG - printf("%s: failed to hook module!\n", __func__); -#endif - return (FALSE); - } - - refData = g_DataRefs; - while (refData->addressRef != NULL) - { - if (!FindDataRef(&g_Module, refData)) - return (FALSE); - refData++; - } - - refFunc = g_FunctionRefs; - while (refFunc->addressRef != NULL) - { - if (!FindDataRef(&g_Module, refFunc)) - return (FALSE); - refFunc++; - } - - hookFunc = g_FunctionHooks; - while (hookFunc->handlerFunc != NULL) - { - if (!HookFunction(&g_Module, hookFunc)) - return (FALSE); - hookFunc++; - } - - return (TRUE); -} - -#ifdef _WIN32 - -void *malloc_wrapper(size_t size) { - return malloc(size); -} - -void *realloc_wrapper(void *orig, size_t newSize) { - return realloc(orig, newSize); -} - -void free_wrapper(void *mem) { - free(mem); -} - -void *calloc_wrapper(size_t count, size_t size) { - return calloc(count, size); -} - -void *__nh_malloc_wrapper(size_t sz, int unk) { - return malloc(sz); -} - -char *strdup_wrapper(const char *s) { - return _strdup(s); -} - -#endif // _WIN32 - -void logf(const char *fmt, ...) -{ - va_list argptr; - static char string[8192]; - - va_start(argptr, fmt); - _vsnprintf(string, sizeof(string), fmt, argptr); - string[sizeof(string) - 1] = 0; - - FILE *fl = fopen("hooker.log", "a"); - fprintf(fl, "%s\n", string); - fclose(fl); -} diff --git a/rehlds/hookers/hooker.h b/rehlds/hookers/hooker.h deleted file mode 100644 index 8f5eeac..0000000 --- a/rehlds/hookers/hooker.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "osconfig.h" - -extern int HookModule(const char *pszAppName, size_t addr); -extern void *GetOriginalFuncAddrOrDie(const char *funcName); -extern void *GetOriginalFuncAddrOrDefault(const char *funcName, void *def); -extern void *GetFuncRefAddrOrDie(const char *funcName); -extern void *GetFuncRefAddrOrDefault(const char *funcName, void *def); -extern void logf(const char *fmt, ...); - -extern FunctionHook g_FunctionHooks[]; -extern AddressRef g_FunctionRefs[]; -extern AddressRef g_DataRefs[]; - -#ifdef _WIN32 - -void *malloc_wrapper(size_t size); -void *realloc_wrapper(void *orig, size_t newSize); -void free_wrapper(void *mem); -void *calloc_wrapper(size_t count, size_t size); -void *__nh_malloc_wrapper(size_t sz, int unk); -char *strdup_wrapper(const char *s); - -#endif // _WIN32 diff --git a/rehlds/msvc/ReHLDS.vcxproj b/rehlds/msvc/ReHLDS.vcxproj index 2ae61ae..d76110b 100644 --- a/rehlds/msvc/ReHLDS.vcxproj +++ b/rehlds/msvc/ReHLDS.vcxproj @@ -88,7 +88,6 @@ - true true @@ -143,6 +142,7 @@ + @@ -366,7 +366,6 @@ - @@ -448,26 +447,13 @@ + - - - true - true - true - true - - - true - true - true - true - - {792df067-9904-4579-99b9-46c17277ade3} @@ -589,7 +575,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true @@ -626,7 +612,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true @@ -665,7 +651,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true @@ -701,7 +687,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true @@ -736,7 +722,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 MaxSpeed true @@ -780,7 +766,7 @@ Setup version from Git revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 MaxSpeed true diff --git a/rehlds/msvc/ReHLDS.vcxproj.filters b/rehlds/msvc/ReHLDS.vcxproj.filters index 81ac2fe..a59f265 100644 --- a/rehlds/msvc/ReHLDS.vcxproj.filters +++ b/rehlds/msvc/ReHLDS.vcxproj.filters @@ -338,8 +338,8 @@ rehlds - - rehlds + + testsuite @@ -1057,16 +1057,8 @@ engine - - rehlds + + testsuite - - - linux - - - linux - - \ No newline at end of file diff --git a/rehlds/public/rehlds/custom.h b/rehlds/public/rehlds/custom.h index 2116ed4..1f0089a 100644 --- a/rehlds/public/rehlds/custom.h +++ b/rehlds/public/rehlds/custom.h @@ -63,13 +63,7 @@ typedef struct resourceinfo_s typedef struct resource_s { -#ifdef HOOK_HLTV - // NOTE HLTV: array szFileName declared on 260 cell, - // this changes necessary for compatibility hookers. - char szFileName[MAX_PATH]; -#else char szFileName[MAX_QPATH]; // File name to download/precache. -#endif // HOOK_HLTV resourcetype_t type; // t_sound, t_skin, t_model, t_decal. int nIndex; // For t_decals diff --git a/rehlds/rehlds/precompiled.h b/rehlds/rehlds/precompiled.h index 5127133..de99a03 100644 --- a/rehlds/rehlds/precompiled.h +++ b/rehlds/rehlds/precompiled.h @@ -14,8 +14,6 @@ #include "static_map.h" #include "ed_strpool.h" - -#include "memory.h" #include "strtools.h" // Valve libs stuff diff --git a/rehlds/hookers/memory.cpp b/rehlds/testsuite/memory.cpp similarity index 100% rename from rehlds/hookers/memory.cpp rename to rehlds/testsuite/memory.cpp diff --git a/rehlds/hookers/memory.h b/rehlds/testsuite/memory.h similarity index 100% rename from rehlds/hookers/memory.h rename to rehlds/testsuite/memory.h diff --git a/rehlds/testsuite/testsuite.h b/rehlds/testsuite/testsuite.h index f3a912b..fc20067 100644 --- a/rehlds/testsuite/testsuite.h +++ b/rehlds/testsuite/testsuite.h @@ -15,4 +15,4 @@ const int TESTSUITE_PROTOCOL_VERSION_MAJOR = 0; void TestSuite_Init(const Module* engine, const Module* executable, const AddressRef* funcRefs); -#endif \ No newline at end of file +#endif