├── Detours ├── detours.cpp ├── detours.h ├── detver.h ├── disasm.cpp ├── image.cpp └── modules.cpp ├── ExceptHandle.h ├── HLSDK ├── cl_dll │ ├── parsemsg.cpp │ ├── parsemsg.h │ ├── util_vector.h │ └── wrect.h ├── common │ ├── Sequence.h │ ├── beamdef.h │ ├── cl_entity.h │ ├── com_model.h │ ├── con_nprint.h │ ├── const.h │ ├── crc.h │ ├── cvardef.h │ ├── demo_api.h │ ├── director_cmds.h │ ├── dlight.h │ ├── dll_state.h │ ├── entity_state.h │ ├── entity_types.h │ ├── enums.h │ ├── event_api.h │ ├── event_args.h │ ├── event_flags.h │ ├── hltv.h │ ├── in_buttons.h │ ├── interface.cpp │ ├── interface.h │ ├── ivoicetweak.h │ ├── mathlib.h │ ├── net_api.h │ ├── netadr.h │ ├── nowin.h │ ├── parsemsg.cpp │ ├── parsemsg.h │ ├── particledef.h │ ├── pmtrace.h │ ├── port.h │ ├── qfont.h │ ├── r_efx.h │ ├── r_studioint.h │ ├── ref_params.h │ ├── screenfade.h │ ├── studio_event.h │ ├── triangleapi.h │ ├── usercmd.h │ ├── weaponinfo.h │ ├── winsani_in.h │ └── winsani_out.h ├── dlls │ └── vector.h ├── engine │ ├── APIProxy.h │ ├── Sequence.h │ ├── anorms.h │ ├── archtypes.h │ ├── cdll_int.h │ ├── custom.h │ ├── customentity.h │ ├── edict.h │ ├── eiface.h │ ├── keydefs.h │ ├── progdefs.h │ ├── progs.h │ ├── shake.h │ └── studio.h ├── pm_shared │ ├── pm_debug.h │ ├── pm_defs.h │ ├── pm_info.h │ ├── pm_materials.h │ ├── pm_math.c │ ├── pm_movevars.h │ └── pm_shared.h └── public │ └── steam │ └── steamtypes.h ├── Interface ├── ICommandLine.h ├── IEngine.h ├── IFileSystem.h ├── IPlugins.h ├── IPluginsV1.h └── IRegistry.h ├── Launcher.ico ├── Launcher.rc ├── LoadBlob.cpp ├── LoadBlob.h ├── MetaHook.sln ├── MetaHook.vcproj ├── MetaHook.vcxproj ├── MetaHook_DLL.sln ├── MetaHook_DLL.vcproj ├── MetaHook_DLL.vcxproj ├── OEPHook.cpp ├── Plugins ├── CopyData │ ├── Controls │ │ ├── Controls.cpp │ │ └── Controls.vcproj │ ├── CopyData.sln │ ├── CopyData.vcproj │ ├── engfuncs.cpp │ ├── engfuncs.h │ ├── exportfuncs.cpp │ ├── exportfuncs.h │ └── plugins.cpp ├── FuckWorld │ ├── FuckWorld.sln │ ├── FuckWorld.vcproj │ ├── engfuncs.cpp │ ├── engfuncs.h │ ├── exportfuncs.cpp │ ├── exportfuncs.h │ └── plugins.cpp ├── IMEInput │ ├── BaseUI.cpp │ ├── BaseUI.h │ ├── Encode.cpp │ ├── Encode.h │ ├── IMEInput.cpp │ ├── IMEInput.h │ ├── IMEInput.sln │ ├── IMEInput.vcproj │ ├── Input.cpp │ ├── Input.h │ ├── UnicodeVoice.cpp │ ├── UnicodeVoice.h │ ├── cmd.h │ ├── engfuncs.cpp │ ├── engfuncs.h │ ├── exportfuncs.cpp │ ├── exportfuncs.h │ ├── plugins.cpp │ └── plugins.h ├── SniperScope │ ├── SniperScope.sln │ ├── SniperScope.vcproj │ ├── engfuncs.cpp │ ├── engfuncs.h │ ├── exportfuncs.cpp │ ├── exportfuncs.h │ ├── mempatchs.cpp │ ├── mempatchs.h │ ├── plugins.cpp │ └── plugins.h ├── VGunLag │ ├── VGunLag.sln │ ├── VGunLag.vcproj │ ├── engfuncs.cpp │ ├── engfuncs.h │ ├── exportfuncs.cpp │ ├── exportfuncs.h │ ├── mathlib.cpp │ ├── mathlib.h │ ├── plugins.cpp │ ├── plugins.h │ └── view.cpp └── WideScreen │ ├── WideScreen.sln │ ├── WideScreen.vcproj │ ├── engfuncs.cpp │ ├── engfuncs.h │ ├── exportfuncs.cpp │ ├── exportfuncs.h │ ├── mempatchs.cpp │ ├── mempatchs.h │ ├── plugins.cpp │ └── plugins.h ├── cdll_export.h ├── commandline.cpp ├── launcher.cpp ├── metahook.cpp ├── metahook.h ├── msvcrt.lib ├── registry.cpp ├── sys.h └── sys_launcher.cpp /Detours/detver.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Common version parameters. 4 | // 5 | // Microsoft Research Detours Package, Version 3.0 Build_316. 6 | // 7 | // Copyright (c) Microsoft Corporation. All rights reserved. 8 | // 9 | 10 | #ifndef DETOURS_STRINGIFY 11 | #define DETOURS_STRINGIFY(x) DETOURS_STRINGIFY_(x) 12 | #define DETOURS_STRINGIFY_(x) #x 13 | #endif 14 | 15 | #define VER_FILEFLAGSMASK 0x3fL 16 | #define VER_FILEFLAGS 0x0L 17 | #define VER_FILEOS 0x00040004L 18 | #define VER_FILETYPE 0x00000002L 19 | #define VER_FILESUBTYPE 0x00000000L 20 | 21 | #define VER_DETOURS_BITS DETOUR_STRINGIFY(DETOURS_BITS) 22 | -------------------------------------------------------------------------------- /ExceptHandle.h: -------------------------------------------------------------------------------- 1 | struct EXCEPTION_REGISTRATION 2 | { 3 | EXCEPTION_REGISTRATION *prev; 4 | FARPROC handler; 5 | }; 6 | 7 | extern "C" int _except_handler3(PEXCEPTION_RECORD, EXCEPTION_REGISTRATION *, PCONTEXT, PEXCEPTION_RECORD); 8 | extern "C" int _except_handler4(PEXCEPTION_RECORD, EXCEPTION_REGISTRATION *, CONTEXT *, void *); 9 | 10 | #define SetupExceptHandler3() \ 11 | DWORD handler = (DWORD)_except_handler3; \ 12 | \ 13 | __asm push handler \ 14 | __asm push FS:[0] \ 15 | __asm mov FS:[0], ESP 16 | 17 | #define SetupExceptHandler4() \ 18 | DWORD handler = (DWORD)_except_handler4; \ 19 | \ 20 | __asm push handler \ 21 | __asm push FS:[0] \ 22 | __asm mov FS:[0], ESP -------------------------------------------------------------------------------- /HLSDK/cl_dll/parsemsg.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // 16 | // parsemsg.cpp 17 | // 18 | typedef unsigned char byte; 19 | #define true 1 20 | 21 | static byte *gpBuf; 22 | static int giSize; 23 | static int giRead; 24 | static int giBadRead; 25 | 26 | void BEGIN_READ( void *buf, int size ) 27 | { 28 | giRead = 0; 29 | giBadRead = 0; 30 | giSize = size; 31 | gpBuf = (byte*)buf; 32 | } 33 | 34 | 35 | int READ_CHAR( void ) 36 | { 37 | int c; 38 | 39 | if (giRead + 1 > giSize) 40 | { 41 | giBadRead = true; 42 | return -1; 43 | } 44 | 45 | c = (signed char)gpBuf[giRead]; 46 | giRead++; 47 | 48 | return c; 49 | } 50 | 51 | int READ_BYTE( void ) 52 | { 53 | int c; 54 | 55 | if (giRead+1 > giSize) 56 | { 57 | giBadRead = true; 58 | return -1; 59 | } 60 | 61 | c = (unsigned char)gpBuf[giRead]; 62 | giRead++; 63 | 64 | return c; 65 | } 66 | 67 | int READ_SHORT( void ) 68 | { 69 | int c; 70 | 71 | if (giRead+2 > giSize) 72 | { 73 | giBadRead = true; 74 | return -1; 75 | } 76 | 77 | c = (short)( gpBuf[giRead] + ( gpBuf[giRead+1] << 8 ) ); 78 | 79 | giRead += 2; 80 | 81 | return c; 82 | } 83 | 84 | int READ_WORD( void ) 85 | { 86 | return READ_SHORT(); 87 | } 88 | 89 | 90 | int READ_LONG( void ) 91 | { 92 | int c; 93 | 94 | if (giRead+4 > giSize) 95 | { 96 | giBadRead = true; 97 | return -1; 98 | } 99 | 100 | c = gpBuf[giRead] + (gpBuf[giRead + 1] << 8) + (gpBuf[giRead + 2] << 16) + (gpBuf[giRead + 3] << 24); 101 | 102 | giRead += 4; 103 | 104 | return c; 105 | } 106 | 107 | float READ_FLOAT( void ) 108 | { 109 | union 110 | { 111 | byte b[4]; 112 | float f; 113 | int l; 114 | } dat; 115 | 116 | dat.b[0] = gpBuf[giRead]; 117 | dat.b[1] = gpBuf[giRead+1]; 118 | dat.b[2] = gpBuf[giRead+2]; 119 | dat.b[3] = gpBuf[giRead+3]; 120 | giRead += 4; 121 | 122 | // dat.l = LittleLong (dat.l); 123 | 124 | return dat.f; 125 | } 126 | 127 | char* READ_STRING( void ) 128 | { 129 | static char string[2048]; 130 | int l,c; 131 | 132 | string[0] = 0; 133 | 134 | l = 0; 135 | do 136 | { 137 | if ( giRead+1 > giSize ) 138 | break; // no more characters 139 | 140 | c = READ_CHAR(); 141 | if (c == -1 || c == 0) 142 | break; 143 | string[l] = c; 144 | l++; 145 | } while (l < sizeof(string)-1); 146 | 147 | string[l] = 0; 148 | 149 | return string; 150 | } 151 | 152 | float READ_COORD( void ) 153 | { 154 | return (float)(READ_SHORT() * (1.0/8)); 155 | } 156 | 157 | float READ_ANGLE( void ) 158 | { 159 | return (float)(READ_CHAR() * (360.0/256)); 160 | } 161 | 162 | float READ_HIRESANGLE( void ) 163 | { 164 | return (float)(READ_SHORT() * (360.0/65536)); 165 | } 166 | 167 | -------------------------------------------------------------------------------- /HLSDK/cl_dll/parsemsg.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // 16 | // parsemsg.h 17 | // 18 | 19 | #define ASSERT( x ) 20 | 21 | void BEGIN_READ( void *buf, int size ); 22 | int READ_CHAR( void ); 23 | int READ_BYTE( void ); 24 | int READ_SHORT( void ); 25 | int READ_WORD( void ); 26 | int READ_LONG( void ); 27 | float READ_FLOAT( void ); 28 | char* READ_STRING( void ); 29 | float READ_COORD( void ); 30 | float READ_ANGLE( void ); 31 | float READ_HIRESANGLE( void ); 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /HLSDK/cl_dll/util_vector.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // Vector.h 16 | // A subset of the extdll.h in the project HL Entity DLL 17 | // 18 | 19 | // Misc C-runtime library headers 20 | #include "stdio.h" 21 | #include "stdlib.h" 22 | #include "math.h" 23 | 24 | // Header file containing definition of globalvars_t and entvars_t 25 | typedef unsigned int func_t; // 26 | typedef unsigned int string_t; // from engine's pr_comp.h; 27 | typedef float vec_t; // needed before including progdefs.h 28 | 29 | //========================================================= 30 | // 2DVector - used for many pathfinding and many other 31 | // operations that are treated as planar rather than 3d. 32 | //========================================================= 33 | class Vector2D 34 | { 35 | public: 36 | inline Vector2D(void) { } 37 | inline Vector2D(float X, float Y) { x = X; y = Y; } 38 | inline Vector2D operator+(const Vector2D& v) const { return Vector2D(x+v.x, y+v.y); } 39 | inline Vector2D operator-(const Vector2D& v) const { return Vector2D(x-v.x, y-v.y); } 40 | inline Vector2D operator*(float fl) const { return Vector2D(x*fl, y*fl); } 41 | inline Vector2D operator/(float fl) const { return Vector2D(x/fl, y/fl); } 42 | 43 | inline float Length(void) const { return (float)sqrt(x*x + y*y ); } 44 | 45 | inline Vector2D Normalize ( void ) const 46 | { 47 | Vector2D vec2; 48 | 49 | float flLen = Length(); 50 | if ( flLen == 0 ) 51 | { 52 | return Vector2D( (float)0, (float)0 ); 53 | } 54 | else 55 | { 56 | flLen = 1 / flLen; 57 | return Vector2D( x * flLen, y * flLen ); 58 | } 59 | } 60 | 61 | vec_t x, y; 62 | }; 63 | 64 | #undef DotProduct 65 | inline float DotProduct(const Vector2D& a, const Vector2D& b) { return( a.x*b.x + a.y*b.y ); } 66 | inline Vector2D operator*(float fl, const Vector2D& v) { return v * fl; } 67 | 68 | //========================================================= 69 | // 3D Vector 70 | //========================================================= 71 | class Vector // same data-layout as engine's vec3_t, 72 | { // which is a vec_t[3] 73 | public: 74 | // Construction/destruction 75 | inline Vector(void) { } 76 | inline Vector(float X, float Y, float Z) { x = X; y = Y; z = Z; } 77 | inline Vector(double X, double Y, double Z) { x = (float)X; y = (float)Y; z = (float)Z; } 78 | inline Vector(int X, int Y, int Z) { x = (float)X; y = (float)Y; z = (float)Z; } 79 | inline Vector(const Vector& v) { x = v.x; y = v.y; z = v.z; } 80 | inline Vector(float rgfl[3]) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; } 81 | 82 | // Operators 83 | inline Vector operator-(void) const { return Vector(-x,-y,-z); } 84 | inline int operator==(const Vector& v) const { return x==v.x && y==v.y && z==v.z; } 85 | inline int operator!=(const Vector& v) const { return !(*this==v); } 86 | inline Vector operator+(const Vector& v) const { return Vector(x+v.x, y+v.y, z+v.z); } 87 | inline Vector operator-(const Vector& v) const { return Vector(x-v.x, y-v.y, z-v.z); } 88 | inline Vector operator*(float fl) const { return Vector(x*fl, y*fl, z*fl); } 89 | inline Vector operator/(float fl) const { return Vector(x/fl, y/fl, z/fl); } 90 | 91 | // Methods 92 | inline void CopyToArray(float* rgfl) const { rgfl[0] = x, rgfl[1] = y, rgfl[2] = z; } 93 | inline float Length(void) const { return (float)sqrt(x*x + y*y + z*z); } 94 | operator float *() { return &x; } // Vectors will now automatically convert to float * when needed 95 | operator const float *() const { return &x; } // Vectors will now automatically convert to float * when needed 96 | inline Vector Normalize(void) const 97 | { 98 | float flLen = Length(); 99 | if (flLen == 0) return Vector(0,0,1); // ???? 100 | flLen = 1 / flLen; 101 | return Vector(x * flLen, y * flLen, z * flLen); 102 | } 103 | 104 | inline Vector2D Make2D ( void ) const 105 | { 106 | Vector2D Vec2; 107 | 108 | Vec2.x = x; 109 | Vec2.y = y; 110 | 111 | return Vec2; 112 | } 113 | inline float Length2D(void) const { return (float)sqrt(x*x + y*y); } 114 | 115 | // Members 116 | vec_t x, y, z; 117 | }; 118 | inline Vector operator*(float fl, const Vector& v) { return v * fl; } 119 | inline float DotProduct(const Vector& a, const Vector& b) { return(a.x*b.x+a.y*b.y+a.z*b.z); } 120 | inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x ); } 121 | 122 | #ifndef DID_VEC3_T_DEFINE 123 | #define DID_VEC3_T_DEFINE 124 | #define vec3_t Vector 125 | #endif 126 | -------------------------------------------------------------------------------- /HLSDK/cl_dll/wrect.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/cl_dll/wrect.h -------------------------------------------------------------------------------- /HLSDK/common/beamdef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( BEAMDEFH ) 16 | #define BEAMDEFH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | #define FBEAM_STARTENTITY 0x00000001 22 | #define FBEAM_ENDENTITY 0x00000002 23 | #define FBEAM_FADEIN 0x00000004 24 | #define FBEAM_FADEOUT 0x00000008 25 | #define FBEAM_SINENOISE 0x00000010 26 | #define FBEAM_SOLID 0x00000020 27 | #define FBEAM_SHADEIN 0x00000040 28 | #define FBEAM_SHADEOUT 0x00000080 29 | #define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet? 30 | #define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet? 31 | #define FBEAM_ISACTIVE 0x40000000 32 | #define FBEAM_FOREVER 0x80000000 33 | 34 | typedef struct beam_s BEAM; 35 | struct beam_s 36 | { 37 | BEAM *next; 38 | int type; 39 | int flags; 40 | vec3_t source; 41 | vec3_t target; 42 | vec3_t delta; 43 | float t; // 0 .. 1 over lifetime of beam 44 | float freq; 45 | float die; 46 | float width; 47 | float amplitude; 48 | float r, g, b; 49 | float brightness; 50 | float speed; 51 | float frameRate; 52 | float frame; 53 | int segments; 54 | int startEntity; 55 | int endEntity; 56 | int modelIndex; 57 | int frameCount; 58 | struct model_s *pFollowModel; 59 | struct particle_s *particles; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /HLSDK/common/cl_entity.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // cl_entity.h 16 | #if !defined( CL_ENTITYH ) 17 | #define CL_ENTITYH 18 | #ifdef _WIN32 19 | #pragma once 20 | #endif 21 | 22 | typedef struct efrag_s 23 | { 24 | struct mleaf_s *leaf; 25 | struct efrag_s *leafnext; 26 | struct cl_entity_s *entity; 27 | struct efrag_s *entnext; 28 | } efrag_t; 29 | 30 | typedef struct 31 | { 32 | byte mouthopen; // 0 = mouth closed, 255 = mouth agape 33 | byte sndcount; // counter for running average 34 | int sndavg; // running average 35 | } mouth_t; 36 | 37 | typedef struct 38 | { 39 | float prevanimtime; 40 | float sequencetime; 41 | byte prevseqblending[2]; 42 | vec3_t prevorigin; 43 | vec3_t prevangles; 44 | 45 | int prevsequence; 46 | float prevframe; 47 | 48 | byte prevcontroller[4]; 49 | byte prevblending[2]; 50 | } latchedvars_t; 51 | 52 | typedef struct 53 | { 54 | // Time stamp for this movement 55 | float animtime; 56 | 57 | vec3_t origin; 58 | vec3_t angles; 59 | } position_history_t; 60 | 61 | typedef struct cl_entity_s cl_entity_t; 62 | 63 | #define HISTORY_MAX 64 // Must be power of 2 64 | #define HISTORY_MASK ( HISTORY_MAX - 1 ) 65 | 66 | 67 | #if !defined( ENTITY_STATEH ) 68 | #include "entity_state.h" 69 | #endif 70 | 71 | #if !defined( PROGS_H ) 72 | #include "progs.h" 73 | #endif 74 | 75 | struct cl_entity_s 76 | { 77 | int index; // Index into cl_entities ( should match actual slot, but not necessarily ) 78 | 79 | qboolean player; // True if this entity is a "player" 80 | 81 | entity_state_t baseline; // The original state from which to delta during an uncompressed message 82 | entity_state_t prevstate; // The state information from the penultimate message received from the server 83 | entity_state_t curstate; // The state information from the last message received from server 84 | 85 | int current_position; // Last received history update index 86 | position_history_t ph[ HISTORY_MAX ]; // History of position and angle updates for this player 87 | 88 | mouth_t mouth; // For synchronizing mouth movements. 89 | 90 | latchedvars_t latched; // Variables used by studio model rendering routines 91 | 92 | // Information based on interplocation, extrapolation, prediction, or just copied from last msg received. 93 | // 94 | float lastmove; 95 | 96 | // Actual render position and angles 97 | vec3_t origin; 98 | vec3_t angles; 99 | 100 | // Attachment points 101 | vec3_t attachment[4]; 102 | 103 | // Other entity local information 104 | int trivial_accept; 105 | 106 | struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model 107 | struct efrag_s *efrag; // linked list of efrags 108 | struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split 109 | 110 | float syncbase; // for client-side animations -- used by obsolete alias animation system, remove? 111 | int visframe; // last frame this entity was found in an active leaf 112 | colorVec cvFloorColor; 113 | }; 114 | 115 | #endif // !CL_ENTITYH 116 | -------------------------------------------------------------------------------- /HLSDK/common/com_model.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/common/com_model.h -------------------------------------------------------------------------------- /HLSDK/common/con_nprint.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( CON_NPRINTH ) 16 | #define CON_NPRINTH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct con_nprint_s 26 | { 27 | int index; // Row # 28 | float time_to_live; // # of seconds before it dissappears 29 | float color[ 3 ]; // RGB colors ( 0.0 -> 1.0 scale ) 30 | } con_nprint_t; 31 | 32 | void Con_NPrintf( int idx, char *fmt, ... ); 33 | void Con_NXPrintf( struct con_nprint_s *info, char *fmt, ... ); 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /HLSDK/common/crc.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | /* crc.h */ 16 | #ifndef CRC_H 17 | #define CRC_H 18 | #ifdef _WIN32 19 | #pragma once 20 | #endif 21 | 22 | #include "archtypes.h" // DAL 23 | 24 | // MD5 Hash 25 | typedef struct 26 | { 27 | unsigned int buf[4]; 28 | unsigned int bits[2]; 29 | unsigned char in[64]; 30 | } MD5Context_t; 31 | 32 | 33 | #ifdef _WIN32 34 | typedef uint32 CRC32_t; 35 | #else 36 | typedef uint32 CRC32_t; 37 | #endif 38 | 39 | #ifdef __cplusplus 40 | extern "C" 41 | { 42 | #endif 43 | void CRC32_Init(CRC32_t *pulCRC); 44 | CRC32_t CRC32_Final(CRC32_t pulCRC); 45 | void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len); 46 | void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch); 47 | int CRC_File(CRC32_t *crcvalue, char *pszFileName); 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | unsigned char COM_BlockSequenceCRCByte (unsigned char *base, int length, int sequence); 52 | 53 | void MD5Init(MD5Context_t *context); 54 | void MD5Update(MD5Context_t *context, unsigned char const *buf, 55 | unsigned int len); 56 | void MD5Final(unsigned char digest[16], MD5Context_t *context); 57 | void Transform(unsigned int buf[4], unsigned int const in[16]); 58 | 59 | int MD5_Hash_File(unsigned char digest[16], char *pszFileName, int bUsefopen, int bSeed, unsigned int seed[4]); 60 | char *MD5_Print(unsigned char hash[16]); 61 | int MD5_Hash_CachedFile(unsigned char digest[16], unsigned char *pCache, int nFileSize, int bSeed, unsigned int seed[4]); 62 | 63 | int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /HLSDK/common/cvardef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef CVARDEF_H 16 | #define CVARDEF_H 17 | 18 | #define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc 19 | #define FCVAR_USERINFO (1<<1) // changes the client's info string 20 | #define FCVAR_SERVER (1<<2) // notifies players when changed 21 | #define FCVAR_EXTDLL (1<<3) // defined by external DLL 22 | #define FCVAR_CLIENTDLL (1<<4) // defined by the client dll 23 | #define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value 24 | #define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server. 25 | #define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). 26 | #define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log 27 | #define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar 28 | 29 | typedef struct cvar_s 30 | { 31 | char *name; 32 | char *string; 33 | int flags; 34 | float value; 35 | struct cvar_s *next; 36 | } cvar_t; 37 | #endif 38 | -------------------------------------------------------------------------------- /HLSDK/common/demo_api.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( DEMO_APIH ) 16 | #define DEMO_APIH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | typedef struct demo_api_s 22 | { 23 | int ( *IsRecording ) ( void ); 24 | int ( *IsPlayingback ) ( void ); 25 | int ( *IsTimeDemo ) ( void ); 26 | void ( *WriteBuffer ) ( int size, unsigned char *buffer ); 27 | } demo_api_t; 28 | 29 | extern demo_api_t demoapi; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /HLSDK/common/director_cmds.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/common/director_cmds.h -------------------------------------------------------------------------------- /HLSDK/common/dlight.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( DLIGHTH ) 16 | #define DLIGHTH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | typedef struct dlight_s 22 | { 23 | vec3_t origin; 24 | float radius; 25 | color24 color; 26 | float die; // stop lighting after this time 27 | float decay; // drop this each second 28 | float minlight; // don't add when contributing less 29 | int key; 30 | qboolean dark; // subtracts light instead of adding 31 | } dlight_t; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /HLSDK/common/dll_state.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/common/dll_state.h -------------------------------------------------------------------------------- /HLSDK/common/entity_state.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( ENTITY_STATEH ) 16 | #define ENTITY_STATEH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | // For entityType below 22 | #define ENTITY_NORMAL (1<<0) 23 | #define ENTITY_BEAM (1<<1) 24 | 25 | // Entity state is used for the baseline and for delta compression of a packet of 26 | // entities that is sent to a client. 27 | typedef struct entity_state_s entity_state_t; 28 | 29 | struct entity_state_s 30 | { 31 | // Fields which are filled in by routines outside of delta compression 32 | int entityType; 33 | // Index into cl_entities array for this entity. 34 | int number; 35 | float msg_time; 36 | 37 | // Message number last time the player/entity state was updated. 38 | int messagenum; 39 | 40 | // Fields which can be transitted and reconstructed over the network stream 41 | vec3_t origin; 42 | vec3_t angles; 43 | 44 | int modelindex; 45 | int sequence; 46 | float frame; 47 | int colormap; 48 | short skin; 49 | short solid; 50 | int effects; 51 | float scale; 52 | 53 | byte eflags; 54 | 55 | // Render information 56 | int rendermode; 57 | int renderamt; 58 | color24 rendercolor; 59 | int renderfx; 60 | 61 | int movetype; 62 | float animtime; 63 | float framerate; 64 | int body; 65 | byte controller[4]; 66 | byte blending[4]; 67 | vec3_t velocity; 68 | 69 | // Send bbox down to client for use during prediction. 70 | vec3_t mins; 71 | vec3_t maxs; 72 | 73 | int aiment; 74 | // If owned by a player, the index of that player ( for projectiles ). 75 | int owner; 76 | 77 | // Friction, for prediction. 78 | float friction; 79 | // Gravity multiplier 80 | float gravity; 81 | 82 | // PLAYER SPECIFIC 83 | int team; 84 | int playerclass; 85 | int health; 86 | qboolean spectator; 87 | int weaponmodel; 88 | int gaitsequence; 89 | // If standing on conveyor, e.g. 90 | vec3_t basevelocity; 91 | // Use the crouched hull, or the regular player hull. 92 | int usehull; 93 | // Latched buttons last time state updated. 94 | int oldbuttons; 95 | // -1 = in air, else pmove entity number 96 | int onground; 97 | int iStepLeft; 98 | // How fast we are falling 99 | float flFallVelocity; 100 | 101 | float fov; 102 | int weaponanim; 103 | 104 | // Parametric movement overrides 105 | vec3_t startpos; 106 | vec3_t endpos; 107 | float impacttime; 108 | float starttime; 109 | 110 | // For mods 111 | int iuser1; 112 | int iuser2; 113 | int iuser3; 114 | int iuser4; 115 | float fuser1; 116 | float fuser2; 117 | float fuser3; 118 | float fuser4; 119 | vec3_t vuser1; 120 | vec3_t vuser2; 121 | vec3_t vuser3; 122 | vec3_t vuser4; 123 | }; 124 | 125 | #include "pm_info.h" 126 | 127 | typedef struct clientdata_s 128 | { 129 | vec3_t origin; 130 | vec3_t velocity; 131 | 132 | int viewmodel; 133 | vec3_t punchangle; 134 | int flags; 135 | int waterlevel; 136 | int watertype; 137 | vec3_t view_ofs; 138 | float health; 139 | 140 | int bInDuck; 141 | 142 | int weapons; // remove? 143 | 144 | int flTimeStepSound; 145 | int flDuckTime; 146 | int flSwimTime; 147 | int waterjumptime; 148 | 149 | float maxspeed; 150 | 151 | float fov; 152 | int weaponanim; 153 | 154 | int m_iId; 155 | int ammo_shells; 156 | int ammo_nails; 157 | int ammo_cells; 158 | int ammo_rockets; 159 | float m_flNextAttack; 160 | 161 | int tfstate; 162 | 163 | int pushmsec; 164 | 165 | int deadflag; 166 | 167 | char physinfo[ MAX_PHYSINFO_STRING ]; 168 | 169 | // For mods 170 | int iuser1; 171 | int iuser2; 172 | int iuser3; 173 | int iuser4; 174 | float fuser1; 175 | float fuser2; 176 | float fuser3; 177 | float fuser4; 178 | vec3_t vuser1; 179 | vec3_t vuser2; 180 | vec3_t vuser3; 181 | vec3_t vuser4; 182 | } clientdata_t; 183 | 184 | #include "weaponinfo.h" 185 | 186 | typedef struct local_state_s 187 | { 188 | entity_state_t playerstate; 189 | clientdata_t client; 190 | weapon_data_t weapondata[ 64 ]; 191 | } local_state_t; 192 | 193 | #endif // !ENTITY_STATEH 194 | -------------------------------------------------------------------------------- /HLSDK/common/entity_types.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // entity_types.h 16 | #if !defined( ENTITY_TYPESH ) 17 | #define ENTITY_TYPESH 18 | 19 | #define ET_NORMAL 0 20 | #define ET_PLAYER 1 21 | #define ET_TEMPENTITY 2 22 | #define ET_BEAM 3 23 | // BMODEL or SPRITE that was split across BSP nodes 24 | #define ET_FRAGMENTED 4 25 | 26 | #endif // !ENTITY_TYPESH 27 | -------------------------------------------------------------------------------- /HLSDK/common/enums.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 2009, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | #ifndef ENUMS_H 17 | #define ENUMS_H 18 | 19 | typedef enum netsrc_s 20 | { 21 | NS_CLIENT, 22 | NS_SERVER, 23 | NS_MULTICAST // xxxMO 24 | } netsrc_t; 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /HLSDK/common/event_api.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( EVENT_APIH ) 16 | #define EVENT_APIH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | #define EVENT_API_VERSION 1 22 | 23 | typedef struct event_api_s 24 | { 25 | int version; 26 | void ( *EV_PlaySound ) ( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ); 27 | void ( *EV_StopSound ) ( int ent, int channel, const char *sample ); 28 | int ( *EV_FindModelIndex )( const char *pmodel ); 29 | int ( *EV_IsLocal ) ( int playernum ); 30 | int ( *EV_LocalPlayerDucking ) ( void ); 31 | void ( *EV_LocalPlayerViewheight ) ( float * ); 32 | void ( *EV_LocalPlayerBounds ) ( int hull, float *mins, float *maxs ); 33 | int ( *EV_IndexFromTrace) ( struct pmtrace_s *pTrace ); 34 | struct physent_s *( *EV_GetPhysent ) ( int idx ); 35 | void ( *EV_SetUpPlayerPrediction ) ( int dopred, int bIncludeLocalClient ); 36 | void ( *EV_PushPMStates ) ( void ); 37 | void ( *EV_PopPMStates ) ( void ); 38 | void ( *EV_SetSolidPlayers ) (int playernum); 39 | void ( *EV_SetTraceHull ) ( int hull ); 40 | void ( *EV_PlayerTrace ) ( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr ); 41 | void ( *EV_WeaponAnimation ) ( int sequence, int body ); 42 | unsigned short ( *EV_PrecacheEvent ) ( int type, const char* psz ); 43 | void ( *EV_PlaybackEvent ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); 44 | const char *( *EV_TraceTexture ) ( int ground, float *vstart, float *vend ); 45 | void ( *EV_StopAllSounds ) ( int entnum, int entchannel ); 46 | void ( *EV_KillEvents ) ( int entnum, const char *eventname ); 47 | } event_api_t; 48 | 49 | extern event_api_t eventapi; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /HLSDK/common/event_args.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( EVENT_ARGSH ) 16 | #define EVENT_ARGSH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | // Event was invoked with stated origin 22 | #define FEVENT_ORIGIN ( 1<<0 ) 23 | 24 | // Event was invoked with stated angles 25 | #define FEVENT_ANGLES ( 1<<1 ) 26 | 27 | typedef struct event_args_s 28 | { 29 | int flags; 30 | 31 | // Transmitted 32 | int entindex; 33 | 34 | float origin[3]; 35 | float angles[3]; 36 | float velocity[3]; 37 | 38 | int ducking; 39 | 40 | float fparam1; 41 | float fparam2; 42 | 43 | int iparam1; 44 | int iparam2; 45 | 46 | int bparam1; 47 | int bparam2; 48 | } event_args_t; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /HLSDK/common/event_flags.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( EVENT_FLAGSH ) 16 | #define EVENT_FLAGSH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | // Skip local host for event send. 22 | #define FEV_NOTHOST (1<<0) 23 | 24 | // Send the event reliably. You must specify the origin and angles and use 25 | // PLAYBACK_EVENT_FULL for this to work correctly on the server for anything 26 | // that depends on the event origin/angles. I.e., the origin/angles are not 27 | // taken from the invoking edict for reliable events. 28 | #define FEV_RELIABLE (1<<1) 29 | 30 | // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC 31 | // sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). 32 | #define FEV_GLOBAL (1<<2) 33 | 34 | // If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate 35 | // 36 | #define FEV_UPDATE (1<<3) 37 | 38 | // Only send to entity specified as the invoker 39 | #define FEV_HOSTONLY (1<<4) 40 | 41 | // Only send if the event was created on the server. 42 | #define FEV_SERVER (1<<5) 43 | 44 | // Only issue event client side ( from shared code ) 45 | #define FEV_CLIENT (1<<6) 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /HLSDK/common/hltv.h: -------------------------------------------------------------------------------- 1 | // hltv.h 2 | // all shared consts between server, clients and proxy 3 | 4 | #ifndef HLTV_H 5 | #define HLTV_H 6 | 7 | #define TYPE_CLIENT 0 // client is a normal HL client (default) 8 | #define TYPE_PROXY 1 // client is another proxy 9 | #define TYPE_COMMENTATOR 3 // client is a commentator 10 | #define TYPE_DEMO 4 // client is a demo file 11 | 12 | // sub commands of svc_hltv: 13 | #define HLTV_ACTIVE 0 // tells client that he's an spectator and will get director commands 14 | #define HLTV_STATUS 1 // send status infos about proxy 15 | #define HLTV_LISTEN 2 // tell client to listen to a multicast stream 16 | 17 | // director command types: 18 | #define DRC_CMD_NONE 0 // NULL director command 19 | #define DRC_CMD_START 1 // start director mode 20 | #define DRC_CMD_EVENT 2 // informs about director command 21 | #define DRC_CMD_MODE 3 // switches camera modes 22 | #define DRC_CMD_CAMERA 4 // set fixed camera 23 | #define DRC_CMD_TIMESCALE 5 // sets time scale 24 | #define DRC_CMD_MESSAGE 6 // send HUD centerprint 25 | #define DRC_CMD_SOUND 7 // plays a particular sound 26 | #define DRC_CMD_STATUS 8 // HLTV broadcast status 27 | #define DRC_CMD_BANNER 9 // set GUI banner 28 | #define DRC_CMD_STUFFTEXT 10 // like the normal svc_stufftext but as director command 29 | #define DRC_CMD_CHASE 11 // chase a certain player 30 | #define DRC_CMD_INEYE 12 // view player through own eyes 31 | #define DRC_CMD_MAP 13 // show overview map 32 | #define DRC_CMD_CAMPATH 14 // define camera waypoint 33 | #define DRC_CMD_WAYPOINTS 15 // start moving camera, inetranl message 34 | 35 | #define DRC_CMD_LAST 15 36 | 37 | 38 | // DRC_CMD_EVENT event flags 39 | #define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important) 40 | #define DRC_FLAG_SIDE (1<<4) // 41 | #define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene 42 | #define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo 43 | #define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc) 44 | #define DRC_FLAG_INTRO (1<<8) // is a introduction scene 45 | #define DRC_FLAG_FINAL (1<<9) // is a final scene 46 | #define DRC_FLAG_NO_RANDOM (1<<10) // don't randomize event data 47 | 48 | 49 | // DRC_CMD_WAYPOINT flags 50 | #define DRC_FLAG_STARTPATH 1 // end with speed 0.0 51 | #define DRC_FLAG_SLOWSTART 2 // start with speed 0.0 52 | #define DRC_FLAG_SLOWEND 4 // end with speed 0.0 53 | 54 | #endif // HLTV_H 55 | -------------------------------------------------------------------------------- /HLSDK/common/in_buttons.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef IN_BUTTONS_H 16 | #define IN_BUTTONS_H 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | #define IN_ATTACK (1 << 0) 22 | #define IN_JUMP (1 << 1) 23 | #define IN_DUCK (1 << 2) 24 | #define IN_FORWARD (1 << 3) 25 | #define IN_BACK (1 << 4) 26 | #define IN_USE (1 << 5) 27 | #define IN_CANCEL (1 << 6) 28 | #define IN_LEFT (1 << 7) 29 | #define IN_RIGHT (1 << 8) 30 | #define IN_MOVELEFT (1 << 9) 31 | #define IN_MOVERIGHT (1 << 10) 32 | #define IN_ATTACK2 (1 << 11) 33 | #define IN_RUN (1 << 12) 34 | #define IN_RELOAD (1 << 13) 35 | #define IN_ALT1 (1 << 14) 36 | #define IN_SCORE (1 << 15) // Used by client.dll for when scoreboard is held down 37 | 38 | #endif // IN_BUTTONS_H 39 | -------------------------------------------------------------------------------- /HLSDK/common/interface.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/common/interface.cpp -------------------------------------------------------------------------------- /HLSDK/common/interface.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/common/interface.h -------------------------------------------------------------------------------- /HLSDK/common/ivoicetweak.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/common/ivoicetweak.h -------------------------------------------------------------------------------- /HLSDK/common/mathlib.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // mathlib.h 16 | 17 | typedef float vec_t; 18 | #ifndef DID_VEC3_T_DEFINE 19 | #define DID_VEC3_T_DEFINE 20 | typedef vec_t vec3_t[3]; 21 | #endif 22 | typedef vec_t vec4_t[4]; // x,y,z,w 23 | typedef vec_t vec5_t[5]; 24 | 25 | typedef short vec_s_t; 26 | typedef vec_s_t vec3s_t[3]; 27 | typedef vec_s_t vec4s_t[4]; // x,y,z,w 28 | typedef vec_s_t vec5s_t[5]; 29 | 30 | typedef int fixed4_t; 31 | typedef int fixed8_t; 32 | typedef int fixed16_t; 33 | #ifndef M_PI 34 | #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h 35 | #endif 36 | 37 | struct mplane_s; 38 | 39 | extern vec3_t vec3_origin; 40 | extern int nanmask; 41 | 42 | #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) 43 | 44 | #ifndef VECTOR_H 45 | #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) 46 | #endif 47 | 48 | #define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} 49 | #define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} 50 | #define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];} 51 | #define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;} 52 | 53 | void VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc); 54 | 55 | vec_t _DotProduct (vec3_t v1, vec3_t v2); 56 | void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); 57 | void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); 58 | void _VectorCopy (vec3_t in, vec3_t out); 59 | 60 | int VectorCompare (const vec3_t v1, const vec3_t v2); 61 | float Length (const vec3_t v); 62 | void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross); 63 | float VectorNormalize (vec3_t v); // returns vector length 64 | void VectorInverse (vec3_t v); 65 | void VectorScale (const vec3_t in, vec_t scale, vec3_t out); 66 | int Q_log2(int val); 67 | 68 | void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); 69 | void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); 70 | 71 | // Here are some "manual" INLINE routines for doing floating point to integer conversions 72 | extern short new_cw, old_cw; 73 | 74 | typedef union DLONG { 75 | int i[2]; 76 | double d; 77 | float f; 78 | } DLONG; 79 | 80 | extern DLONG dlong; 81 | 82 | #ifdef _WIN32 83 | void __inline set_fpu_cw(void) 84 | { 85 | _asm 86 | { wait 87 | fnstcw old_cw 88 | wait 89 | mov ax, word ptr old_cw 90 | or ah, 0xc 91 | mov word ptr new_cw,ax 92 | fldcw new_cw 93 | } 94 | } 95 | 96 | int __inline quick_ftol(float f) 97 | { 98 | _asm { 99 | // Assumes that we are already in chop mode, and only need a 32-bit int 100 | fld DWORD PTR f 101 | fistp DWORD PTR dlong 102 | } 103 | return dlong.i[0]; 104 | } 105 | 106 | void __inline restore_fpu_cw(void) 107 | { 108 | _asm fldcw old_cw 109 | } 110 | #else 111 | #define set_fpu_cw() /* */ 112 | #define quick_ftol(f) ftol(f) 113 | #define restore_fpu_cw() /* */ 114 | #endif 115 | 116 | void FloorDivMod (double numer, double denom, int *quotient, 117 | int *rem); 118 | fixed16_t Invert24To16(fixed16_t val); 119 | int GreatestCommonDivisor (int i1, int i2); 120 | 121 | void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); 122 | void AngleVectorsTranspose (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); 123 | #define AngleIVectors AngleVectorsTranspose 124 | 125 | void AngleMatrix (const vec3_t angles, float (*matrix)[4] ); 126 | void AngleIMatrix (const vec3_t angles, float (*matrix)[4] ); 127 | void VectorTransform (const vec3_t in1, float in2[3][4], vec3_t out); 128 | 129 | void NormalizeAngles( vec3_t angles ); 130 | void InterpolateAngles( vec3_t start, vec3_t end, vec3_t output, float frac ); 131 | float AngleBetweenVectors( const vec3_t v1, const vec3_t v2 ); 132 | 133 | 134 | void VectorMatrix( vec3_t forward, vec3_t right, vec3_t up); 135 | void VectorAngles( const vec3_t forward, vec3_t angles ); 136 | 137 | int InvertMatrix( const float * m, float *out ); 138 | 139 | int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane); 140 | float anglemod(float a); 141 | 142 | 143 | 144 | #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ 145 | (((p)->type < 3)? \ 146 | ( \ 147 | ((p)->dist <= (emins)[(p)->type])? \ 148 | 1 \ 149 | : \ 150 | ( \ 151 | ((p)->dist >= (emaxs)[(p)->type])?\ 152 | 2 \ 153 | : \ 154 | 3 \ 155 | ) \ 156 | ) \ 157 | : \ 158 | BoxOnPlaneSide( (emins), (emaxs), (p))) 159 | -------------------------------------------------------------------------------- /HLSDK/common/net_api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/common/net_api.h -------------------------------------------------------------------------------- /HLSDK/common/netadr.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // netadr.h 16 | #ifndef NETADR_H 17 | #define NETADR_H 18 | #ifdef _WIN32 19 | #pragma once 20 | #endif 21 | 22 | typedef enum 23 | { 24 | NA_UNUSED, 25 | NA_LOOPBACK, 26 | NA_BROADCAST, 27 | NA_IP, 28 | NA_IPX, 29 | NA_BROADCAST_IPX, 30 | } netadrtype_t; 31 | 32 | typedef struct netadr_s 33 | { 34 | netadrtype_t type; 35 | unsigned char ip[4]; 36 | unsigned char ipx[10]; 37 | unsigned short port; 38 | } netadr_t; 39 | 40 | #endif // NETADR_H 41 | -------------------------------------------------------------------------------- /HLSDK/common/nowin.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/common/nowin.h -------------------------------------------------------------------------------- /HLSDK/common/parsemsg.cpp: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // 16 | // parsemsg.cpp 17 | // 18 | //-------------------------------------------------------------------------------------------------------------- 19 | #include "parsemsg.h" 20 | #include 21 | 22 | typedef unsigned char byte; 23 | #define true 1 24 | 25 | static byte *gpBuf; 26 | static int giSize; 27 | static int giRead; 28 | static int giBadRead; 29 | 30 | int READ_OK( void ) 31 | { 32 | return !giBadRead; 33 | } 34 | 35 | void BEGIN_READ( void *buf, int size ) 36 | { 37 | giRead = 0; 38 | giBadRead = 0; 39 | giSize = size; 40 | gpBuf = (byte*)buf; 41 | } 42 | 43 | 44 | int READ_CHAR( void ) 45 | { 46 | int c; 47 | 48 | if (giRead + 1 > giSize) 49 | { 50 | giBadRead = true; 51 | return -1; 52 | } 53 | 54 | c = (signed char)gpBuf[giRead]; 55 | giRead++; 56 | 57 | return c; 58 | } 59 | 60 | int READ_BYTE( void ) 61 | { 62 | int c; 63 | 64 | if (giRead+1 > giSize) 65 | { 66 | giBadRead = true; 67 | return -1; 68 | } 69 | 70 | c = (unsigned char)gpBuf[giRead]; 71 | giRead++; 72 | 73 | return c; 74 | } 75 | 76 | int READ_SHORT( void ) 77 | { 78 | int c; 79 | 80 | if (giRead+2 > giSize) 81 | { 82 | giBadRead = true; 83 | return -1; 84 | } 85 | 86 | c = (short)( gpBuf[giRead] + ( gpBuf[giRead+1] << 8 ) ); 87 | 88 | giRead += 2; 89 | 90 | return c; 91 | } 92 | 93 | int READ_WORD( void ) 94 | { 95 | return READ_SHORT(); 96 | } 97 | 98 | 99 | int READ_LONG( void ) 100 | { 101 | int c; 102 | 103 | if (giRead+4 > giSize) 104 | { 105 | giBadRead = true; 106 | return -1; 107 | } 108 | 109 | c = gpBuf[giRead] + (gpBuf[giRead + 1] << 8) + (gpBuf[giRead + 2] << 16) + (gpBuf[giRead + 3] << 24); 110 | 111 | giRead += 4; 112 | 113 | return c; 114 | } 115 | 116 | float READ_FLOAT( void ) 117 | { 118 | union 119 | { 120 | byte b[4]; 121 | float f; 122 | int l; 123 | } dat; 124 | 125 | dat.b[0] = gpBuf[giRead]; 126 | dat.b[1] = gpBuf[giRead+1]; 127 | dat.b[2] = gpBuf[giRead+2]; 128 | dat.b[3] = gpBuf[giRead+3]; 129 | giRead += 4; 130 | 131 | // dat.l = LittleLong (dat.l); 132 | 133 | return dat.f; 134 | } 135 | 136 | char* READ_STRING( void ) 137 | { 138 | static char string[2048]; 139 | int l,c; 140 | 141 | string[0] = 0; 142 | 143 | l = 0; 144 | do 145 | { 146 | if ( giRead+1 > giSize ) 147 | break; // no more characters 148 | 149 | c = READ_CHAR(); 150 | if (c == -1 || c == 0) 151 | break; 152 | string[l] = c; 153 | l++; 154 | } while (l < sizeof(string)-1); 155 | 156 | string[l] = 0; 157 | 158 | return string; 159 | } 160 | 161 | float READ_COORD( void ) 162 | { 163 | return (float)(READ_SHORT() * (1.0/8)); 164 | } 165 | 166 | float READ_ANGLE( void ) 167 | { 168 | return (float)(READ_CHAR() * (360.0/256)); 169 | } 170 | 171 | float READ_HIRESANGLE( void ) 172 | { 173 | return (float)(READ_SHORT() * (360.0/65536)); 174 | } 175 | 176 | //-------------------------------------------------------------------------------------------------------------- 177 | BufferWriter::BufferWriter() 178 | { 179 | Init( NULL, 0 ); 180 | } 181 | 182 | //-------------------------------------------------------------------------------------------------------------- 183 | BufferWriter::BufferWriter( unsigned char *buffer, int bufferLen ) 184 | { 185 | Init( buffer, bufferLen ); 186 | } 187 | 188 | //-------------------------------------------------------------------------------------------------------------- 189 | void BufferWriter::Init( unsigned char *buffer, int bufferLen ) 190 | { 191 | m_overflow = false; 192 | m_buffer = buffer; 193 | m_remaining = bufferLen; 194 | m_overallLength = bufferLen; 195 | } 196 | 197 | //-------------------------------------------------------------------------------------------------------------- 198 | void BufferWriter::WriteByte( unsigned char data ) 199 | { 200 | if (!m_buffer || !m_remaining) 201 | { 202 | m_overflow = true; 203 | return; 204 | } 205 | 206 | *m_buffer = data; 207 | ++m_buffer; 208 | --m_remaining; 209 | } 210 | 211 | //-------------------------------------------------------------------------------------------------------------- 212 | void BufferWriter::WriteLong( int data ) 213 | { 214 | if (!m_buffer || m_remaining < 4) 215 | { 216 | m_overflow = true; 217 | return; 218 | } 219 | 220 | m_buffer[0] = data&0xff; 221 | m_buffer[1] = (data>>8)&0xff; 222 | m_buffer[2] = (data>>16)&0xff; 223 | m_buffer[3] = data>>24; 224 | m_buffer += 4; 225 | m_remaining -= 4; 226 | } 227 | 228 | //-------------------------------------------------------------------------------------------------------------- 229 | void BufferWriter::WriteString( const char *str ) 230 | { 231 | if (!m_buffer || !m_remaining) 232 | { 233 | m_overflow = true; 234 | return; 235 | } 236 | 237 | if (!str) 238 | str = ""; 239 | 240 | int len = strlen(str)+1; 241 | if ( len > m_remaining ) 242 | { 243 | m_overflow = true; 244 | str = ""; 245 | len = 1; 246 | } 247 | 248 | strcpy((char *)m_buffer, str); 249 | m_remaining -= len; 250 | m_buffer += len; 251 | } 252 | 253 | //-------------------------------------------------------------------------------------------------------------- 254 | int BufferWriter::GetSpaceUsed() 255 | { 256 | return m_overallLength - m_remaining; 257 | } 258 | 259 | //-------------------------------------------------------------------------------------------------------------- 260 | -------------------------------------------------------------------------------- /HLSDK/common/parsemsg.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // 16 | // parsemsg.h 17 | // MDC - copying from cstrike\cl_dll so career-mode stuff can catch messages 18 | // in this dll. (and C++ifying it) 19 | // 20 | 21 | #ifndef PARSEMSG_H 22 | #define PARSEMSG_H 23 | 24 | #define ASSERT( x ) 25 | //-------------------------------------------------------------------------------------------------------------- 26 | void BEGIN_READ( void *buf, int size ); 27 | int READ_CHAR( void ); 28 | int READ_BYTE( void ); 29 | int READ_SHORT( void ); 30 | int READ_WORD( void ); 31 | int READ_LONG( void ); 32 | float READ_FLOAT( void ); 33 | char* READ_STRING( void ); 34 | float READ_COORD( void ); 35 | float READ_ANGLE( void ); 36 | float READ_HIRESANGLE( void ); 37 | int READ_OK( void ); 38 | 39 | //-------------------------------------------------------------------------------------------------------------- 40 | class BufferWriter 41 | { 42 | public: 43 | BufferWriter(); 44 | BufferWriter( unsigned char *buffer, int bufferLen ); 45 | void Init( unsigned char *buffer, int bufferLen ); 46 | 47 | void WriteByte( unsigned char data ); 48 | void WriteLong( int data ); 49 | void WriteString( const char *str ); 50 | 51 | bool HasOverflowed(); 52 | int GetSpaceUsed(); 53 | 54 | protected: 55 | unsigned char *m_buffer; 56 | int m_remaining; 57 | bool m_overflow; 58 | int m_overallLength; 59 | }; 60 | 61 | //-------------------------------------------------------------------------------------------------------------- 62 | 63 | #endif // PARSEMSG_H 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /HLSDK/common/particledef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( PARTICLEDEFH ) 16 | #define PARTICLEDEFH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | typedef enum { 22 | pt_static, 23 | pt_grav, 24 | pt_slowgrav, 25 | pt_fire, 26 | pt_explode, 27 | pt_explode2, 28 | pt_blob, 29 | pt_blob2, 30 | pt_vox_slowgrav, 31 | pt_vox_grav, 32 | pt_clientcustom // Must have callback function specified 33 | } ptype_t; 34 | 35 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! 36 | typedef struct particle_s 37 | { 38 | // driver-usable fields 39 | vec3_t org; 40 | short color; 41 | short packedColor; 42 | // drivers never touch the following fields 43 | struct particle_s *next; 44 | vec3_t vel; 45 | float ramp; 46 | float die; 47 | ptype_t type; 48 | void (*deathfunc)( struct particle_s *particle ); 49 | 50 | // for pt_clientcusttom, we'll call this function each frame 51 | void (*callback)( struct particle_s *particle, float frametime ); 52 | 53 | // For deathfunc, etc. 54 | unsigned char context; 55 | } particle_t; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /HLSDK/common/pmtrace.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( PMTRACEH ) 16 | #define PMTRACEH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | typedef struct 22 | { 23 | vec3_t normal; 24 | float dist; 25 | } pmplane_t; 26 | 27 | typedef struct pmtrace_s pmtrace_t; 28 | 29 | struct pmtrace_s 30 | { 31 | qboolean allsolid; // if true, plane is not valid 32 | qboolean startsolid; // if true, the initial point was in a solid area 33 | qboolean inopen, inwater; // End point is in empty space or in water 34 | float fraction; // time completed, 1.0 = didn't hit anything 35 | vec3_t endpos; // final position 36 | pmplane_t plane; // surface normal at impact 37 | int ent; // entity at impact 38 | vec3_t deltavelocity; // Change in player's velocity caused by impact. 39 | // Only run on server. 40 | int hitgroup; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /HLSDK/common/port.h: -------------------------------------------------------------------------------- 1 | // port.h: portability helper 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined PORT_H 6 | #define PORT_H 7 | 8 | #include "archtypes.h" // DAL 9 | 10 | #ifdef _WIN32 11 | 12 | // Insert your headers here 13 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 14 | #define WIN32_EXTRA_LEAN 15 | 16 | #include "winsani_in.h" 17 | #include 18 | #include "winsani_out.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #define snprintf _snprintf 25 | #define vsnprintf _vsnprintf 26 | 27 | #else // _WIN32 28 | 29 | #include 30 | #include 31 | #include // exit() 32 | #include // strncpy() 33 | #include // tolower() 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | typedef unsigned char BYTE; 40 | typedef short int WORD; 41 | typedef unsigned int DWORD; 42 | typedef int32 LONG; 43 | //typedef uint32 ULONG; 44 | #ifndef ARCHTYPES_H 45 | typedef uint32 ULONG; 46 | #endif 47 | typedef void *HANDLE; 48 | #ifndef HMODULE 49 | typedef void *HMODULE; 50 | #endif 51 | typedef char * LPSTR; 52 | 53 | #define __cdecl 54 | 55 | 56 | //const int MAX_PATH = PATH_MAX; 57 | #define MAX_PATH PATH_MAX 58 | 59 | #ifdef LINUX 60 | typedef struct POINT_s 61 | { 62 | int x; 63 | int y; 64 | } POINT; 65 | typedef void *HINSTANCE; 66 | typedef void *HWND; 67 | typedef void *HDC; 68 | typedef void *HGLRC; 69 | 70 | typedef struct RECT_s 71 | { 72 | int left; 73 | int right; 74 | int top; 75 | int bottom; 76 | } RECT; 77 | #endif 78 | 79 | 80 | #ifdef __cplusplus 81 | 82 | //#undef FALSE 83 | //#undef TRUE 84 | 85 | #ifdef OSX 86 | //#else 87 | //const bool FALSE = false; 88 | //const bool TRUE = true; 89 | #endif 90 | #endif 91 | 92 | #ifndef NULL 93 | #ifdef __cplusplus 94 | #define NULL 0 95 | #else 96 | #define NULL ((void *)0) 97 | #endif 98 | #endif 99 | 100 | #ifdef __cplusplus 101 | inline int ioctlsocket( int d, int cmd, uint32 *argp ) { return ioctl( d, cmd, argp ); } 102 | inline int closesocket( int fd ) { return close( fd ); } 103 | inline char * GetCurrentDirectory( size_t size, char * buf ) { return getcwd( buf, size ); } 104 | inline int WSAGetLastError() { return errno; } 105 | 106 | inline void DebugBreak( void ) { exit( 1 ); } 107 | #endif 108 | 109 | extern char g_szEXEName[ 4096 ]; 110 | 111 | #define _snprintf snprintf 112 | 113 | #if defined(OSX) 114 | #define SO_ARCH_SUFFIX ".dylib" 115 | #else 116 | #if defined ( __x86_64__ ) 117 | #define SO_ARCH_SUFFIX "_amd64.so" 118 | #else 119 | #define SO_ARCH_SUFFIX ".so" 120 | #endif 121 | #endif 122 | #endif 123 | 124 | #endif // PORT_H 125 | -------------------------------------------------------------------------------- /HLSDK/common/qfont.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( QFONTH ) 16 | #define QFONTH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | // Font stuff 22 | 23 | #define NUM_GLYPHS 256 24 | // does not exist: // #include "basetypes.h" 25 | 26 | typedef struct 27 | { 28 | short startoffset; 29 | short charwidth; 30 | } charinfo; 31 | 32 | typedef struct qfont_s 33 | { 34 | int width, height; 35 | int rowcount; 36 | int rowheight; 37 | charinfo fontinfo[ NUM_GLYPHS ]; 38 | unsigned char data[4]; 39 | } qfont_t; 40 | 41 | #endif // qfont.h 42 | -------------------------------------------------------------------------------- /HLSDK/common/r_studioint.h: -------------------------------------------------------------------------------- 1 | #if !defined( R_STUDIOINT_H ) 2 | #define R_STUDIOINT_H 3 | #if defined( _WIN32 ) 4 | #pragma once 5 | #endif 6 | 7 | #define STUDIO_INTERFACE_VERSION 1 8 | 9 | typedef struct engine_studio_api_s 10 | { 11 | // Allocate number*size bytes and zero it 12 | void *( *Mem_Calloc ) ( int number, size_t size ); 13 | // Check to see if pointer is in the cache 14 | void *( *Cache_Check ) ( struct cache_user_s *c ); 15 | // Load file into cache ( can be swapped out on demand ) 16 | void ( *LoadCacheFile ) ( char *path, struct cache_user_s *cu ); 17 | // Retrieve model pointer for the named model 18 | struct model_s *( *Mod_ForName ) ( const char *name, int crash_if_missing ); 19 | // Retrieve pointer to studio model data block from a model 20 | void *( *Mod_Extradata ) ( struct model_s *mod ); 21 | // Retrieve indexed model from client side model precache list 22 | struct model_s *( *GetModelByIndex ) ( int index ); 23 | // Get entity that is set for rendering 24 | struct cl_entity_s * ( *GetCurrentEntity ) ( void ); 25 | // Get referenced player_info_t 26 | struct player_info_s *( *PlayerInfo ) ( int index ); 27 | // Get most recently received player state data from network system 28 | struct entity_state_s *( *GetPlayerState ) ( int index ); 29 | // Get viewentity 30 | struct cl_entity_s * ( *GetViewEntity ) ( void ); 31 | // Get current frame count, and last two timestampes on client 32 | void ( *GetTimes ) ( int *framecount, double *current, double *old ); 33 | // Get a pointer to a cvar by name 34 | struct cvar_s *( *GetCvar ) ( const char *name ); 35 | // Get current render origin and view vectors ( up, right and vpn ) 36 | void ( *GetViewInfo ) ( float *origin, float *upv, float *rightv, float *vpnv ); 37 | // Get sprite model used for applying chrome effect 38 | struct model_s *( *GetChromeSprite ) ( void ); 39 | // Get model counters so we can incement instrumentation 40 | void ( *GetModelCounters ) ( int **s, int **a ); 41 | // Get software scaling coefficients 42 | void ( *GetAliasScale ) ( float *x, float *y ); 43 | 44 | // Get bone, light, alias, and rotation matrices 45 | float ****( *StudioGetBoneTransform ) ( void ); 46 | float ****( *StudioGetLightTransform )( void ); 47 | float ***( *StudioGetAliasTransform ) ( void ); 48 | float ***( *StudioGetRotationMatrix ) ( void ); 49 | 50 | // Set up body part, and get submodel pointers 51 | void ( *StudioSetupModel ) ( int bodypart, void **ppbodypart, void **ppsubmodel ); 52 | // Check if entity's bbox is in the view frustum 53 | int ( *StudioCheckBBox ) ( void ); 54 | // Apply lighting effects to model 55 | void ( *StudioDynamicLight ) ( struct cl_entity_s *ent, struct alight_s *plight ); 56 | void ( *StudioEntityLight ) ( struct alight_s *plight ); 57 | void ( *StudioSetupLighting ) ( struct alight_s *plighting ); 58 | 59 | // Draw mesh vertices 60 | void ( *StudioDrawPoints ) ( void ); 61 | 62 | // Draw hulls around bones 63 | void ( *StudioDrawHulls ) ( void ); 64 | // Draw bbox around studio models 65 | void ( *StudioDrawAbsBBox ) ( void ); 66 | // Draws bones 67 | void ( *StudioDrawBones ) ( void ); 68 | // Loads in appropriate texture for model 69 | void ( *StudioSetupSkin ) ( void *ptexturehdr, int index ); 70 | // Sets up for remapped colors 71 | void ( *StudioSetRemapColors ) ( int top, int bottom ); 72 | // Set's player model and returns model pointer 73 | struct model_s *( *SetupPlayerModel ) ( int index ); 74 | // Fires any events embedded in animation 75 | void ( *StudioClientEvents ) ( void ); 76 | // Retrieve/set forced render effects flags 77 | int ( *GetForceFaceFlags ) ( void ); 78 | void ( *SetForceFaceFlags ) ( int flags ); 79 | // Tell engine the value of the studio model header 80 | void ( *StudioSetHeader ) ( void *header ); 81 | // Tell engine which model_t * is being renderered 82 | void ( *SetRenderModel ) ( struct model_s *model ); 83 | 84 | // Final state setup and restore for rendering 85 | void ( *SetupRenderer ) ( int rendermode ); 86 | void ( *RestoreRenderer ) ( void ); 87 | 88 | // Set render origin for applying chrome effect 89 | void ( *SetChromeOrigin ) ( void ); 90 | 91 | // True if using D3D/OpenGL 92 | int ( *IsHardware ) ( void ); 93 | 94 | // Only called by hardware interface 95 | void ( *GL_StudioDrawShadow ) ( void ); 96 | void ( *GL_SetRenderMode ) ( int mode ); 97 | 98 | void ( *StudioSetRenderamt ) (int iRenderamt); //!!!CZERO added for rendering glass on viewmodels 99 | void ( *StudioSetCullState ) ( int iCull ); 100 | void ( *StudioRenderShadow ) ( int iSprite, float *p1, float *p2, float *p3, float *p4 ); 101 | } engine_studio_api_t; 102 | 103 | typedef struct server_studio_api_s 104 | { 105 | // Allocate number*size bytes and zero it 106 | void *( *Mem_Calloc ) ( int number, size_t size ); 107 | // Check to see if pointer is in the cache 108 | void *( *Cache_Check ) ( struct cache_user_s *c ); 109 | // Load file into cache ( can be swapped out on demand ) 110 | void ( *LoadCacheFile ) ( char *path, struct cache_user_s *cu ); 111 | // Retrieve pointer to studio model data block from a model 112 | void *( *Mod_Extradata ) ( struct model_s *mod ); 113 | } server_studio_api_t; 114 | 115 | 116 | // client blending 117 | typedef struct r_studio_interface_s 118 | { 119 | int version; 120 | int ( *StudioDrawModel ) ( int flags ); 121 | int ( *StudioDrawPlayer ) ( int flags, struct entity_state_s *pplayer ); 122 | } r_studio_interface_t; 123 | 124 | extern r_studio_interface_t *pStudioAPI; 125 | 126 | // server blending 127 | #define SV_BLENDING_INTERFACE_VERSION 1 128 | 129 | typedef struct sv_blending_interface_s 130 | { 131 | int version; 132 | 133 | void ( *SV_StudioSetupBones ) ( struct model_s *pModel, 134 | float frame, 135 | int sequence, 136 | const vec3_t angles, 137 | const vec3_t origin, 138 | const byte *pcontroller, 139 | const byte *pblending, 140 | int iBone, 141 | const edict_t *pEdict ); 142 | } sv_blending_interface_t; 143 | 144 | #endif // R_STUDIOINT_H 145 | -------------------------------------------------------------------------------- /HLSDK/common/ref_params.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( REF_PARAMSH ) 16 | #define REF_PARAMSH 17 | 18 | typedef struct ref_params_s 19 | { 20 | // Output 21 | float vieworg[3]; 22 | float viewangles[3]; 23 | 24 | float forward[3]; 25 | float right[3]; 26 | float up[3]; 27 | 28 | // Client frametime; 29 | float frametime; 30 | // Client time 31 | float time; 32 | 33 | // Misc 34 | int intermission; 35 | int paused; 36 | int spectator; 37 | int onground; 38 | int waterlevel; 39 | 40 | float simvel[3]; 41 | float simorg[3]; 42 | 43 | float viewheight[3]; 44 | float idealpitch; 45 | 46 | float cl_viewangles[3]; 47 | 48 | int health; 49 | float crosshairangle[3]; 50 | float viewsize; 51 | 52 | float punchangle[3]; 53 | int maxclients; 54 | int viewentity; 55 | int playernum; 56 | int max_entities; 57 | int demoplayback; 58 | int hardware; 59 | 60 | int smoothing; 61 | 62 | // Last issued usercmd 63 | struct usercmd_s *cmd; 64 | 65 | // Movevars 66 | struct movevars_s *movevars; 67 | 68 | int viewport[4]; // the viewport coordinates x ,y , width, height 69 | 70 | int nextView; // the renderer calls ClientDLL_CalcRefdef() and Renderview 71 | // so long in cycles until this value is 0 (multiple views) 72 | int onlyClientDraw; // if !=0 nothing is drawn by the engine except clientDraw functions 73 | } ref_params_t; 74 | 75 | #endif // !REF_PARAMSH 76 | -------------------------------------------------------------------------------- /HLSDK/common/screenfade.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/common/screenfade.h -------------------------------------------------------------------------------- /HLSDK/common/studio_event.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( STUDIO_EVENTH ) 16 | #define STUDIO_EVENTH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | typedef struct mstudioevent_s 22 | { 23 | int frame; 24 | int event; 25 | int type; 26 | char options[64]; 27 | } mstudioevent_t; 28 | 29 | #endif // STUDIO_EVENTH 30 | -------------------------------------------------------------------------------- /HLSDK/common/triangleapi.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( TRIANGLEAPIH ) 16 | #define TRIANGLEAPIH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | typedef enum 22 | { 23 | TRI_FRONT = 0, 24 | TRI_NONE = 1, 25 | } TRICULLSTYLE; 26 | 27 | #define TRI_API_VERSION 1 28 | 29 | #define TRI_TRIANGLES 0 30 | #define TRI_TRIANGLE_FAN 1 31 | #define TRI_QUADS 2 32 | #define TRI_POLYGON 3 33 | #define TRI_LINES 4 34 | #define TRI_TRIANGLE_STRIP 5 35 | #define TRI_QUAD_STRIP 6 36 | 37 | typedef struct triangleapi_s 38 | { 39 | int version; 40 | 41 | void ( *RenderMode )( int mode ); 42 | void ( *Begin )( int primitiveCode ); 43 | void ( *End ) ( void ); 44 | 45 | void ( *Color4f ) ( float r, float g, float b, float a ); 46 | void ( *Color4ub ) ( unsigned char r, unsigned char g, unsigned char b, unsigned char a ); 47 | void ( *TexCoord2f ) ( float u, float v ); 48 | void ( *Vertex3fv ) ( float *worldPnt ); 49 | void ( *Vertex3f ) ( float x, float y, float z ); 50 | void ( *Brightness ) ( float brightness ); 51 | void ( *CullFace ) ( TRICULLSTYLE style ); 52 | int ( *SpriteTexture ) ( struct model_s *pSpriteModel, int frame ); 53 | int ( *WorldToScreen ) ( float *world, float *screen ); // Returns 1 if it's z clipped 54 | void ( *Fog ) ( float flFogColor[3], float flStart, float flEnd, int bOn ); // Works just like GL_FOG, flFogColor is r/g/b. 55 | void ( *ScreenToWorld ) ( float *screen, float *world ); 56 | void ( *GetMatrix ) ( const int pname, float *matrix ); 57 | int ( *BoxInPVS ) ( float *mins, float *maxs ); 58 | void ( *LightAtPoint ) ( float *pos, float *value ); 59 | void ( *Color4fRendermode ) ( float r, float g, float b, float a, int rendermode ); 60 | void ( *FogParams ) ( float flDensity, int iFogSkybox ); // Used with Fog()...sets fog density and whether the fog should be applied to the skybox 61 | 62 | } triangleapi_t; 63 | 64 | #endif // !TRIANGLEAPIH 65 | -------------------------------------------------------------------------------- /HLSDK/common/usercmd.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef USERCMD_H 16 | #define USERCMD_H 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | typedef struct usercmd_s 22 | { 23 | short lerp_msec; // Interpolation time on client 24 | byte msec; // Duration in ms of command 25 | vec3_t viewangles; // Command view angles. 26 | 27 | // intended velocities 28 | float forwardmove; // Forward velocity. 29 | float sidemove; // Sideways velocity. 30 | float upmove; // Upward velocity. 31 | byte lightlevel; // Light level at spot where we are standing. 32 | unsigned short buttons; // Attack buttons 33 | byte impulse; // Impulse command issued. 34 | byte weaponselect; // Current weapon id 35 | 36 | // Experimental player impact stuff. 37 | int impact_index; 38 | vec3_t impact_position; 39 | } usercmd_t; 40 | 41 | #endif // USERCMD_H 42 | -------------------------------------------------------------------------------- /HLSDK/common/weaponinfo.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( WEAPONINFOH ) 16 | #define WEAPONINFOH 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | // Info about weapons player might have in his/her possession 22 | typedef struct weapon_data_s 23 | { 24 | int m_iId; 25 | int m_iClip; 26 | 27 | float m_flNextPrimaryAttack; 28 | float m_flNextSecondaryAttack; 29 | float m_flTimeWeaponIdle; 30 | 31 | int m_fInReload; 32 | int m_fInSpecialReload; 33 | float m_flNextReload; 34 | float m_flPumpTime; 35 | float m_fReloadTime; 36 | 37 | float m_fAimedDamage; 38 | float m_fNextAimBonus; 39 | int m_fInZoom; 40 | int m_iWeaponState; 41 | 42 | int iuser1; 43 | int iuser2; 44 | int iuser3; 45 | int iuser4; 46 | float fuser1; 47 | float fuser2; 48 | float fuser3; 49 | float fuser4; 50 | } weapon_data_t; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /HLSDK/common/winsani_in.h: -------------------------------------------------------------------------------- 1 | #if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008) 2 | #pragma push_macro("ARRAYSIZE") 3 | #ifdef ARRAYSIZE 4 | #undef ARRAYSIZE 5 | #endif 6 | #define HSPRITE WINDOWS_HSPRITE 7 | #endif 8 | -------------------------------------------------------------------------------- /HLSDK/common/winsani_out.h: -------------------------------------------------------------------------------- 1 | #if _MSC_VER >= 1500 // MSVC++ 9.0 (Visual Studio 2008) 2 | #undef HSPRITE 3 | #pragma pop_macro("ARRAYSIZE") 4 | #endif 5 | -------------------------------------------------------------------------------- /HLSDK/dlls/vector.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef VECTOR_H 16 | #define VECTOR_H 17 | 18 | //========================================================= 19 | // 2DVector - used for many pathfinding and many other 20 | // operations that are treated as planar rather than 3d. 21 | //========================================================= 22 | class Vector2D 23 | { 24 | public: 25 | inline Vector2D(void): x(0.0), y(0.0) { } 26 | inline Vector2D(float X, float Y): x(0.0), y(0.0) { x = X; y = Y; } 27 | inline Vector2D operator+(const Vector2D& v) const { return Vector2D(x+v.x, y+v.y); } 28 | inline Vector2D operator-(const Vector2D& v) const { return Vector2D(x-v.x, y-v.y); } 29 | inline Vector2D operator*(float fl) const { return Vector2D(x*fl, y*fl); } 30 | inline Vector2D operator/(float fl) const { return Vector2D(x/fl, y/fl); } 31 | 32 | inline float Length(void) const { return sqrt(x*x + y*y ); } 33 | 34 | inline Vector2D Normalize ( void ) const 35 | { 36 | // Vector2D vec2; 37 | 38 | float flLen = Length(); 39 | if ( flLen == 0 ) 40 | { 41 | return Vector2D( 0, 0 ); 42 | } 43 | else 44 | { 45 | flLen = 1 / flLen; 46 | return Vector2D( x * flLen, y * flLen ); 47 | } 48 | } 49 | 50 | vec_t x, y; 51 | }; 52 | 53 | inline float DotProduct(const Vector2D& a, const Vector2D& b) { return( a.x*b.x + a.y*b.y ); } 54 | inline Vector2D operator*(float fl, const Vector2D& v) { return v * fl; } 55 | 56 | //========================================================= 57 | // 3D Vector 58 | //========================================================= 59 | class Vector // same data-layout as engine's vec3_t, 60 | { // which is a vec_t[3] 61 | public: 62 | // Construction/destruction 63 | inline Vector(void): x(0.0), y(0.0), z(0.0) { } 64 | inline Vector(float X, float Y, float Z): x(0.0), y(0.0), z(0.0) { x = X; y = Y; z = Z; } 65 | //inline Vector(double X, double Y, double Z) { x = (float)X; y = (float)Y; z = (float)Z; } 66 | //inline Vector(int X, int Y, int Z) { x = (float)X; y = (float)Y; z = (float)Z; } 67 | inline Vector(const Vector& v): x(0.0), y(0.0), z(0.0) { x = v.x; y = v.y; z = v.z; } 68 | inline Vector(float rgfl[3]): x(0.0), y(0.0), z(0.0) { x = rgfl[0]; y = rgfl[1]; z = rgfl[2]; } 69 | 70 | // Operators 71 | inline Vector operator-(void) const { return Vector(-x,-y,-z); } 72 | inline int operator==(const Vector& v) const { return x==v.x && y==v.y && z==v.z; } 73 | inline int operator!=(const Vector& v) const { return !(*this==v); } 74 | inline Vector operator+(const Vector& v) const { return Vector(x+v.x, y+v.y, z+v.z); } 75 | inline Vector operator-(const Vector& v) const { return Vector(x-v.x, y-v.y, z-v.z); } 76 | inline Vector operator*(float fl) const { return Vector(x*fl, y*fl, z*fl); } 77 | inline Vector operator/(float fl) const { return Vector(x/fl, y/fl, z/fl); } 78 | 79 | // Methods 80 | inline void CopyToArray(float* rgfl) const { rgfl[0] = x, rgfl[1] = y, rgfl[2] = z; } 81 | inline float Length(void) const { return sqrt(x*x + y*y + z*z); } 82 | operator float *() { return &x; } // Vectors will now automatically convert to float * when needed 83 | operator const float *() const { return &x; } // Vectors will now automatically convert to float * when needed 84 | inline Vector Normalize(void) const 85 | { 86 | float flLen = Length(); 87 | if (flLen == 0) return Vector(0,0,1); // ???? 88 | flLen = 1 / flLen; 89 | return Vector(x * flLen, y * flLen, z * flLen); 90 | } 91 | 92 | inline Vector2D Make2D ( void ) const 93 | { 94 | Vector2D Vec2; 95 | 96 | Vec2.x = x; 97 | Vec2.y = y; 98 | 99 | return Vec2; 100 | } 101 | inline float Length2D(void) const { return sqrt(x*x + y*y); } 102 | 103 | // Members 104 | vec_t x, y, z; 105 | }; 106 | inline Vector operator*(float fl, const Vector& v) { return v * fl; } 107 | inline float DotProduct(const Vector& a, const Vector& b) { return(a.x*b.x+a.y*b.y+a.z*b.z); } 108 | inline Vector CrossProduct(const Vector& a, const Vector& b) { return Vector( a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x ); } 109 | 110 | 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /HLSDK/engine/archtypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Word size dependent definitions 3 | // DAL 1/03 4 | // 5 | #ifndef ARCHTYPES_H 6 | #define ARCHTYPES_H 7 | 8 | #ifdef __x86_64__ 9 | #define X64BITS 10 | #endif 11 | 12 | #if defined( _WIN32 ) && (! defined( __MINGW32__ )) 13 | 14 | typedef __int16 int16; 15 | typedef unsigned __int16 uint16; 16 | typedef __int32 int32; 17 | typedef unsigned __int32 uint32; 18 | typedef __int64 int64; 19 | typedef unsigned __int64 uint64; 20 | typedef __int32 intp; // intp is an integer that can accomodate a pointer 21 | typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) 22 | 23 | #else /* _WIN32 */ 24 | 25 | typedef short int16; 26 | typedef unsigned short uint16; 27 | typedef int int32; 28 | typedef unsigned int uint32; 29 | typedef long long int64; 30 | typedef unsigned long long uint64; 31 | #ifdef X64BITS 32 | typedef long long intp; 33 | typedef unsigned long long uintp; 34 | #else 35 | typedef int intp; 36 | typedef unsigned int uintp; 37 | #endif 38 | 39 | #endif /* else _WIN32 */ 40 | 41 | #endif /* ARCHTYPES_H */ 42 | -------------------------------------------------------------------------------- /HLSDK/engine/custom.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // Customization.h 16 | 17 | #ifndef CUSTOM_H 18 | #define CUSTOM_H 19 | #ifdef _WIN32 20 | #pragma once 21 | #endif 22 | 23 | #include "const.h" 24 | 25 | #define MAX_QPATH 64 // Must match value in quakedefs.h 26 | 27 | ///////////////// 28 | // Customization 29 | // passed to pfnPlayerCustomization 30 | // For automatic downloading. 31 | typedef enum 32 | { 33 | t_sound = 0, 34 | t_skin, 35 | t_model, 36 | t_decal, 37 | t_generic, 38 | t_eventscript, 39 | t_world, // Fake type for world, is really t_model 40 | } resourcetype_t; 41 | 42 | 43 | typedef struct 44 | { 45 | int size; 46 | } _resourceinfo_t; 47 | 48 | typedef struct resourceinfo_s 49 | { 50 | _resourceinfo_t info[ 8 ]; 51 | } resourceinfo_t; 52 | 53 | #define RES_FATALIFMISSING (1<<0) // Disconnect if we can't get this file. 54 | #define RES_WASMISSING (1<<1) // Do we have the file locally, did we get it ok? 55 | #define RES_CUSTOM (1<<2) // Is this resource one that corresponds to another player's customization 56 | // or is it a server startup resource. 57 | #define RES_REQUESTED (1<<3) // Already requested a download of this one 58 | #define RES_PRECACHED (1<<4) // Already precached 59 | 60 | #include "crc.h" 61 | 62 | typedef struct resource_s 63 | { 64 | char szFileName[MAX_QPATH]; // File name to download/precache. 65 | resourcetype_t type; // t_sound, t_skin, t_model, t_decal. 66 | int nIndex; // For t_decals 67 | int nDownloadSize; // Size in Bytes if this must be downloaded. 68 | unsigned char ucFlags; 69 | 70 | // For handling client to client resource propagation 71 | unsigned char rgucMD5_hash[16]; // To determine if we already have it. 72 | unsigned char playernum; // Which player index this resource is associated with, if it's a custom resource. 73 | 74 | unsigned char rguc_reserved[ 32 ]; // For future expansion 75 | struct resource_s *pNext; // Next in chain. 76 | struct resource_s *pPrev; 77 | } resource_t; 78 | 79 | typedef struct customization_s 80 | { 81 | qboolean bInUse; // Is this customization in use; 82 | resource_t resource; // The resource_t for this customization 83 | qboolean bTranslated; // Has the raw data been translated into a useable format? 84 | // (e.g., raw decal .wad make into texture_t *) 85 | int nUserData1; // Customization specific data 86 | int nUserData2; // Customization specific data 87 | void *pInfo; // Buffer that holds the data structure that references the data (e.g., the cachewad_t) 88 | void *pBuffer; // Buffer that holds the data for the customization (the raw .wad data) 89 | struct customization_s *pNext; // Next in chain 90 | } customization_t; 91 | 92 | #define FCUST_FROMHPAK ( 1<<0 ) 93 | #define FCUST_WIPEDATA ( 1<<1 ) 94 | #define FCUST_IGNOREINIT ( 1<<2 ) 95 | 96 | void COM_ClearCustomizationList( struct customization_s *pHead, qboolean bCleanDecals); 97 | qboolean COM_CreateCustomization( struct customization_s *pListHead, struct resource_s *pResource, int playernumber, int flags, 98 | struct customization_s **pCustomization, int *nLumps ); 99 | int COM_SizeofResourceList ( struct resource_s *pList, struct resourceinfo_s *ri ); 100 | 101 | #endif // CUSTOM_H 102 | -------------------------------------------------------------------------------- /HLSDK/engine/customentity.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef CUSTOMENTITY_H 16 | #define CUSTOMENTITY_H 17 | 18 | // Custom Entities 19 | 20 | // Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12) 21 | #define BEAMENT_ENTITY(x) ((x)&0xFFF) 22 | #define BEAMENT_ATTACHMENT(x) (((x)>>12)&0xF) 23 | 24 | // Beam types, encoded as a byte 25 | enum 26 | { 27 | BEAM_POINTS = 0, 28 | BEAM_ENTPOINT, 29 | BEAM_ENTS, 30 | BEAM_HOSE, 31 | }; 32 | 33 | #define BEAM_FSINE 0x10 34 | #define BEAM_FSOLID 0x20 35 | #define BEAM_FSHADEIN 0x40 36 | #define BEAM_FSHADEOUT 0x80 37 | 38 | #endif //CUSTOMENTITY_H 39 | -------------------------------------------------------------------------------- /HLSDK/engine/edict.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/engine/edict.h -------------------------------------------------------------------------------- /HLSDK/engine/keydefs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/engine/keydefs.h -------------------------------------------------------------------------------- /HLSDK/engine/progdefs.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef PROGDEFS_H 16 | #define PROGDEFS_H 17 | #ifdef _WIN32 18 | #pragma once 19 | #endif 20 | 21 | typedef struct 22 | { 23 | float time; 24 | float frametime; 25 | float force_retouch; 26 | string_t mapname; 27 | string_t startspot; 28 | float deathmatch; 29 | float coop; 30 | float teamplay; 31 | float serverflags; 32 | float found_secrets; 33 | vec3_t v_forward; 34 | vec3_t v_up; 35 | vec3_t v_right; 36 | float trace_allsolid; 37 | float trace_startsolid; 38 | float trace_fraction; 39 | vec3_t trace_endpos; 40 | vec3_t trace_plane_normal; 41 | float trace_plane_dist; 42 | edict_t *trace_ent; 43 | float trace_inopen; 44 | float trace_inwater; 45 | int trace_hitgroup; 46 | int trace_flags; 47 | int msg_entity; 48 | int cdAudioTrack; 49 | int maxClients; 50 | int maxEntities; 51 | const char *pStringBase; 52 | 53 | void *pSaveData; 54 | vec3_t vecLandmarkOffset; 55 | } globalvars_t; 56 | 57 | 58 | typedef struct entvars_s 59 | { 60 | string_t classname; 61 | string_t globalname; 62 | 63 | vec3_t origin; 64 | vec3_t oldorigin; 65 | vec3_t velocity; 66 | vec3_t basevelocity; 67 | vec3_t clbasevelocity; // Base velocity that was passed in to server physics so 68 | // client can predict conveyors correctly. Server zeroes it, so we need to store here, too. 69 | vec3_t movedir; 70 | 71 | vec3_t angles; // Model angles 72 | vec3_t avelocity; // angle velocity (degrees per second) 73 | vec3_t punchangle; // auto-decaying view angle adjustment 74 | vec3_t v_angle; // Viewing angle (player only) 75 | 76 | // For parametric entities 77 | vec3_t endpos; 78 | vec3_t startpos; 79 | float impacttime; 80 | float starttime; 81 | 82 | int fixangle; // 0:nothing, 1:force view angles, 2:add avelocity 83 | float idealpitch; 84 | float pitch_speed; 85 | float ideal_yaw; 86 | float yaw_speed; 87 | 88 | int modelindex; 89 | string_t model; 90 | 91 | int viewmodel; // player's viewmodel 92 | int weaponmodel; // what other players see 93 | 94 | vec3_t absmin; // BB max translated to world coord 95 | vec3_t absmax; // BB max translated to world coord 96 | vec3_t mins; // local BB min 97 | vec3_t maxs; // local BB max 98 | vec3_t size; // maxs - mins 99 | 100 | float ltime; 101 | float nextthink; 102 | 103 | int movetype; 104 | int solid; 105 | 106 | int skin; 107 | int body; // sub-model selection for studiomodels 108 | int effects; 109 | 110 | float gravity; // % of "normal" gravity 111 | float friction; // inverse elasticity of MOVETYPE_BOUNCE 112 | 113 | int light_level; 114 | 115 | int sequence; // animation sequence 116 | int gaitsequence; // movement animation sequence for player (0 for none) 117 | float frame; // % playback position in animation sequences (0..255) 118 | float animtime; // world time when frame was set 119 | float framerate; // animation playback rate (-8x to 8x) 120 | byte controller[4]; // bone controller setting (0..255) 121 | byte blending[2]; // blending amount between sub-sequences (0..255) 122 | 123 | float scale; // sprite rendering scale (0..255) 124 | 125 | int rendermode; 126 | float renderamt; 127 | vec3_t rendercolor; 128 | int renderfx; 129 | 130 | float health; 131 | float frags; 132 | int weapons; // bit mask for available weapons 133 | float takedamage; 134 | 135 | int deadflag; 136 | vec3_t view_ofs; // eye position 137 | 138 | int button; 139 | int impulse; 140 | 141 | edict_t *chain; // Entity pointer when linked into a linked list 142 | edict_t *dmg_inflictor; 143 | edict_t *enemy; 144 | edict_t *aiment; // entity pointer when MOVETYPE_FOLLOW 145 | edict_t *owner; 146 | edict_t *groundentity; 147 | 148 | int spawnflags; 149 | int flags; 150 | 151 | int colormap; // lowbyte topcolor, highbyte bottomcolor 152 | int team; 153 | 154 | float max_health; 155 | float teleport_time; 156 | float armortype; 157 | float armorvalue; 158 | int waterlevel; 159 | int watertype; 160 | 161 | string_t target; 162 | string_t targetname; 163 | string_t netname; 164 | string_t message; 165 | 166 | float dmg_take; 167 | float dmg_save; 168 | float dmg; 169 | float dmgtime; 170 | 171 | string_t noise; 172 | string_t noise1; 173 | string_t noise2; 174 | string_t noise3; 175 | 176 | float speed; 177 | float air_finished; 178 | float pain_finished; 179 | float radsuit_finished; 180 | 181 | edict_t *pContainingEntity; 182 | 183 | int playerclass; 184 | float maxspeed; 185 | 186 | float fov; 187 | int weaponanim; 188 | 189 | int pushmsec; 190 | 191 | int bInDuck; 192 | int flTimeStepSound; 193 | int flSwimTime; 194 | int flDuckTime; 195 | int iStepLeft; 196 | float flFallVelocity; 197 | 198 | int gamestate; 199 | 200 | int oldbuttons; 201 | 202 | int groupinfo; 203 | 204 | // For mods 205 | int iuser1; 206 | int iuser2; 207 | int iuser3; 208 | int iuser4; 209 | float fuser1; 210 | float fuser2; 211 | float fuser3; 212 | float fuser4; 213 | vec3_t vuser1; 214 | vec3_t vuser2; 215 | vec3_t vuser3; 216 | vec3_t vuser4; 217 | edict_t *euser1; 218 | edict_t *euser2; 219 | edict_t *euser3; 220 | edict_t *euser4; 221 | } entvars_t; 222 | 223 | 224 | #endif // PROGDEFS_H -------------------------------------------------------------------------------- /HLSDK/engine/progs.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef PROGS_H 16 | #define PROGS_H 17 | 18 | #include "progdefs.h" 19 | 20 | // 16 simultaneous events, max 21 | #define MAX_EVENT_QUEUE 64 22 | 23 | #define DEFAULT_EVENT_RESENDS 1 24 | 25 | #include "event_flags.h" 26 | 27 | typedef struct event_info_s event_info_t; 28 | 29 | #include "event_args.h" 30 | 31 | struct event_info_s 32 | { 33 | unsigned short index; // 0 implies not in use 34 | 35 | short packet_index; // Use data from state info for entity in delta_packet . -1 implies separate info based on event 36 | // parameter signature 37 | short entity_index; // The edict this event is associated with 38 | 39 | float fire_time; // if non-zero, the time when the event should be fired ( fixed up on the client ) 40 | 41 | event_args_t args; 42 | 43 | // CLIENT ONLY 44 | int flags; // Reliable or not, etc. 45 | 46 | }; 47 | 48 | typedef struct event_state_s event_state_t; 49 | 50 | struct event_state_s 51 | { 52 | struct event_info_s ei[ MAX_EVENT_QUEUE ]; 53 | }; 54 | 55 | #if !defined( ENTITY_STATEH ) 56 | #include "entity_state.h" 57 | #endif 58 | 59 | #if !defined( EDICT_H ) 60 | #include "edict.h" 61 | #endif 62 | 63 | #define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m))) 64 | #define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area) 65 | 66 | //============================================================================ 67 | 68 | extern char *pr_strings; 69 | extern globalvars_t gGlobalVariables; 70 | 71 | //============================================================================ 72 | 73 | edict_t *ED_Alloc (void); 74 | void ED_Free (edict_t *ed); 75 | void ED_LoadFromFile (char *data); 76 | 77 | edict_t *EDICT_NUM(int n); 78 | int NUM_FOR_EDICT(const edict_t *e); 79 | 80 | #define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e)) 81 | 82 | #endif // PROGS_H -------------------------------------------------------------------------------- /HLSDK/engine/shake.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef SHAKE_H 16 | #define SHAKE_H 17 | 18 | // Screen / View effects 19 | 20 | // screen shake 21 | extern int gmsgShake; 22 | 23 | // This structure is sent over the net to describe a screen shake event 24 | typedef struct 25 | { 26 | unsigned short amplitude; // FIXED 4.12 amount of shake 27 | unsigned short duration; // FIXED 4.12 seconds duration 28 | unsigned short frequency; // FIXED 8.8 noise frequency (low frequency is a jerk,high frequency is a rumble) 29 | } ScreenShake; 30 | 31 | extern void V_ApplyShake( float *origin, float *angles, float factor ); 32 | extern void V_CalcShake( void ); 33 | extern int V_ScreenShake( const char *pszName, int iSize, void *pbuf ); 34 | extern int V_ScreenFade( const char *pszName, int iSize, void *pbuf ); 35 | 36 | 37 | // Fade in/out 38 | extern int gmsgFade; 39 | 40 | #define FFADE_IN 0x0000 // Just here so we don't pass 0 into the function 41 | #define FFADE_OUT 0x0001 // Fade out (not in) 42 | #define FFADE_MODULATE 0x0002 // Modulate (don't blend) 43 | #define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received 44 | 45 | // This structure is sent over the net to describe a screen fade event 46 | typedef struct 47 | { 48 | unsigned short duration; // FIXED 4.12 seconds duration 49 | unsigned short holdTime; // FIXED 4.12 seconds duration until reset (fade & hold) 50 | short fadeFlags; // flags 51 | byte r, g, b, a; // fade to color ( max alpha ) 52 | } ScreenFade; 53 | 54 | #endif // SHAKE_H 55 | 56 | -------------------------------------------------------------------------------- /HLSDK/pm_shared/pm_debug.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef PM_DEBUG_H 16 | #define PM_DEBUG_H 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | void PM_ViewEntity( void ); 24 | void PM_DrawBBox(vec3_t mins, vec3_t maxs, vec3_t origin, int pcolor, float life); 25 | void PM_ParticleLine(vec3_t start, vec3_t end, int pcolor, float life, float vert); 26 | void PM_ShowClipBox( void ); 27 | 28 | #endif // PMOVEDBG_H 29 | -------------------------------------------------------------------------------- /HLSDK/pm_shared/pm_info.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // Physics info string definition 16 | #if !defined( PM_INFOH ) 17 | #define PM_INFOH 18 | #ifdef _WIN32 19 | #ifndef __MINGW32__ 20 | #pragma once 21 | #endif /* not __MINGW32__ */ 22 | #endif 23 | 24 | #define MAX_PHYSINFO_STRING 256 25 | 26 | #endif // PM_INFOH 27 | -------------------------------------------------------------------------------- /HLSDK/pm_shared/pm_materials.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( PM_MATERIALSH ) 16 | #define PM_MATERIALSH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | #define CBTEXTURENAMEMAX 13 // only load first n chars of name 24 | 25 | #define CHAR_TEX_CONCRETE 'C' // texture types 26 | #define CHAR_TEX_METAL 'M' 27 | #define CHAR_TEX_DIRT 'D' 28 | #define CHAR_TEX_VENT 'V' 29 | #define CHAR_TEX_GRATE 'G' 30 | #define CHAR_TEX_TILE 'T' 31 | #define CHAR_TEX_SLOSH 'S' 32 | #define CHAR_TEX_WOOD 'W' 33 | #define CHAR_TEX_COMPUTER 'P' 34 | #define CHAR_TEX_GLASS 'Y' 35 | #define CHAR_TEX_FLESH 'F' 36 | 37 | #endif // !PM_MATERIALSH 38 | -------------------------------------------------------------------------------- /HLSDK/pm_shared/pm_movevars.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/HLSDK/pm_shared/pm_movevars.h -------------------------------------------------------------------------------- /HLSDK/pm_shared/pm_shared.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | // 17 | // pm_shared.h 18 | // 19 | #if !defined( PM_SHAREDH ) 20 | #define PM_SHAREDH 21 | #ifdef _WIN32 22 | #ifndef __MINGW32__ 23 | #pragma once 24 | #endif /* not __MINGW32__ */ 25 | #endif 26 | 27 | void PM_Init( struct playermove_s *ppmove ); 28 | void PM_Move ( struct playermove_s *ppmove, int server ); 29 | char PM_FindTextureType( char *name ); 30 | 31 | // Spectator Movement modes (stored in pev->iuser1, so the physics code can get at them) 32 | #define OBS_NONE 0 33 | #define OBS_CHASE_LOCKED 1 34 | #define OBS_CHASE_FREE 2 35 | #define OBS_ROAMING 3 36 | #define OBS_IN_EYE 4 37 | #define OBS_MAP_FREE 5 38 | #define OBS_MAP_CHASE 6 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /HLSDK/public/steam/steamtypes.h: -------------------------------------------------------------------------------- 1 | //========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | 7 | #ifndef STEAMTYPES_H 8 | #define STEAMTYPES_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | // Steam-specific types. Defined here so this header file can be included in other code bases. 14 | #if defined( __GNUC__ ) && !defined(POSIX) 15 | #if __GNUC__ < 4 16 | #error "Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)" 17 | #endif 18 | #define POSIX 1 19 | #endif 20 | 21 | #if defined(__x86_64__) || defined(_WIN64) 22 | #define X64BITS 23 | #endif 24 | 25 | // Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code. 26 | #if !defined(VALVE_BIG_ENDIAN) && defined(_PS3) 27 | #define VALVE_BIG_ENDIAN 28 | #endif 29 | 30 | typedef unsigned char uint8; 31 | typedef signed char int8; 32 | 33 | #if defined( _WIN32 ) 34 | 35 | typedef __int16 int16; 36 | typedef unsigned __int16 uint16; 37 | typedef __int32 int32; 38 | typedef unsigned __int32 uint32; 39 | typedef __int64 int64; 40 | typedef unsigned __int64 uint64; 41 | 42 | #ifdef X64BITS 43 | typedef __int64 intp; // intp is an integer that can accomodate a pointer 44 | typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) 45 | #else 46 | typedef __int32 intp; 47 | typedef unsigned __int32 uintp; 48 | #endif 49 | 50 | #else // _WIN32 51 | 52 | typedef short int16; 53 | typedef unsigned short uint16; 54 | typedef int int32; 55 | typedef unsigned int uint32; 56 | typedef long long int64; 57 | typedef unsigned long long uint64; 58 | #ifdef X64BITS 59 | typedef long long intp; 60 | typedef unsigned long long uintp; 61 | #else 62 | typedef int intp; 63 | typedef unsigned int uintp; 64 | #endif 65 | 66 | #endif // else _WIN32 67 | 68 | #ifdef __cplusplus 69 | const int k_cubSaltSize = 8; 70 | #else 71 | #define k_cubSaltSize 8 72 | #endif 73 | 74 | typedef uint8 Salt_t[ k_cubSaltSize ]; 75 | 76 | //----------------------------------------------------------------------------- 77 | // GID (GlobalID) stuff 78 | // This is a globally unique identifier. It's guaranteed to be unique across all 79 | // racks and servers for as long as a given universe persists. 80 | //----------------------------------------------------------------------------- 81 | // NOTE: for GID parsing/rendering and other utils, see gid.h 82 | typedef uint64 GID_t; 83 | 84 | #ifdef __cplusplus 85 | const GID_t k_GIDNil = 0xfffffffffffffffful; 86 | #else 87 | #define k_GIDNil 0xffffffffffffffffull; 88 | #endif 89 | 90 | // For convenience, we define a number of types that are just new names for GIDs 91 | typedef GID_t JobID_t; // Each Job has a unique ID 92 | typedef GID_t TxnID_t; // Each financial transaction has a unique ID 93 | 94 | #ifdef __cplusplus 95 | const GID_t k_TxnIDNil = k_GIDNil; 96 | const GID_t k_TxnIDUnknown = 0; 97 | #else 98 | #define k_TxnIDNil k_GIDNil; 99 | #define k_TxnIDUnknown 0; 100 | #endif 101 | 102 | // this is baked into client messages and interfaces as an int, 103 | // make sure we never break this. 104 | typedef uint32 PackageId_t; 105 | #ifdef __cplusplus 106 | const PackageId_t k_uPackageIdFreeSub = 0x0; 107 | const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF; 108 | #else 109 | #define k_uPackageIdFreeSub 0x0; 110 | #define k_uPackageIdInvalid 0xFFFFFFFF; 111 | #endif 112 | 113 | // this is baked into client messages and interfaces as an int, 114 | // make sure we never break this. 115 | typedef uint32 AppId_t; 116 | #ifdef __cplusplus 117 | const AppId_t k_uAppIdInvalid = 0x0; 118 | #else 119 | #define k_uAppIdInvalid 0x0; 120 | #endif 121 | 122 | typedef uint64 AssetClassId_t; 123 | #ifdef __cplusplus 124 | const AssetClassId_t k_ulAssetClassIdInvalid = 0x0; 125 | #else 126 | #define k_ulAssetClassIdInvalid 0x0; 127 | #endif 128 | 129 | typedef uint32 PhysicalItemId_t; 130 | #ifdef __cplusplus 131 | const PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0; 132 | #else 133 | #define k_uPhysicalItemIdInvalid 0x0; 134 | #endif 135 | 136 | 137 | // this is baked into client messages and interfaces as an int, 138 | // make sure we never break this. AppIds and DepotIDs also presently 139 | // share the same namespace, but since we'd like to change that in the future 140 | // I've defined it seperately here. 141 | typedef uint32 DepotId_t; 142 | #ifdef __cplusplus 143 | const DepotId_t k_uDepotIdInvalid = 0x0; 144 | #else 145 | #define k_uDepotIdInvalid 0x0; 146 | #endif 147 | 148 | // RTime32 149 | // We use this 32 bit time representing real world time. 150 | // It offers 1 second resolution beginning on January 1, 1970 (Unix time) 151 | typedef uint32 RTime32; 152 | 153 | typedef uint32 CellID_t; 154 | #ifdef __cplusplus 155 | const CellID_t k_uCellIDInvalid = 0xFFFFFFFF; 156 | #else 157 | #define k_uCellIDInvalid 0x0; 158 | #endif 159 | 160 | // handle to a Steam API call 161 | typedef uint64 SteamAPICall_t; 162 | #ifdef __cplusplus 163 | const SteamAPICall_t k_uAPICallInvalid = 0x0; 164 | #else 165 | #define k_uAPICallInvalid 0x0; 166 | #endif 167 | 168 | typedef uint32 AccountID_t; 169 | 170 | typedef uint32 PartnerId_t; 171 | #ifdef __cplusplus 172 | const PartnerId_t k_uPartnerIdInvalid = 0; 173 | #else 174 | #define k_uPartnerIdInvalid 0x0; 175 | #endif 176 | 177 | #endif // STEAMTYPES_H 178 | -------------------------------------------------------------------------------- /Interface/ICommandLine.h: -------------------------------------------------------------------------------- 1 | #ifndef ICOMMANDLINE_H 2 | #define ICOMMANDLINE_H 3 | 4 | #ifdef _WIN32 5 | #pragma once 6 | #endif 7 | 8 | class ICommandLine 9 | { 10 | public: 11 | virtual void CreateCmdLine(const char *commandline) = 0; 12 | virtual const char *GetCmdLine(void) const = 0; 13 | virtual const char *CheckParm(const char *psz, const char **ppszValue = 0) const = 0; 14 | virtual void RemoveParm(const char *parm) = 0; 15 | virtual void AppendParm(const char *pszParm, const char *pszValues) = 0; 16 | virtual void SetParm(const char *pszParm, const char *pszValues) = 0; 17 | virtual void SetParm(const char *pszParm, int iValue) = 0; 18 | }; 19 | 20 | ICommandLine *CommandLine(void); 21 | 22 | #endif -------------------------------------------------------------------------------- /Interface/IEngine.h: -------------------------------------------------------------------------------- 1 | #ifndef IENGINE_H 2 | #define IENGINE_H 3 | 4 | #ifdef _WIN32 5 | #pragma once 6 | #endif 7 | 8 | enum 9 | { 10 | ENGINE_RESULT_NONE, 11 | ENGINE_RESULT_RESTART, 12 | ENGINE_RESULT_UNSUPPORTEDVIDEO 13 | }; 14 | 15 | class IEngine : public IBaseInterface 16 | { 17 | public: 18 | virtual int Run(HINSTANCE instance, char *basedir, const char *cmdline, char *szCommand, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory); 19 | }; 20 | 21 | #define VENGINE_LAUNCHER_API_VERSION "VENGINE_LAUNCHER_API_VERSION002" 22 | 23 | #endif -------------------------------------------------------------------------------- /Interface/IFileSystem.h: -------------------------------------------------------------------------------- 1 | #ifndef IFILESYSTEM_H 2 | #define IFILESYSTEM_H 3 | 4 | #ifdef _WIN32 5 | #pragma once 6 | #endif 7 | 8 | typedef void *FileHandle_t; 9 | typedef int FileFindHandle_t; 10 | typedef int WaitForResourcesHandle_t; 11 | 12 | enum FileSystemSeek_t 13 | { 14 | FILESYSTEM_SEEK_HEAD = 0, 15 | FILESYSTEM_SEEK_CURRENT, 16 | FILESYSTEM_SEEK_TAIL, 17 | }; 18 | 19 | enum 20 | { 21 | FILESYSTEM_INVALID_FIND_HANDLE = -1 22 | }; 23 | 24 | enum FileWarningLevel_t 25 | { 26 | FILESYSTEM_WARNING = -1, 27 | FILESYSTEM_WARNING_QUIET = 0, 28 | FILESYSTEM_WARNING_REPORTUNCLOSED, 29 | FILESYSTEM_WARNING_REPORTUSAGE, 30 | FILESYSTEM_WARNING_REPORTALLACCESSES, 31 | FILESYSTEM_WARNING_REPORTALLACCESSES_READ, 32 | FILESYSTEM_WARNING_REPORTALLACCESSES_READWRITE, 33 | FILESYSTEM_WARNING_REPORTALLACCESSES_ASYNC, 34 | }; 35 | 36 | #define FILESYSTEM_INVALID_HANDLE (FileHandle_t)NULL 37 | 38 | class IFileSystem : public IBaseInterface 39 | { 40 | public: 41 | virtual void Mount(void) = 0; 42 | virtual void Unmount(void) = 0; 43 | virtual void RemoveAllSearchPaths(void) = 0; 44 | virtual void AddSearchPath(const char *pPath, const char *pathID = 0) = 0; 45 | virtual bool RemoveSearchPath(const char *pPath) = 0; 46 | virtual void RemoveFile(const char *pRelativePath, const char *pathID = 0) = 0; 47 | virtual void CreateDirHierarchy(const char *path, const char *pathID = 0) = 0; 48 | virtual bool FileExists(const char *pFileName) = 0; 49 | virtual bool IsDirectory(const char *pFileName) = 0; 50 | virtual FileHandle_t Open(const char *pFileName, const char *pOptions, const char *pathID = 0) = 0; 51 | virtual void Close(FileHandle_t file) = 0; 52 | virtual void Seek(FileHandle_t file, int pos, FileSystemSeek_t seekType) = 0; 53 | virtual unsigned Tell(FileHandle_t file) = 0; 54 | virtual unsigned Size(FileHandle_t file) = 0; 55 | virtual unsigned Size(const char *pFileName) = 0; 56 | virtual long GetFileTime(const char *pFileName) = 0; 57 | virtual void FileTimeToString(char *pStrip, int maxCharsIncludingTerminator, long fileTime) = 0; 58 | virtual bool IsOk(FileHandle_t file) = 0; 59 | virtual void Flush(FileHandle_t file) = 0; 60 | virtual bool EndOfFile(FileHandle_t file) = 0; 61 | virtual int Read(void *pOutput, int size, FileHandle_t file) = 0; 62 | virtual int Write(void const *pInput, int size, FileHandle_t file) = 0; 63 | virtual char *ReadLine(char *pOutput, int maxChars, FileHandle_t file) = 0; 64 | virtual int FPrintf(FileHandle_t file, char *pFormat, ...) = 0; 65 | virtual char *GetReadBuffer(FileHandle_t file, char *pBuffer) = 0; 66 | virtual void ReleaseReadBuffer(FileHandle_t file, char *pBuffer) = 0; 67 | virtual const char *FindFirst(const char *pWildCard, FileFindHandle_t *pHandle, const char *pathID = 0) = 0; 68 | virtual const char *FindNext(FileFindHandle_t handle) = 0; 69 | virtual bool FindIsDirectory(FileFindHandle_t handle) = 0; 70 | virtual void FindClose(FileFindHandle_t handle) = 0; 71 | virtual void GetLocalCopy(const char *pFileName) = 0; 72 | virtual const char *GetLocalPath(const char *pFileName, char *pLocalPath, int maxlen) = 0; 73 | virtual char *ParseFile(char *data, char *token, bool *wasquoted) = 0; 74 | virtual bool FullPathToRelativePath(const char *pFullpath, char *pRelative) = 0; 75 | virtual bool GetCurrentDirectory(char *pDirectory, int maxlen) = 0; 76 | virtual void PrintOpenedFiles(void) = 0; 77 | virtual void SetWarningFunc(void (*pfnWarning)(const char *fmt, ...)) = 0; 78 | virtual void SetWarningLevel(FileWarningLevel_t level) = 0; 79 | virtual void LogLevelLoadStarted(const char *name) = 0; 80 | virtual void LogLevelLoadFinished(const char *name) = 0; 81 | virtual int HintResourceNeed(const char *hintlist, int forgetEverything) = 0; 82 | virtual int PauseResourcePreloading(void) = 0; 83 | virtual int ResumeResourcePreloading(void) = 0; 84 | virtual int SetVBuf(FileHandle_t stream, char *buffer, int mode, long size) = 0; 85 | virtual void GetInterfaceVersion(char *p, int maxlen) = 0; 86 | virtual bool IsFileImmediatelyAvailable(const char *path) = 0; 87 | virtual void *WaitForResources(const char *pFileName) = 0; 88 | virtual bool GetWaitForResourcesProgress(WaitForResourcesHandle_t handle, float *progress, bool *complete) = 0; 89 | virtual void CancelWaitForResources(WaitForResourcesHandle_t handle) = 0; 90 | virtual bool IsAppReadyForOfflinePlay(void) = 0; 91 | virtual void AddPackFile(const char *pPath, const char *pathID = 0) = 0; 92 | virtual void *OpenFromCacheForRead(const char *pFileName, const char *pOptions, const char *pathID = 0) = 0; 93 | }; 94 | 95 | #define FILESYSTEM_INTERFACE_VERSION "VFileSystem009" 96 | 97 | #endif -------------------------------------------------------------------------------- /Interface/IPlugins.h: -------------------------------------------------------------------------------- 1 | #ifndef IPLUGINS_H 2 | #define IPLUGINS_H 3 | 4 | #ifdef _WIN32 5 | #pragma once 6 | #endif 7 | 8 | class IPlugins : public IBaseInterface 9 | { 10 | public: 11 | virtual void Init(metahook_api_t *pAPI, mh_interface_t *pInterface, mh_enginesave_t *pSave); 12 | virtual void Shutdown(void); 13 | virtual void LoadEngine(void); 14 | virtual void LoadClient(cl_exportfuncs_t *pExportFunc); 15 | virtual void ExitGame(int iResult); 16 | }; 17 | 18 | #define METAHOOK_PLUGIN_API_VERSION "METAHOOK_PLUGIN_API_VERSION002" 19 | 20 | #endif -------------------------------------------------------------------------------- /Interface/IPluginsV1.h: -------------------------------------------------------------------------------- 1 | #ifndef IPLUGINS_V1_H 2 | #define IPLUGINS_V1_H 3 | 4 | #ifdef _WIN32 5 | #pragma once 6 | #endif 7 | 8 | class IPluginsV1 : public IBaseInterface 9 | { 10 | public: 11 | virtual void Init(struct cl_exportfuncs_s *pExportfuncs); 12 | virtual void Shutdown(int restart); 13 | }; 14 | 15 | #define METAHOOK_PLUGIN_API_VERSION_V1 "METAHOOK_PLUGIN_API_VERSION001" 16 | 17 | #endif -------------------------------------------------------------------------------- /Interface/IRegistry.h: -------------------------------------------------------------------------------- 1 | #ifndef IREGISTRY_H 2 | #define IREGISTRY_H 3 | 4 | #ifdef _WIN32 5 | #pragma once 6 | #endif 7 | 8 | class IRegistry 9 | { 10 | public: 11 | virtual void Init(void) = 0; 12 | virtual void Shutdown(void) = 0; 13 | virtual int ReadInt(const char *key, int defaultValue = 0) = 0; 14 | virtual void WriteInt(const char *key, int value) = 0; 15 | virtual const char *ReadString(const char *key, const char *defaultValue = NULL) = 0; 16 | virtual void WriteString(const char *key, const char *value) = 0; 17 | }; 18 | 19 | extern IRegistry *registry; 20 | 21 | #endif -------------------------------------------------------------------------------- /Launcher.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/Launcher.ico -------------------------------------------------------------------------------- /Launcher.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 101 ICON "Launcher.ico" 4 | 5 | VS_VERSION_INFO VERSIONINFO 6 | FILEVERSION 0,4,0,0 7 | PRODUCTVERSION 0,4,0,0 8 | FILEFLAGSMASK 0x17L 9 | #ifdef _DEBUG 10 | FILEFLAGS 0x1L 11 | #else 12 | FILEFLAGS 0x0L 13 | #endif 14 | FILEOS 0x4L 15 | FILETYPE 0x1L 16 | FILESUBTYPE 0x0L 17 | BEGIN 18 | BLOCK "StringFileInfo" 19 | 20 | BEGIN 21 | BLOCK "000004b0" 22 | 23 | BEGIN 24 | VALUE "FileDescription", "MetaHook Plus" 25 | VALUE "FileVersion", "0.4.0.0" 26 | VALUE "InternalName", "MetaHook" 27 | VALUE "OriginalFilename", "MetaHook.exe" 28 | END 29 | END 30 | 31 | BLOCK "VarFileInfo" 32 | 33 | BEGIN 34 | VALUE "Translation", 0x0, 1200 35 | END 36 | END -------------------------------------------------------------------------------- /LoadBlob.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "LoadBlob.h" 3 | #include 4 | #include "IFileSystem.h" 5 | 6 | extern IFileSystem *g_pFileSystem; 7 | 8 | #ifndef _USRDLL 9 | #pragma data_seg(".data") 10 | BYTE g_pBlobBuffer[0x2000000]; 11 | #endif 12 | 13 | BlobHeader_t g_BlobHeader; 14 | 15 | BlobHeader_t *GetBlobHeader(void) 16 | { 17 | return &g_BlobHeader; 18 | } 19 | 20 | BOOL FIsBlob(const char *pstFileName) 21 | { 22 | FileHandle_t file = g_pFileSystem->Open(pstFileName, "rb"); 23 | 24 | if (file == FILESYSTEM_INVALID_HANDLE) 25 | return FALSE; 26 | 27 | BlobInfo_t info; 28 | g_pFileSystem->Read(&info, sizeof(BlobInfo_t), file); 29 | g_pFileSystem->Close(file); 30 | 31 | if (info.m_dwAlgorithm != BLOB_ALGORITHM) 32 | return FALSE; 33 | 34 | return TRUE; 35 | } 36 | 37 | DWORD NLoadBlobFile(const char *pstFileName, BlobFootprint_t *pblobfootprint, void **pv) 38 | { 39 | FileHandle_t file = g_pFileSystem->Open(pstFileName, "rb"); 40 | 41 | DWORD dwSize; 42 | BYTE *pBuffer; 43 | DWORD dwAddress; 44 | 45 | g_pFileSystem->Seek(file, 0, FILESYSTEM_SEEK_TAIL); 46 | dwSize = g_pFileSystem->Tell(file); 47 | g_pFileSystem->Seek(file, 0, FILESYSTEM_SEEK_HEAD); 48 | 49 | pBuffer = (BYTE *)malloc(dwSize); 50 | g_pFileSystem->Read(pBuffer, dwSize, file); 51 | 52 | dwAddress = LoadBlobFile(pBuffer, pblobfootprint, pv, dwSize); 53 | free(pBuffer); 54 | g_pFileSystem->Close(file); 55 | return dwAddress; 56 | } 57 | 58 | DWORD LoadBlobFile(BYTE *pBuffer, BlobFootprint_t *pblobfootprint, void **pv, DWORD dwSize) 59 | { 60 | BYTE bXor = 0x57; 61 | BlobHeader_t *pHeader; 62 | BlobSection_t *pSection; 63 | DWORD dwAddress = 0; 64 | 65 | for (size_t i = sizeof(BlobInfo_t); i < dwSize; i++) 66 | { 67 | pBuffer[i] ^= bXor; 68 | bXor += pBuffer[i] + 0x57; 69 | } 70 | 71 | pHeader = (BlobHeader_t *)(pBuffer + sizeof(BlobInfo_t)); 72 | pHeader->m_dwExportPoint ^= 0x7A32BC85; 73 | pHeader->m_dwImageBase ^= 0x49C042D1; 74 | pHeader->m_dwEntryPoint -= 12; 75 | pHeader->m_dwImportTable ^= 0x872C3D47; 76 | pSection = (BlobSection_t *)(pBuffer + sizeof(BlobInfo_t) + sizeof(BlobHeader_t)); 77 | 78 | memcpy(&g_BlobHeader, pHeader, sizeof(BlobHeader_t)); 79 | 80 | for (WORD j = 0; j <= pHeader->m_wSectionCount; j++) 81 | { 82 | if (pSection[j].m_bIsSpecial) 83 | dwAddress = pSection[j].m_dwDataAddress; 84 | 85 | if (pSection[j].m_dwVirtualSize > pSection[j].m_dwDataSize) 86 | memset((BYTE *)(pSection[j].m_dwVirtualAddress + pSection[j].m_dwDataSize), NULL, pSection[j].m_dwVirtualSize - pSection[j].m_dwDataSize); 87 | 88 | memcpy((BYTE *)pSection[j].m_dwVirtualAddress, pBuffer + pSection[j].m_dwDataAddress, pSection[j].m_dwDataSize); 89 | } 90 | 91 | PIMAGE_IMPORT_DESCRIPTOR pImport = (PIMAGE_IMPORT_DESCRIPTOR)pHeader->m_dwImportTable; 92 | 93 | while (pImport->Name) 94 | { 95 | HMODULE hPorcDll = LoadLibrary((char *)(pHeader->m_dwImageBase + pImport->Name)); 96 | PIMAGE_THUNK_DATA pThunk = (PIMAGE_THUNK_DATA)(pHeader->m_dwImageBase + pImport++->FirstThunk); 97 | 98 | while (pThunk->u1.Function) 99 | { 100 | const char *pszProcName = IMAGE_SNAP_BY_ORDINAL(pThunk->u1.Ordinal) ? (char *)((LONG)pThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG32 - 1) : (char *)(pHeader->m_dwImageBase + ((IMAGE_IMPORT_BY_NAME *)((LONG)pThunk->u1.Ordinal & IMAGE_ORDINAL_FLAG32 - 1))->Name); 101 | pThunk++->u1.AddressOfData = (DWORD)GetProcAddress(hPorcDll, pszProcName); 102 | } 103 | } 104 | 105 | ((BOOL (WINAPI *)(HINSTANCE, DWORD, void *))(pHeader->m_dwEntryPoint))(0, DLL_PROCESS_ATTACH, 0); 106 | ((void (*)(void **))(pHeader->m_dwExportPoint))(pv); 107 | return dwAddress; 108 | } 109 | 110 | void FreeBlob(BlobFootprint_t *pblobfootprint) 111 | { 112 | FreeLibrary(pblobfootprint->m_hDll); 113 | } -------------------------------------------------------------------------------- /LoadBlob.h: -------------------------------------------------------------------------------- 1 | #define BLOB_ALGORITHM 0x12345678 2 | 3 | typedef struct BlobInfo_s 4 | { 5 | char m_szPath[10]; 6 | char m_szDescribe[32]; 7 | char m_szCompany[22]; 8 | DWORD m_dwAlgorithm; 9 | } 10 | BlobInfo_t; 11 | 12 | typedef struct BlobHeader_s 13 | { 14 | DWORD m_dwCheckSum; 15 | WORD m_wSectionCount; 16 | DWORD m_dwExportPoint; 17 | DWORD m_dwImageBase; 18 | DWORD m_dwEntryPoint; 19 | DWORD m_dwImportTable; 20 | } 21 | BlobHeader_t; 22 | 23 | typedef struct BlobSection_s 24 | { 25 | DWORD m_dwVirtualAddress; 26 | DWORD m_dwVirtualSize; 27 | DWORD m_dwDataSize; 28 | DWORD m_dwDataAddress; 29 | BOOL m_bIsSpecial; 30 | } 31 | BlobSection_t; 32 | 33 | typedef struct BlobFootprint_s 34 | { 35 | HMODULE m_hDll; 36 | } 37 | BlobFootprint_t; 38 | 39 | BlobHeader_t *GetBlobHeader(void); 40 | BOOL FIsBlob(const char *pstFileName); 41 | DWORD NLoadBlobFile(const char *pstFileName, BlobFootprint_t *pblobfootprint, void **pv); 42 | DWORD LoadBlobFile(BYTE *pBuffer, BlobFootprint_t *pblobfootprint, void **pv, DWORD dwSize); 43 | void FreeBlob(BlobFootprint_t *pblobfootprint); -------------------------------------------------------------------------------- /MetaHook.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaHook", "MetaHook.vcproj", "{0931F284-681C-41F1-AF30-97D1DCE2283C}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {0931F284-681C-41F1-AF30-97D1DCE2283C}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {0931F284-681C-41F1-AF30-97D1DCE2283C}.Debug|Win32.Build.0 = Debug|Win32 14 | {0931F284-681C-41F1-AF30-97D1DCE2283C}.Release|Win32.ActiveCfg = Release|Win32 15 | {0931F284-681C-41F1-AF30-97D1DCE2283C}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /MetaHook_DLL.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MetaHook", "MetaHook_DLL.vcproj", "{0931F284-681C-41F1-AF30-97D1DCE2283C}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {0931F284-681C-41F1-AF30-97D1DCE2283C}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {0931F284-681C-41F1-AF30-97D1DCE2283C}.Debug|Win32.Build.0 = Debug|Win32 14 | {0931F284-681C-41F1-AF30-97D1DCE2283C}.Release|Win32.ActiveCfg = Release|Win32 15 | {0931F284-681C-41F1-AF30-97D1DCE2283C}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /OEPHook.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Detours\detours.h" 3 | 4 | typedef int (CALLBACK *fnWinMain)(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow); 5 | 6 | void HookOEP(void) 7 | { 8 | HMODULE hGameModule = GetModuleHandle(NULL); 9 | PBYTE PEHead = (PBYTE)hGameModule; 10 | PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hGameModule; 11 | PIMAGE_NT_HEADERS pNTHeader = (PIMAGE_NT_HEADERS)&PEHead[pDosHeader->e_lfanew]; 12 | fnWinMain pWinMain = (fnWinMain)&PEHead[pNTHeader->OptionalHeader.AddressOfEntryPoint]; 13 | 14 | DetourTransactionBegin(); 15 | DetourUpdateThread(GetCurrentThread()); 16 | DetourAttach((void**)&pWinMain, WinMain); 17 | DetourTransactionCommit(); 18 | } 19 | 20 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) 21 | { 22 | switch (fdwReason) 23 | { 24 | case DLL_PROCESS_ATTACH: 25 | { 26 | HookOEP(); 27 | } 28 | } 29 | 30 | return TRUE; 31 | } -------------------------------------------------------------------------------- /Plugins/CopyData/Controls/Controls.cpp: -------------------------------------------------------------------------------- 1 | #define _WIN32_WINNT 0x500 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | if (argc < 2) 9 | return 0; 10 | 11 | char *command = argv[1]; 12 | HWND hWnd = FindWindow("Valve001", NULL); 13 | 14 | if (!hWnd) 15 | return 0; 16 | 17 | COPYDATASTRUCT CopyData; 18 | CopyData.lpData = command; 19 | CopyData.cbData = strlen(command); 20 | SendMessage(hWnd, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&CopyData); 21 | return 1; 22 | } -------------------------------------------------------------------------------- /Plugins/CopyData/Controls/Controls.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/Plugins/CopyData/Controls/Controls.vcproj -------------------------------------------------------------------------------- /Plugins/CopyData/CopyData.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CopyData", "CopyData.vcproj", "{FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.Build.0 = Debug|Win32 14 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.ActiveCfg = Release|Win32 15 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Plugins/CopyData/CopyData.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 54 | 57 | 60 | 63 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 94 | 95 | 103 | 106 | 109 | 112 | 115 | 118 | 129 | 132 | 135 | 138 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 171 | 172 | 173 | 174 | 175 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 195 | 196 | 197 | 202 | 205 | 206 | 209 | 210 | 213 | 214 | 217 | 218 | 219 | 224 | 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /Plugins/CopyData/engfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include -------------------------------------------------------------------------------- /Plugins/CopyData/engfuncs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/Plugins/CopyData/engfuncs.h -------------------------------------------------------------------------------- /Plugins/CopyData/exportfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | cl_enginefunc_t gEngfuncs; 4 | 5 | WNDPROC g_MainWndProc; 6 | 7 | LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 8 | { 9 | switch (message) 10 | { 11 | case WM_COPYDATA: 12 | { 13 | COPYDATASTRUCT *pCopyData = (COPYDATASTRUCT*)lParam; 14 | 15 | char command[128]; 16 | strcpy(command, (char *)pCopyData->lpData); 17 | command[pCopyData->cbData] = 0; 18 | 19 | gEngfuncs.pfnClientCmd(command); 20 | return 1; 21 | } 22 | } 23 | 24 | return CallWindowProc(g_MainWndProc, hWnd, message, wParam, lParam); 25 | } 26 | 27 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion) 28 | { 29 | memcpy(&gEngfuncs, pEnginefuncs, sizeof(gEngfuncs)); 30 | 31 | HWND hWnd = FindWindow("Valve001", NULL); 32 | g_MainWndProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC); 33 | SetWindowLong(hWnd, GWL_WNDPROC, (LONG)MainWndProc); 34 | 35 | return gExportfuncs.Initialize(pEnginefuncs, iVersion); 36 | } -------------------------------------------------------------------------------- /Plugins/CopyData/exportfuncs.h: -------------------------------------------------------------------------------- 1 | extern cl_enginefunc_t gEngfuncs; 2 | 3 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion); -------------------------------------------------------------------------------- /Plugins/CopyData/plugins.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "exportfuncs.h" 3 | 4 | cl_exportfuncs_t gExportfuncs; 5 | mh_interface_t *g_pInterface; 6 | metahook_api_t *g_pMetaHookAPI; 7 | mh_enginesave_t *g_pMetaSave; 8 | 9 | void IPlugins::Init(metahook_api_t *pAPI, mh_interface_t *pInterface, mh_enginesave_t *pSave) 10 | { 11 | g_pInterface = pInterface; 12 | g_pMetaHookAPI = pAPI; 13 | g_pMetaSave = pSave; 14 | } 15 | 16 | void IPlugins::Shutdown(void) 17 | { 18 | } 19 | 20 | void IPlugins::LoadEngine(void) 21 | { 22 | } 23 | 24 | void IPlugins::LoadClient(cl_exportfuncs_t *pExportFunc) 25 | { 26 | memcpy(&gExportfuncs, pExportFunc, sizeof(gExportfuncs)); 27 | 28 | pExportFunc->Initialize = Initialize; 29 | } 30 | 31 | void IPlugins::ExitGame(int iResult) 32 | { 33 | } 34 | 35 | EXPOSE_SINGLE_INTERFACE(IPlugins, IPlugins, METAHOOK_PLUGIN_API_VERSION); -------------------------------------------------------------------------------- /Plugins/FuckWorld/FuckWorld.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FuckWorld", "FuckWorld.vcproj", "{FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.Build.0 = Debug|Win32 14 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.ActiveCfg = Release|Win32 15 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Plugins/FuckWorld/FuckWorld.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 54 | 57 | 60 | 63 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 94 | 95 | 103 | 106 | 109 | 112 | 115 | 118 | 129 | 132 | 135 | 138 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 171 | 172 | 173 | 174 | 175 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 195 | 196 | 197 | 202 | 205 | 206 | 209 | 210 | 213 | 214 | 217 | 218 | 219 | 224 | 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /Plugins/FuckWorld/engfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include -------------------------------------------------------------------------------- /Plugins/FuckWorld/engfuncs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/Plugins/FuckWorld/engfuncs.h -------------------------------------------------------------------------------- /Plugins/FuckWorld/exportfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | cl_enginefunc_t gEngfuncs; 4 | 5 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion) 6 | { 7 | memcpy(&gEngfuncs, pEnginefuncs, sizeof(gEngfuncs)); 8 | return gExportfuncs.Initialize(pEnginefuncs, iVersion); 9 | } 10 | 11 | void HUD_Init(void) 12 | { 13 | return gExportfuncs.HUD_Init(); 14 | } 15 | 16 | int HUD_Redraw(float time, int intermission) 17 | { 18 | static int count = 0; 19 | 20 | if (count < 10) 21 | { 22 | gEngfuncs.Con_Printf("Fuck World!!!!! (hit:%d)\n", count + 1); 23 | count++; 24 | } 25 | 26 | return gExportfuncs.HUD_Redraw(time, intermission); 27 | } -------------------------------------------------------------------------------- /Plugins/FuckWorld/exportfuncs.h: -------------------------------------------------------------------------------- 1 | extern cl_enginefunc_t gEngfuncs; 2 | 3 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion); 4 | void HUD_Init(void); 5 | int HUD_Redraw(float time, int intermission); -------------------------------------------------------------------------------- /Plugins/FuckWorld/plugins.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "exportfuncs.h" 3 | 4 | cl_exportfuncs_t gExportfuncs; 5 | mh_interface_t *g_pInterface; 6 | metahook_api_t *g_pMetaHookAPI; 7 | mh_enginesave_t *g_pMetaSave; 8 | 9 | void IPlugins::Init(metahook_api_t *pAPI, mh_interface_t *pInterface, mh_enginesave_t *pSave) 10 | { 11 | g_pInterface = pInterface; 12 | g_pMetaHookAPI = pAPI; 13 | g_pMetaSave = pSave; 14 | } 15 | 16 | void IPlugins::Shutdown(void) 17 | { 18 | } 19 | 20 | void IPlugins::LoadEngine(void) 21 | { 22 | } 23 | 24 | void IPlugins::LoadClient(cl_exportfuncs_t *pExportFunc) 25 | { 26 | memcpy(&gExportfuncs, pExportFunc, sizeof(gExportfuncs)); 27 | 28 | pExportFunc->Initialize = Initialize; 29 | pExportFunc->HUD_Init = HUD_Init; 30 | pExportFunc->HUD_Redraw = HUD_Redraw; 31 | } 32 | 33 | void IPlugins::ExitGame(int iResult) 34 | { 35 | } 36 | 37 | EXPOSE_SINGLE_INTERFACE(IPlugins, IPlugins, METAHOOK_PLUGIN_API_VERSION); -------------------------------------------------------------------------------- /Plugins/IMEInput/BaseUI.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "BaseUI.h" 7 | #include "Input.h" 8 | 9 | HINTERFACEMODULE g_hVGUI2; 10 | 11 | void (__fastcall *g_pfnCBaseUI_Initialize)(void *pthis, int, CreateInterfaceFn *factories, int count); 12 | void (__fastcall *g_pfnCBaseUI_Start)(void *pthis, int, struct cl_enginefuncs_s *engineFuncs, int interfaceVersion); 13 | void (__fastcall *g_pfnCBaseUI_Shutdown)(void *pthis, int); 14 | int (__fastcall *g_pfnCBaseUI_Key_Event)(void *pthis, int, int down, int keynum, const char *pszCurrentBinding); 15 | void (__fastcall *g_pfnCBaseUI_CallEngineSurfaceProc)(void *pthis, int, void *hwnd, unsigned int msg, unsigned int wparam, long lparam); 16 | void (__fastcall *g_pfnCBaseUI_Paint)(void *pthis, int, int x, int y, int right, int bottom); 17 | void (__fastcall *g_pfnCBaseUI_HideGameUI)(void *pthis, int); 18 | void (__fastcall *g_pfnCBaseUI_ActivateGameUI)(void *pthis, int); 19 | bool (__fastcall *g_pfnCBaseUI_IsGameUIVisible)(void *pthis, int); 20 | void (__fastcall *g_pfnCBaseUI_HideConsole)(void *pthis, int); 21 | void (__fastcall *g_pfnCBaseUI_ShowConsole)(void *pthis, int); 22 | 23 | class CBaseUI : public IBaseUI 24 | { 25 | public: 26 | virtual void Initialize(CreateInterfaceFn *factories, int count); 27 | virtual void Start(struct cl_enginefuncs_s *engineFuncs, int interfaceVersion); 28 | virtual void Shutdown(void); 29 | virtual int Key_Event(int down, int keynum, const char *pszCurrentBinding); 30 | virtual void CallEngineSurfaceProc(void *hwnd, unsigned int msg, unsigned int wparam, long lparam); 31 | virtual void Paint(int x, int y, int right, int bottom); 32 | virtual void HideGameUI(void); 33 | virtual void ActivateGameUI(void); 34 | virtual bool IsGameUIVisible(void); 35 | virtual void HideConsole(void); 36 | virtual void ShowConsole(void); 37 | }; 38 | 39 | IBaseUI *g_pBaseUI; 40 | vgui::IPanel *g_pPanel; 41 | 42 | void CBaseUI::Initialize(CreateInterfaceFn *factories, int count) 43 | { 44 | g_pfnCBaseUI_Initialize(this, 0, factories, count); 45 | g_hVGUI2 = (HINTERFACEMODULE)GetModuleHandle("vgui2.dll"); 46 | 47 | if (g_hVGUI2) 48 | { 49 | CreateInterfaceFn fnVGUI2CreateInterface = Sys_GetFactory(g_hVGUI2); 50 | CreateInterfaceFn fnEngineCreateInterface = g_pMetaHookAPI->GetEngineFactory(); 51 | 52 | vgui::ISurface *pSurface = (vgui::ISurface *)fnEngineCreateInterface(VGUI_SURFACE_INTERFACE_VERSION, NULL); 53 | vgui::ISchemeManager *pSchemeManager = (vgui::ISchemeManager *)fnVGUI2CreateInterface(VGUI_SCHEME_INTERFACE_VERSION, NULL); 54 | vgui::ILocalize *pLocalize = (vgui::ILocalize *)fnVGUI2CreateInterface(VGUI_LOCALIZE_INTERFACE_VERSION, NULL); 55 | vgui::IInputInternal *pInput = (vgui::IInputInternal *)fnVGUI2CreateInterface(VGUI_INPUT_INTERFACE_VERSION, NULL); 56 | 57 | Input_InstallHook(pInput); 58 | 59 | g_pPanel = (vgui::IPanel *)fnVGUI2CreateInterface(VGUI_PANEL_INTERFACE_VERSION, NULL); 60 | } 61 | } 62 | 63 | void CBaseUI::Start(struct cl_enginefuncs_s *engineFuncs, int interfaceVersion) 64 | { 65 | g_pfnCBaseUI_Start(this, 0, engineFuncs, interfaceVersion); 66 | } 67 | 68 | void CBaseUI::Shutdown(void) 69 | { 70 | g_pfnCBaseUI_Shutdown(this, 0); 71 | } 72 | 73 | int CBaseUI::Key_Event(int down, int keynum, const char *pszCurrentBinding) 74 | { 75 | return g_pfnCBaseUI_Key_Event(this, 0, down, keynum, pszCurrentBinding); 76 | } 77 | 78 | void CBaseUI::CallEngineSurfaceProc(void *hwnd, unsigned int msg, unsigned int wparam, long lparam) 79 | { 80 | g_pfnCBaseUI_CallEngineSurfaceProc(this, 0, hwnd, msg, wparam, lparam); 81 | } 82 | 83 | void CBaseUI::Paint(int x, int y, int right, int bottom) 84 | { 85 | g_pfnCBaseUI_Paint(this, 0, x, y, right, bottom); 86 | } 87 | 88 | void CBaseUI::HideGameUI(void) 89 | { 90 | g_pfnCBaseUI_HideGameUI(this, 0); 91 | } 92 | 93 | void CBaseUI::ActivateGameUI(void) 94 | { 95 | g_pfnCBaseUI_ActivateGameUI(this, 0); 96 | } 97 | 98 | bool CBaseUI::IsGameUIVisible(void) 99 | { 100 | return g_pfnCBaseUI_IsGameUIVisible(this, 0); 101 | } 102 | 103 | void CBaseUI::HideConsole(void) 104 | { 105 | g_pfnCBaseUI_HideConsole(this, 0); 106 | } 107 | 108 | void CBaseUI::ShowConsole(void) 109 | { 110 | g_pfnCBaseUI_ShowConsole(this, 0); 111 | } 112 | 113 | void BaseUI_InstallHook(void) 114 | { 115 | CreateInterfaceFn fnCreateInterface = g_pMetaHookAPI->GetEngineFactory(); 116 | g_pBaseUI = (IBaseUI *)fnCreateInterface(BASEUI_INTERFACE_VERSION, NULL); 117 | 118 | CBaseUI BaseUI; 119 | DWORD *pVFTable = *(DWORD **)&BaseUI; 120 | 121 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 1, (void *)pVFTable[1], (void *&)g_pfnCBaseUI_Initialize); 122 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 2, (void *)pVFTable[2], (void *&)g_pfnCBaseUI_Start); 123 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 3, (void *)pVFTable[3], (void *&)g_pfnCBaseUI_Shutdown); 124 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 4, (void *)pVFTable[4], (void *&)g_pfnCBaseUI_Key_Event); 125 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 5, (void *)pVFTable[5], (void *&)g_pfnCBaseUI_CallEngineSurfaceProc); 126 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 6, (void *)pVFTable[6], (void *&)g_pfnCBaseUI_Paint); 127 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 7, (void *)pVFTable[7], (void *&)g_pfnCBaseUI_HideGameUI); 128 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 8, (void *)pVFTable[8], (void *&)g_pfnCBaseUI_ActivateGameUI); 129 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 9, (void *)pVFTable[9], (void *&)g_pfnCBaseUI_IsGameUIVisible); 130 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 10, (void *)pVFTable[10], (void *&)g_pfnCBaseUI_HideConsole); 131 | g_pMetaHookAPI->VFTHook(g_pBaseUI, 0, 11, (void *)pVFTable[11], (void *&)g_pfnCBaseUI_ShowConsole); 132 | } -------------------------------------------------------------------------------- /Plugins/IMEInput/BaseUI.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern vgui::IPanel *g_pPanel; 4 | void BaseUI_InstallHook(void); -------------------------------------------------------------------------------- /Plugins/IMEInput/Encode.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *UTF8ToUnicode(const char *str) 4 | { 5 | static wchar_t result[1024]; 6 | int len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); 7 | MultiByteToWideChar(CP_UTF8, 0, str, -1, result, len); 8 | result[len] = L'\0'; 9 | return result; 10 | } 11 | 12 | wchar_t *ANSIToUnicode(const char *str) 13 | { 14 | static wchar_t result[1024]; 15 | int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); 16 | MultiByteToWideChar(CP_ACP, 0, str, -1, result, len); 17 | result[len] = '\0'; 18 | return result; 19 | } 20 | 21 | char *UnicodeToUTF8(const wchar_t *str) 22 | { 23 | static char result[1024]; 24 | int len = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL); 25 | WideCharToMultiByte(CP_UTF8, 0, str, -1, result, len, NULL, NULL); 26 | result[len] = '\0'; 27 | return result; 28 | } 29 | 30 | char *UnicodeToANSI(const wchar_t *str) 31 | { 32 | static char result[1024]; 33 | int len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); 34 | WideCharToMultiByte(CP_ACP, 0, str, -1, result, len, NULL, NULL); 35 | result[len] = '\0'; 36 | return result; 37 | } -------------------------------------------------------------------------------- /Plugins/IMEInput/Encode.h: -------------------------------------------------------------------------------- 1 | wchar_t *UTF8ToUnicode(const char *str); 2 | wchar_t *ANSIToUnicode(const char *str); 3 | char *UnicodeToUTF8(const wchar_t *str); 4 | char *UnicodeToANSI(const wchar_t *str); -------------------------------------------------------------------------------- /Plugins/IMEInput/IMEInput.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "IMEInput.h" 6 | #include "Encode.h" 7 | #include "cmd.h" 8 | #include "plugins.h" 9 | 10 | WNDPROC g_MainWndProc; 11 | char g_szInputBuffer[4096]; 12 | char *g_pszInputCommand; 13 | int *g_piEngineKeyDest; 14 | int (*g_pfnVGuiWrap2_IsConsoleVisible)(void); 15 | void (*g_pfnKey_Message)(int key); 16 | int (*g_pfnDrawConsoleString)(int x, int y, char *string); 17 | 18 | void IMEIN_KeyEvent(int key) 19 | { 20 | if (key == K_ENTER || key == K_KP_ENTER) 21 | { 22 | static char command[276]; 23 | sprintf(command, "%s \"%s\"", g_pszInputCommand, g_szInputBuffer); 24 | gEngfuncs.pfnClientCmd(command); 25 | g_szInputBuffer[0] = '\0'; 26 | *g_piEngineKeyDest = 0; 27 | } 28 | else if (key == K_ESCAPE) 29 | { 30 | g_szInputBuffer[0] = '\0'; 31 | *g_piEngineKeyDest = 0; 32 | } 33 | } 34 | 35 | int IMEIN_DrawConsoleString(int x, int y, char *string) 36 | { 37 | int result = 0; 38 | 39 | if (*g_piEngineKeyDest == 1) 40 | { 41 | static int need = 0; 42 | 43 | if (string == g_pszInputCommand) 44 | { 45 | need = 3; 46 | result = g_pfnDrawConsoleString(x, y, string); 47 | } 48 | else if (need == 1) 49 | result = g_pfnDrawConsoleString(x, y, g_szInputBuffer); 50 | else 51 | result = g_pfnDrawConsoleString(x, y, string); 52 | 53 | need--; 54 | } 55 | else 56 | result = g_pfnDrawConsoleString(x, y, string); 57 | 58 | return result; 59 | } 60 | 61 | LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 62 | { 63 | switch (message) 64 | { 65 | case WM_CHAR: 66 | { 67 | if (!g_pfnVGuiWrap2_IsConsoleVisible() && *g_piEngineKeyDest == 1) 68 | { 69 | int len = strlen(g_szInputBuffer); 70 | 71 | if (wParam == VK_BACK) 72 | { 73 | if (g_szInputBuffer[len - 1] < 0) 74 | g_szInputBuffer[len - 3] = '\0'; 75 | else 76 | g_szInputBuffer[len - 1] = '\0'; 77 | } 78 | else 79 | { 80 | g_szInputBuffer[len] = wParam; 81 | g_szInputBuffer[len + 1] = '\0'; 82 | } 83 | 84 | return 1; 85 | } 86 | 87 | break; 88 | } 89 | 90 | case WM_IME_CHAR: 91 | { 92 | int len = strlen(g_szInputBuffer); 93 | 94 | if (!g_pfnVGuiWrap2_IsConsoleVisible() && *g_piEngineKeyDest == 1) 95 | { 96 | char buf[3]; 97 | buf[0] = wParam >> 8; 98 | buf[1] = (byte)wParam; 99 | buf[2] = '\0'; 100 | strcat(g_szInputBuffer, UnicodeToUTF8(ANSIToUnicode(buf))); 101 | return 1; 102 | } 103 | 104 | break; 105 | } 106 | } 107 | 108 | return CallWindowProc(g_MainWndProc, hWnd, message, wParam, lParam); 109 | } 110 | 111 | void IMEIN_PatchNonASCIICheck(void) 112 | { 113 | DWORD addr = (DWORD)g_pMetaHookAPI->SearchPattern((void *)((DWORD)gEngfuncs.pNetAPI->SetValueForKey + 0x1B0), 0xFF, "\x83\xFB\x20\x7C\x2A\x83\xFB\x7E", 8); 114 | 115 | if (addr) 116 | { 117 | g_pMetaHookAPI->WriteNOP((void *)addr, 10); 118 | } 119 | 120 | cvar_t *cl_name = gEngfuncs.pfnGetCvarPointer("name"); 121 | 122 | if (cl_name) 123 | { 124 | cl_name->flags &= ~FCVAR_PRINTABLEONLY; 125 | } 126 | } 127 | 128 | void INEIN_InstallHook(void) 129 | { 130 | if (g_dwEngineBuildnum >= 5953) 131 | return; 132 | 133 | for (cmd_function_t *cmd = (cmd_function_t *)gEngfuncs.GetFirstCmdFunctionHandle(); cmd; cmd = cmd->next) 134 | { 135 | if (!strcmp(cmd->name, "toggleconsole")) 136 | { 137 | DWORD addr = (DWORD)cmd->function + 0x1; 138 | g_pfnVGuiWrap2_IsConsoleVisible = (int (*)(void))(addr + *(DWORD *)addr + 0x4); 139 | continue; 140 | } 141 | 142 | if (!strcmp(cmd->name, "escape")) 143 | { 144 | DWORD addr = (DWORD)g_pMetaHookAPI->SearchPattern((void *)((DWORD)cmd->function + 0x40), 0x20, "\x6A\x1B\xE8", 3) + 0x3; 145 | g_pfnKey_Message = (void (*)(int))(addr + *(DWORD *)addr + 0x4); 146 | continue; 147 | } 148 | 149 | if (!strcmp(cmd->name, "messagemode")) 150 | { 151 | DWORD addr = (DWORD)g_pMetaHookAPI->SearchPattern((void *)((DWORD)cmd->function + 0x10), 0x50, "\x83\xC4\x04\x50\x68", 5) + 0x5; 152 | g_pszInputCommand = *(char **)addr; 153 | continue; 154 | } 155 | } 156 | 157 | HWND hWnd = FindWindow("Valve001", NULL); 158 | g_MainWndProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC); 159 | SetWindowLong(hWnd, GWL_WNDPROC, (LONG)MainWndProc); 160 | 161 | IMEIN_PatchNonASCIICheck(); 162 | 163 | g_szInputBuffer[0] = '\0'; 164 | g_piEngineKeyDest = *(int **)((DWORD)g_pMetaHookAPI->SearchPattern((void *)((DWORD)gEngfuncs.VGui_ViewportPaintBackground + 0x10), 0x200, "\x85\xC0\x75\x2A\x83\x3D\x2A\x2A\x2A\x2A\x01", 10) + 0xE); 165 | g_pMetaHookAPI->InlineHook(g_pfnKey_Message, IMEIN_KeyEvent, (void *&)g_pfnKey_Message); 166 | g_pMetaHookAPI->InlineHook(gEngfuncs.pfnDrawConsoleString, IMEIN_DrawConsoleString, (void *&)g_pfnDrawConsoleString); 167 | } -------------------------------------------------------------------------------- /Plugins/IMEInput/IMEInput.h: -------------------------------------------------------------------------------- 1 | void INEIN_InstallHook(void); -------------------------------------------------------------------------------- /Plugins/IMEInput/IMEInput.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IMEInput", "IMEInput.vcproj", "{FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.Build.0 = Debug|Win32 14 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.ActiveCfg = Release|Win32 15 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Plugins/IMEInput/Input.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern vgui::IInputInternal *g_pInput; 5 | void Input_InstallHook(vgui::IInputInternal *pInput); -------------------------------------------------------------------------------- /Plugins/IMEInput/UnicodeVoice.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Encode.h" 3 | 4 | bool g_bUpdateVoiceState; 5 | void (*g_pfnHUD_VoiceStatus)(int entindex, qboolean bTalking); 6 | 7 | void HUD_VoiceStatus(int entindex, qboolean bTalking) 8 | { 9 | g_bUpdateVoiceState = true; 10 | g_pfnHUD_VoiceStatus(entindex, bTalking); 11 | g_bUpdateVoiceState = false; 12 | } 13 | 14 | void GetPlayerInfo(int ent_num, hud_player_info_t *pinfo) 15 | { 16 | gEngfuncs.pfnGetPlayerInfo(ent_num, pinfo); 17 | 18 | if (!g_bUpdateVoiceState) 19 | return; 20 | 21 | pinfo->name = UnicodeToANSI(UTF8ToUnicode(pinfo->name)); 22 | } -------------------------------------------------------------------------------- /Plugins/IMEInput/UnicodeVoice.h: -------------------------------------------------------------------------------- 1 | extern void (*g_pfnHUD_VoiceStatus)(int entindex, qboolean bTalking); 2 | 3 | void GetPlayerInfo(int ent_num, hud_player_info_t *pinfo); 4 | void HUD_VoiceStatus(int entindex, qboolean bTalking); -------------------------------------------------------------------------------- /Plugins/IMEInput/cmd.h: -------------------------------------------------------------------------------- 1 | typedef struct cmd_function_s 2 | { 3 | struct cmd_function_s *next; 4 | char *name; 5 | void (*function)(void); 6 | int flags; 7 | } 8 | cmd_function_t; -------------------------------------------------------------------------------- /Plugins/IMEInput/engfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include -------------------------------------------------------------------------------- /Plugins/IMEInput/engfuncs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/Plugins/IMEInput/engfuncs.h -------------------------------------------------------------------------------- /Plugins/IMEInput/exportfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "IMEInput.h" 3 | #include "UnicodeVoice.h" 4 | 5 | cl_enginefunc_t gEngfuncs; 6 | 7 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion) 8 | { 9 | memcpy(&gEngfuncs, pEnginefuncs, sizeof(gEngfuncs)); 10 | 11 | pEnginefuncs->pfnGetPlayerInfo = GetPlayerInfo; 12 | 13 | INEIN_InstallHook(); 14 | 15 | return gExportfuncs.Initialize(pEnginefuncs, iVersion); 16 | } -------------------------------------------------------------------------------- /Plugins/IMEInput/exportfuncs.h: -------------------------------------------------------------------------------- 1 | extern cl_enginefunc_t gEngfuncs; 2 | 3 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion); -------------------------------------------------------------------------------- /Plugins/IMEInput/plugins.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "exportfuncs.h" 3 | #include "BaseUI.h" 4 | #include "Encode.h" 5 | #include "UnicodeVoice.h" 6 | 7 | cl_exportfuncs_t gExportfuncs; 8 | mh_interface_t *g_pInterface; 9 | metahook_api_t *g_pMetaHookAPI; 10 | mh_enginesave_t *g_pMetaSave; 11 | 12 | DWORD g_dwEngineBuildnum; 13 | 14 | void IPlugins::Init(metahook_api_t *pAPI, mh_interface_t *pInterface, mh_enginesave_t *pSave) 15 | { 16 | g_pInterface = pInterface; 17 | g_pMetaHookAPI = pAPI; 18 | g_pMetaSave = pSave; 19 | } 20 | 21 | void IPlugins::Shutdown(void) 22 | { 23 | } 24 | 25 | void IPlugins::LoadEngine(void) 26 | { 27 | g_dwEngineBuildnum = g_pMetaHookAPI->GetEngineBuildnum(); 28 | 29 | BaseUI_InstallHook(); 30 | } 31 | 32 | void IPlugins::LoadClient(cl_exportfuncs_t *pExportFunc) 33 | { 34 | memcpy(&gExportfuncs, pExportFunc, sizeof(gExportfuncs)); 35 | 36 | pExportFunc->Initialize = Initialize; 37 | 38 | g_pMetaHookAPI->InlineHook(pExportFunc->HUD_VoiceStatus, HUD_VoiceStatus, (void *&)g_pfnHUD_VoiceStatus); 39 | } 40 | 41 | void IPlugins::ExitGame(int iResult) 42 | { 43 | } 44 | 45 | EXPOSE_SINGLE_INTERFACE(IPlugins, IPlugins, METAHOOK_PLUGIN_API_VERSION); -------------------------------------------------------------------------------- /Plugins/IMEInput/plugins.h: -------------------------------------------------------------------------------- 1 | extern DWORD g_dwEngineBuildnum; -------------------------------------------------------------------------------- /Plugins/SniperScope/SniperScope.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SniperScope", "SniperScope.vcproj", "{FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.Build.0 = Debug|Win32 14 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.ActiveCfg = Release|Win32 15 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Plugins/SniperScope/SniperScope.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 54 | 57 | 60 | 63 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 94 | 95 | 103 | 106 | 109 | 112 | 115 | 118 | 129 | 132 | 135 | 138 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 171 | 172 | 173 | 174 | 175 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 195 | 196 | 199 | 200 | 201 | 206 | 209 | 210 | 213 | 214 | 217 | 218 | 221 | 222 | 225 | 226 | 229 | 230 | 231 | 236 | 237 | 238 | 239 | 240 | 241 | -------------------------------------------------------------------------------- /Plugins/SniperScope/engfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include -------------------------------------------------------------------------------- /Plugins/SniperScope/engfuncs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/Plugins/SniperScope/engfuncs.h -------------------------------------------------------------------------------- /Plugins/SniperScope/exportfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "mempatchs.h" 3 | 4 | cl_enginefunc_t gEngfuncs; 5 | 6 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion) 7 | { 8 | memcpy(&gEngfuncs, pEnginefuncs, sizeof(gEngfuncs)); 9 | 10 | MemPatch_Start(MEMPATCH_STEP_INITCLIENT); 11 | 12 | return gExportfuncs.Initialize(pEnginefuncs, iVersion); 13 | } 14 | 15 | void HUD_Init(void) 16 | { 17 | return gExportfuncs.HUD_Init(); 18 | } 19 | 20 | int HUD_Redraw(float time, int intermission) 21 | { 22 | return gExportfuncs.HUD_Redraw(time, intermission); 23 | } -------------------------------------------------------------------------------- /Plugins/SniperScope/exportfuncs.h: -------------------------------------------------------------------------------- 1 | extern cl_enginefunc_t gEngfuncs; 2 | 3 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion); 4 | void HUD_Init(void); 5 | int HUD_Redraw(float time, int intermission); -------------------------------------------------------------------------------- /Plugins/SniperScope/mempatchs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "mempatchs.h" 5 | #include "plugins.h" 6 | 7 | void MemPatch_BlockSniperScope(void) 8 | { 9 | if (g_dwEngineBuildnum >= 5953) 10 | return; 11 | 12 | unsigned char data[] = { 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC2, 0x04, 0x00 }; 13 | DWORD addr = (DWORD)g_pMetaHookAPI->SearchPattern((void *)g_pMetaSave->pExportFuncs->Initialize, 0x100000, "\x83\xEC\x50\xA1\x2A\x2A\x2A\x2A\x89\x4C\x24\x00\x85\xC0", 14); 14 | 15 | if (!addr) 16 | { 17 | MessageBox(NULL, "BlockSniperScope patch failed!", "Warning", MB_ICONWARNING); 18 | return; 19 | } 20 | 21 | g_pMetaHookAPI->WriteMemory((void *)addr, data, sizeof(data)); 22 | } 23 | 24 | void MemPatch_Start(MEMPATCH_STEP step) 25 | { 26 | switch (step) 27 | { 28 | case MEMPATCH_STEP_LOADENGINE: 29 | { 30 | break; 31 | } 32 | 33 | case MEMPATCH_STEP_LOADCLIENT: 34 | { 35 | break; 36 | } 37 | 38 | case MEMPATCH_STEP_INITCLIENT: 39 | { 40 | MemPatch_BlockSniperScope(); 41 | break; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Plugins/SniperScope/mempatchs.h: -------------------------------------------------------------------------------- 1 | typedef enum 2 | { 3 | MEMPATCH_STEP_LOADENGINE, 4 | MEMPATCH_STEP_LOADCLIENT, 5 | MEMPATCH_STEP_INITCLIENT, 6 | } 7 | MEMPATCH_STEP; 8 | 9 | void MemPatch_Start(MEMPATCH_STEP step); -------------------------------------------------------------------------------- /Plugins/SniperScope/plugins.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "exportfuncs.h" 3 | #include "mempatchs.h" 4 | 5 | cl_exportfuncs_t gExportfuncs; 6 | mh_interface_t *g_pInterface; 7 | metahook_api_t *g_pMetaHookAPI; 8 | mh_enginesave_t *g_pMetaSave; 9 | 10 | DWORD g_dwEngineBase, g_dwEngineSize; 11 | DWORD g_dwEngineBuildnum; 12 | 13 | void IPlugins::Init(metahook_api_t *pAPI, mh_interface_t *pInterface, mh_enginesave_t *pSave) 14 | { 15 | g_pInterface = pInterface; 16 | g_pMetaHookAPI = pAPI; 17 | g_pMetaSave = pSave; 18 | } 19 | 20 | void IPlugins::Shutdown(void) 21 | { 22 | } 23 | 24 | void IPlugins::LoadEngine(void) 25 | { 26 | g_dwEngineBuildnum = g_pMetaHookAPI->GetEngineBuildnum(); 27 | g_dwEngineBase = g_pMetaHookAPI->GetEngineBase(); 28 | g_dwEngineSize = g_pMetaHookAPI->GetEngineSize(); 29 | 30 | MemPatch_Start(MEMPATCH_STEP_LOADENGINE); 31 | } 32 | 33 | void IPlugins::LoadClient(cl_exportfuncs_t *pExportFunc) 34 | { 35 | memcpy(&gExportfuncs, pExportFunc, sizeof(gExportfuncs)); 36 | 37 | pExportFunc->Initialize = Initialize; 38 | 39 | MemPatch_Start(MEMPATCH_STEP_LOADCLIENT); 40 | } 41 | 42 | void IPlugins::ExitGame(int iResult) 43 | { 44 | } 45 | 46 | EXPOSE_SINGLE_INTERFACE(IPlugins, IPlugins, METAHOOK_PLUGIN_API_VERSION); -------------------------------------------------------------------------------- /Plugins/SniperScope/plugins.h: -------------------------------------------------------------------------------- 1 | extern HINSTANCE g_hInstance, g_hThisModule, g_hEngineModule; 2 | extern DWORD g_dwEngineBase, g_dwEngineSize; 3 | extern DWORD g_dwEngineBuildnum; 4 | extern DWORD g_iVideoMode; 5 | extern bool g_bIsNewEngine; 6 | extern int g_iVideoWidth, g_iVideoHeight; 7 | extern bool g_bWindowed; 8 | extern bool g_bIsUseSteam; 9 | extern bool g_bIsDebuggerPresent; -------------------------------------------------------------------------------- /Plugins/VGunLag/VGunLag.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VGunLag", "VGunLag.vcproj", "{FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.Build.0 = Debug|Win32 14 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.ActiveCfg = Release|Win32 15 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Plugins/VGunLag/VGunLag.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 54 | 57 | 60 | 63 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 94 | 95 | 103 | 106 | 109 | 112 | 115 | 118 | 129 | 132 | 135 | 138 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 171 | 172 | 173 | 174 | 175 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 195 | 196 | 199 | 200 | 203 | 204 | 205 | 210 | 213 | 214 | 217 | 218 | 221 | 222 | 225 | 226 | 229 | 230 | 233 | 234 | 235 | 240 | 241 | 242 | 243 | 244 | 245 | -------------------------------------------------------------------------------- /Plugins/VGunLag/engfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include -------------------------------------------------------------------------------- /Plugins/VGunLag/engfuncs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/Plugins/VGunLag/engfuncs.h -------------------------------------------------------------------------------- /Plugins/VGunLag/exportfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "plugins.h" 4 | 5 | #define V_CALCGUNANGLE_SIG "\xFF\x15\x2A\x2A\x2A\x2A\x85\xC0\x0F\x84\x2A\x2A\x2A\x2A\x8B\x4C\x24\x04\xD9\x81\x94\x00\x00\x00\xD8\x41\x10\xD9\x98\x58\x0B\x00\x00\xD9\x81\x90\x00\x00\x00\xDC\x0D" 6 | 7 | extern void (*g_pfnV_CalcGunAngle)(ref_params_s *pparams); 8 | void V_CalcGunAngle(ref_params_s *pparams); 9 | 10 | cl_enginefunc_t gEngfuncs; 11 | cvar_t *cl_vgunlag; 12 | 13 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion) 14 | { 15 | memcpy(&gEngfuncs, pEnginefuncs, sizeof(gEngfuncs)); 16 | 17 | g_pfnV_CalcGunAngle = (void (*)(ref_params_s *pparams))g_pMetaHookAPI->SearchPattern((void *)g_pMetaSave->pExportFuncs->HUD_DrawNormalTriangles, 0x100000, V_CALCGUNANGLE_SIG, sizeof(V_CALCGUNANGLE_SIG) - 1); 18 | 19 | if (g_pfnV_CalcGunAngle) 20 | { 21 | g_pMetaHookAPI->InlineHook(g_pfnV_CalcGunAngle, V_CalcGunAngle, (void *&)g_pfnV_CalcGunAngle); 22 | } 23 | 24 | return gExportfuncs.Initialize(pEnginefuncs, iVersion); 25 | } 26 | 27 | void HUD_Init(void) 28 | { 29 | cl_vgunlag = gEngfuncs.pfnRegisterVariable("cl_vgunlag", "0", FCVAR_ARCHIVE); 30 | 31 | return gExportfuncs.HUD_Init(); 32 | } 33 | 34 | int HUD_Redraw(float time, int intermission) 35 | { 36 | return gExportfuncs.HUD_Redraw(time, intermission); 37 | } -------------------------------------------------------------------------------- /Plugins/VGunLag/exportfuncs.h: -------------------------------------------------------------------------------- 1 | extern cl_enginefunc_t gEngfuncs; 2 | 3 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion); 4 | void HUD_Init(void); 5 | int HUD_Redraw(float time, int intermission); -------------------------------------------------------------------------------- /Plugins/VGunLag/mathlib.h: -------------------------------------------------------------------------------- 1 | typedef float vec_t; 2 | typedef vec_t vec3_t[3]; 3 | typedef vec_t vec4_t[4]; 4 | typedef vec_t vec5_t[5]; 5 | 6 | typedef int fixed4_t; 7 | typedef int fixed8_t; 8 | typedef int fixed16_t; 9 | 10 | #define SIDE_FRONT 0 11 | #define SIDE_ON 2 12 | #define SIDE_BACK 1 13 | #define SIDE_CROSS -2 14 | 15 | #ifndef M_PI 16 | #define M_PI 3.14159265358979323846 17 | #endif 18 | 19 | #define Q_PI 3.14159265358979323846 20 | 21 | extern vec3_t vec3_origin; 22 | 23 | #define EQUAL_EPSILON 0.001 24 | #define COLINEAR_EPSILON 0.001 25 | 26 | struct mplane_s; 27 | 28 | extern int nanmask; 29 | 30 | #define IS_NAN(x) (((*(int *)&x)&nanmask) == nanmask) 31 | 32 | #define METERS_PER_INCH 0.0254f 33 | #define METER2INCH(x) (float)(x * (1.0f / METERS_PER_INCH)) 34 | #define INCH2METER(x) (float)(x * (METERS_PER_INCH / 1.0f)) 35 | 36 | #define VectorSubtract(a, b, c) { (c)[0] = (a)[0] - (b)[0]; (c)[1] = (a)[1] - (b)[1]; (c)[2] = (a)[2] - (b)[2]; } 37 | #define VectorAdd(a, b, c) { (c)[0] = (a)[0] + (b)[0]; (c)[1] = (a)[1] + (b)[1]; (c)[2] = (a)[2] + (b)[2]; } 38 | #define VectorCopy(a, b) { (b)[0] = (a)[0]; (b)[1] = (a)[1]; (b)[2] = (a)[2]; } 39 | #define VectorClear(a) { (a)[0] = 0.0; (a)[1] = 0.0; (a)[2] = 0.0; } 40 | #define DotProduct(x, y) ((x)[0] * (y)[0] + (x)[1] * (y)[1] + (x)[2] * (y)[2]) 41 | 42 | void VectorMA(const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc); 43 | 44 | vec_t _DotProduct(vec3_t v1, vec3_t v2); 45 | void _VectorSubtract(vec3_t veca, vec3_t vecb, vec3_t out); 46 | void _VectorAdd(vec3_t veca, vec3_t vecb, vec3_t out); 47 | void _VectorCopy(vec3_t in, vec3_t out); 48 | 49 | int VectorCompare(const vec3_t v1, const vec3_t v2); 50 | double VectorLength(vec3_t v); 51 | void CrossProduct(const vec3_t v1, const vec3_t v2, vec3_t cross); 52 | float VectorNormalize(vec3_t v); 53 | void VectorInverse(vec3_t v); 54 | void VectorScale(const vec3_t in, vec_t scale, vec3_t out); 55 | int Q_log2(int val); 56 | void ClearBounds(vec3_t mins, vec3_t maxs); 57 | 58 | void R_ConcatRotations(float in1[3][3], float in2[3][3], float out[3][3]); 59 | void R_ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]); 60 | 61 | extern short new_cw, old_cw; 62 | 63 | typedef union DLONG 64 | { 65 | int i[2]; 66 | double d; 67 | float f; 68 | } 69 | DLONG; 70 | 71 | extern DLONG dlong; 72 | 73 | #ifdef _WIN32 74 | 75 | void __inline set_fpu_cw(void) 76 | { 77 | _asm 78 | { 79 | wait 80 | fnstcw old_cw 81 | wait 82 | mov ax, word ptr old_cw 83 | or ah, 0xc 84 | mov word ptr new_cw,ax 85 | fldcw new_cw 86 | } 87 | } 88 | 89 | int __inline quick_ftol(float f) 90 | { 91 | _asm 92 | { 93 | fld DWORD PTR f 94 | fistp DWORD PTR dlong 95 | } 96 | 97 | return dlong.i[0]; 98 | } 99 | 100 | void __inline restore_fpu_cw(void) 101 | { 102 | _asm fldcw old_cw 103 | } 104 | 105 | #else 106 | 107 | #define set_fpu_cw() 108 | #define quick_ftol(f) ftol(f) 109 | #define restore_fpu_cw() 110 | 111 | #endif 112 | 113 | void FloorDivMod(double numer, double denom, int *quotient, int *rem); 114 | int GreatestCommonDivisor(int i1, int i2); 115 | void RotatePointAroundVector(vec3_t dst, const vec3_t dir, const vec3_t point, float degrees); 116 | 117 | void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); 118 | void AngleVectorsTranspose(const vec3_t angles, vec3_t *forward, vec3_t *right, vec3_t *up); 119 | 120 | #define AngleIVectors AngleVectorsTranspose 121 | 122 | void AngleMatrix(const vec3_t angles, float (*matrix)[4]); 123 | void AngleIMatrix(const vec3_t angles, float (*matrix)[4]); 124 | void VectorTransform(const vec3_t in1, float in2[3][4], vec3_t out); 125 | 126 | void NormalizeAngles(vec3_t angles); 127 | void InterpolateAngles(vec3_t start, vec3_t end, vec3_t output, float frac); 128 | float AngleBetweenVectors(const vec3_t v1, const vec3_t v2); 129 | 130 | void VectorMatrix(vec3_t forward, vec3_t right, vec3_t up); 131 | void VectorAngles(const vec3_t forward, vec3_t angles); 132 | 133 | int InvertMatrix(const float * m, float *out); 134 | 135 | int BoxOnPlaneSide(vec3_t emins, vec3_t emaxs, struct mplane_s *plane); 136 | 137 | float anglemod(float a); 138 | 139 | #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ 140 | (((p)->type < 3) ? \ 141 | ( \ 142 | ((p)->dist <= (emins)[(p)->type]) ? \ 143 | 1 \ 144 | : \ 145 | ( \ 146 | ((p)->dist >= (emaxs)[(p)->type]) ? \ 147 | 2 \ 148 | : \ 149 | 3 \ 150 | ) \ 151 | ) \ 152 | : \ 153 | BoxOnPlaneSide((emins), (emaxs), (p))) -------------------------------------------------------------------------------- /Plugins/VGunLag/plugins.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "exportfuncs.h" 3 | 4 | cl_exportfuncs_t gExportfuncs; 5 | mh_interface_t *g_pInterface; 6 | metahook_api_t *g_pMetaHookAPI; 7 | mh_enginesave_t *g_pMetaSave; 8 | 9 | DWORD g_dwEngineBase, g_dwEngineSize; 10 | DWORD g_dwEngineBuildnum; 11 | 12 | void IPlugins::Init(metahook_api_t *pAPI, mh_interface_t *pInterface, mh_enginesave_t *pSave) 13 | { 14 | g_pInterface = pInterface; 15 | g_pMetaHookAPI = pAPI; 16 | g_pMetaSave = pSave; 17 | } 18 | 19 | void IPlugins::Shutdown(void) 20 | { 21 | } 22 | 23 | void IPlugins::LoadEngine(void) 24 | { 25 | g_dwEngineBuildnum = g_pMetaHookAPI->GetEngineBuildnum(); 26 | g_dwEngineBase = g_pMetaHookAPI->GetEngineBase(); 27 | g_dwEngineSize = g_pMetaHookAPI->GetEngineSize(); 28 | } 29 | 30 | void IPlugins::LoadClient(cl_exportfuncs_t *pExportFunc) 31 | { 32 | memcpy(&gExportfuncs, pExportFunc, sizeof(gExportfuncs)); 33 | 34 | pExportFunc->Initialize = Initialize; 35 | pExportFunc->HUD_Init = HUD_Init; 36 | } 37 | 38 | void IPlugins::ExitGame(int iResult) 39 | { 40 | } 41 | 42 | EXPOSE_SINGLE_INTERFACE(IPlugins, IPlugins, METAHOOK_PLUGIN_API_VERSION); -------------------------------------------------------------------------------- /Plugins/VGunLag/plugins.h: -------------------------------------------------------------------------------- 1 | extern HINSTANCE g_hInstance, g_hThisModule, g_hEngineModule; 2 | extern DWORD g_dwEngineBase, g_dwEngineSize; 3 | extern DWORD g_dwEngineBuildnum; 4 | extern DWORD g_iVideoMode; 5 | extern bool g_bIsNewEngine; 6 | extern int g_iVideoWidth, g_iVideoHeight; 7 | extern bool g_bWindowed; 8 | extern bool g_bIsUseSteam; 9 | extern bool g_bIsDebuggerPresent; -------------------------------------------------------------------------------- /Plugins/VGunLag/view.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "mathlib.h" 4 | 5 | extern cvar_t *cl_vgunlag; 6 | 7 | void (*g_pfnV_CalcGunAngle)(ref_params_s *pparams); 8 | vec3_t v_lastFacing; 9 | 10 | void V_CalcGunlLag(struct ref_params_s *pparams) 11 | { 12 | float speed; 13 | float diff; 14 | vec3_t newOrigin; 15 | vec3_t vecDiff; 16 | vec3_t forward, right, up; 17 | float pitch; 18 | 19 | AngleVectors(pparams->viewangles, forward, right, up); 20 | 21 | if (pparams->frametime != 0.0f) 22 | { 23 | VectorSubtract(forward, v_lastFacing, vecDiff); 24 | 25 | speed = 5.0f; 26 | diff = VectorLength(vecDiff); 27 | 28 | if ((diff > cl_vgunlag->value) && (cl_vgunlag->value > 0.0f)) 29 | speed *= diff * cl_vgunlag->value; 30 | 31 | v_lastFacing[0] += vecDiff[0] * (speed * pparams->frametime); 32 | v_lastFacing[1] += vecDiff[1] * (speed * pparams->frametime); 33 | v_lastFacing[2] += vecDiff[2] * (speed * pparams->frametime); 34 | 35 | VectorNormalize(v_lastFacing); 36 | 37 | newOrigin[0] = pparams->vieworg[0] + (vecDiff[0] * -1.0f) * speed; 38 | newOrigin[1] = pparams->vieworg[1] + (vecDiff[1] * -1.0f) * speed; 39 | newOrigin[2] = pparams->vieworg[2] + (vecDiff[2] * -1.0f) * speed; 40 | } 41 | 42 | if (cl_vgunlag->value > 0.0f) 43 | { 44 | pitch = pparams->viewangles[2]; 45 | 46 | if (pitch > 180.0f) 47 | pitch -= 360.0f; 48 | else if (pitch < -180.0f) 49 | pitch += 360.0f; 50 | 51 | VectorScale(forward, -pitch * 0.035f, forward); 52 | VectorScale(right, -pitch * 0.03f, right); 53 | VectorScale(up, -pitch * 0.02f, up); 54 | VectorAdd(newOrigin, forward, newOrigin); 55 | VectorAdd(newOrigin, right, newOrigin); 56 | VectorAdd(newOrigin, up, newOrigin); 57 | VectorCopy(newOrigin, pparams->vieworg); 58 | } 59 | } 60 | 61 | void V_CalcGunAngle(ref_params_s *pparams) 62 | { 63 | g_pfnV_CalcGunAngle(pparams); 64 | 65 | V_CalcGunlLag(pparams); 66 | } -------------------------------------------------------------------------------- /Plugins/WideScreen/WideScreen.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WideScreen", "WideScreen.vcproj", "{FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Debug|Win32.Build.0 = Debug|Win32 14 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.ActiveCfg = Release|Win32 15 | {FBF9CAF6-8DED-4EB0-8E7B-18294607C5C5}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Plugins/WideScreen/WideScreen.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 54 | 57 | 60 | 63 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 94 | 95 | 103 | 106 | 109 | 112 | 115 | 118 | 129 | 132 | 135 | 138 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 171 | 172 | 173 | 174 | 175 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 195 | 196 | 199 | 200 | 201 | 206 | 209 | 210 | 213 | 214 | 217 | 218 | 221 | 222 | 225 | 226 | 229 | 230 | 231 | 236 | 237 | 238 | 239 | 240 | 241 | -------------------------------------------------------------------------------- /Plugins/WideScreen/engfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include -------------------------------------------------------------------------------- /Plugins/WideScreen/engfuncs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/Plugins/WideScreen/engfuncs.h -------------------------------------------------------------------------------- /Plugins/WideScreen/exportfuncs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "mempatchs.h" 3 | 4 | cl_enginefunc_t gEngfuncs; 5 | 6 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion) 7 | { 8 | memcpy(&gEngfuncs, pEnginefuncs, sizeof(gEngfuncs)); 9 | 10 | MemPatch_Start(MEMPATCH_STEP_INITCLIENT); 11 | 12 | return gExportfuncs.Initialize(pEnginefuncs, iVersion); 13 | } 14 | 15 | void HUD_Init(void) 16 | { 17 | return gExportfuncs.HUD_Init(); 18 | } 19 | 20 | int HUD_Redraw(float time, int intermission) 21 | { 22 | return gExportfuncs.HUD_Redraw(time, intermission); 23 | } -------------------------------------------------------------------------------- /Plugins/WideScreen/exportfuncs.h: -------------------------------------------------------------------------------- 1 | extern cl_enginefunc_t gEngfuncs; 2 | 3 | int Initialize(struct cl_enginefuncs_s *pEnginefuncs, int iVersion); 4 | void HUD_Init(void); 5 | int HUD_Redraw(float time, int intermission); -------------------------------------------------------------------------------- /Plugins/WideScreen/mempatchs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "mempatchs.h" 5 | #include "plugins.h" 6 | 7 | void MemPatch_WideScreenLimit(void) 8 | { 9 | if (g_dwEngineBuildnum >= 5953) 10 | return; 11 | 12 | DWORD addr = (DWORD)g_pMetaHookAPI->SearchPattern((void *)g_dwEngineBase, g_dwEngineSize, "\x8B\x51\x08\x8B\x41\x0C\x8B\x71\x54\x8B\xFA\xC1\xE7\x04", 14); 13 | 14 | if (!addr) 15 | { 16 | MessageBox(NULL, "WideScreenLimit patch failed!", "Warning", MB_ICONWARNING); 17 | return; 18 | } 19 | 20 | DWORD addr2 = addr + 11; 21 | DWORD addr3 = (DWORD)g_pMetaHookAPI->SearchPattern((void *)addr, 0x60, "\xB1\x01\x8B\x7C\x24\x14", 6); 22 | 23 | if (addr3) 24 | { 25 | g_pMetaHookAPI->WriteNOP((void *)addr2, addr3 - addr2); 26 | } 27 | } 28 | 29 | void MemPatch_Start(MEMPATCH_STEP step) 30 | { 31 | switch (step) 32 | { 33 | case MEMPATCH_STEP_LOADENGINE: 34 | { 35 | MemPatch_WideScreenLimit(); 36 | break; 37 | } 38 | 39 | case MEMPATCH_STEP_LOADCLIENT: 40 | { 41 | break; 42 | } 43 | 44 | case MEMPATCH_STEP_INITCLIENT: 45 | { 46 | break; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Plugins/WideScreen/mempatchs.h: -------------------------------------------------------------------------------- 1 | typedef enum 2 | { 3 | MEMPATCH_STEP_LOADENGINE, 4 | MEMPATCH_STEP_LOADCLIENT, 5 | MEMPATCH_STEP_INITCLIENT, 6 | } 7 | MEMPATCH_STEP; 8 | 9 | void MemPatch_Start(MEMPATCH_STEP step); -------------------------------------------------------------------------------- /Plugins/WideScreen/plugins.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "exportfuncs.h" 3 | #include "mempatchs.h" 4 | 5 | cl_exportfuncs_t gExportfuncs; 6 | mh_interface_t *g_pInterface; 7 | metahook_api_t *g_pMetaHookAPI; 8 | mh_enginesave_t *g_pMetaSave; 9 | 10 | DWORD g_dwEngineBase, g_dwEngineSize; 11 | DWORD g_dwEngineBuildnum; 12 | 13 | void IPlugins::Init(metahook_api_t *pAPI, mh_interface_t *pInterface, mh_enginesave_t *pSave) 14 | { 15 | g_pInterface = pInterface; 16 | g_pMetaHookAPI = pAPI; 17 | g_pMetaSave = pSave; 18 | } 19 | 20 | void IPlugins::Shutdown(void) 21 | { 22 | } 23 | 24 | void IPlugins::LoadEngine(void) 25 | { 26 | g_dwEngineBuildnum = g_pMetaHookAPI->GetEngineBuildnum(); 27 | g_dwEngineBase = g_pMetaHookAPI->GetEngineBase(); 28 | g_dwEngineSize = g_pMetaHookAPI->GetEngineSize(); 29 | 30 | MemPatch_Start(MEMPATCH_STEP_LOADENGINE); 31 | } 32 | 33 | void IPlugins::LoadClient(cl_exportfuncs_t *pExportFunc) 34 | { 35 | memcpy(&gExportfuncs, pExportFunc, sizeof(gExportfuncs)); 36 | 37 | MemPatch_Start(MEMPATCH_STEP_LOADCLIENT); 38 | } 39 | 40 | void IPlugins::ExitGame(int iResult) 41 | { 42 | } 43 | 44 | EXPOSE_SINGLE_INTERFACE(IPlugins, IPlugins, METAHOOK_PLUGIN_API_VERSION); -------------------------------------------------------------------------------- /Plugins/WideScreen/plugins.h: -------------------------------------------------------------------------------- 1 | extern HINSTANCE g_hInstance, g_hThisModule, g_hEngineModule; 2 | extern DWORD g_dwEngineBase, g_dwEngineSize; 3 | extern DWORD g_dwEngineBuildnum; 4 | extern DWORD g_iVideoMode; 5 | extern bool g_bIsNewEngine; 6 | extern int g_iVideoWidth, g_iVideoHeight; 7 | extern bool g_bWindowed; 8 | extern bool g_bIsUseSteam; 9 | extern bool g_bIsDebuggerPresent; -------------------------------------------------------------------------------- /cdll_export.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | typedef struct cl_exportfuncs_s 5 | { 6 | INITIALIZE_FUNC Initialize; 7 | HUD_INIT_FUNC HUD_Init; 8 | HUD_VIDINIT_FUNC HUD_VidInit; 9 | HUD_REDRAW_FUNC HUD_Redraw; 10 | HUD_UPDATECLIENTDATA_FUNC HUD_UpdateClientData; 11 | HUD_RESET_FUNC HUD_Reset; 12 | HUD_CLIENTMOVE_FUNC HUD_PlayerMove; 13 | HUD_CLIENTMOVEINIT_FUNC HUD_PlayerMoveInit; 14 | HUD_TEXTURETYPE_FUNC HUD_PlayerMoveTexture; 15 | HUD_IN_ACTIVATEMOUSE_FUNC IN_ActivateMouse; 16 | HUD_IN_DEACTIVATEMOUSE_FUNC IN_DeactivateMouse; 17 | HUD_IN_MOUSEEVENT_FUNC IN_MouseEvent; 18 | HUD_IN_CLEARSTATES_FUNC IN_ClearStates; 19 | HUD_IN_ACCUMULATE_FUNC IN_Accumulate; 20 | HUD_CL_CREATEMOVE_FUNC CL_CreateMove; 21 | HUD_CL_ISTHIRDPERSON_FUNC CL_IsThirdPerson; 22 | HUD_CL_GETCAMERAOFFSETS_FUNC CL_CameraOffset; 23 | HUD_KB_FIND_FUNC KB_Find; 24 | HUD_CAMTHINK_FUNC CAM_Think; 25 | HUD_CALCREF_FUNC V_CalcRefdef; 26 | HUD_ADDENTITY_FUNC HUD_AddEntity; 27 | HUD_CREATEENTITIES_FUNC HUD_CreateEntities; 28 | HUD_DRAWNORMALTRIS_FUNC HUD_DrawNormalTriangles; 29 | HUD_DRAWTRANSTRIS_FUNC HUD_DrawTransparentTriangles; 30 | HUD_STUDIOEVENT_FUNC HUD_StudioEvent; 31 | HUD_POSTRUNCMD_FUNC HUD_PostRunCmd; 32 | HUD_SHUTDOWN_FUNC HUD_Shutdown; 33 | HUD_TXFERLOCALOVERRIDES_FUNC HUD_TxferLocalOverrides; 34 | HUD_PROCESSPLAYERSTATE_FUNC HUD_ProcessPlayerState; 35 | HUD_TXFERPREDICTIONDATA_FUNC HUD_TxferPredictionData; 36 | HUD_DEMOREAD_FUNC Demo_ReadBuffer; 37 | HUD_CONNECTIONLESS_FUNC HUD_ConnectionlessPacket; 38 | HUD_GETHULLBOUNDS_FUNC HUD_GetHullBounds; 39 | HUD_FRAME_FUNC HUD_Frame; 40 | HUD_KEY_EVENT_FUNC HUD_Key_Event; 41 | HUD_TEMPENTUPDATE_FUNC HUD_TempEntUpdate; 42 | HUD_GETUSERENTITY_FUNC HUD_GetUserEntity; 43 | HUD_VOICESTATUS_FUNC HUD_VoiceStatus; 44 | HUD_DIRECTORMESSAGE_FUNC HUD_DirectorMessage; 45 | HUD_STUDIO_INTERFACE_FUNC HUD_GetStudioModelInterface; 46 | HUD_CHATINPUTPOSITION_FUNC HUD_ChatInputPosition; 47 | HUD_GETPLAYERTEAM HUD_GetPlayerTeam; 48 | CLIENTFACTORY ClientFactory; 49 | } 50 | cl_exportfuncs_t; 51 | 52 | extern cl_exportfuncs_t gExportfuncs; -------------------------------------------------------------------------------- /metahook.h: -------------------------------------------------------------------------------- 1 | #ifndef _METAHOOK_H 2 | #define _METAHOOK_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | typedef float vec_t; 10 | typedef float vec2_t[2]; 11 | typedef float vec3_t[3]; 12 | 13 | #include 14 | #include 15 | 16 | typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf); 17 | 18 | #include 19 | #include 20 | 21 | typedef struct hook_s hook_t; 22 | 23 | #define VIDEOMODE_SOFTWARE 0 24 | #define VIDEOMODE_OPENGL 1 25 | #define VIDEOMODE_D3D 2 26 | 27 | typedef struct metahook_api_s 28 | { 29 | BOOL (*UnHook)(hook_t *pHook); 30 | hook_t *(*InlineHook)(void *pOldFuncAddr, void *pNewFuncAddr, void *&pCallBackFuncAddr); 31 | hook_t *(*VFTHook)(void *pClass, int iTableIndex, int iFuncIndex, void *pNewFuncAddr, void *&pCallBackFuncAddr); 32 | hook_t *(*IATHook)(HMODULE hModule, const char *pszModuleName, const char *pszFuncName, void *pNewFuncAddr, void *&pCallBackFuncAddr); 33 | void *(*GetClassFuncAddr)(...); 34 | DWORD (*GetModuleBase)(HMODULE hModule); 35 | DWORD (*GetModuleSize)(HMODULE hModule); 36 | HMODULE (*GetEngineModule)(void); 37 | DWORD (*GetEngineBase)(void); 38 | DWORD (*GetEngineSize)(void); 39 | void *(*SearchPattern)(void *pStartSearch, DWORD dwSearchLen, char *pPattern, DWORD dwPatternLen); 40 | void (*WriteDWORD)(void *pAddress, DWORD dwValue); 41 | DWORD (*ReadDWORD)(void *pAddress); 42 | DWORD (*WriteMemory)(void *pAddress, BYTE *pData, DWORD dwDataSize); 43 | DWORD (*ReadMemory)(void *pAddress, BYTE *pData, DWORD dwDataSize); 44 | DWORD (*GetVideoMode)(int *width, int *height, int *bpp, bool *windowed); 45 | DWORD (*GetEngineBuildnum)(void); 46 | CreateInterfaceFn (*GetEngineFactory)(void); 47 | DWORD (*GetNextCallAddr)(void *pAddress, DWORD dwCount); 48 | void (*WriteBYTE)(void *pAddress, BYTE ucValue); 49 | BYTE (*ReadBYTE)(void *pAddress); 50 | void (*WriteNOP)(void *pAddress, DWORD dwCount); 51 | } 52 | metahook_api_t; 53 | 54 | typedef struct mh_enginesave_s 55 | { 56 | cl_exportfuncs_t *pExportFuncs; 57 | cl_enginefunc_t *pEngineFuncs; 58 | } 59 | mh_enginesave_t; 60 | 61 | void MH_FreeAllHook(void); 62 | void MH_Init(const char *pszGameName); 63 | void MH_LoadClient(cl_exportfuncs_t *pExportFuncs, cl_exportfuncs_t *pCallExportFuncs); 64 | void MH_LoadEngine(HMODULE hModule); 65 | void MH_ExitGame(int iResult); 66 | void MH_Shutdown(void); 67 | 68 | #include 69 | #include 70 | #include 71 | 72 | typedef struct mh_interface_s 73 | { 74 | ICommandLine *CommandLine; 75 | IFileSystem *FileSystem; 76 | IRegistry *Registry; 77 | } 78 | mh_interface_t; 79 | 80 | #include 81 | 82 | extern mh_interface_t *g_pInterface; 83 | extern cl_enginefunc_t gEngfuncs; 84 | extern metahook_api_t *g_pMetaHookAPI; 85 | extern mh_enginesave_t *g_pMetaSave; 86 | 87 | #endif -------------------------------------------------------------------------------- /msvcrt.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nagist/metahook/8500b5c59eec031f2de08c0c7408014fbf3ad378/msvcrt.lib -------------------------------------------------------------------------------- /registry.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "IRegistry.h" 3 | 4 | class CRegistry : public IRegistry 5 | { 6 | public: 7 | CRegistry(void); 8 | virtual ~CRegistry(void); 9 | 10 | public: 11 | void Init(void); 12 | void Shutdown(void); 13 | int ReadInt(const char *key, int defaultValue = 0); 14 | void WriteInt(const char *key, int value); 15 | const char *ReadString(const char *key, const char *defaultValue = NULL); 16 | void WriteString(const char *key, const char *value); 17 | 18 | private: 19 | bool m_bValid; 20 | HKEY m_hKey; 21 | }; 22 | 23 | static CRegistry g_Registry; 24 | IRegistry *registry = (IRegistry *)&g_Registry; 25 | 26 | CRegistry::CRegistry(void) 27 | { 28 | m_bValid = false; 29 | m_hKey = 0; 30 | } 31 | 32 | CRegistry::~CRegistry(void) 33 | { 34 | } 35 | 36 | int CRegistry::ReadInt(const char *key, int defaultValue) 37 | { 38 | LONG lResult; 39 | DWORD dwType; 40 | DWORD dwSize; 41 | 42 | int value; 43 | 44 | if (!m_bValid) 45 | return defaultValue; 46 | 47 | dwSize = sizeof(DWORD); 48 | lResult = RegQueryValueEx(m_hKey, key, 0, &dwType, (LPBYTE)&value, &dwSize); 49 | 50 | if (lResult != ERROR_SUCCESS) 51 | return defaultValue; 52 | 53 | if (dwType != REG_DWORD) 54 | return defaultValue; 55 | 56 | return value; 57 | } 58 | 59 | void CRegistry::WriteInt(const char *key, int value) 60 | { 61 | DWORD dwSize; 62 | 63 | if (!m_bValid) 64 | return; 65 | 66 | dwSize = sizeof(DWORD); 67 | RegSetValueEx(m_hKey, key, 0, REG_DWORD, (LPBYTE)&value, dwSize); 68 | } 69 | 70 | const char *CRegistry::ReadString(const char *key, const char *defaultValue) 71 | { 72 | LONG lResult; 73 | DWORD dwType; 74 | DWORD dwSize = 512; 75 | 76 | static char value[512]; 77 | value[0] = 0; 78 | 79 | if (!m_bValid) 80 | return defaultValue; 81 | 82 | lResult = RegQueryValueEx(m_hKey, key, 0, &dwType, (unsigned char *)value, &dwSize); 83 | 84 | if (lResult != ERROR_SUCCESS) 85 | return defaultValue; 86 | 87 | if (dwType != REG_SZ) 88 | return defaultValue; 89 | 90 | return value; 91 | } 92 | 93 | void CRegistry::WriteString(const char *key, const char *value) 94 | { 95 | DWORD dwSize; 96 | 97 | if (!m_bValid) 98 | return; 99 | 100 | dwSize = (DWORD)(strlen(value) + 1); 101 | RegSetValueEx(m_hKey, key, 0, REG_SZ, (LPBYTE)value, dwSize); 102 | } 103 | 104 | static char *GetPlatformName(void) 105 | { 106 | return "Half-Life"; 107 | } 108 | 109 | void CRegistry::Init(void) 110 | { 111 | LONG lResult; 112 | DWORD dwDisposition; 113 | 114 | char szModelKey[1024]; 115 | wsprintf(szModelKey, "Software\\Valve\\%s\\Settings\\", GetPlatformName()); 116 | lResult = RegCreateKeyEx(HKEY_CURRENT_USER, szModelKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &m_hKey, &dwDisposition); 117 | 118 | if (lResult != ERROR_SUCCESS) 119 | { 120 | m_bValid = false; 121 | return; 122 | } 123 | 124 | m_bValid = true; 125 | } 126 | 127 | void CRegistry::Shutdown(void) 128 | { 129 | if (!m_bValid) 130 | return; 131 | 132 | m_bValid = false; 133 | RegCloseKey(m_hKey); 134 | } -------------------------------------------------------------------------------- /sys.h: -------------------------------------------------------------------------------- 1 | BOOL Sys_CloseDEP(void); 2 | BOOL Sys_GetExecutableName(char *pszName, int nSize); 3 | char *Sys_GetLongPathName(void); -------------------------------------------------------------------------------- /sys_launcher.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | typedef LONG NTSTATUS; 4 | typedef NTSTATUS *PNTSTATUS; 5 | 6 | #define STATUS_SUCCESS ((NTSTATUS)0x00000000) 7 | 8 | #define MEM_EXECUTE_OPTION_DISABLE 0x1 9 | #define MEM_EXECUTE_OPTION_ENABLE 0x2 10 | #define MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION 0x4 11 | #define MEM_EXECUTE_OPTION_PERMANENT 0x8 12 | #define MEM_EXECUTE_OPTION_EXECUTE_DISPATCH_ENABLE 0x10 13 | #define MEM_EXECUTE_OPTION_IMAGE_DISPATCH_ENABLE 0x20 14 | #define MEM_EXECUTE_OPTION_VALID_FLAGS 0x3f 15 | 16 | typedef enum _PROCESSINFOCLASS 17 | { 18 | ProcessBasicInformation, 19 | ProcessQuotaLimits, 20 | ProcessIoCounters, 21 | ProcessVmCounters, 22 | ProcessTimes, 23 | ProcessBasePriority, 24 | ProcessRaisePriority, 25 | ProcessDebugPort, 26 | ProcessExceptionPort, 27 | ProcessAccessToken, 28 | ProcessLdtInformation, 29 | ProcessLdtSize, 30 | ProcessDefaultHardErrorMode, 31 | ProcessIoPortHandlers, 32 | ProcessPooledUsageAndLimits, 33 | ProcessWorkingSetWatch, 34 | ProcessUserModeIOPL, 35 | ProcessEnableAlignmentFaultFixup, 36 | ProcessPriorityClass, 37 | ProcessWx86Information, 38 | ProcessHandleCount, 39 | ProcessAffinityMask, 40 | ProcessPriorityBoost, 41 | ProcessDeviceMap, 42 | ProcessSessionInformation, 43 | ProcessForegroundInformation, 44 | ProcessWow64Information, 45 | ProcessImageFileName, 46 | ProcessLUIDDeviceMapsEnabled, 47 | ProcessBreakOnTermination, 48 | ProcessDebugObjectHandle, 49 | ProcessDebugFlags, 50 | ProcessHandleTracing, 51 | ProcessIoPriority, 52 | ProcessExecuteFlags, 53 | ProcessResourceManagement, 54 | ProcessCookie, 55 | ProcessImageInformation, 56 | MaxProcessInfoClass 57 | } 58 | PROCESSINFOCLASS; 59 | 60 | BOOL Sys_CloseDEP(void) 61 | { 62 | static NTSTATUS (WINAPI *pfnNtSetInformationProcess)(HANDLE ProcessHandle, PROCESSINFOCLASS ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength) = (NTSTATUS (WINAPI *)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG))GetProcAddress(GetModuleHandle("ntdll.dll"), "NtSetInformationProcess"); 63 | ULONG ExecuteFlags = MEM_EXECUTE_OPTION_ENABLE; 64 | 65 | return (pfnNtSetInformationProcess(GetCurrentProcess(), ProcessExecuteFlags, &ExecuteFlags, sizeof(ExecuteFlags)) == 0); 66 | } 67 | 68 | BOOL Sys_GetExecutableName(char *pszName, int nSize) 69 | { 70 | return GetModuleFileName(GetModuleHandle(NULL), pszName, nSize) != 0; 71 | } 72 | 73 | char *Sys_GetLongPathName(void) 74 | { 75 | char szShortPath[MAX_PATH]; 76 | static char szLongPath[MAX_PATH]; 77 | char *pszPath; 78 | 79 | szShortPath[0] = 0; 80 | szLongPath[0] = 0; 81 | 82 | if (GetModuleFileName(NULL, szShortPath, sizeof(szShortPath))) 83 | { 84 | GetLongPathName(szShortPath, szLongPath, sizeof(szLongPath)); 85 | pszPath = strrchr(szLongPath, '\\'); 86 | 87 | if (pszPath[0]) 88 | pszPath[1] = 0; 89 | 90 | size_t len = strlen(szLongPath); 91 | 92 | if (len > 0) 93 | { 94 | if (szLongPath[len - 1] == '\\' || szLongPath[len - 1] == '/') 95 | szLongPath[len - 1] = 0; 96 | } 97 | } 98 | 99 | return szLongPath; 100 | } --------------------------------------------------------------------------------