├── .gitattributes ├── CAimbot.cpp ├── CAimbot.h ├── CBaseCombatWeapon.h ├── CBaseEntity.h ├── CDebugOverlay.h ├── CDraw.cpp ├── CDraw.h ├── CESP.cpp ├── CESP.h ├── CEngineClient.h ├── CEntityList.h ├── CGameEventManager.cpp ├── CGameEventManager.h ├── CGameMovement.h ├── CGlobalVars.h ├── CInput.h ├── CMath.cpp ├── CMath.h ├── CModelInfo.h ├── CNoSpread.cpp ├── CNoSpread.h ├── CPrediction.h ├── CSSBase.sln ├── CSSBase.vcxproj ├── CSSBase.vcxproj.filters ├── CSSBase.vcxproj.user ├── CTrace.h ├── CVARS.cpp ├── CVARS.h ├── CValve.cpp ├── CValve.h ├── CWinsock.cpp ├── CWinsock.h ├── ClientClass.h ├── ConVar.h ├── DllMain.cpp ├── DllMain.h ├── HLClient.h ├── IGameEvent.h ├── IGameEventListener2.h ├── IGameEventManager.h ├── IMoveHelper.h ├── IPanel.h ├── ISurface.h ├── MD5.cpp ├── MD5.h ├── Netvars.cpp ├── ReflectiveDLLInjection.h ├── ReflectiveLoader.h ├── Surface.cpp ├── Surface.h ├── Utils.cpp ├── Utils.h ├── Vector.h ├── checksum_crc.cpp ├── checksum_crc.h ├── client.cpp ├── client.h ├── dt_common2.h ├── dt_recv2.h ├── menu.cpp ├── menu.h ├── mouse.cpp ├── mouse.h ├── netvars.h ├── platform.h ├── sdk.h ├── valve_off.h ├── valve_on.h ├── wchartypes.h └── xor.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /CAimbot.h: -------------------------------------------------------------------------------- 1 | //CSS only 2 | #define CHAR_TEX_CONCRETE 'C' 3 | #define CHAR_TEX_DIRT 'D' 4 | #define CHAR_TEX_GRATE 'G' 5 | #define CHAR_TEX_METAL 'M' 6 | #define CHAR_TEX_COMPUTER 'P' 7 | #define CHAR_TEX_TILE 'T' 8 | #define CHAR_TEX_VENT 'V' 9 | #define CHAR_TEX_WOOD 'W' 10 | #define CHAR_TEX_GLASS 'Y' 11 | 12 | typedef struct 13 | { 14 | int iBulletType;//CSS only 15 | int iPenetration;//CSS only 16 | int iDamage; 17 | float fMaxRange; 18 | float fRangeModifier; 19 | float fPenetrationPower; 20 | float fPenetrationDistance;//CSS only 21 | } WeaponInfo_t; 22 | 23 | class CAimbot 24 | { 25 | public: 26 | CAimbot() 27 | { 28 | for(int i = 0; i < 66; i++) 29 | { 30 | fIsSelected[i] = 0; 31 | fYawMod[i] = 0; 32 | fPitchMod[i] = 0; 33 | fWhiteList[i] = 0; 34 | fSpecialAimspot[i] = -1; 35 | } 36 | } 37 | 38 | void Main(ValveSDK::CInput::CUserCmd* pUserCmd, CBaseEntity* pLocal, ValveSDK::CBaseCombatWeapon *pWeapon); 39 | bool MultiPoints(CBaseEntity* pPlayer, Vector &vPos, int iHitBox); 40 | 41 | bool Main_Triggerbot(Vector vSource, Vector qCurAngle, Vector vForward, Vector vRight, Vector vUp, float fMaxDistance, int iLocalTeamNumber,ValveSDK::CBaseCombatWeapon *pWeapon, CBaseEntity *pLocal, int iSeed); 42 | bool Triggerbot(ValveSDK::CBaseCombatWeapon *pWeapon, CBaseEntity *pLocal, ValveSDK::CInput::CUserCmd* pUserCmd); 43 | void Main_RCS(ValveSDK::CInput::CUserCmd* pUserCmd, CBaseEntity* pLocal, ValveSDK::CBaseCombatWeapon *pWeapon); 44 | 45 | bool Main_Knifebot(CBaseEntity* pLocal, ValveSDK::CBaseCombatWeapon *pWeapon); 46 | 47 | bool IsVisible(Vector vStart, Vector vEnd, unsigned int nMask, ValveSDK::CTrace::ITraceFilter *pTraceFilter); 48 | 49 | void FixMovement(ValveSDK::CInput::CUserCmd* c, Vector &qOld, int iPositive = 1); 50 | 51 | void Reset() 52 | { 53 | iTarget = -1; 54 | fBestTarget = 99999.9f; 55 | vTarget.Init(0.0f,0.0f,0.0f); 56 | vFinal.Init(0.0f,0.0f,0.0f); 57 | } 58 | 59 | void ResetRCS() 60 | { 61 | iRCSTarget = -1; 62 | fBestRCSTarget = 99999.9f; 63 | vRCSTarget.Init(0.0f,0.0f,0.0f); 64 | vRCSFinal.Init(0.0f,0.0f,0.0f); 65 | } 66 | 67 | bool HasTarget() 68 | { 69 | return (iTarget != -1); 70 | } 71 | 72 | bool HasTargetRCS() 73 | { 74 | return (iRCSTarget != -1); 75 | } 76 | 77 | void ResetPlayerList(float &handle) 78 | { 79 | if(handle) 80 | { 81 | for(int i = 0; i < 66; i++) 82 | { 83 | fIsSelected[i] = 0; 84 | fYawMod[i] = 0; 85 | fPitchMod[i] = 0; 86 | fWhiteList[i] = 0; 87 | fSpecialAimspot[i] = -1; 88 | } 89 | 90 | handle = 0; 91 | } 92 | } 93 | 94 | ValveSDK::CTrace::CTraceFilterNoPlayer tfNoPlayers; 95 | 96 | int iTarget; 97 | int iRCSTarget; 98 | 99 | float fBestTarget; 100 | float fBestRCSTarget; 101 | 102 | Vector vPoints[55]; 103 | 104 | Vector vTarget; 105 | Vector vRCSTarget; 106 | 107 | Vector vFinal; 108 | Vector vRCSFinal; 109 | 110 | Vector vEyePos; 111 | 112 | WeaponInfo_t wiWeaponInfo; 113 | 114 | //playerlist specifics 115 | float fIsSelected[66]; 116 | float fYawMod[66]; 117 | float fPitchMod[66]; 118 | float fWhiteList[66]; 119 | float fSpecialAimspot[66]; 120 | }; 121 | 122 | extern CAimbot g_Aimbot; -------------------------------------------------------------------------------- /CBaseCombatWeapon.h: -------------------------------------------------------------------------------- 1 | enum EItemDefinitionIndex : short 2 | { 3 | WEAPON_NONE = 0, 4 | WEAPON_DEAGLE = 1, 5 | WEAPON_ELITE = 2, 6 | WEAPON_FIVESEVEN = 3, 7 | WEAPON_GLOCK = 4, 8 | WEAPON_AK47 = 7, 9 | WEAPON_AUG = 8, 10 | WEAPON_AWP = 9, 11 | WEAPON_FAMAS = 10, 12 | WEAPON_G3SG1 = 11, 13 | WEAPON_GALILAR = 13, 14 | WEAPON_M249 = 14, 15 | WEAPON_M4A1 = 16, 16 | WEAPON_MAC10 = 17, 17 | WEAPON_P90 = 19, 18 | WEAPON_ZONE_REPULSOR = 20, 19 | WEAPON_MP5SD = 23, 20 | WEAPON_UMP45 = 24, 21 | WEAPON_XM1014 = 25, 22 | WEAPON_BIZON = 26, 23 | WEAPON_MAG7 = 27, 24 | WEAPON_NEGEV = 28, 25 | WEAPON_SAWEDOFF = 29, 26 | WEAPON_TEC9 = 30, 27 | WEAPON_TASER = 31, 28 | WEAPON_HKP2000 = 32, 29 | WEAPON_MP7 = 33, 30 | WEAPON_MP9 = 34, 31 | WEAPON_NOVA = 35, 32 | WEAPON_P250 = 36, 33 | WEAPON_SHIELD = 37, 34 | WEAPON_SCAR20 = 38, 35 | WEAPON_SG556 = 39, 36 | WEAPON_SSG08 = 40, 37 | WEAPON_KNIFE_GG = 41, 38 | WEAPON_KNIFE = 42, 39 | WEAPON_FLASHBANG = 43, 40 | WEAPON_HEGRENADE = 44, 41 | WEAPON_SMOKEGRENADE = 45, 42 | WEAPON_MOLOTOV = 46, 43 | WEAPON_DECOY = 47, 44 | WEAPON_INCGRENADE = 48, 45 | WEAPON_C4 = 49, 46 | WEAPON_HEALTHSHOT = 57, 47 | WEAPON_KNIFE_T = 59, 48 | WEAPON_M4A1_SILENCER = 60, 49 | WEAPON_USP_SILENCER = 61, 50 | WEAPON_CZ75A = 63, 51 | WEAPON_REVOLVER = 64, 52 | WEAPON_TAGRENADE = 68, 53 | WEAPON_FISTS = 69, 54 | WEAPON_BREACHCHARGE = 70, 55 | WEAPON_TABLET = 72, 56 | WEAPON_MELEE = 74, 57 | WEAPON_AXE = 75, 58 | WEAPON_HAMMER = 76, 59 | WEAPON_SPANNER = 78, 60 | WEAPON_KNIFE_GHOST = 80, 61 | WEAPON_FIREBOMB = 81, 62 | WEAPON_DIVERSION = 82, 63 | WEAPON_FRAG_GRENADE = 83, 64 | WEAPON_SNOWBALL = 84, 65 | WEAPON_BUMPMINE = 85, 66 | WEAPON_KNIFE_BAYONET = 500, 67 | WEAPON_KNIFE_CSS = 503, 68 | WEAPON_KNIFE_FLIP = 505, 69 | WEAPON_KNIFE_GUT = 506, 70 | WEAPON_KNIFE_KARAMBIT = 507, 71 | WEAPON_KNIFE_M9_BAYONET = 508, 72 | WEAPON_KNIFE_TACTICAL = 509, 73 | WEAPON_KNIFE_FALCHION = 512, 74 | WEAPON_KNIFE_SURVIVAL_BOWIE = 514, 75 | WEAPON_KNIFE_BUTTERFLY = 515, 76 | WEAPON_KNIFE_PUSH = 516, 77 | WEAPON_KNIFE_CORD = 517, 78 | WEAPON_KNIFE_CANIS = 518, 79 | WEAPON_KNIFE_URSUS = 519, 80 | WEAPON_KNIFE_GYPSY_JACKKNIFE = 520, 81 | WEAPON_KNIFE_OUTDOOR = 521, 82 | WEAPON_KNIFE_STILETTO = 522, 83 | WEAPON_KNIFE_WIDOWMAKER = 523, 84 | WEAPON_KNIFE_SKELETON = 525, 85 | GLOVE_STUDDED_BROKENFANG = 4725, 86 | GLOVE_STUDDED_BLOODHOUND = 5027, 87 | GLOVE_T = 5028, 88 | GLOVE_CT = 5029, 89 | GLOVE_SPORTY = 5030, 90 | GLOVE_SLICK = 5031, 91 | GLOVE_LEATHER_HANDWRAPS = 5032, 92 | GLOVE_MOTORCYCLE = 5033, 93 | GLOVE_SPECIALIST = 5034, 94 | GLOVE_STUDDED_HYDRA = 5035, 95 | SPECIAL_AGENT_BLUEBERRIES_BUCKSHOT = 4619, 96 | SPECIAL_AGENT_TWO_TIMES_MCCOY_TACP = 4680, 97 | SPECIAL_AGENT_COMMANDOR_MAE_JAMISON = 4711, 98 | SPECIAL_AGENT_1ST_LIEUTENANT_FARLOW, 99 | SPECIAL_AGENT_JOHN_KASK, 100 | SPECIAL_AGENT_BIO_HAZ_SPECIALIST, 101 | SPECIAL_AGENT_SERGEANT_BOMBSON, 102 | SPECIAL_AGENT_CHEM_HAZ_SPECIALIST, 103 | SPECIAL_AGENT_REZAN_THE_REDSHIRT = 4718, 104 | SPECIAL_AGENT_SIR_BLOODY_MIAMI_DARRYL = 4726, 105 | SPECIAL_AGENT_SAFECRACKER_VOLTZMANN, 106 | SPECIAL_AGENT_LITTLE_KEV, 107 | SPECIAL_AGENT_GETAWAY_SALLY = 4730, 108 | SPECIAL_AGENT_NUMBER_K = 4732, 109 | SPECIAL_AGENT_SIR_BLOODY_SILENT_DARRYL = 4733, 110 | SPECIAL_AGENT_SIR_BLOODY_SKULLHEAD_DARRYL, 111 | SPECIAL_AGENT_SIR_BLOODY_DARRYL_ROYALE, 112 | SPECIAL_AGENT_SIR_BLOODY_LOUDMOUTH_DARRYL, 113 | SPECIAL_AGENT_T = 5036, 114 | SPECIAL_AGENT_CT = 5037, 115 | SPECIAL_AGENT_GROUND_REBEL = 5105, 116 | SPECIAL_AGENT_OSIRIS, 117 | SPECIAL_AGENT_SHAHMAT, 118 | SPECIAL_AGENT_MUHLIK, 119 | SPECIAL_AGENT_SOLDIER = 5205, 120 | SPECIAL_AGENT_ENFORCER, 121 | SPECIAL_AGENT_SLINGSHOT, 122 | SPECIAL_AGENT_STREET_SOLDIER, 123 | SPECIAL_AGENT_OPERATOR = 5305, 124 | SPECIAL_AGENT_MARKUS_DELROW, 125 | SPECIAL_AGENT_MICHAEL_SYFERS, 126 | SPECIAL_AGENT_AVA, 127 | SPECIAL_AGENT_3RD_COMMANDO_COMPANY = 5400, 128 | SPECIAL_AGENT_SEAL_TEAM_6_SOLDIER, 129 | SPECIAL_AGENT_BUCKSHOT, 130 | SPECIAL_AGENT_TWO_TIMES_MCCOY_USAF, 131 | SPECIAL_AGENT_RICKSAW, 132 | SPECIAL_AGENT_DRAGOMIR = 5500, 133 | SPECIAL_AGENT_MAXIMUS, 134 | SPECIAL_AGENT_REZAN_THE_READY, 135 | SPECIAL_AGENT_BLACKWOLF = 5503, 136 | SPECIAL_AGENT_THE_DOCTOR, 137 | SPECIAL_AGENT_DRAGOMIR_FOOTSOLDIERS, 138 | SPECIAL_AGENT_B_SQUADRON_OFFICER = 5601 139 | }; 140 | 141 | namespace ValveSDK 142 | { 143 | class CBaseCombatWeapon 144 | { 145 | public: 146 | float GetNextPrimaryAttack() 147 | { 148 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_BaseCombatWeapon*/XorStr<0x0C,20,0xCCB89A4B>("\x48\x59\x51\x4D\x71\x62\x77\x50\x7B\x78\x74\x76\x6C\x4E\x7F\x7A\x6C\x72\x70"+0xCCB89A4B).s, /*m_flNextPrimaryAttack*/XorStr<0x0D,22,0x423C055C>("\x60\x51\x69\x7C\x5F\x77\x6B\x60\x45\x64\x7E\x75\x78\x68\x62\x5D\x69\x6A\x7E\x43\x4A"+0x423C055C).s); 149 | return *(float*)((DWORD)this + iOffset); 150 | } 151 | 152 | bool HasAmmo() 153 | { 154 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_BaseCombatWeapon*/XorStr<0x5E,20,0xBED67F8D>("\x1A\x0B\x3F\x23\x03\x10\x01\x26\x09\x0A\x0A\x08\x1E\x3C\x09\x0C\x1E\x00\x1E"+0xBED67F8D).s,/*m_iClip1*/XorStr<0x7B,9,0xEBD79649>("\x16\x23\x14\x3D\x13\xE9\xF1\xB3"+0xEBD79649).s); 155 | return ((*(PINT)((DWORD)this + iOffset)) > 0); 156 | } 157 | 158 | bool IsSilencerOn() 159 | { 160 | static int iOffsetPistol = g_NetworkedVariableManager.GetOffset(/*DT_WeaponUSP*/XorStr<0x88,13,0xD9DE2C14>("\xCC\xDD\xD5\xDC\xE9\xEC\xFE\xE0\xFE\xC4\xC1\xC3"+0xD9DE2C14).s,/*m_bSilencerOn*/XorStr<0xFD,14,0x2902C67C>("\x90\xA1\x9D\x53\x68\x6E\x66\x6A\x66\x63\x75\x47\x67"+0x2902C67C).s); 161 | static int iOffsetRifle = g_NetworkedVariableManager.GetOffset(/*DT_WeaponM4A1*/XorStr<0x80,14,0x78EF406B>("\xC4\xD5\xDD\xD4\xE1\xE4\xF6\xE8\xE6\xC4\xBE\xCA\xBD"+0x78EF406B).s,/*m_bSilencerOn*/XorStr<0xFD,14,0x2902C67C>("\x90\xA1\x9D\x53\x68\x6E\x66\x6A\x66\x63\x75\x47\x67"+0x2902C67C).s); 162 | 163 | int iWeaponID = GetWeaponID(); 164 | 165 | if(iWeaponID == WEAPON_USP_SILENCER) 166 | return (*(PBOOL)((DWORD)this + iOffsetPistol)); 167 | else if(iWeaponID == WEAPON_M4A1) 168 | return (*(PBOOL)((DWORD)this + iOffsetRifle)); 169 | 170 | return false; 171 | } 172 | 173 | float GetSpread() 174 | { 175 | typedef float(__thiscall *GetSpread_t)(PVOID); 176 | return getvfunc( this, 453 )( this ); 177 | } 178 | 179 | float GetCone() 180 | { 181 | typedef float(__thiscall *GetCone_t)(PVOID); 182 | return getvfunc( this, 483 )( this ); 183 | } 184 | 185 | void UpdateAccuracyPenalty() 186 | { 187 | typedef void(__thiscall *UpdateAccuracyPenalty_t)(PVOID); 188 | getvfunc( this, 484 )( this ); 189 | } 190 | 191 | short GetWeaponID() 192 | { 193 | static auto offset = g_NetworkedVariableManager.GetOffset(/*DT_BaseAttributableItem*/XorStr<0x02, 24, 0xD9AC4BA5>( "\x46\x57\x5B\x47\x67\x74\x6D\x48\x7E\x7F\x7E\x64\x6C\x7A\x64\x70\x70\x7F\x71\x5C\x62\x72\x75" + 0xD9AC4BA5 ).s, /*m_iItemDefinitionIndex*/XorStr<0x80, 23, 0x25DEA788>( "\xED\xDE\xEB\xCA\xF0\xE0\xEB\xC3\xED\xEF\xE3\xE5\xE5\xF9\xE7\xE0\xFE\xD8\xFC\xF7\xF1\xED" + 0x25DEA788 ).s ); 194 | return *( short* )( ( DWORD )this + offset ); 195 | } 196 | 197 | bool IsMiscWeapon() 198 | { 199 | short iWeaponID = GetWeaponID(); 200 | 201 | return (iWeaponID == WEAPON_KNIFE || iWeaponID == WEAPON_C4 202 | || iWeaponID == WEAPON_HEGRENADE || iWeaponID == WEAPON_SMOKEGRENADE 203 | || iWeaponID == WEAPON_FLASHBANG || iWeaponID == WEAPON_DECOY 204 | || iWeaponID == WEAPON_FLASHBANG || iWeaponID == WEAPON_INCGRENADE 205 | || iWeaponID == WEAPON_KNIFE_T || (iWeaponID >= WEAPON_KNIFE_BAYONET && iWeaponID <= WEAPON_KNIFE_WIDOWMAKER)); 206 | } 207 | 208 | void* GetWeaponData( ) 209 | { 210 | return getvfunc( this, 454 )( this ); 211 | } 212 | }; 213 | } 214 | 215 | class CCSWeaponData 216 | { 217 | public: 218 | byte pad0[ 0x14 ]; // 0x0000 219 | int iMaxClip1; // 0x0014 220 | int iMaxClip2; // 0x0018 221 | int iDefaultClip1; // 0x001C 222 | int iDefaultClip2; // 0x0020 223 | int iPrimaryMaxReserveAmmo; // 0x0024 224 | int iSecondaryMaxReserveAmmo; // 0x0028 225 | const char* szWorldModel; // 0x002C 226 | const char* szViewModel; // 0x0030 227 | const char* szDroppedModel; // 0x0034 228 | BYTE pad1[ 0x50 ]; // 0x0038 229 | const char* szHudName; // 0x0088 230 | const char* szWeaponName; // 0x008C 231 | byte pad2[ 0x2 ]; // 0x0090 232 | bool bIsMeleeWeapon; // 0x0092 233 | byte pad3[ 0x9 ]; // 0x0093 234 | float flWeaponWeight; // 0x009C 235 | byte pad4[ 0x4 ]; // 0x00A0 236 | int iSlot; // 0x00A4 237 | int iPosition; // 0x00A8 238 | byte pad5[ 0x1C ]; // 0x00AC 239 | int nWeaponType; // 0x00C8 240 | byte pad6[ 0x4 ]; // 0x00CC 241 | int iWeaponPrice; // 0x00D0 242 | int iKillAward; // 0x00D4 243 | const char* szAnimationPrefix; // 0x00D8 244 | float flCycleTime; // 0x00DC 245 | float flCycleTimeAlt; // 0x00E0 246 | byte pad8[ 0x8 ]; // 0x00E4 247 | bool bFullAuto; // 0x00EC 248 | byte pad9[ 0x3 ]; // 0x00ED 249 | int iDamage; // 0x00F0 250 | float flHeadShotMultiplier; // 0x00F4 251 | float flArmorRatio; // 0x00F8 252 | int iBullets; // 0x00FC 253 | float flPenetration; // 0x0100 254 | byte pad10[ 0x8 ]; // 0x0104 255 | float flRange; // 0x010C 256 | float flRangeModifier; // 0x0110 257 | float flThrowVelocity; // 0x0114 258 | byte pad11[ 0xC ]; // 0x0118 259 | bool bHasSilencer; // 0x0124 260 | byte pad12[ 0xF ]; // 0x0125 261 | float flMaxSpeed[ 2 ]; // 0x0134 262 | byte pad13[ 0x4 ]; // 0x013C 263 | float flSpread[ 2 ]; // 0x0140 264 | float flInaccuracyCrouch[ 2 ]; // 0x0148 265 | float flInaccuracyStand[ 2 ]; // 0x0150 266 | byte pad14[ 0x8 ]; // 0x0158 267 | float flInaccuracyJump[ 2 ]; // 0x0160 268 | float flInaccuracyLand[ 2 ]; // 0x0168 269 | float flInaccuracyLadder[ 2 ]; // 0x0170 270 | float flInaccuracyFire[ 2 ]; // 0x0178 271 | float flInaccuracyMove[ 2 ]; // 0x0180 272 | float flInaccuracyReload; // 0x0188 273 | int iRecoilSeed; // 0x018C 274 | float flRecoilAngle[ 2 ]; // 0x0190 275 | float flRecoilAngleVariance[ 2 ]; // 0x0198 276 | float flRecoilMagnitude[ 2 ]; // 0x01A0 277 | float flRecoilMagnitudeVariance[ 2 ]; // 0x01A8 278 | int iSpreadSeed; // 0x01B0 279 | }; -------------------------------------------------------------------------------- /CBaseEntity.h: -------------------------------------------------------------------------------- 1 | /* 2 | CBaseEntity rebuild 3 | 22.08.2014 4 | */ 5 | 6 | class CBaseEntity{ 7 | public: 8 | virtual void init(){}; 9 | 10 | const Vector& GetAbsOrigin() 11 | { 12 | typedef const Vector& ( __thiscall *GetAbsOrg_t )(PVOID); 13 | return getvfunc( this, 10 )( this ); 14 | } 15 | 16 | void GetRenderBounds(Vector &vMins, Vector &vMaxs) 17 | { 18 | PVOID pEnt = (PVOID)this; 19 | 20 | _asm 21 | { 22 | PUSH vMaxs 23 | PUSH vMins 24 | MOV ECX, pEnt 25 | MOV EAX, DWORD PTR DS:[ECX+0x4] 26 | MOV EDX, DWORD PTR DS:[EAX+0x44] 27 | LEA ESI, DWORD PTR DS:[ECX+0x4] 28 | MOV ECX, ESI 29 | CALL EDX 30 | } 31 | } 32 | 33 | Vector GetEyeAngles() 34 | { 35 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_CSPlayer*/XorStr<0xAA,12,0x6F938DD5>("\xEE\xFF\xF3\xEE\xFD\xFF\xDC\xD0\xCB\xD6\xC6"+0x6F938DD5).s, /*m_angEyeAngles[0]*/XorStr<0x7E,18,0x0D7A3609>("\x13\x20\xE1\xEF\xE5\xC6\xFD\xE0\xC7\xE9\xEF\xE5\xEF\xF8\xD7\xBD\xD3"+0x0D7A3609).s); 36 | return *(Vector*)((DWORD)this + iOffset); 37 | } 38 | 39 | color32 GetModelColor() 40 | { 41 | static auto offset = g_NetworkedVariableManager.GetOffset(/*DT_BaseEntity*/XorStr<0x7D, 14, 0xB7E0165A>( "\x39\x2A\x20\xC2\xE0\xF1\xE6\xC1\xEB\xF2\xEE\xFC\xF0" + 0xB7E0165A ).s, /*m_clrRender*/XorStr<0x0A, 12, 0x6A96886C>( "\x67\x54\x6F\x61\x7C\x5D\x75\x7F\x76\x76\x66" + 0x6A96886C ).s ); 42 | return *(color32*)((DWORD)this + offset); 43 | } 44 | 45 | bool IsSpawnProtectedPlayer() 46 | { 47 | static auto offset = g_NetworkedVariableManager.GetOffset(/*DT_CSPlayer*/XorStr<0xAA, 12, 0x6F938DD5>( "\xEE\xFF\xF3\xEE\xFD\xFF\xDC\xD0\xCB\xD6\xC6" + 0x6F938DD5 ).s, /*m_bGunGameImmunity*/XorStr<0xDE, 19, 0xCA2CA6B5>( "\xB3\x80\x82\xA6\x97\x8D\xA3\x84\x8B\x82\xA1\x84\x87\x9E\x82\x84\x9A\x96" + 0xCA2CA6B5 ).s ); 48 | return *( bool* )( ( DWORD )this + offset ); 49 | //return (this->GetModelColor().a < 255); 50 | } 51 | 52 | ValveSDK::CBaseCombatWeapon* GetActiveBaseCombatWeapon(); 53 | 54 | int GetIndex() 55 | { 56 | int iEntIndex; 57 | 58 | PVOID pEnt = (PVOID)this; 59 | 60 | __asm 61 | { 62 | MOV ECX, pEnt 63 | MOV EAX, DWORD PTR DS:[ECX+0x8] 64 | MOV EDX, DWORD PTR DS:[EAX+0x28] 65 | LEA ESI, DWORD PTR DS:[ECX+0x8] 66 | MOV ECX, ESI 67 | CALL EDX 68 | MOV iEntIndex, EAX 69 | } 70 | 71 | return iEntIndex; 72 | } 73 | 74 | /*void AddEFlags(DWORD dwFlags) 75 | { 76 | PINT piEFlags = (PINT)((DWORD)this + 0x170); 77 | *piEFlags |= dwFlags; 78 | } 79 | 80 | PVOID GetCollisionProperty() 81 | { 82 | return (PVOID)((DWORD)this + 0x198); 83 | }*/ 84 | 85 | bool IsDormant() 86 | { 87 | bool bRet; 88 | 89 | PVOID pEnt = (PVOID)this; 90 | 91 | __asm 92 | { 93 | MOV ECX, pEnt 94 | MOV EAX, DWORD PTR DS:[ECX+0x8] 95 | MOV EDX, DWORD PTR DS:[EAX+0x24] 96 | LEA ESI, DWORD PTR DS:[ECX+0x8] 97 | MOV ECX, ESI 98 | CALL EDX 99 | MOV bRet, AL 100 | } 101 | 102 | return bRet; 103 | } 104 | 105 | bool IsPlayer() 106 | { 107 | return getvfunc( this, 158 )( this ); 108 | } 109 | 110 | model_t* GetModel() 111 | { 112 | model_t *mRet; 113 | 114 | PVOID pEnt = (PVOID)this; 115 | 116 | _asm 117 | { 118 | MOV ECX, pEnt 119 | MOV EAX, DWORD PTR DS:[ECX+0x4] 120 | MOV EDX, DWORD PTR DS:[EAX+0x20] 121 | LEA ESI, DWORD PTR DS:[ECX+0x4] 122 | MOV ECX, ESI 123 | CALL EDX 124 | MOV mRet, EAX 125 | } 126 | 127 | return mRet; 128 | } 129 | 130 | int GetHealth() 131 | { 132 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_BasePlayer*/XorStr<0xC2,14,0xCFD8B52B>("\x86\x97\x9B\x87\xA7\xB4\xAD\x99\xA6\xAA\xB5\xA8\xBC"+0xCFD8B52B).s, /*m_iHealth*/XorStr<0x7A,10,0x7B6EFF44>("\x17\x24\x15\x35\x1B\x1E\xEC\xF5\xEA"+0x7B6EFF44).s); 133 | return *(int*)((DWORD)this + iOffset); 134 | } 135 | 136 | char GetLifeState() 137 | { 138 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_BasePlayer*/XorStr<0xC2,14,0xCFD8B52B>("\x86\x97\x9B\x87\xA7\xB4\xAD\x99\xA6\xAA\xB5\xA8\xBC"+0xCFD8B52B).s, /*m_LifeState*/XorStr<0x8E,12,0x5618CCB6>("\xE3\xD0\xDC\xF8\xF4\xF6\xC7\xE1\xF7\xE3\xFD"+0x5618CCB6).s); 139 | return *(char*)((DWORD)this + iOffset); 140 | } 141 | 142 | int GetTeamNum() 143 | { 144 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_BasePlayer*/XorStr<0xC2,14,0xCFD8B52B>("\x86\x97\x9B\x87\xA7\xB4\xAD\x99\xA6\xAA\xB5\xA8\xBC"+0xCFD8B52B).s, /*m_iTeamNum*/XorStr<0xBC,11,0x9EF53877>("\xD1\xE2\xD7\xEB\xA5\xA0\xAF\x8D\xB1\xA8"+0x9EF53877).s); 145 | return *(int*)((DWORD)this + iOffset); 146 | } 147 | 148 | int GetFlags() 149 | { 150 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_BasePlayer*/XorStr<0xC2,14,0xCFD8B52B>("\x86\x97\x9B\x87\xA7\xB4\xAD\x99\xA6\xAA\xB5\xA8\xBC"+0xCFD8B52B).s, /*m_fFlags*/XorStr<0xC3,9,0x8951F943>("\xAE\x9B\xA3\x80\xAB\xA9\xAE\xB9"+0x8951F943).s); 151 | return *(int*)((DWORD)this + iOffset); 152 | } 153 | 154 | float GetFallVelocity() 155 | { 156 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_CSPlayer*/XorStr<0xAA,12,0x6F938DD5>("\xEE\xFF\xF3\xEE\xFD\xFF\xDC\xD0\xCB\xD6\xC6"+0x6F938DD5).s, /*m_flFallVelocity*/XorStr<0xC4,17,0x8454FEF5>("\xA9\x9A\xA0\xAB\x8E\xA8\xA6\xA7\x9A\xA8\xA2\xA0\xB3\xB8\xA6\xAA"+0x8454FEF5).s); 157 | return *(float*)((DWORD)this + iOffset); 158 | } 159 | 160 | Vector GetBaseVelocity() 161 | { 162 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_CSPlayer*/XorStr<0x34,12,0x959D9DAB>("\x70\x61\x69\x74\x6B\x69\x56\x5A\x45\x58\x4C"+0x959D9DAB).s,/*m_vecBaseVelocity*/XorStr<0x44,18,0xF97A7797>("\x29\x1A\x30\x22\x2B\x0B\x2B\x38\x29\x1B\x2B\x23\x3F\x32\x3B\x27\x2D"+0xF97A7797).s); 163 | return *(Vector*)((DWORD)this + iOffset); 164 | } 165 | 166 | Vector GetNetworkedOrigin() 167 | { 168 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_BasePlayer*/XorStr<0xC2,14,0xCFD8B52B>("\x86\x97\x9B\x87\xA7\xB4\xAD\x99\xA6\xAA\xB5\xA8\xBC"+0xCFD8B52B).s, /*m_vecOrigin*/XorStr<0x1D,12,0x2333782C>("\x70\x41\x69\x45\x42\x6D\x51\x4D\x42\x4F\x49"+0x2333782C).s); 169 | return *(Vector*)((DWORD)this + iOffset); 170 | } 171 | 172 | Vector GetVecViewOffset() 173 | { 174 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_BasePlayer*/XorStr<0xC2,14,0xCFD8B52B>("\x86\x97\x9B\x87\xA7\xB4\xAD\x99\xA6\xAA\xB5\xA8\xBC"+0xCFD8B52B).s, /*m_vecViewOffset[0]*/XorStr<0xF0,19,0xB93B59BD>("\x9D\xAE\x84\x96\x97\xA3\x9F\x92\x8F\xB6\x9C\x9D\x8F\x98\x8A\xA4\x30\x5C"+0xB93B59BD).s); 175 | return *(Vector*)((DWORD)this + iOffset); 176 | } 177 | 178 | Vector GetEyePosition() 179 | { 180 | return GetNetworkedOrigin() + GetVecViewOffset(); 181 | } 182 | 183 | Vector GetPunchAngle() 184 | { 185 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_BasePlayer*/XorStr<0xC2, 14, 0xCFD8B52B>( "\x86\x97\x9B\x87\xA7\xB4\xAD\x99\xA6\xAA\xB5\xA8\xBC" + 0xCFD8B52B ).s, /*m_aimPunchAngle*/XorStr<0xEA, 16, 0x4D0C6C95>( "\x87\xB4\x8D\x84\x83\xBF\x85\x9F\x91\x9B\xB5\x9B\x91\x9B\x9D" + 0x4D0C6C95 ).s ); 186 | return *(Vector*)((DWORD)this + iOffset); 187 | } 188 | 189 | Vector GetVelocity() 190 | { 191 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_CSPlayer*/XorStr<0xAA,12,0x6F938DD5>("\xEE\xFF\xF3\xEE\xFD\xFF\xDC\xD0\xCB\xD6\xC6"+0x6F938DD5).s,/*m_vecVelocity[0]*/XorStr<0x60,17,0x44C61C52>("\x0D\x3E\x14\x06\x07\x33\x03\x0B\x07\x0A\x03\x1F\x15\x36\x5E\x32"+0x44C61C52).s); 192 | return *(Vector*)((DWORD)this + iOffset); 193 | } 194 | 195 | int GetTickBase() 196 | { 197 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_CSPlayer*/XorStr<0x34,12,0x959D9DAB>("\x70\x61\x69\x74\x6B\x69\x56\x5A\x45\x58\x4C"+0x959D9DAB).s, /*m_nTickBase*/XorStr<0x5E,12,0xDB7AF0A6>("\x33\x00\x0E\x35\x0B\x00\x0F\x27\x07\x14\x0D"+0xDB7AF0A6).s); 198 | return *(int*)((DWORD)this + iOffset); 199 | } 200 | 201 | bool isValidPlayer() 202 | { 203 | //kolonote: 204 | //there are no dormant player ents in csgo...there are some other ents tho like grenades 205 | return (GetLifeState() == LIFE_ALIVE && !IsDormant()); 206 | } 207 | 208 | int GetMoveType() 209 | { 210 | return *(int*)((DWORD)this + 0x25C); 211 | } 212 | 213 | bool SetupBones(matrix3x4_t *pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime) 214 | { 215 | bool bRet; 216 | 217 | PVOID pAnimating = ( PVOID )this; 218 | 219 | __asm 220 | { 221 | PUSH currentTime 222 | PUSH boneMask 223 | PUSH nMaxBones 224 | PUSH pBoneToWorldOut 225 | MOV ECX, DWORD PTR DS:[pAnimating] 226 | ADD ECX, 4 227 | MOV EDX, DWORD PTR DS:[pAnimating] 228 | MOV EAX, DWORD PTR DS:[EDX+4] 229 | MOV EDX, DWORD PTR DS:[EAX+0x34] 230 | CALL EDX 231 | MOV bRet, AL 232 | } 233 | 234 | return bRet; 235 | } 236 | 237 | //later usage 238 | bool IsUsingAntiAim() 239 | { 240 | Vector qAngles = GetEyeAngles(); 241 | 242 | return (qAngles.x >= 68.0f && qAngles.x <= 90.0f); 243 | } 244 | }; -------------------------------------------------------------------------------- /CDebugOverlay.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class CDebugOverlay 4 | { 5 | public: 6 | int ScreenPosition(const Vector& vIn, Vector& vOut) 7 | { 8 | typedef int(__thiscall* OriginalFn)(PVOID, const Vector&, Vector&); 9 | return getvfunc(this, 13)(this, vIn, vOut); 10 | } 11 | }; 12 | } -------------------------------------------------------------------------------- /CDraw.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mr-nv/interwebz-csgo/229af391c05d22451ef31e8806518952bf521de5/CDraw.cpp -------------------------------------------------------------------------------- /CDraw.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CDraw 4 | { 5 | public: 6 | VOID InitFonts(); 7 | INT getWidht(unsigned long font, const char* input); 8 | std::wstring stringToWide(const std::string& text); 9 | VOID DrawString(unsigned long font,int x, int y, int r, int g, int b, const wchar_t *pszText); 10 | VOID DrawStringA(unsigned long font, bool center, int x, int y, int r, int g, int b, int a, const char *input, ...); 11 | VOID FillRGBA(int x, int y, int w, int h, int r, int g, int b, int a); 12 | VOID DrawHeader(INT x, INT y, INT w, INT r, INT g, INT b, INT HealthBarWidth); 13 | VOID DrawHealthBox(int x, int y, int r, int g, int b, int a, int CurHealth, int MaxHealth); 14 | VOID boxESP(int x, int y, int radius, int R, int G, int B); 15 | VOID drawCrosshair(int x, int y, int r, int g, int b); 16 | VOID DrawBox(int x, int y, int w, int h, int lw, int r, int g, int b, int a); 17 | VOID DrawBoxHealth(int x, int y, int w, int h, int lw, int r, int g, int b, int a, int targetId, int damageDealt, int animTimer, int index); 18 | VOID DrawOutlinedRect(int x0, int y0, int x1, int y1, int R, int G, int B); 19 | 20 | unsigned long m_ESPFont, m_WatermarkFont, m_MenuFont, m_ListItemFont; 21 | private: 22 | }; -------------------------------------------------------------------------------- /CESP.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mr-nv/interwebz-csgo/229af391c05d22451ef31e8806518952bf521de5/CESP.cpp -------------------------------------------------------------------------------- /CESP.h: -------------------------------------------------------------------------------- 1 | class CESP 2 | { 3 | public: 4 | void DrawHeader( int x, int y, int w, int r, int g, int b, int HealthBarWidth ); 5 | void DrawRadar( void ); 6 | void DrawChickenESP( void ); 7 | void draw( void ); 8 | }; -------------------------------------------------------------------------------- /CEngineClient.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class CEngineClient 4 | { 5 | public: 6 | typedef struct 7 | { 8 | __int64 unknown; //0x0000 9 | union 10 | { 11 | __int64 steamID64; //0x0008 - SteamID64 12 | struct 13 | { 14 | __int32 xuid_low; 15 | __int32 xuid_high; 16 | }; 17 | }; 18 | 19 | char name[ 128 ]; 20 | int userID; 21 | char guid[ 20 ]; 22 | char pad[ 0x10 ]; 23 | unsigned long steamid; 24 | char friendsName[ 128 ]; 25 | bool fakeplayer; 26 | bool ishltv; 27 | CRC32_t customFiles[ 4 ]; 28 | unsigned char filesdownloaded; 29 | } player_info_t; 30 | 31 | void GetScreenSize(int& width, int& height) 32 | { 33 | typedef void(__thiscall* OriginalFn)(PVOID, int&, int&); 34 | return getvfunc(this, 5)(this, width, height); 35 | } 36 | 37 | bool GetPlayerInfo(int iIndex, player_info_t *pInfo) 38 | { 39 | typedef bool(__thiscall* OriginalFn)(PVOID, int, player_info_t*); 40 | return getvfunc(this, 8)(this, iIndex, pInfo); 41 | } 42 | 43 | int GetLocalPlayer(VOID) 44 | { 45 | typedef int(__thiscall* OriginalFn)(PVOID); 46 | return getvfunc(this, 12)(this); 47 | } 48 | 49 | void ExecuteClientCmd(char const* szCommand) 50 | { 51 | typedef void(__thiscall* OriginalFn)(PVOID, char const* szCommand); 52 | getvfunc(this, 105)(this, szCommand); 53 | } 54 | 55 | void GetViewAngles(Vector& vAngles) 56 | { 57 | typedef void(__thiscall* OriginalFn)(PVOID, Vector&); 58 | return getvfunc< OriginalFn >(this, 18)(this, vAngles); 59 | } 60 | 61 | void SetViewAngles(Vector& vAngles) 62 | { 63 | typedef void(__thiscall* oSetViewAngles)(PVOID, Vector&); 64 | return getvfunc< oSetViewAngles >(this, 19)(this, vAngles); 65 | } 66 | 67 | bool IsConnected() 68 | { 69 | typedef bool(__thiscall* oGetScreenSize)(PVOID); 70 | return getvfunc< oGetScreenSize >(this, 27)(this); 71 | } 72 | 73 | bool IsInGame() 74 | { 75 | typedef bool(__thiscall* oLocal)(PVOID); 76 | return getvfunc< oLocal >(this, 26)(this); 77 | } 78 | 79 | int GetMaxClients() 80 | { 81 | typedef bool(__thiscall* oGetMaxClients)(PVOID); 82 | return getvfunc< oGetMaxClients >(this, 20)(this); 83 | } 84 | }; 85 | } -------------------------------------------------------------------------------- /CEntityList.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class CEntityList 4 | { 5 | public: 6 | CBaseEntity* GetClientEntity(int entnum) 7 | { 8 | typedef CBaseEntity* (__thiscall* OriginalFn)(PVOID, int); 9 | return getvfunc(this, 3)(this, entnum); 10 | } 11 | CBaseEntity* GetClientEntityFromHandle(int hEnt) 12 | { 13 | typedef CBaseEntity* (__thiscall* OriginalFn)(PVOID, int); 14 | return getvfunc(this, 4)(this, hEnt); 15 | } 16 | int GetHighestEntityIndex(void) 17 | { 18 | typedef int(__thiscall* OriginalFn)(PVOID); 19 | return getvfunc(this, 6)(this); 20 | } 21 | }; 22 | } -------------------------------------------------------------------------------- /CGameEventManager.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | 3 | cGameEventManager gGameEventManager; 4 | std::vectorg_healthInfo; 5 | 6 | int getZahlAnStelle(const int zahl, const int stelle) 7 | { 8 | int retValue = int(zahl / pow(10.0, int(log10(double(zahl)) - (stelle - 1)))) % 10; 9 | if (retValue < 0) 10 | retValue = 0; 11 | else if (zahl < 10) 12 | retValue = 1; 13 | return retValue; 14 | } 15 | 16 | void cGameEventManager::FireGameEvent(ValveSDK::IGameEvent *event) 17 | { 18 | const char* szEventName = event->GetName(); 19 | 20 | static std::string sXor = /*player_hurt*/XorStr<0x7D,12,0x427069F4>("\x0D\x12\x1E\xF9\xE4\xF0\xDC\xEC\xF0\xF4\xF3"+0x427069F4).s; 21 | static std::string sXor2 = /*player_death*/XorStr<0x72,13,0x2C0196D0>("\x02\x1F\x15\x0C\x13\x05\x27\x1D\x1F\x1A\x08\x15"+0x2C0196D0).s; 22 | static std::string sXor3 = /*round_start*/XorStr<0x76,12,0xE9B186D0>("\x04\x18\x0D\x17\x1E\x24\x0F\x09\x1F\x0D\xF4"+0xE9B186D0).s; 23 | static std::string sXor4 = /*attacker*/XorStr<0x3B,9,0x53678E3F>("\x5A\x48\x49\x5F\x5C\x2B\x24\x30"+0x53678E3F).s; 24 | static std::string sXor5 = /*userid*/XorStr<0x76,7,0x9CB96FC6>("\x03\x04\x1D\x0B\x13\x1F"+0x9CB96FC6).s; 25 | static std::string sXor6 = /*health*/XorStr<0xB5,7,0x0F3F2A4E>("\xDD\xD3\xD6\xD4\xCD\xD2"+0x0F3F2A4E).s; 26 | static std::string sXor7 = /*dmg_health*/XorStr<0x2B,11,0xC337D88F>("\x4F\x41\x4A\x71\x47\x55\x50\x5E\x47\x5C"+0xC337D88F).s; 27 | static std::string sXor8 = /*I did %i damage to %s [%i -> %i] OldFirstDigit: %i NewFirstDigit: %i*/XorStr<0x9E,69,0xC7A6549B>("\xD7\xBF\xC4\xC8\xC6\x83\x81\xCC\x86\xC3\xC9\xC4\xCB\xCC\xC9\x8D\xDA\xC0\x90\x94\xC1\x93\xEF\x90\xDF\x97\x95\x87\x9A\x9E\xD5\xE0\x9E\xF0\xAC\xA5\x84\xAA\xB6\xB6\xB2\x83\xA1\xAE\xA3\xBF\xF6\xED\xEB\xA6\xF0\x9F\xB7\xA4\x92\xBC\xA4\xA4\xAC\x9D\xB3\xBC\xB5\xA9\xE4\xFF\xC5\x88"+0xC7A6549B).s; 28 | 29 | /* 30 | short userid user ID who was hurt 31 | short attacker user ID who attacked 32 | byte health remaining health points 33 | byte armor remaining armor points 34 | string weapon weapon name attacker used, if not the world 35 | short dmg_health damage done to health 36 | byte dmg_armor damage done to armor 37 | byte hitgroup hitgroup that was damaged 38 | */ 39 | 40 | if (strcmp(szEventName, sXor.data()) == 0) 41 | { 42 | char szString[200]; 43 | 44 | if (event->GetInt(sXor4.data(), 0) - 1 == g_Valve.pEngine->GetLocalPlayer()) 45 | { 46 | ValveSDK::CEngineClient::player_info_t info; 47 | if (!g_Valve.pEngine->GetPlayerInfo(event->GetInt(sXor5.data(), 0) - 1, &info)) 48 | return; 49 | 50 | // complicated part XDDDD 51 | int oldHealth = event->GetInt(sXor6.data(), 100) + event->GetInt(sXor7.data(), 100); 52 | int newHealth = event->GetInt(sXor6.data(), 100); 53 | 54 | int oldFirstDigit = getZahlAnStelle(oldHealth, 1); 55 | int newFirstDigit = getZahlAnStelle(newHealth, 1); 56 | 57 | //if ( oldFirstDigit == 1 && oldHealth == 100 && oldHealth != newHealth ) // take care of 100 hp XDD 58 | // 10 healthbars, jeweils 10 hp 59 | //if (newHealth < 91 && oldFirstDigit != newFirstDigit) 60 | //{ 61 | // von 100 auf 90 -> healthbar nummer 10 removen 62 | // von 90 auf 80 -> healthbar nummer 9 removen 63 | // von 70 auf 50 -> healthbar nummer 7 und 8 removen 64 | // etc.. 65 | 66 | int healthbarRemovedNum = 0; 67 | if (newHealth < oldHealth) 68 | { 69 | //int numberOfRemovedHealthbars = getZahlAnStelle(oldHealth - newHealth, 1); 70 | } 71 | // i removed da fuckin healthbar XDDD 72 | 73 | bool foundInList = false; 74 | int i = 0; 75 | for (i = 0; i < g_healthInfo.size(); i++) 76 | { 77 | if (g_healthInfo[i].targetId == event->GetInt(sXor5.data(), 0)) 78 | { 79 | g_healthInfo[i].damage += event->GetInt(sXor7.data(), 100); 80 | g_healthInfo[i].animTimer = GetTickCount(); 81 | foundInList = true; 82 | break; 83 | } 84 | } 85 | 86 | if (!foundInList) 87 | { 88 | healthInfo_t pHealthDummy; 89 | pHealthDummy.damage = event->GetInt(sXor7.data(), 100); 90 | pHealthDummy.targetId = event->GetInt(sXor5.data(), 0); 91 | pHealthDummy.animTimer = GetTickCount(); 92 | g_healthInfo.push_back(pHealthDummy); 93 | } 94 | /* 95 | pHealthDummy.damage = event->GetInt("dmg_health", 100); 96 | pHealthDummy.targetId = event->GetInt("userid", 0); 97 | pHealthDummy.animTimer = GetTickCount(); 98 | g_healthInfo.push_back(pHealthDummy); 99 | */ 100 | //} 101 | // complicated part XDDDD 102 | 103 | #ifdef DEBUGMODE 104 | sprintf(szString, sXor8.data(), event->GetInt(sXor7.data(), 100), info.name, oldHealth, newHealth, oldFirstDigit, newFirstDigit); 105 | Base::Debug::LOG(szString); 106 | #endif 107 | } 108 | } 109 | 110 | /* 111 | short userid user ID who died 112 | short attacker user ID who killed 113 | short assister user ID who assisted in the kill 114 | bool headshot singals a headshot 115 | */ 116 | 117 | if (strcmp(szEventName, sXor2.data()) == 0) 118 | { 119 | for (int i = 0; i < g_healthInfo.size(); i++) 120 | { 121 | if (g_healthInfo[i].targetId == event->GetInt(sXor5.data(), 0)) 122 | g_healthInfo[i].animTimer = 0, g_healthInfo[i].damage = 0, g_healthInfo[i].targetId = 0; 123 | } 124 | } 125 | 126 | if (strcmp(szEventName, sXor3.data()) == 0) 127 | { 128 | g_healthInfo.clear(); 129 | } 130 | 131 | } 132 | 133 | void cGameEventManager::RegisterSelf() 134 | { 135 | static std::string sXor = /*player_hurt*/XorStr<0x7D,12,0x427069F4>("\x0D\x12\x1E\xF9\xE4\xF0\xDC\xEC\xF0\xF4\xF3"+0x427069F4).s; 136 | static std::string sXor2 = /*player_death*/XorStr<0x72,13,0x2C0196D0>("\x02\x1F\x15\x0C\x13\x05\x27\x1D\x1F\x1A\x08\x15"+0x2C0196D0).s; 137 | static std::string sXor3 = /*round_start*/XorStr<0x76,12,0xE9B186D0>("\x04\x18\x0D\x17\x1E\x24\x0F\x09\x1F\x0D\xF4"+0xE9B186D0).s; 138 | 139 | g_Valve.pGameEventManager->AddListener(this, sXor.data(), false); 140 | g_Valve.pGameEventManager->AddListener(this, sXor2.data(), false); 141 | g_Valve.pGameEventManager->AddListener(this, sXor3.data(), false); 142 | } 143 | 144 | -------------------------------------------------------------------------------- /CGameEventManager.h: -------------------------------------------------------------------------------- 1 | #ifndef _CGAMEEVENTMANAGER_H_ 2 | #define _CGAMEEVENTMANAGER_H_ 3 | 4 | class cGameEventManager : public ValveSDK::IGameEventListener2 5 | { 6 | public: 7 | void FireGameEvent(ValveSDK::IGameEvent *event); 8 | void RegisterSelf(); 9 | 10 | }; 11 | 12 | extern cGameEventManager gGameEventManager; 13 | 14 | 15 | #endif -------------------------------------------------------------------------------- /CGameMovement.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class CGameMovement 4 | { 5 | public: 6 | void ProcessMovement(CBaseEntity *pPlayer, PVOID moveData) 7 | { 8 | typedef void(__thiscall* OriginalFn)(PVOID, CBaseEntity *pPlayer, PVOID moveData); 9 | getvfunc(this, 1)(this, pPlayer, moveData); 10 | } 11 | }; 12 | } -------------------------------------------------------------------------------- /CGlobalVars.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class CGlobalVars 4 | { 5 | public: 6 | float realtime; 7 | int framecount; 8 | float absoluteframetime; 9 | float fNew; 10 | float curtime; 11 | float frametime; 12 | int maxclients; 13 | int tickcount; 14 | float interval_per_tick; 15 | float interpolation_amount; 16 | int simTicksThisFrame; 17 | int network_protocol; 18 | PVOID pSaveData; 19 | bool m_bClient; 20 | int nTimestampNetworkingBase; 21 | int nTimestampRandomizeWindow; 22 | }; 23 | } -------------------------------------------------------------------------------- /CInput.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | enum 4 | { 5 | JOYSTICK_MAX_BUTTON_COUNT = 32, 6 | JOYSTICK_POV_BUTTON_COUNT = 4, 7 | JOYSTICK_AXIS_BUTTON_COUNT = 12, 8 | }; 9 | 10 | #define JOYSTICK_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_BUTTON + ((_joystick) * JOYSTICK_MAX_BUTTON_COUNT) + (_button) ) 11 | #define JOYSTICK_POV_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_POV_BUTTON + ((_joystick) * JOYSTICK_POV_BUTTON_COUNT) + (_button) ) 12 | #define JOYSTICK_AXIS_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_AXIS_BUTTON + ((_joystick) * JOYSTICK_AXIS_BUTTON_COUNT) + (_button) ) 13 | 14 | #define JOYSTICK_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_BUTTON_INTERNAL( _joystick, _button ) ) 15 | #define JOYSTICK_POV_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_POV_BUTTON_INTERNAL( _joystick, _button ) ) 16 | #define JOYSTICK_AXIS_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_AXIS_BUTTON_INTERNAL( _joystick, _button ) ) 17 | 18 | enum ButtonCode_t 19 | { 20 | BUTTON_CODE_INVALID = -1, 21 | BUTTON_CODE_NONE = 0, 22 | 23 | KEY_FIRST = 0, 24 | 25 | KEY_NONE = KEY_FIRST, 26 | KEY_0, 27 | KEY_1, 28 | KEY_2, 29 | KEY_3, 30 | KEY_4, 31 | KEY_5, 32 | KEY_6, 33 | KEY_7, 34 | KEY_8, 35 | KEY_9, 36 | KEY_A, 37 | KEY_B, 38 | KEY_C, 39 | KEY_D, 40 | KEY_E, 41 | KEY_F, 42 | KEY_G, 43 | KEY_H, 44 | KEY_I, 45 | KEY_J, 46 | KEY_K, 47 | KEY_L, 48 | KEY_M, 49 | KEY_N, 50 | KEY_O, 51 | KEY_P, 52 | KEY_Q, 53 | KEY_R, 54 | KEY_S, 55 | KEY_T, 56 | KEY_U, 57 | KEY_V, 58 | KEY_W, 59 | KEY_X, 60 | KEY_Y, 61 | KEY_Z, 62 | KEY_PAD_0, 63 | KEY_PAD_1, 64 | KEY_PAD_2, 65 | KEY_PAD_3, 66 | KEY_PAD_4, 67 | KEY_PAD_5, 68 | KEY_PAD_6, 69 | KEY_PAD_7, 70 | KEY_PAD_8, 71 | KEY_PAD_9, 72 | KEY_PAD_DIVIDE, 73 | KEY_PAD_MULTIPLY, 74 | KEY_PAD_MINUS, 75 | KEY_PAD_PLUS, 76 | KEY_PAD_ENTER, 77 | KEY_PAD_DECIMAL, 78 | KEY_LBRACKET, 79 | KEY_RBRACKET, 80 | KEY_SEMICOLON, 81 | KEY_APOSTROPHE, 82 | KEY_BACKQUOTE, 83 | KEY_COMMA, 84 | KEY_PERIOD, 85 | KEY_SLASH, 86 | KEY_BACKSLASH, 87 | KEY_MINUS, 88 | KEY_EQUAL, 89 | KEY_ENTER, 90 | KEY_SPACE, 91 | KEY_BACKSPACE, 92 | KEY_TAB, 93 | KEY_CAPSLOCK, 94 | KEY_NUMLOCK, 95 | KEY_ESCAPE, 96 | KEY_SCROLLLOCK, 97 | KEY_INSERT, 98 | KEY_DELETE, 99 | KEY_HOME, 100 | KEY_END, 101 | KEY_PAGEUP, 102 | KEY_PAGEDOWN, 103 | KEY_BREAK, 104 | KEY_LSHIFT, 105 | KEY_RSHIFT, 106 | KEY_LALT, 107 | KEY_RALT, 108 | KEY_LCONTROL, 109 | KEY_RCONTROL, 110 | KEY_LWIN, 111 | KEY_RWIN, 112 | KEY_APP, 113 | KEY_UP, 114 | KEY_LEFT, 115 | KEY_DOWN, 116 | KEY_RIGHT, 117 | KEY_F1, 118 | KEY_F2, 119 | KEY_F3, 120 | KEY_F4, 121 | KEY_F5, 122 | KEY_F6, 123 | KEY_F7, 124 | KEY_F8, 125 | KEY_F9, 126 | KEY_F10, 127 | KEY_F11, 128 | KEY_F12, 129 | KEY_CAPSLOCKTOGGLE, 130 | KEY_NUMLOCKTOGGLE, 131 | KEY_SCROLLLOCKTOGGLE, 132 | 133 | KEY_LAST = KEY_SCROLLLOCKTOGGLE, 134 | KEY_COUNT = KEY_LAST - KEY_FIRST + 1, 135 | 136 | // Mouse 137 | MOUSE_FIRST = KEY_LAST + 1, 138 | 139 | MOUSE_LEFT = MOUSE_FIRST, 140 | MOUSE_RIGHT, 141 | MOUSE_MIDDLE, 142 | MOUSE_4, 143 | MOUSE_5, 144 | MOUSE_WHEEL_UP, // A fake button which is 'pressed' and 'released' when the wheel is moved up 145 | MOUSE_WHEEL_DOWN, // A fake button which is 'pressed' and 'released' when the wheel is moved down 146 | 147 | MOUSE_LAST = MOUSE_WHEEL_DOWN, 148 | MOUSE_COUNT = MOUSE_LAST - MOUSE_FIRST + 1, 149 | 150 | // Joystick 151 | JOYSTICK_FIRST = MOUSE_LAST + 1, 152 | 153 | JOYSTICK_FIRST_BUTTON = JOYSTICK_FIRST, 154 | JOYSTICK_LAST_BUTTON = JOYSTICK_BUTTON_INTERNAL( 0, JOYSTICK_MAX_BUTTON_COUNT-1 ), 155 | JOYSTICK_FIRST_POV_BUTTON, 156 | JOYSTICK_LAST_POV_BUTTON = JOYSTICK_POV_BUTTON_INTERNAL( 0, JOYSTICK_POV_BUTTON_COUNT-1 ), 157 | JOYSTICK_FIRST_AXIS_BUTTON, 158 | JOYSTICK_LAST_AXIS_BUTTON = JOYSTICK_AXIS_BUTTON_INTERNAL( 0, JOYSTICK_AXIS_BUTTON_COUNT-1 ), 159 | 160 | JOYSTICK_LAST = JOYSTICK_LAST_AXIS_BUTTON, 161 | 162 | BUTTON_CODE_LAST, 163 | BUTTON_CODE_COUNT = BUTTON_CODE_LAST - KEY_FIRST + 1, 164 | 165 | // Helpers for XBox 360 166 | KEY_XBUTTON_UP = JOYSTICK_FIRST_POV_BUTTON, // POV buttons 167 | KEY_XBUTTON_RIGHT, 168 | KEY_XBUTTON_DOWN, 169 | KEY_XBUTTON_LEFT, 170 | 171 | KEY_XBUTTON_A = JOYSTICK_FIRST_BUTTON, // Buttons 172 | KEY_XBUTTON_B, 173 | KEY_XBUTTON_X, 174 | KEY_XBUTTON_Y, 175 | KEY_XBUTTON_LEFT_SHOULDER, 176 | KEY_XBUTTON_RIGHT_SHOULDER, 177 | KEY_XBUTTON_BACK, 178 | KEY_XBUTTON_START, 179 | KEY_XBUTTON_STICK1, 180 | KEY_XBUTTON_STICK2, 181 | 182 | KEY_XSTICK1_RIGHT = JOYSTICK_FIRST_AXIS_BUTTON, // XAXIS POSITIVE 183 | KEY_XSTICK1_LEFT, // XAXIS NEGATIVE 184 | KEY_XSTICK1_DOWN, // YAXIS POSITIVE 185 | KEY_XSTICK1_UP, // YAXIS NEGATIVE 186 | KEY_XBUTTON_LTRIGGER, // ZAXIS POSITIVE 187 | KEY_XBUTTON_RTRIGGER, // ZAXIS NEGATIVE 188 | KEY_XSTICK2_RIGHT, // UAXIS POSITIVE 189 | KEY_XSTICK2_LEFT, // UAXIS NEGATIVE 190 | KEY_XSTICK2_DOWN, // VAXIS POSITIVE 191 | KEY_XSTICK2_UP, // VAXIS NEGATIVE 192 | }; 193 | 194 | //INPUTw 195 | class CInput 196 | { 197 | public: 198 | class CUserCmd 199 | { 200 | public: 201 | CRC32_t GetChecksum( void ) const 202 | { 203 | CRC32_t crc; 204 | CRC32_Init( &crc ); 205 | CRC32_ProcessBuffer( &crc, &command_number, sizeof( command_number ) ); 206 | CRC32_ProcessBuffer( &crc, &tick_count, sizeof( tick_count ) ); 207 | CRC32_ProcessBuffer( &crc, &viewangles, sizeof( viewangles ) ); 208 | CRC32_ProcessBuffer( &crc, &aimdirection, sizeof( aimdirection ) ); 209 | CRC32_ProcessBuffer( &crc, &forwardmove, sizeof( forwardmove ) ); 210 | CRC32_ProcessBuffer( &crc, &sidemove, sizeof( sidemove ) ); 211 | CRC32_ProcessBuffer( &crc, &upmove, sizeof( upmove ) ); 212 | CRC32_ProcessBuffer( &crc, &buttons, sizeof( buttons ) ); 213 | CRC32_ProcessBuffer( &crc, &impulse, sizeof( impulse ) ); 214 | CRC32_ProcessBuffer( &crc, &weaponselect, sizeof( weaponselect ) ); 215 | CRC32_ProcessBuffer( &crc, &weaponsubtype, sizeof( weaponsubtype ) ); 216 | CRC32_ProcessBuffer( &crc, &random_seed, sizeof( random_seed ) ); 217 | CRC32_ProcessBuffer( &crc, &mousedx, sizeof( mousedx ) ); 218 | CRC32_ProcessBuffer( &crc, &mousedy, sizeof( mousedy ) ); 219 | CRC32_Final( &crc ); 220 | return crc; 221 | } 222 | 223 | BYTE u1[ 4 ]; 224 | int command_number; 225 | int tick_count; 226 | Vector viewangles; 227 | Vector aimdirection; 228 | float forwardmove; 229 | float sidemove; 230 | float upmove; 231 | int buttons; 232 | BYTE impulse; 233 | int weaponselect; 234 | int weaponsubtype; 235 | int random_seed; 236 | short mousedx; 237 | short mousedy; 238 | bool hasbeenpredicted; 239 | Vector headangles; 240 | Vector headoffset; 241 | }; 242 | 243 | class CVerifiedUserCmd 244 | { 245 | public: 246 | CUserCmd m_cmd; 247 | unsigned long m_crc; 248 | }; 249 | 250 | char pad_0x00[ 0x0C ]; 251 | bool m_trackir_available; 252 | bool m_mouse_initiated; 253 | bool m_mouse_active; 254 | bool m_fJoystickAdvancedInit; 255 | char pad_0x08[ 0x2C ]; 256 | void* m_pKeys; 257 | char pad_0x38[ 0x6C ]; 258 | bool m_fCameraInterceptingMouse; 259 | bool m_fCameraInThirdPerson; 260 | bool m_fCameraMovingWithMouse; 261 | Vector m_vecCameraOffset; 262 | bool m_fCameraDistanceMove; 263 | int m_nCameraOldX; 264 | int m_nCameraOldY; 265 | int m_nCameraX; 266 | int m_nCameraY; 267 | bool m_CameraIsOrthographic; 268 | Vector m_angPreviousViewAngles; 269 | Vector m_angPreviousViewAnglesTilt; 270 | float m_flLastForwardMove; 271 | int m_nClearInputState; 272 | char pad_0xE4[ 0x8 ]; 273 | CUserCmd* m_pCommands; 274 | CVerifiedUserCmd* m_pVerifiedCommands; 275 | 276 | CUserCmd* GetUserCmd(int seq, int num) 277 | { 278 | typedef CUserCmd* (__thiscall* OriginalFn)(PVOID, int, int); 279 | return getvfunc(this, 8)(this, seq, num); 280 | } 281 | }; 282 | } -------------------------------------------------------------------------------- /CMath.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | 3 | 4 | 5 | VOID CMath::sinCos(float radians, PFLOAT sine, PFLOAT cosine) 6 | { 7 | __asm 8 | { 9 | fld dword ptr[radians] 10 | fsincos 11 | mov edx, dword ptr[cosine] 12 | mov eax, dword ptr[sine] 13 | fstp dword ptr[edx] 14 | fstp dword ptr[eax] 15 | } 16 | } 17 | 18 | VOID CMath::angleVectors(PFLOAT angles, PFLOAT f, PFLOAT r, PFLOAT u) 19 | { 20 | float sp, sy, sr, cp, cy, cr; 21 | 22 | sinCos(DEG2RAD(angles[0]), &sp, &cp); 23 | sinCos(DEG2RAD(angles[1]), &sy, &cy); 24 | sinCos(DEG2RAD(angles[2]), &sr, &cr); 25 | 26 | f[0] = cp * cy; 27 | f[1] = cp * sy; 28 | f[2] = -sp; 29 | 30 | r[0] = -1.0f * sr * sp * cy + -1.0f * cr * -sy; 31 | r[1] = -1.0f * sr * sp * sy + -1.0f * cr * cy; 32 | r[2] = -1.0f * sr * cp; 33 | 34 | u[0] = cr * sp * cy + -sr * -sy; 35 | u[1] = cr * sp * sy + -sr * cy; 36 | u[2] = cr * cp; 37 | } 38 | 39 | float CMath::sseSqrt(float x) 40 | { 41 | float root = 0.0f; 42 | 43 | __asm 44 | { 45 | sqrtss xmm0, x 46 | movss root, xmm0 47 | } 48 | 49 | return root; 50 | } 51 | 52 | void CMath::vectorAngles(float* forward, float* angles) 53 | { 54 | if (forward[1] == 0.0f && forward[0] == 0.0f) 55 | { 56 | angles[0] = (forward[2] > 0.0f) ? 270.0f : 90.0f; 57 | angles[1] = 0.0f; 58 | } 59 | else 60 | { 61 | float len2d = sseSqrt(square(forward[0]) + square(forward[1])); 62 | 63 | angles[0] = RAD2DEG(atan2f(-forward[2], len2d)); 64 | angles[1] = RAD2DEG(atan2f(forward[1], forward[0])); 65 | 66 | if (angles[0] < 0.0f) angles[0] += 360.0f; 67 | if (angles[1] < 0.0f) angles[1] += 360.0f; 68 | } 69 | 70 | angles[2] = 0.0f; 71 | } 72 | 73 | float CMath::AngleNormalize(float angle) 74 | { 75 | while (angle < -180) angle += 360; 76 | while (angle > 180) angle -= 360; 77 | 78 | return angle; 79 | } 80 | 81 | float CMath::DotProduct(const float *v1, const float *v2) 82 | { 83 | return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; 84 | } 85 | 86 | VOID CMath::VectorTransform(const Vector in1, const matrix3x4_t& in2, Vector& out) 87 | { 88 | float buf[3]; 89 | buf[0] = in1.x; 90 | buf[1] = in1.y; 91 | buf[2] = in1.z; 92 | 93 | out[0] = DotProduct(buf, in2[0]) + in2[0][3]; 94 | out[1] = DotProduct(buf, in2[1]) + in2[1][3]; 95 | out[2] = DotProduct(buf, in2[2]) + in2[2][3]; 96 | } -------------------------------------------------------------------------------- /CMath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define PI 3.14159265358979323846f 4 | #define DEG2RAD( x ) ( ( float )( x ) * ( float )( ( float )( PI ) / 180.0f ) ) 5 | #define RAD2DEG( x ) ( ( float )( x ) * ( float )( 180.0f / ( float )( PI ) ) ) 6 | #define square( x ) ( x * x ) 7 | 8 | struct matrix3x4_t 9 | { 10 | matrix3x4_t() {} 11 | matrix3x4_t( 12 | float m00, float m01, float m02, float m03, 13 | float m10, float m11, float m12, float m13, 14 | float m20, float m21, float m22, float m23) 15 | { 16 | m_flMatVal[0][0] = m00; m_flMatVal[0][1] = m01; m_flMatVal[0][2] = m02; m_flMatVal[0][3] = m03; 17 | m_flMatVal[1][0] = m10; m_flMatVal[1][1] = m11; m_flMatVal[1][2] = m12; m_flMatVal[1][3] = m13; 18 | m_flMatVal[2][0] = m20; m_flMatVal[2][1] = m21; m_flMatVal[2][2] = m22; m_flMatVal[2][3] = m23; 19 | } 20 | void Init(const Vector& xAxis, const Vector& yAxis, const Vector& zAxis, const Vector &vecOrigin) 21 | { 22 | m_flMatVal[0][0] = xAxis.x; m_flMatVal[0][1] = yAxis.x; m_flMatVal[0][2] = zAxis.x; m_flMatVal[0][3] = vecOrigin.x; 23 | m_flMatVal[1][0] = xAxis.y; m_flMatVal[1][1] = yAxis.y; m_flMatVal[1][2] = zAxis.y; m_flMatVal[1][3] = vecOrigin.y; 24 | m_flMatVal[2][0] = xAxis.z; m_flMatVal[2][1] = yAxis.z; m_flMatVal[2][2] = zAxis.z; m_flMatVal[2][3] = vecOrigin.z; 25 | } 26 | 27 | matrix3x4_t(const Vector& xAxis, const Vector& yAxis, const Vector& zAxis, const Vector &vecOrigin) 28 | { 29 | Init(xAxis, yAxis, zAxis, vecOrigin); 30 | } 31 | float *operator[](int i) 32 | { 33 | return m_flMatVal[i]; 34 | } 35 | const float *operator[](int i) const 36 | { 37 | return m_flMatVal[i]; 38 | } 39 | float *Base() 40 | { 41 | return &m_flMatVal[0][0]; 42 | } 43 | const float *Base() const 44 | { 45 | return &m_flMatVal[0][0]; 46 | } 47 | 48 | float m_flMatVal[3][4]; 49 | }; 50 | 51 | class CMath 52 | { 53 | public: 54 | VOID sinCos(float radians, PFLOAT sine, PFLOAT cosine); 55 | VOID angleVectors(PFLOAT angles, PFLOAT f, PFLOAT r, PFLOAT u); 56 | float sseSqrt(float x); 57 | VOID vectorAngles(float* forward, float* angles); 58 | float AngleNormalize(float angle); 59 | float DotProduct(const float *v1, const float *v2); 60 | VOID VectorTransform(const Vector in1, const matrix3x4_t& in2, Vector& out); 61 | 62 | }; 63 | 64 | -------------------------------------------------------------------------------- /CModelInfo.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class CModelInfo 4 | { 5 | public: 6 | const char* GetModelName(const model_t* pModel) 7 | { 8 | typedef const char* (__thiscall* OriginalFn)(PVOID, const model_t*); 9 | return getvfunc(this, 3)(this, pModel); 10 | } 11 | 12 | studiohdr_t* GetStudiomodel(const model_t *pModel) 13 | { 14 | typedef studiohdr_t* (__thiscall* OriginalFn)(PVOID, const model_t*); 15 | return getvfunc< OriginalFn >(this, 32)(this, pModel); 16 | } 17 | 18 | void GetModelMaterials(const model_t *pModel, int count, IMaterial** ppMaterial) 19 | { 20 | typedef void (__thiscall* OriginalFn)(PVOID, const model_t*, int, IMaterial**); 21 | getvfunc< OriginalFn >(this, 19)(this, pModel, count, ppMaterial); 22 | } 23 | }; 24 | } -------------------------------------------------------------------------------- /CNoSpread.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | 3 | CMath g_Math; 4 | 5 | void sinCos(float radians, PFLOAT sine, PFLOAT cosine) 6 | { 7 | __asm 8 | { 9 | fld dword ptr[radians] 10 | fsincos 11 | mov edx, dword ptr[cosine] 12 | mov eax, dword ptr[sine] 13 | fstp dword ptr[edx] 14 | fstp dword ptr[eax] 15 | } 16 | } 17 | 18 | #define DEG2RAD( x ) ( ( float )( x ) * ( float )( ( float )( PI ) / 180.0f ) ) 19 | #define RAD2DEG( x ) ( ( float )( x ) * ( float )( 180.0f / ( float )( PI ) ) ) 20 | #define square( x ) ( x * x ) 21 | 22 | void CNoSpread::angleVectors(Vector angles, Vector &f, Vector &r, Vector &u) 23 | { 24 | float sp, sy, sr, cp, cy, cr; 25 | 26 | sinCos(DEG2RAD(angles[0]), &sp, &cp); 27 | sinCos(DEG2RAD(angles[1]), &sy, &cy); 28 | sinCos(DEG2RAD(angles[2]), &sr, &cr); 29 | 30 | f[0] = cp * cy; 31 | f[1] = cp * sy; 32 | f[2] = -sp; 33 | 34 | r[0] = -1.0f * sr * sp * cy + -1.0f * cr * -sy; 35 | r[1] = -1.0f * sr * sp * sy + -1.0f * cr * cy; 36 | r[2] = -1.0f * sr * cp; 37 | 38 | u[0] = cr * sp * cy + -sr * -sy; 39 | u[1] = cr * sp * sy + -sr * cy; 40 | u[2] = cr * cp; 41 | } 42 | 43 | void CNoSpread::angleVectors(Vector angles, Vector &f) 44 | { 45 | float sp, sy, sr, cp, cy, cr; 46 | 47 | sinCos(DEG2RAD(angles[0]), &sp, &cp); 48 | sinCos(DEG2RAD(angles[1]), &sy, &cy); 49 | sinCos(DEG2RAD(angles[2]), &sr, &cr); 50 | 51 | f[0] = cp * cy; 52 | f[1] = cp * sy; 53 | f[2] = -sp; 54 | } 55 | 56 | float sseSqrt(float x) 57 | { 58 | float root = 0.0f; 59 | 60 | __asm 61 | { 62 | sqrtss xmm0, x 63 | movss root, xmm0 64 | } 65 | 66 | return root; 67 | } 68 | 69 | void CNoSpread::vectorAngles(Vector forward, Vector &angles) 70 | { 71 | if (forward[1] == 0.0f && forward[0] == 0.0f) 72 | { 73 | angles[0] = (forward[2] > 0.0f) ? 270.0f : 90.0f; 74 | angles[1] = 0.0f; 75 | } 76 | else 77 | { 78 | float len2d = sseSqrt(square(forward[0]) + square(forward[1])); 79 | 80 | angles[0] = RAD2DEG(atan2f(-forward[2], len2d)); 81 | angles[1] = RAD2DEG(atan2f(forward[1], forward[0])); 82 | 83 | if (angles[0] < 0.0f) angles[0] += 360.0f; 84 | if (angles[1] < 0.0f) angles[1] += 360.0f; 85 | } 86 | 87 | angles[2] = 0.0f; 88 | } 89 | 90 | void VectorAngles(const Vector &forward, const Vector &pseudoup, Vector &angles) 91 | { 92 | Vector left; 93 | 94 | left = CrossProduct( pseudoup, forward ); 95 | left.NormalizeInPlace(); 96 | 97 | float xyDist = sseSqrt( forward[0] * forward[0] + forward[1] * forward[1] ); 98 | 99 | if ( xyDist > 0.001f ) 100 | { 101 | angles[1] = RAD2DEG( atan2f( forward[1], forward[0] ) ); 102 | angles[0] = RAD2DEG( atan2f( -forward[2], xyDist ) ); 103 | 104 | float up_z = (left[1] * forward[0]) - (left[0] * forward[1]); 105 | 106 | angles[2] = RAD2DEG( atan2f( left[2], up_z ) ); 107 | } 108 | else 109 | { 110 | angles[1] = RAD2DEG( atan2f( -left[0], left[1] ) ); 111 | angles[0] = RAD2DEG( atan2f( -forward[2], xyDist ) ); 112 | angles[2] = 0; 113 | } 114 | } 115 | 116 | float CNoSpread::AngleNormalize(float angle) 117 | { 118 | while (angle < -180) angle += 360; 119 | while (angle > 180) angle -= 360; 120 | 121 | return angle; 122 | } 123 | 124 | void CNoSpread::RandomSeed(int iSeed) 125 | { 126 | typedef void(__cdecl* RandomSeed_t)(int); 127 | static RandomSeed_t pRandomSeed = (RandomSeed_t)(GetProcAddress(GetModuleHandle(/*vstdlib*/XorStr<0x54,8,0xFE0933A5>("\x22\x26\x22\x33\x34\x30\x38"+0xFE0933A5).s), /*RandomSeed*/XorStr<0xFB,11,0x36C577CD>("\xA9\x9D\x93\x9A\x90\x6D\x52\x67\x66\x60"+0x36C577CD).s)); 128 | pRandomSeed(iSeed); 129 | } 130 | 131 | float CNoSpread::RandomFloat(float fMin, float fMax) 132 | { 133 | typedef float(__cdecl* RandomFloat_t)(float, float); 134 | static RandomFloat_t pRandomFloat = (RandomFloat_t)(GetProcAddress(GetModuleHandle(/*vstdlib*/XorStr<0x54,8,0xFE0933A5>("\x22\x26\x22\x33\x34\x30\x38"+0xFE0933A5).s), /*RandomFloat*/XorStr<0x79,12,0x49861C66>("\x2B\x1B\x15\x18\x12\x13\x39\xEC\xEE\xE3\xF7"+0x49861C66).s)); 135 | return pRandomFloat(fMin, fMax); 136 | } 137 | 138 | void CNoSpread::GetRollSpreadFix(ValveSDK::CBaseCombatWeapon *m_pWeapon, UINT seed, Vector& pflInAngles) 139 | { 140 | pflInAngles.x = AngleNormalize(pflInAngles.x); 141 | pflInAngles.y = AngleNormalize(pflInAngles.y); 142 | 143 | RandomSeed((seed & 0xFF) + 1); 144 | float flA = RandomFloat( 0.0f, m_pWeapon->GetCone( ) ); 145 | float flB = RandomFloat( 0.0f, 6.283185f ); 146 | float flC = RandomFloat( 0.0f, m_pWeapon->GetSpread( ) ); 147 | float flD = RandomFloat( 0.0f, 6.283185f ); 148 | 149 | Vector vForward,vRight,vUp,vDir; 150 | Vector vView,vSpread, flIdentity[3]; 151 | float flRoll, flCross; 152 | 153 | vSpread.x = ( cos( flB ) * flA ) + ( cos( flD ) * flC ); 154 | vSpread.y = ( sin( flB ) * flA ) + ( sin( flD ) * flC ); 155 | 156 | Vector qViewAngles = pflInAngles; 157 | 158 | vSpread[0] = -vSpread[0]; 159 | vSpread[1] = -vSpread[1]; 160 | 161 | angleVectors( qViewAngles, vForward, vRight, vUp ); 162 | 163 | vDir[0] = vForward[0] + ( vRight[0] * vSpread[0] ) + ( vUp[0] * vSpread[1] ); 164 | vDir[1] = vForward[1] + ( vRight[1] * vSpread[0] ) + ( vUp[1] * vSpread[1] ); 165 | vDir[2] = vForward[2] + ( vRight[2] * vSpread[0] ) + ( vUp[2] * vSpread[1] ); 166 | 167 | vDir.NormalizeInPlace(); 168 | 169 | flIdentity[2][0] = 1.0f; 170 | flIdentity[2][1] = -vSpread[0]; 171 | flIdentity[2][2] = vSpread[1]; 172 | 173 | flIdentity[2].NormalizeInPlace(); 174 | 175 | flIdentity[0][0] = 0.0f; 176 | flIdentity[0][1] = -vSpread[0]; 177 | flIdentity[0][2] = ( 1.0f / vSpread[1] ) + ( 1.0f / flIdentity[2][2] ) + vSpread[1]; 178 | 179 | if( vSpread[0] > 0.0f && vSpread[1] < 0.0f ) 180 | { 181 | if( flIdentity[0][1] < 0.0f ) 182 | flIdentity[0][1] = -flIdentity[0][1]; 183 | } 184 | else if( vSpread[0] < 0.0f && vSpread[1] < 0.0f ) 185 | { 186 | if( flIdentity[0][1] > 0.0f ) 187 | flIdentity[0][1] = -flIdentity[0][1]; 188 | } 189 | 190 | if( flIdentity[0][2] < 0.0f ) 191 | flIdentity[0][2] = -flIdentity[0][2]; 192 | 193 | flIdentity[0].NormalizeInPlace(); 194 | 195 | flIdentity[1] = CrossProduct( flIdentity[0], flIdentity[2] ); 196 | flIdentity[1].NormalizeInPlace(); 197 | 198 | flCross = ( flIdentity[1][1] * flIdentity[2][0] ) - ( flIdentity[1][0] * flIdentity[2][1] ); 199 | 200 | if( qViewAngles[0] > 84.0f || qViewAngles[0] < -84.0f ) 201 | flRoll = RAD2DEG( atan2f( flIdentity[1][2], sseSqrt( flCross ) ) ); 202 | else 203 | flRoll = RAD2DEG( atan2f( flIdentity[1][2], flCross ) ); 204 | 205 | if( flRoll < 0.0f ) 206 | flRoll += 360.0f; 207 | 208 | VectorAngles( vDir, vUp, pflInAngles ); 209 | pflInAngles[2] += flRoll; 210 | 211 | pflInAngles.x = AngleNormalize(pflInAngles.x); 212 | pflInAngles.y = AngleNormalize(pflInAngles.y); 213 | } 214 | 215 | void CNoSpread::GetSpreadFix(ValveSDK::CBaseCombatWeapon *m_pWeapon, UINT seed, Vector& pflInAngles) 216 | { 217 | pflInAngles.x = AngleNormalize(pflInAngles.x); 218 | pflInAngles.y = AngleNormalize(pflInAngles.y); 219 | 220 | RandomSeed((seed & 0xFF) + 1); 221 | float flA = RandomFloat( 0.0f, m_pWeapon->GetCone( ) ); 222 | float flB = RandomFloat( 0.0f, 6.283185f ); 223 | float flC = RandomFloat( 0.0f, m_pWeapon->GetSpread( ) ); 224 | float flD = RandomFloat( 0.0f, 6.283185f ); 225 | 226 | Vector vForward,vRight,vUp,vDir; 227 | Vector vView,vSpread; 228 | 229 | vSpread.x = ( cos( flB ) * flA ) + ( cos( flD ) * flC ); 230 | vSpread.y = ( sin( flB ) * flA ) + ( sin( flD ) * flC ); 231 | 232 | Vector qAng = pflInAngles; 233 | 234 | Vector qDifference; 235 | Vector EstimatedViewAngles; 236 | 237 | float fDiff = 0.0f; 238 | float fDiffOld = 180.0f; 239 | 240 | for ( ;; ) 241 | { 242 | angleVectors(pflInAngles,vForward,vRight,vUp); 243 | 244 | vDir.x = vForward.x + vSpread.x * vRight.x + vSpread.y * vUp.x; 245 | vDir.y = vForward.y + vSpread.x * vRight.y + vSpread.y * vUp.y; 246 | vDir.z = vForward.z + vSpread.x * vRight.z + vSpread.y * vUp.z; 247 | 248 | vView.x = 8192.0f * vDir.x; 249 | vView.y = 8192.0f * vDir.y; 250 | vView.z = 8192.0f * vDir.z; 251 | 252 | vectorAngles(vView,EstimatedViewAngles); 253 | 254 | EstimatedViewAngles.x = AngleNormalize(EstimatedViewAngles.x); 255 | EstimatedViewAngles.y = AngleNormalize(EstimatedViewAngles.y); 256 | 257 | qDifference = qAng - EstimatedViewAngles; 258 | 259 | qDifference.x = AngleNormalize(qDifference.x); 260 | qDifference.y = AngleNormalize(qDifference.y); 261 | 262 | fDiff = sqrt((qDifference.x * qDifference.x) + (qDifference.y * qDifference.y)); 263 | 264 | if((fDiff <= 0.001f) || (fDiff >= fDiffOld)) 265 | break; 266 | 267 | fDiffOld = fDiff; 268 | 269 | pflInAngles += qDifference; 270 | 271 | pflInAngles.x = AngleNormalize(pflInAngles.x); 272 | pflInAngles.y = AngleNormalize(pflInAngles.y); 273 | } 274 | } 275 | -------------------------------------------------------------------------------- /CNoSpread.h: -------------------------------------------------------------------------------- 1 | class CNoSpread 2 | { 3 | public: 4 | void GetSpreadFix(ValveSDK::CBaseCombatWeapon *m_pWeapon, UINT seed, Vector& pflInAngles); 5 | void GetRollSpreadFix(ValveSDK::CBaseCombatWeapon *m_pWeapon, UINT seed, Vector& pflInAngles); 6 | 7 | void angleVectors(Vector angles, Vector &f, Vector &r, Vector &u); 8 | void angleVectors(Vector angles, Vector &f); 9 | void vectorAngles(Vector forward, Vector &angles); 10 | float AngleNormalize(float angle); 11 | void RandomSeed(int iSeed); 12 | float RandomFloat(float fMin, float fMax); 13 | }; 14 | extern CNoSpread g_NoSpread; -------------------------------------------------------------------------------- /CPrediction.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class CPrediction 4 | { 5 | public: 6 | void SetupMove(CBaseEntity *player, ValveSDK::CInput::CUserCmd *ucmd, PVOID movehelper, PVOID moveData) 7 | { 8 | typedef void(__thiscall* OriginalFn)(PVOID, CBaseEntity*, ValveSDK::CInput::CUserCmd*, PVOID, PVOID); 9 | getvfunc(this, 20)(this, player, ucmd, movehelper, moveData); 10 | } 11 | 12 | void FinishMove(CBaseEntity *player, ValveSDK::CInput::CUserCmd *ucmd, PVOID moveData) 13 | { 14 | typedef void(__thiscall* OriginalFn)(PVOID, CBaseEntity*, ValveSDK::CInput::CUserCmd*, PVOID); 15 | getvfunc(this, 21)(this, player, ucmd, moveData); 16 | } 17 | }; 18 | } -------------------------------------------------------------------------------- /CSSBase.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28606.126 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSSBase", "CSSBase.vcxproj", "{BFE914CC-1786-45E7-B592-12F657563848}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {BFE914CC-1786-45E7-B592-12F657563848}.Debug|x64.ActiveCfg = Debug|x64 17 | {BFE914CC-1786-45E7-B592-12F657563848}.Debug|x64.Build.0 = Debug|x64 18 | {BFE914CC-1786-45E7-B592-12F657563848}.Debug|x86.ActiveCfg = Debug|Win32 19 | {BFE914CC-1786-45E7-B592-12F657563848}.Debug|x86.Build.0 = Debug|Win32 20 | {BFE914CC-1786-45E7-B592-12F657563848}.Release|x64.ActiveCfg = Release|x64 21 | {BFE914CC-1786-45E7-B592-12F657563848}.Release|x64.Build.0 = Release|x64 22 | {BFE914CC-1786-45E7-B592-12F657563848}.Release|x86.ActiveCfg = Release|Win32 23 | {BFE914CC-1786-45E7-B592-12F657563848}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {DCC55DB8-8459-4137-BE33-02927D512324} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /CSSBase.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | fuck 10 | Win32 11 | 12 | 13 | fuck 14 | x64 15 | 16 | 17 | Release 18 | Win32 19 | 20 | 21 | Debug 22 | x64 23 | 24 | 25 | Release 26 | x64 27 | 28 | 29 | 30 | 16.0 31 | {BFE914CC-1786-45E7-B592-12F657563848} 32 | Win32Proj 33 | 10.0 34 | 35 | 36 | 37 | DynamicLibrary 38 | true 39 | v143 40 | 41 | 42 | DynamicLibrary 43 | false 44 | v143 45 | 46 | 47 | Application 48 | true 49 | v143 50 | 51 | 52 | Application 53 | false 54 | v143 55 | 56 | 57 | v143 58 | DynamicLibrary 59 | 60 | 61 | v143 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | true 83 | 84 | 85 | false 86 | 87 | 88 | 89 | WIN32;_DEBUG;_WINDOWS;_USRDLL;CSSBASE_EXPORTS;%(PreprocessorDefinitions) 90 | MultiThreadedDebugDLL 91 | Level3 92 | ProgramDatabase 93 | Disabled 94 | true 95 | 96 | 97 | MachineX86 98 | true 99 | Windows 100 | false 101 | false 102 | 103 | 104 | 105 | 106 | WIN32;NDEBUG;_WINDOWS;_USRDLL;CSSBASE_EXPORTS;%(PreprocessorDefinitions) 107 | MultiThreadedDLL 108 | Level3 109 | ProgramDatabase 110 | true 111 | Disabled 112 | true 113 | true 114 | true 115 | false 116 | true 117 | stdcpp17 118 | 119 | 120 | MachineX86 121 | true 122 | Windows 123 | true 124 | true 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /CSSBase.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files 59 | 60 | 61 | Source Files 62 | 63 | 64 | Source Files 65 | 66 | 67 | Source Files 68 | 69 | 70 | Source Files 71 | 72 | 73 | 74 | 75 | Header Files 76 | 77 | 78 | Header Files 79 | 80 | 81 | Header Files 82 | 83 | 84 | Header Files 85 | 86 | 87 | Header Files 88 | 89 | 90 | Header Files 91 | 92 | 93 | Header Files 94 | 95 | 96 | Header Files 97 | 98 | 99 | Header Files 100 | 101 | 102 | Header Files 103 | 104 | 105 | Header Files 106 | 107 | 108 | Header Files 109 | 110 | 111 | Header Files 112 | 113 | 114 | Header Files 115 | 116 | 117 | Header Files 118 | 119 | 120 | Header Files 121 | 122 | 123 | Header Files 124 | 125 | 126 | Header Files 127 | 128 | 129 | Header Files 130 | 131 | 132 | Header Files 133 | 134 | 135 | Header Files 136 | 137 | 138 | Header Files 139 | 140 | 141 | Header Files 142 | 143 | 144 | Header Files 145 | 146 | 147 | Header Files 148 | 149 | 150 | Header Files 151 | 152 | 153 | Header Files 154 | 155 | 156 | Header Files 157 | 158 | 159 | Header Files 160 | 161 | 162 | Header Files 163 | 164 | 165 | Header Files 166 | 167 | 168 | Header Files 169 | 170 | 171 | Header Files 172 | 173 | 174 | Header Files 175 | 176 | 177 | Header Files 178 | 179 | 180 | Header Files 181 | 182 | 183 | Header Files 184 | 185 | 186 | Header Files 187 | 188 | 189 | Header Files 190 | 191 | 192 | Header Files 193 | 194 | 195 | Header Files 196 | 197 | 198 | Header Files 199 | 200 | 201 | Header Files 202 | 203 | 204 | Header Files 205 | 206 | 207 | Header Files 208 | 209 | 210 | Header Files 211 | 212 | 213 | Header Files 214 | 215 | 216 | Header Files 217 | 218 | 219 | Header Files 220 | 221 | 222 | -------------------------------------------------------------------------------- /CSSBase.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /CTrace.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | struct surfacephysicsparams_t 4 | { 5 | // vphysics physical properties 6 | float friction; 7 | float elasticity; // collision elasticity - used to compute coefficient of restitution 8 | float density; // physical density (in kg / m^3) 9 | float thickness; // material thickness if not solid (sheet materials) in inches 10 | float dampening; 11 | }; 12 | 13 | struct surfaceaudioparams_t 14 | { 15 | float reflectivity; 16 | float hardnessFactor; 17 | float roughnessFactor; 18 | float roughThreshold; 19 | float hardThreshold; 20 | float hardMinVelocity; 21 | float highPitchOcclusion; 22 | float midPitchOcclusion; 23 | float lowPitchOcclusion; 24 | }; 25 | 26 | struct surfacesoundnames_t 27 | { 28 | unsigned short stepleft; 29 | unsigned short stepright; 30 | 31 | unsigned short impactSoft; 32 | unsigned short impactHard; 33 | 34 | unsigned short scrapeSmooth; 35 | unsigned short scrapeRough; 36 | 37 | unsigned short bulletImpact; 38 | unsigned short rolling; 39 | 40 | unsigned short breakSound; 41 | unsigned short strainSound; 42 | }; 43 | 44 | struct surfacesoundhandles_t 45 | { 46 | short stepleft; 47 | short stepright; 48 | 49 | short impactSoft; 50 | short impactHard; 51 | 52 | short scrapeSmooth; 53 | short scrapeRough; 54 | 55 | short bulletImpact; 56 | short rolling; 57 | 58 | short breakSound; 59 | short strainSound; 60 | }; 61 | 62 | struct surfacegameprops_t 63 | { 64 | // game movement data 65 | float maxSpeedFactor; // Modulates player max speed when walking on this surface 66 | float jumpFactor; // Indicates how much higher the player should jump when on the surface 67 | // Game-specific data 68 | unsigned short material; 69 | 70 | // Indicates whether or not the player is on a ladder. 71 | unsigned char climbable; 72 | unsigned char pad; 73 | }; 74 | 75 | struct surfacedata_t 76 | { 77 | surfacephysicsparams_t physics; // physics parameters 78 | surfaceaudioparams_t audio; // audio parameters 79 | surfacesoundnames_t sounds; // names of linked sounds 80 | surfacegameprops_t game; // Game data / properties 81 | 82 | surfacesoundhandles_t soundhandles; 83 | }; 84 | 85 | class IPhysicsSurfaceProps 86 | { 87 | public: 88 | surfacedata_t *GetSurfaceData(int surfaceDataIndex) 89 | { 90 | typedef surfacedata_t*(__thiscall* OriginalFn)(PVOID, int); 91 | return getvfunc(this, 5)(this, surfaceDataIndex); 92 | } 93 | }; 94 | 95 | class CTrace 96 | { 97 | public: 98 | enum TraceType_t 99 | { 100 | TRACE_EVERYTHING = 0, 101 | TRACE_WORLD_ONLY, // NOTE: This does *not* test static props!!! 102 | TRACE_ENTITIES_ONLY, // NOTE: This version will *not* test static props 103 | TRACE_EVERYTHING_FILTER_PROPS, // NOTE: This version will pass the IHandleEntity for props through the filter, unlike all other filters 104 | }; 105 | 106 | struct cplane_t 107 | { 108 | Vector normal; 109 | float dist; 110 | BYTE type; 111 | BYTE signBits; 112 | BYTE pad[2]; 113 | }; 114 | 115 | struct csurface_t 116 | { 117 | const char* name; 118 | short surfaceProps; 119 | unsigned short flags; 120 | }; 121 | 122 | struct Ray_t 123 | { 124 | VectorAligned m_Start; // starting point, centered within the extents 125 | VectorAligned m_Delta; // direction + length of the ray 126 | VectorAligned m_StartOffset; // Add this to m_Start to get the actual ray start 127 | VectorAligned m_Extents; // Describes an axis aligned box extruded along a ray 128 | //const matrix3x4_t* m_pWorldAxisTransform; 129 | bool m_IsRay; // are the extents zero? 130 | bool m_IsSwept; // is delta != 0? 131 | 132 | void Init( Vector const& start, Vector const& end ) 133 | { 134 | VectorSubtract( end, start, m_Delta ); 135 | 136 | m_IsSwept = (m_Delta.LengthSqr() != 0); 137 | 138 | VectorClear( m_Extents ); 139 | m_IsRay = true; 140 | 141 | // Offset m_Start to be in the center of the box... 142 | VectorClear( m_StartOffset ); 143 | VectorCopy( start, m_Start ); 144 | } 145 | 146 | void Init( Vector const& start, Vector const& end, Vector const& mins, Vector const& maxs ) 147 | { 148 | VectorSubtract( end, start, m_Delta ); 149 | 150 | m_IsSwept = (m_Delta.LengthSqr() != 0); 151 | 152 | VectorSubtract( maxs, mins, m_Extents ); 153 | m_Extents *= 0.5f; 154 | m_IsRay = (m_Extents.LengthSqr() < 1e-6); 155 | 156 | // Offset m_Start to be in the center of the box... 157 | VectorAdd( mins, maxs, m_StartOffset ); 158 | m_StartOffset *= 0.5f; 159 | VectorAdd( start, m_StartOffset, m_Start ); 160 | m_StartOffset *= -1.0f; 161 | } 162 | 163 | // compute inverse delta 164 | Vector InvDelta() const 165 | { 166 | Vector vecInvDelta; 167 | for ( int iAxis = 0; iAxis < 3; ++iAxis ) 168 | { 169 | if ( m_Delta[iAxis] != 0.0f ) 170 | { 171 | vecInvDelta[iAxis] = 1.0f / m_Delta[iAxis]; 172 | } 173 | else 174 | { 175 | vecInvDelta[iAxis] = FLT_MAX; 176 | } 177 | } 178 | return vecInvDelta; 179 | } 180 | 181 | private: 182 | }; 183 | 184 | struct trace_t 185 | { 186 | Vector start; 187 | Vector endpos; 188 | cplane_t plane; 189 | float fraction; 190 | int contents; 191 | WORD dispFlags; 192 | bool allSolid; 193 | bool startSolid; 194 | float fractionLeftSolid; 195 | csurface_t surface; 196 | int hitgroup; 197 | short physicsBone; 198 | CBaseEntity* m_pEnt; 199 | int hitbox; 200 | }; 201 | 202 | class IHandleEntity 203 | { 204 | public: 205 | virtual ~IHandleEntity() {} 206 | virtual void Func01() = 0; 207 | virtual void Func02() = 0; 208 | }; 209 | 210 | class ITraceFilter 211 | { 212 | public: 213 | virtual bool ShouldHitEntity( IHandleEntity *pEntity, int contentsMask ) = 0; 214 | virtual TraceType_t GetTraceType() const = 0; 215 | }; 216 | 217 | class CTraceFilter : public ITraceFilter 218 | { 219 | public: 220 | virtual TraceType_t GetTraceType() const 221 | { 222 | return TRACE_EVERYTHING; 223 | } 224 | }; 225 | 226 | class CSimpleTraceFilter : public ITraceFilter 227 | { 228 | public: 229 | CSimpleTraceFilter(PVOID pEnt) 230 | { 231 | m_pPassEnt = pEnt; 232 | } 233 | 234 | virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) 235 | { 236 | return pHandleEntity != m_pPassEnt; 237 | } 238 | 239 | virtual TraceType_t GetTraceType() const 240 | { 241 | return TRACE_EVERYTHING; 242 | } 243 | 244 | PVOID m_pPassEnt; 245 | }; 246 | 247 | class CTraceFilterSkipTwoEnts : public ITraceFilter 248 | { 249 | public: 250 | CTraceFilterSkipTwoEnts(PVOID pEnt,PVOID pEnt2) 251 | { 252 | m_pPassEnt = pEnt; 253 | m_pPassEnt2 = pEnt2; 254 | } 255 | 256 | virtual bool ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) 257 | { 258 | return (pHandleEntity != m_pPassEnt && pHandleEntity != m_pPassEnt2); 259 | } 260 | 261 | virtual TraceType_t GetTraceType() const 262 | { 263 | return TRACE_EVERYTHING; 264 | } 265 | 266 | PVOID m_pPassEnt; 267 | PVOID m_pPassEnt2; 268 | }; 269 | 270 | class IClientUnknown : public IHandleEntity 271 | { 272 | public: 273 | virtual PVOID GetCollideable() = 0; 274 | virtual PVOID GetClientNetworkable() = 0; 275 | virtual PVOID GetClientRenderable() = 0; 276 | virtual PVOID GetIClientEntity() = 0; 277 | virtual CBaseEntity *GetBaseEntity() = 0; 278 | virtual PVOID GetClientThinkable() = 0; 279 | virtual void *class1(void) = 0; 280 | virtual void *class2(void) = 0; 281 | }; 282 | 283 | class CTraceFilterNoPlayer : public CTraceFilter 284 | { 285 | public: 286 | CTraceFilterNoPlayer() {} 287 | virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask ) 288 | { 289 | IClientUnknown *pUnk = (IClientUnknown*)pServerEntity; 290 | CBaseEntity *pEnt = pUnk->GetBaseEntity(); 291 | return !pEnt->IsPlayer(); 292 | } 293 | }; 294 | 295 | int GetPointContents( const Vector &vecAbsPosition, int mask = /*MASK_ALL*/0xFFFFFFFF, IHandleEntity** ppEntity = NULL ) 296 | { 297 | typedef int(__thiscall* OriginalFn)(PVOID, const Vector&, int, IHandleEntity**); 298 | return getvfunc(this, 0)(this, vecAbsPosition, mask, ppEntity); 299 | } 300 | 301 | void TraceRay(const Ray_t &ray, unsigned int flMask, ITraceFilter *pTraceFilter, trace_t *ptrace) 302 | { 303 | typedef void(__thiscall* OriginalFn)(PVOID, const Ray_t &, unsigned int, ITraceFilter *, trace_t *); 304 | getvfunc(this, 5)(this, ray, flMask, pTraceFilter, ptrace); 305 | } 306 | }; 307 | } -------------------------------------------------------------------------------- /CVARS.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | 3 | cCVARS g_CVARS; 4 | 5 | std::string CvarNames[MAX_CVARS]; 6 | 7 | void cCVARS::Init(HMODULE hinstDLL) 8 | { 9 | GetModuleFileName(hinstDLL,g_CVARS.szIniFilePath,2048); 10 | 11 | for(int i = strlen(g_CVARS.szIniFilePath); i > 0; i--) 12 | { 13 | if(g_CVARS.szIniFilePath[i] == '\\') 14 | { 15 | g_CVARS.szIniFilePath[i+1] = 0; 16 | break;//break loop so we dont delete everything 17 | } 18 | } 19 | 20 | for(int i = 0; i < MAX_CVARS; i++) 21 | { 22 | char szName[10]; 23 | sprintf(szName,/*[var%i]*/XorStr<0xC0,8,0x685B0EEB>("\x9B\xB7\xA3\xB1\xE1\xAC\x9B"+0x685B0EEB).s,i); 24 | CvarNames[i] = szName; 25 | } 26 | } 27 | 28 | //example: 29 | //szPublicHtmlURL - should be for example "yoursite.com" (without http:// and www.) 30 | //szURLPath - should be for example "kolo.php" (so this would mean yoursite.com/kolo.php) 31 | //szURLPath - you can also assign it with something like "hehe/kolo.php" (this would result in a url of yoursite.com/hehe/kolo.php) 32 | //return value - a byte array of any kind of data received from the url (binary data, text,...) 33 | __forceinline void Winsock_StreamOnlineDataToMemory(char *szPublicHtmlURL, char *szURLPath, std::string &out) 34 | { 35 | g_Winsock.InitWinsock(); 36 | g_Winsock.Connect(szPublicHtmlURL); 37 | g_Winsock.SendHttpGet(szURLPath,out); 38 | g_Winsock.Disconnect(); 39 | g_Winsock.CleanUp(); 40 | } 41 | 42 | //kolonote: 43 | //ok time to use my skillz ehi ehi 44 | //note that this is pretty slow soooo 45 | float FindVarValue(const char *szTextArray, const char *pszVarName) 46 | { 47 | int iLen = strlen(pszVarName) - 1; 48 | 49 | for(int i = 0; i < strlen(szTextArray); i++) 50 | { 51 | //first character matches but we gotta check if whole word matches 52 | if(szTextArray[i] == pszVarName[0]) 53 | { 54 | bool bSkipThis = false; 55 | 56 | for(int i2 = 0; i2 <= iLen; i2++) 57 | { 58 | //we already checked for first character in the array 59 | if(i2 == 0) 60 | continue; 61 | 62 | if(szTextArray[i+i2] != pszVarName[i2]) 63 | { 64 | bSkipThis = true; 65 | break;//ok not our string lets skip this one 66 | } 67 | } 68 | 69 | //something didnt match so lets skip to this one 70 | if(bSkipThis) 71 | continue; 72 | 73 | //everything matches meaning we can retrieve the value now 74 | std::string sOwn = &szTextArray[i+iLen+1];//move 1 more spot as thats where the space is 75 | 76 | return atof(sOwn.data()); 77 | } 78 | } 79 | 80 | return 0.0f; 81 | } 82 | 83 | void cCVARS::HandleConfig(const char *pszConfigName, int iType) 84 | { 85 | //kolonote: 86 | //to save shit were gonna generate a config file 87 | std::string sSavedConfig; 88 | //our file loaded from server 89 | std::string sLoadResponse; 90 | 91 | HW_PROFILE_INFO hwProfileInfo; 92 | 93 | //REMEMBER: TEMPORARY 94 | //this is utter shit but i didnt find a quicker way for unique identification and i need it to store configs for different users on server 95 | GetCurrentHwProfile(&hwProfileInfo); 96 | 97 | for(int varindex = 0;varindex < MAX_CVARS; varindex++) 98 | { 99 | bool bLastInLoop = (varindex == (MAX_CVARS-1)); 100 | bool bFirstInLoop = (varindex == 0); 101 | 102 | if(iType == LoadConfig && bFirstInLoop) 103 | { 104 | std::string sPath = /*confighandle.php*/XorStr<0x5B,17,0x34079F60>("\x38\x33\x33\x38\x36\x07\x09\x03\x0D\x00\x09\x03\x49\x18\x01\x1A"+0x34079F60).s; 105 | char *pszFullPath = new char[sPath.size() + strlen(pszConfigName) + strlen(hwProfileInfo.szHwProfileGuid) + 20]; 106 | sprintf(pszFullPath,/*%s?n=%s&t=1&d=%s&g=2*/XorStr<0x54,21,0x02EED730>("\x71\x26\x69\x39\x65\x7C\x29\x7D\x28\x60\x6F\x79\x04\x5C\x47\x10\x42\x02\x5B\x55"+0x02EED730).s,sPath.data(),pszConfigName,hwProfileInfo.szHwProfileGuid); 107 | 108 | //Winsock_StreamOnlineDataToMemory(/*37.48.84.23*/XorStr<0x72,12,0xFE4D2C44>("\x41\x44\x5A\x41\x4E\x59\x40\x4D\x54\x49\x4F"+0xFE4D2C44).s,pszFullPath,sLoadResponse); 109 | 110 | Winsock_StreamOnlineDataToMemory(/*interwebz.cc*/XorStr<0xD0,13,0xAECE5734>("\xB9\xBF\xA6\xB6\xA6\xA2\xB3\xB5\xA2\xF7\xB9\xB8"+0xAECE5734).s,pszFullPath,sLoadResponse); 111 | 112 | delete [] pszFullPath; 113 | } 114 | 115 | if(iType == SaveConfig) 116 | { 117 | #ifdef DEBUGMODE 118 | if(bFirstInLoop) 119 | { 120 | Base::Debug::LOG(""); 121 | Base::Debug::LOG("Settings Saved!"); 122 | Base::Debug::LOG(""); 123 | } 124 | 125 | char szLog[256]; 126 | sprintf(szLog,"%s = %f",CvarNames[varindex].data(),g_CVARS.CvarList[varindex]); 127 | Base::Debug::LOG(szLog); 128 | #endif 129 | char szBitcho[256]; 130 | sprintf(szBitcho,/*%s%f*/XorStr<0x46,5,0x504F1CD1>("\x63\x34\x6D\x2F"+0x504F1CD1).s,CvarNames[varindex].data(),g_CVARS.CvarList[varindex]); 131 | sSavedConfig += szBitcho; 132 | 133 | if(bLastInLoop) 134 | { 135 | std::string sPath = /*confighandle.php*/XorStr<0x3A,17,0xE30B48FD>("\x59\x54\x52\x5B\x57\x58\x28\x20\x2C\x27\x28\x20\x68\x37\x20\x39"+0xE30B48FD).s; 136 | char *pszFullPath = new char[sPath.size() + sSavedConfig.size() + strlen(pszConfigName) + strlen(hwProfileInfo.szHwProfileGuid) + 20]; 137 | sprintf(pszFullPath,/*%s?t=0&n=%s&f=%s&d=%s&g=2*/XorStr<0xDB,26,0xCAACD7BA>("\xFE\xAF\xE2\xAA\xE2\xD0\xC7\x8C\xDE\xC1\x96\xC0\x81\xD5\xCC\x99\xCD\x88\xD0\xCB\x9C\xD6\x96\xCF\xC1"+0xCAACD7BA).s,sPath.data(),pszConfigName,sSavedConfig.data(),hwProfileInfo.szHwProfileGuid); 138 | 139 | std::string sOut; 140 | Winsock_StreamOnlineDataToMemory(/*interwebz.cc*/XorStr<0xD0,13,0xAECE5734>("\xB9\xBF\xA6\xB6\xA6\xA2\xB3\xB5\xA2\xF7\xB9\xB8"+0xAECE5734).s,pszFullPath,sOut); 141 | 142 | delete [] pszFullPath; 143 | } 144 | 145 | #ifdef DEBUGMODE 146 | if(bLastInLoop) 147 | Base::Debug::LOG(""); 148 | #endif 149 | } 150 | else if(iType == LoadConfig) 151 | { 152 | #ifdef DEBUGMODE 153 | if(bFirstInLoop) 154 | { 155 | Base::Debug::LOG(""); 156 | Base::Debug::LOG("Settings Loaded!"); 157 | Base::Debug::LOG(""); 158 | } 159 | #endif 160 | 161 | g_CVARS.CvarList[varindex] = FindVarValue(sLoadResponse.data(),CvarNames[varindex].data()); 162 | 163 | #ifdef DEBUGMODE 164 | char szLog[256]; 165 | sprintf(szLog,"%s = %f",CvarNames[varindex].data(),g_CVARS.CvarList[varindex]); 166 | Base::Debug::LOG(szLog); 167 | 168 | if(bLastInLoop) 169 | Base::Debug::LOG(""); 170 | #endif 171 | } 172 | } 173 | } 174 | 175 | /*char *CvarNames[] = 176 | { 177 | "esp_name","esp_health","removals_norecoil","removals_nospread","aim_enable","esp_enable", 178 | "misc_bunnyhop","misc_autopistol","aim_onfire","aim_autoshoot","aim_silent","aim_team", 179 | "aim_fov","misc_psilent","misc_fakelagamount","trigger_enable","trigger_perfect","trigger_burst", 180 | "trigger_headonly","trigger_all","removals_novisrecoil","rcs_enable","rcs_fov","rcs_smooth", 181 | "rcs_spot","rcs_scs","aim_spot","rcs_aimteam","trigger_seed","aim_height","aim_hitscan", 182 | "aim_autowall","aim_hitscan_autowall" 183 | };*/ -------------------------------------------------------------------------------- /CVARS.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define MAX_CVARS 118 4 | 5 | enum 6 | { 7 | NameESP, HealthESP, NoRecoil, NoSpread, EnableAim, EnableESP, Bunnyhop, Autopistol, AimOnFire, 8 | Autoshoot, SilentAim, AimTeam, AimFOV, PSilent, FakelagAmount, Triggerbot, PTrigger, TriggerBurst, 9 | TriggerHead, TriggerAll, NoVisRecoil, RCS, RCSFOV, RCSSmooth, RCSSpot, SCS, AimSpot, 10 | RCSAimTeam, TriggerSeed, AimHeight, Hitscans, Autowall, HitscanAutowall, Chams, BrightChams, 11 | ESPEnemyOnly, ChamsEnemyOnly, Glow, GlowEnemyOnly, AimKey, TriggerKey, SmoothAim, AimTime, 12 | TargetSelection, AntiDM, IgnoreLegsAndArms, Knifebot, BackstabOnly, AntiAimX, AntiAimY, 13 | Strafebot, XQZ, NoHands, Asus, AsusAmount, NoSky, HeadESP, BoxESP, Chams_T_Vis, RESERVED0, 14 | RESERVED1, Chams_T_InVis, RESERVED3, RESERVED4, Chams_CT_Vis, RESERVED6, 15 | RESERVED7, Chams_CT_InVis, RESERVED9, RESERVED10, Glow_T_Vis, RESERVED12, 16 | RESERVED35, Glow_T_InVis, RESERVED24, RESERVED23, Glow_CT_Vis, RESERVED13, 17 | RESERVED34, Glow_CT_InVis, RESERVED25, RESERVED22, Esp_T_Vis, RESERVED14, 18 | RESERVED33, RESERVED30, Esp_T_InVis, RESERVED26, RESERVED21, RESERVED18, Esp_CT_Vis, RESERVED15, 19 | RESERVED32, RESERVED31, Esp_CT_InVis, RESERVED27, RESERVED20, RESERVED19, ModelAlpha, VisChecks, 20 | SmartAim, SMACBot, HelmetESP, BombESP, BombDetonation, GrenadeESP, EntESP, WeaponESP, FlashedESP, 21 | DefuseESP, Radar, RadarX, RadarY, RadarHeight, RadarWorld, RadarVisuals, RadarRange, NoSmoke, 22 | NoFlash 23 | }; 24 | 25 | enum 26 | { 27 | SaveConfig, 28 | LoadConfig 29 | }; 30 | 31 | class cCVARS 32 | { 33 | public: 34 | void SetDefaultConfig() 35 | { 36 | CvarList[NameESP] = 1; 37 | CvarList[HealthESP] = 1; 38 | CvarList[ESPEnemyOnly] = 1; 39 | CvarList[Bunnyhop] = 1; 40 | CvarList[Autopistol] = 1; 41 | CvarList[EnableESP] = 1; 42 | CvarList[BoxESP] = 1; 43 | //CvarList[RCS] = 1; 44 | CvarList[RCSSpot] = 11; 45 | CvarList[RCSFOV] = 4; 46 | CvarList[RCSSmooth] = 7; 47 | CvarList[RadarRange] = 31; 48 | //CvarList[XQZ] = 1; 49 | CvarList[NoVisRecoil] = 1; 50 | CvarList[Triggerbot] = 0; 51 | CvarList[PTrigger] = 0; 52 | CvarList[TriggerSeed] = 3; 53 | CvarList[TriggerHead] = 1; 54 | //CvarList[Chams] = 2; 55 | CvarList[ChamsEnemyOnly] = 1; 56 | CvarList[AimSpot] = 0; 57 | //CvarList[EnableAim] = 1; 58 | //CvarList[NoSpread] = 2; 59 | //CvarList[NoRecoil] = 1; 60 | //CvarList[Autowall] = 1; 61 | //CvarList[PSilent] = 1; 62 | //CvarList[Chams] = 2; 63 | //CvarList[Glow] = 1; 64 | //CvarList[AntiAimX] = 2; 65 | //CvarList[AntiAimY] = 1; 66 | CvarList[BoxESP] = 1; 67 | CvarList[AsusAmount] = 255; 68 | //CvarList[NoSky] = 1; 69 | CvarList[NoHands] = 1; 70 | CvarList[Autoshoot] = 1; 71 | CvarList[Knifebot] = 0; 72 | CvarList[AimFOV] = 360.0f; 73 | CvarList[ModelAlpha] = 255; 74 | CvarList[GlowEnemyOnly] = 1; 75 | CvarList[AntiDM] = 1; 76 | CvarList[AimKey] = 1;//lbutton todo: virtual key binder inside inkeyevent (when menu is done) 77 | CvarList[TriggerKey] = 69;//e 78 | CvarList[RadarVisuals] = 1; 79 | 80 | CvarList[Chams_T_InVis] = 255; 81 | CvarList[Chams_CT_InVis + 2] = 255; 82 | 83 | CvarList[Chams_T_Vis] = 255; 84 | CvarList[Chams_T_Vis + 1] = 255; 85 | CvarList[Chams_CT_Vis + 1] = 255; 86 | 87 | CvarList[Esp_T_InVis] = 255; 88 | CvarList[Esp_T_InVis + 1] = 255; 89 | CvarList[Esp_CT_InVis + 1] = 255; 90 | 91 | CvarList[Esp_T_Vis] = 255; 92 | CvarList[Esp_CT_Vis + 2] = 255; 93 | CvarList[Esp_T_InVis + 3] = CvarList[Esp_T_Vis + 3] = CvarList[Esp_CT_InVis + 3] = CvarList[Esp_CT_Vis + 3] = 255; 94 | 95 | CvarList[Glow_T_InVis] = 255; 96 | CvarList[Glow_CT_InVis + 2] = 255; 97 | 98 | CvarList[Glow_T_Vis] = 255; 99 | CvarList[Glow_T_Vis + 1] = 255; 100 | CvarList[Glow_CT_Vis + 1] = 255; 101 | } 102 | 103 | void HandleConfig(const char *pszConfigName, int iType); 104 | 105 | void Init(HMODULE hinstDLL); 106 | 107 | float CvarList[MAX_CVARS]; 108 | 109 | private: 110 | 111 | char szIniFilePath[2048]; 112 | }; 113 | 114 | extern cCVARS g_CVARS; -------------------------------------------------------------------------------- /CValve.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | 3 | ValveSDK::CBaseCombatWeapon* CBaseEntity::GetActiveBaseCombatWeapon() 4 | { 5 | static int iOffset = g_NetworkedVariableManager.GetOffset(/*DT_CSPlayer*/XorStr<0x8F,12,0xB341DDC2>("\xCB\xC4\xCE\xD1\xC0\xC4\xF9\xF7\xEE\xFD\xEB"+0xB341DDC2).s,/*m_hActiveWeapon*/XorStr<0xA4,16,0x547EFF2E>("\xC9\xFA\xCE\xE6\xCB\xDD\xC3\xDD\xC9\xFA\xCB\xCE\xC0\xDE\xDC"+0x547EFF2E).s); 6 | ULONG pWeepEhandle = *(PULONG)((DWORD)this + iOffset); 7 | return (ValveSDK::CBaseCombatWeapon*)(g_Valve.pEntList->GetClientEntityFromHandle(pWeepEhandle)); 8 | } 9 | 10 | void* GetInterfacePtr(const char* interfaceName, const char* ptrName, CreateInterface_t pInterface) 11 | { 12 | #ifdef DEBUGMODE 13 | char szDebugString[1024]; 14 | #endif 15 | std::string sinterface = ""; 16 | std::string interfaceVersion = /*0*/XorStr<0xBF,2,0xE204B62B>("\x8F"+0xE204B62B).s; 17 | 18 | for (int i = 0; i <= 99; i++) 19 | { 20 | sinterface = interfaceName; 21 | sinterface += interfaceVersion; 22 | sinterface += std::to_string(i); 23 | 24 | void* funcPtr = pInterface(sinterface.c_str(), NULL); 25 | 26 | if ((DWORD)funcPtr != 0x0) 27 | { 28 | #ifdef DEBUGMODE 29 | sprintf(szDebugString, "%s: 0x%x (%s%s%i)", ptrName, (DWORD)funcPtr, interfaceName, interfaceVersion.c_str(), i); 30 | Base::Debug::LOG(szDebugString); 31 | #endif 32 | return funcPtr; 33 | } 34 | if (i >= 99 && interfaceVersion == /*0*/XorStr<0xFE,2,0x8291FF95>("\xCE"+0x8291FF95).s) 35 | { 36 | interfaceVersion = /*00*/XorStr<0x79,3,0x0494E7DB>("\x49\x4A"+0x0494E7DB).s; 37 | i = 0; 38 | } 39 | else if (i >= 99 && interfaceVersion == /*00*/XorStr<0x79,3,0x0494E7DB>("\x49\x4A"+0x0494E7DB).s) 40 | { 41 | #ifdef DEBUGMODE 42 | sprintf(szDebugString, "%s: 0x%x (error)", ptrName, (DWORD)funcPtr); 43 | Base::Debug::LOG(szDebugString); 44 | #endif 45 | } 46 | } 47 | return 0; 48 | } 49 | 50 | VOID CValve::initSDK() 51 | { 52 | #ifdef DEBUGMODE 53 | Base::Debug::LOG("Initiate Thread"); 54 | char szDebugString[1024]; 55 | #endif 56 | 57 | auto ClientFactory = ( CreateInterfaceFn )( GetProcAddress( GetModuleHandleA(/*client*/XorStr<0x41, 7, 0xAFB21C5E>( "\x22\x2E\x2A\x21\x2B\x32" + 0xAFB21C5E ).s), /*CreateInterface*/XorStr<0x8B, 16, 0x507A77F7>( "\xC8\xFE\xE8\xEF\xFB\xF5\xD8\xFC\xE7\xF1\xE7\xF0\xF6\xFB\xFC" + 0x507A77F7 ).s ) ); 58 | auto AppSystemFactory = ( CreateInterfaceFn )( **( DWORD** )( Base::Utils::PatternSearch(/*engine*/XorStr<0x62, 7, 0x5AA493CE>( "\x07\x0D\x03\x0C\x08\x02" + 0x5AA493CE ).s, ( PBYTE )"\xFF\x15\x00\x00\x00\x00\x6A\x00\x68\x00\x00\x00\x00\xA3\x00\x00\x00\x00", /*xx????xxx????x????*/XorStr<0xDA, 19, 0x263614AA>( "\xA2\xA3\xE3\xE2\xE1\xE0\x98\x99\x9A\xDC\xDB\xDA\xD9\x9F\xD7\xD6\xD5\xD4" + 0x263614AA ).s, NULL, NULL ) + 2 ) ); 59 | 60 | //DWORD dwCLMoveAddress = Base::Utils::PatternSearch( /*engine.dll*/XorStr<0xA1,11,0xE75EB804>("\xC4\xCC\xC4\xCD\xCB\xC3\x89\xCC\xC5\xC6"+0xE75EB804).s,(PBYTE)"\x55\x8B\xEC\x83\xEC\x4C\x53\x56\x57\x8B\x3D",/*xxxxxxxxxxx*/XorStr<0xEF,12,0xC7505732>("\x97\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x80\x81"+0xC7505732).s,NULL,NULL); 61 | 62 | pClient = (ValveSDK::HLCLient*)GetInterfacePtr(/*VClient*/XorStr<0xAF,8,0x968D4BC3>("\xF9\xF3\xDD\xDB\xD6\xDA\xC1"+0x968D4BC3).s, /*g_pClient*/XorStr<0x0C,10,0xD5C0FAD9>("\x6B\x52\x7E\x4C\x7C\x78\x77\x7D\x60"+0xD5C0FAD9).s, ClientFactory); 63 | pEntList = (ValveSDK::CEntityList*)GetInterfacePtr(/*VClientEntityList*/XorStr<0xD9,18,0x06C34A7E>("\x8F\x99\xB7\xB5\xB8\xB0\xAB\xA5\x8F\x96\x8A\x90\x9C\xAA\x8E\x9B\x9D"+0x06C34A7E).s, /*g_pEntList*/XorStr<0x4E,11,0x4F329B8F>("\x29\x10\x20\x14\x3C\x27\x18\x3C\x25\x23"+0x4F329B8F).s, ClientFactory); 64 | pPred = (ValveSDK::CPrediction*)GetInterfacePtr(/*VClientPrediction*/XorStr<0x08,18,0x5594458A>("\x5E\x4A\x66\x62\x69\x63\x7A\x5F\x62\x74\x76\x7A\x77\x61\x7F\x78\x76"+0x5594458A).s, /*g_pPred*/XorStr<0xC8,8,0x048281FC>("\xAF\x96\xBA\x9B\xBE\xA8\xAA"+0x048281FC).s, ClientFactory); 65 | pGameMovement = (ValveSDK::CGameMovement*)GetInterfacePtr(/*GameMovement*/XorStr<0x6C,13,0xBA6B4994>("\x2B\x0C\x03\x0A\x3D\x1E\x04\x16\x19\x10\x18\x03"+0xBA6B4994).s, /*g_pGameMovement*/XorStr<0xE3,16,0xA149CDDD>("\x84\xBB\x95\xA1\x86\x85\x8C\xA7\x84\x9A\x88\x83\x8A\x9E\x85"+0xA149CDDD).s, ClientFactory); 66 | pEngine = (ValveSDK::CEngineClient*)GetInterfacePtr(/*VEngineClient*/XorStr<0x0F,14,0xECD749D0>("\x59\x55\x7F\x75\x7A\x7A\x70\x55\x7B\x71\x7C\x74\x6F"+0xECD749D0).s, /*g_pEngine*/XorStr<0xB8,10,0x06F99669>("\xDF\xE6\xCA\xFE\xD2\xDA\xD7\xD1\xA5"+0x06F99669).s, AppSystemFactory); 67 | pModel = (ValveSDK::CModelInfo*)GetInterfacePtr(/*VModelInfoClient*/XorStr<0x45,17,0x10AE6F86>("\x13\x0B\x28\x2C\x2C\x26\x02\x22\x2B\x21\x0C\x3C\x38\x37\x3D\x20"+0x10AE6F86).s, /*g_pModel*/XorStr<0x62,9,0x7A9B9A92>("\x05\x3C\x14\x28\x09\x03\x0D\x05"+0x7A9B9A92).s, AppSystemFactory); 68 | pDebugOverlay = (ValveSDK::CDebugOverlay*)GetInterfacePtr(/*VDebugOverlay*/XorStr<0x7C,14,0x84B69AE6>("\x2A\x39\x1B\x1D\xF5\xE6\xCD\xF5\xE1\xF7\xEA\xE6\xF1"+0x84B69AE6).s, /*g_pDebugOverlay*/XorStr<0xA4,16,0xE3165656>("\xC3\xFA\xD6\xE3\xCD\xCB\xDF\xCC\xE3\xDB\xCB\xDD\xDC\xD0\xCB"+0xE3165656).s, AppSystemFactory); 69 | pEngineTrace = (ValveSDK::CTrace*)GetInterfacePtr(/*EngineTraceClient*/XorStr<0x63,18,0x9F57E38B>("\x26\x0A\x02\x0F\x09\x0D\x3D\x18\x0A\x0F\x08\x2D\x03\x19\x14\x1C\x07"+0x9F57E38B).s, /*g_pEngineTrace*/XorStr<0x9B,15,0x979D2673>("\xFC\xC3\xED\xDB\xF1\xC7\xC8\xCC\xC6\xF0\xD7\xC7\xC4\xCD"+0x979D2673).s, AppSystemFactory); 70 | pSurface = (ValveSDK::ISurface*)GetInterfacePtr(/*VGUI_Surface*/XorStr<0xD8,13,0xA16C3D37>("\x8E\x9E\x8F\x92\x83\x8E\xAB\xAD\x86\x80\x81\x86"+0xA16C3D37).s, /*g_pSurface*/XorStr<0x1A,11,0x8765E1C4>("\x7D\x44\x6C\x4E\x6B\x6D\x46\x40\x41\x46"+0x8765E1C4).s, AppSystemFactory); 71 | pPanel = (ValveSDK::IPanel*)GetInterfacePtr(/*VGUI_Panel*/XorStr<0x11,11,0x7A40E632>("\x47\x55\x46\x5D\x4A\x46\x76\x76\x7C\x76"+0x7A40E632).s, /*g_pPanel*/XorStr<0xB4,9,0x01C7FA4D>("\xD3\xEA\xC6\xE7\xD9\xD7\xDF\xD7"+0x01C7FA4D).s, AppSystemFactory); 72 | pPhysics = (ValveSDK::IPhysicsSurfaceProps*)GetInterfacePtr(/*VPhysicsSurfaceProps*/XorStr<0x7A,21,0x2D8FF92E>("\x2C\x2B\x14\x04\x0D\x16\xE3\xF2\xD1\xF6\xF6\xE3\xE7\xE4\xED\xD9\xF8\xE4\xFC\xFE"+0x2D8FF92E).s,/*g_pPhysics*/XorStr<0x36,11,0xEC4BCCBD>("\x51\x68\x48\x69\x52\x42\x4F\x54\x5D\x4C"+0xEC4BCCBD).s, AppSystemFactory); 73 | pModelRender = (ValveSDK::IVModelRender*)GetInterfacePtr(/*VEngineModel*/XorStr<0xCB,13,0x8FEE9BDA>("\x9D\x89\xA3\xA9\xA6\xBE\xB4\x9F\xBC\xB0\xB0\xBA"+0x8FEE9BDA).s,/*g_pModelRender*/XorStr<0x28,15,0x592E98CF>("\x4F\x76\x5A\x66\x43\x49\x4B\x43\x62\x54\x5C\x57\x51\x47"+0x592E98CF).s,AppSystemFactory); 74 | pRenderView = (ValveSDK::IVRenderView*)GetInterfacePtr(/*VEngineRenderView*/XorStr<0xB4,18,0xAD1665A7>("\xE2\xF0\xD8\xD0\xD1\xD7\xDF\xE9\xD9\xD3\xDA\xDA\xB2\x97\xAB\xA6\xB3"+0xAD1665A7).s,/*g_pRenderView*/XorStr<0x0D,14,0xBA1E3FE5>("\x6A\x51\x7F\x42\x74\x7C\x77\x71\x67\x40\x7E\x7D\x6E"+0xBA1E3FE5).s,AppSystemFactory); 75 | pMaterialSystem = (ValveSDK::IMaterialSystem*)GetInterfacePtr(/*VMaterialSystem*/XorStr<0x07,16,0x9D711B90>("\x51\x45\x68\x7E\x6E\x7E\x64\x6F\x63\x43\x68\x61\x67\x71\x78"+0x9D711B90).s,/*g_pMaterialSystem*/XorStr<0xD7,18,0xC2404C57>("\xB0\x87\xA9\x97\xBA\xA8\xB8\xAC\xB6\x81\x8D\xB1\x9A\x97\x91\x83\x8A"+0xC2404C57).s,AppSystemFactory); 76 | pConVar = (ValveSDK::ICvar*)GetInterfacePtr(/*VEngineCvar*/XorStr<0x0F,12,0xCAB92F1C>("\x59\x55\x7F\x75\x7A\x7A\x70\x55\x61\x79\x6B"+0xCAB92F1C).s,/*g_pConVar*/XorStr<0xB1,10,0xFC444677>("\xD6\xED\xC3\xF7\xDA\xD8\xE1\xD9\xCB"+0xFC444677).s,AppSystemFactory); 77 | pGameEventManager = (ValveSDK::IGameEventManager*)AppSystemFactory(/*GAMEEVENTSMANAGER002*/XorStr<0x75,21,0xAAE7DB93>("\x32\x37\x3A\x3D\x3C\x2C\x3E\x32\x29\x2D\x32\xC1\xCF\xC3\xC4\xC1\xD7\xB6\xB7\xBA"+0xAAE7DB93).s,NULL); 78 | 79 | #ifdef DEBUGMODE 80 | sprintf(szDebugString, "g_pGameEventManager: 0x%x", (DWORD)pGameEventManager); 81 | Base::Debug::LOG(szDebugString); 82 | #endif 83 | 84 | pGlobalVars = **(ValveSDK::CGlobalVars***)(((*(PDWORD*)g_Valve.pClient)[11]) + GLOBALSOFFSET); 85 | 86 | #ifdef DEBUGMODE 87 | sprintf(szDebugString, "g_pGlobalVars: 0x%x", (DWORD)pGlobalVars); 88 | Base::Debug::LOG(szDebugString); 89 | #endif 90 | 91 | m_bInitiated = TRUE; 92 | } 93 | 94 | BOOL CValve::isInitiated() 95 | { 96 | return this->m_bInitiated; 97 | } 98 | 99 | bool CValve::WorldToScreen(const Vector &vOrigin, Vector &vScreen) 100 | { 101 | return (pDebugOverlay->ScreenPosition(vOrigin, vScreen) != 1); 102 | } -------------------------------------------------------------------------------- /CWinsock.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | 3 | cWinsocky g_Winsock; 4 | 5 | cWinsocky::cWinsocky ( VOID ) 6 | { 7 | m_ConnectedSocket = INVALID_SOCKET; 8 | } 9 | 10 | VOID cWinsocky::InitWinsock ( VOID ) 11 | { 12 | WSADATA wsaData; 13 | 14 | if ( WSAStartup ( MAKEWORD ( 2, 2 ), &wsaData ) != 0 ) 15 | { 16 | #ifdef DEBUGMODE 17 | Base::Debug::LOG("WINSOCK ERROR: WSAStartup"); 18 | #endif 19 | } 20 | 21 | } 22 | 23 | VOID cWinsocky::Connect ( const char* pszServerUrl ) 24 | { 25 | m_pszConnectedUrl = pszServerUrl; 26 | 27 | addrinfo hints, *pAddrInfo; 28 | 29 | SecureZeroMemory ( &hints, sizeof ( hints ) ); 30 | 31 | hints.ai_family = AF_INET; 32 | hints.ai_socktype = SOCK_STREAM; 33 | hints.ai_protocol = IPPROTO_TCP; 34 | 35 | if ( getaddrinfo ( pszServerUrl, /*80*/XorStr<0x15,3,0x9AED279F>((const char*)"\x2D\x26"+0x9AED279F).s, &hints, &pAddrInfo ) != 0 ) 36 | { 37 | CleanUp( ); 38 | #ifdef DEBUGMODE 39 | Base::Debug::LOG("WINSOCK ERROR: getaddrinfo"); 40 | #endif 41 | } 42 | 43 | if ( ( m_ConnectedSocket = socket ( pAddrInfo->ai_family, pAddrInfo->ai_socktype, pAddrInfo->ai_protocol ) ) == INVALID_SOCKET ) 44 | { 45 | freeaddrinfo ( pAddrInfo ); 46 | CleanUp( ); 47 | #ifdef DEBUGMODE 48 | Base::Debug::LOG("WINSOCK ERROR: socket"); 49 | #endif 50 | } 51 | 52 | if ( connect ( m_ConnectedSocket, pAddrInfo->ai_addr, ( INT ) pAddrInfo->ai_addrlen ) != 0 ) 53 | { 54 | freeaddrinfo ( pAddrInfo ); 55 | Disconnect( ); 56 | CleanUp( ); 57 | #ifdef DEBUGMODE 58 | Base::Debug::LOG("WINSOCK ERROR: connect"); 59 | #endif 60 | } 61 | 62 | freeaddrinfo ( pAddrInfo ); 63 | } 64 | 65 | VOID cWinsocky::SendHttpGet ( const char* pszFileUrl, std::string &sDestBuffer ) 66 | { 67 | std::string sMsg = /*GET /*/XorStr<0x57,6,0x59E137A6>("\x10\x1D\x0D\x7A\x74"+0x59E137A6).s; 68 | sMsg += pszFileUrl; 69 | sMsg += /* HTTP/1.0\r\nHost: */XorStr<0xBD,18,0x809D9B98>("\x9D\xF6\xEB\x94\x91\xED\xF2\xEA\xF5\xCB\xCD\x80\xA6\xB9\xBF\xF6\xED"+0x809D9B98).s; // 1.0 statt 1.1 wegen Chunked_transfer_encoding 70 | sMsg += m_pszConnectedUrl; 71 | sMsg += /*\r\n\r\n*/XorStr<0x79,5,0x2EE0F46F>("\x74\x70\x76\x76"+0x2EE0F46F).s; 72 | 73 | CHAR szRecvBuffer [ 512 ]; 74 | 75 | if ( send ( m_ConnectedSocket, sMsg.data(), strlen ( sMsg.data() ), 0 ) == SOCKET_ERROR ) 76 | { 77 | Disconnect( ); 78 | WSACleanup( ); 79 | #ifdef DEBUGMODE 80 | Base::Debug::LOG("WINSOCK ERROR: send"); 81 | #endif 82 | } 83 | 84 | INT iBytesReceived = 0; 85 | do 86 | { 87 | iBytesReceived = recv ( m_ConnectedSocket, szRecvBuffer, sizeof ( szRecvBuffer ), 0 ); 88 | 89 | sDestBuffer.append ( szRecvBuffer, iBytesReceived ); 90 | 91 | } while ( iBytesReceived > 0 ); 92 | 93 | // httpheader entfernen 94 | for ( size_t i = 0; i < sDestBuffer.size(); i++ ) 95 | { 96 | if ( sDestBuffer [ i ] == '\r' && sDestBuffer [ i + 1 ] == '\n' && sDestBuffer [ i + 2 ] == '\r' && sDestBuffer [ i + 3 ] == '\n' ) 97 | sDestBuffer.erase( 0, i + 4 ); 98 | } 99 | 100 | } 101 | 102 | VOID cWinsocky::Disconnect ( VOID ) 103 | { 104 | if ( m_ConnectedSocket != INVALID_SOCKET ) 105 | { 106 | closesocket ( m_ConnectedSocket ); 107 | m_ConnectedSocket = INVALID_SOCKET; 108 | } 109 | 110 | } 111 | 112 | VOID cWinsocky::CleanUp ( VOID ) 113 | { 114 | WSACleanup( ); 115 | } -------------------------------------------------------------------------------- /CWinsock.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class cWinsocky 4 | { 5 | public: 6 | cWinsocky ( VOID ); 7 | 8 | VOID InitWinsock ( VOID ); 9 | VOID Connect ( const char* pszServerUrl ); 10 | VOID SendHttpGet ( const char* pszFileUrl, std::string &sDestBuffer ); 11 | 12 | VOID Disconnect ( VOID ); 13 | VOID CleanUp ( VOID ); 14 | private: 15 | SOCKET m_ConnectedSocket; 16 | const char* m_pszConnectedUrl; 17 | 18 | }; 19 | 20 | extern cWinsocky g_Winsock; -------------------------------------------------------------------------------- /ClientClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | Clientclass rebuild 3 | 22.08.2014 4 | */ 5 | namespace ValveSDK 6 | { 7 | class ClientClass 8 | { 9 | public: 10 | const char* GetName(void) 11 | { 12 | return *(char**)(this + 0x8); 13 | } 14 | RecvTable* GetTable() 15 | { 16 | return *(RecvTable**)(this + 0xC); 17 | } 18 | ClientClass* NextClass() 19 | { 20 | return *(ClientClass**)(this + 0x10); 21 | } 22 | int GetClassID(void) 23 | { 24 | return *(int*)(this + 0x14); 25 | } 26 | }; 27 | } -------------------------------------------------------------------------------- /ConVar.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class ConVar 4 | { 5 | public: 6 | int GetInt() 7 | { 8 | return getvfunc( this, 13 )( this ); 9 | } 10 | 11 | void SetValue(int iValue) 12 | { 13 | getvfunc( this, 16 )( this, iValue ); 14 | } 15 | }; 16 | 17 | class IAppSystem 18 | { 19 | public: 20 | // Here's where the app systems get to learn about each other 21 | virtual void func00() = 0; 22 | virtual void func01() = 0; 23 | virtual void func02() = 0; 24 | virtual void func03() = 0; 25 | virtual void func04() = 0; 26 | }; 27 | 28 | class ICvar : public IAppSystem 29 | { 30 | public: 31 | virtual void funcy() = 0; 32 | virtual void funcy1() = 0; 33 | virtual void funcy2() = 0; 34 | virtual void funcy3() = 0; 35 | virtual void funcy4() = 0; 36 | virtual void funcy5() = 0; 37 | virtual void funcy6( ) = 0; 38 | virtual void funcy7( ) = 0; 39 | virtual void funcy8( ) = 0; 40 | virtual void funcy9( ) = 0; 41 | virtual ConVar *FindVar(const char *var_name) = 0; 42 | //virtual const ConVar *FindVar(const char *var_name) const = 0; 43 | }; 44 | } -------------------------------------------------------------------------------- /DllMain.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////// 2 | /* 3 | SOURCE Base by rifk kolo & gt3x 4 | CREDITS: floesen,outline,inurface 5 | Init - 22.08-2014 6 | */ 7 | /////////////////////////////// 8 | #include "DllMain.h" 9 | 10 | CValve g_Valve; 11 | 12 | EXTERN_C IMAGE_DOS_HEADER __ImageBase; 13 | 14 | static HMODULE DllBaseAddress() // works with manually mapped dlls (will get us our HMODULE) 15 | { 16 | MEMORY_BASIC_INFORMATION info; 17 | size_t len = VirtualQueryEx(GetCurrentProcess(), (void*)DllBaseAddress, &info, sizeof(info)); 18 | Assert(len == sizeof(info)); 19 | return len ? (HMODULE)info.AllocationBase : NULL; 20 | } 21 | 22 | void InitDllThread(void* ptr) 23 | { 24 | g_Valve.initSDK(); 25 | 26 | g_NetworkedVariableManager.Init(); 27 | 28 | #ifdef DEBUGMODE 29 | Base::Debug::LOG("Netvars initialized"); 30 | #endif 31 | 32 | g_pClientVMT.bInitialize((PDWORD*)g_Valve.pClient); 33 | dwOriginCreateMove = g_pClientVMT.dwGetMethodAddress(22); 34 | g_pClientVMT.dwHookMethod((DWORD)hkdCreateMove, 22); 35 | 36 | g_Valve.pInput = *( ValveSDK::CInput** )( Base::Utils::PatternSearch(/*client*/XorStr<0x41, 7, 0xAFB21C5E>( "\x22\x2E\x2A\x21\x2B\x32" + 0xAFB21C5E ).s, ( PBYTE )"\xB9\x00\x00\x00\x00\xF3\x0F\x11\x04\x24\xFF\x50\x10", /*x????xxxxxxxx*/XorStr<0x08, 14, 0x17B34CA9>( "\x70\x36\x35\x34\x33\x75\x76\x77\x68\x69\x6A\x6B\x6C" + 0x17B34CA9 ).s, 0, 0 ) + 1 ); 37 | 38 | #ifdef DEBUGMODE 39 | char szDebugString[1024]; 40 | sprintf(szDebugString, "g_pInput: 0x%08X ", (DWORD)g_Valve.pInput); 41 | Base::Debug::LOG(szDebugString); 42 | #endif 43 | 44 | g_pInputVMT.bInitialize((PDWORD*)g_Valve.pInput); 45 | g_pInputVMT.dwHookMethod((DWORD)hkdGetUserCmd, 8); 46 | 47 | #ifdef DEBUGMODE 48 | Base::Debug::LOG("hooked GetUserCmd..."); 49 | #endif 50 | 51 | #ifdef DEBUGMODE 52 | Base::Debug::LOG("hooked CreateMove..."); 53 | #endif 54 | 55 | g_pClientVMT.dwHookMethod((DWORD)hkdFrameStageNotify, 37); 56 | 57 | #ifdef DEBUGMODE 58 | Base::Debug::LOG("hooked FrameStageNotify"); 59 | #endif 60 | 61 | g_pClientVMT.dwHookMethod((DWORD)hkdIN_KeyEvent, 21); 62 | 63 | #ifdef DEBUGMODE 64 | Base::Debug::LOG("hooked IN_KeyEvent"); 65 | #endif 66 | 67 | g_pPredictionVMT.bInitialize((PDWORD*)g_Valve.pPred); 68 | g_pPredictionVMT.dwHookMethod((DWORD)hkdRunCommand, 19); 69 | 70 | #ifdef DEBUGMODE 71 | sprintf(szDebugString,"runcommand: 0x%X",g_pPredictionVMT.dwGetMethodAddress(19)); 72 | Base::Debug::LOG(szDebugString); 73 | #endif 74 | 75 | #ifdef DEBUGMODE 76 | Base::Debug::LOG("hooked RunCommand"); 77 | #endif 78 | 79 | g_pPredictionVMT.dwHookMethod((DWORD)hkdFinishMove, 21); 80 | 81 | #ifdef DEBUGMODE 82 | Base::Debug::LOG("hooked FinishMove"); 83 | #endif 84 | 85 | g_pModelRenderVMT.bInitialize((PDWORD*)g_Valve.pModelRender); 86 | g_pModelRenderVMT.dwHookMethod((DWORD)hkdDrawModelExecute, 21); 87 | 88 | #ifdef DEBUGMODE 89 | Base::Debug::LOG("hooked DrawModelExecute"); 90 | #endif 91 | 92 | g_pPanelVMT.bInitialize((PDWORD*)g_Valve.pPanel); 93 | g_pPanelVMT.dwHookMethod((DWORD)hkdPaintTraverse, 41); 94 | 95 | #ifdef DEBUGMODE 96 | Base::Debug::LOG("hooked PaintTraverse"); 97 | #endif 98 | 99 | g_pSurfaceVMT.bInitialize( ( PDWORD* )g_Valve.pSurface ); 100 | g_pSurfaceVMT.dwHookMethod( ( DWORD )hkdLockCursor, 67 ); 101 | 102 | #ifdef DEBUGMODE 103 | Base::Debug::LOG( "hooked LockCursor" ); 104 | #endif 105 | 106 | //g_NetworkedVariableManager.HookProp(/*DT_CSPlayer*/XorStr<0xAA,12,0x6F938DD5>("\xEE\xFF\xF3\xEE\xFD\xFF\xDC\xD0\xCB\xD6\xC6"+0x6F938DD5).s, /*m_angEyeAngles[0]*/XorStr<0x7E,18,0x0D7A3609>("\x13\x20\xE1\xEF\xE5\xC6\xFD\xE0\xC7\xE9\xEF\xE5\xEF\xF8\xD7\xBD\xD3"+0x0D7A3609).s,PitchEyeAngleProxy); 107 | //g_NetworkedVariableManager.HookProp(/*DT_CSPlayer*/XorStr<0xAA,12,0x6F938DD5>("\xEE\xFF\xF3\xEE\xFD\xFF\xDC\xD0\xCB\xD6\xC6"+0x6F938DD5).s, /*m_angEyeAngles[1]*/XorStr<0x1B,18,0x97DB0871>("\x76\x43\x7C\x70\x78\x65\x58\x47\x62\x4A\x42\x4A\x42\x5B\x72\x1B\x76"+0x97DB0871).s,YawEyeAngleProxy); 108 | 109 | //gGameEventManager.RegisterSelf(); 110 | 111 | /* 112 | char path[260]; 113 | HMODULE hm = NULL; 114 | 115 | if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 116 | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, 117 | (LPCSTR)&DllBaseAddress, 118 | &hm)) 119 | { 120 | int ret = GetLastError(); 121 | fprintf(stderr, "GetModuleHandle returned %d\n", ret); 122 | } 123 | 124 | char strDLLPath1[MAX_PATH]; 125 | //::GetModuleFileNameA(hm, strDLLPath1, _MAX_PATH); 126 | //LoadConfig(strDLLPath1); 127 | */ 128 | } 129 | 130 | /*void unhookThread(LPARAM lpParam) 131 | { 132 | HMODULE hModule = (HMODULE)lpParam; 133 | while (true) 134 | { 135 | if (GetAsyncKeyState(VK_NUMPAD9) & 1) 136 | { 137 | Sleep(1000); 138 | 139 | g_pClientVMT.UnHook(); 140 | g_pPredictionVMT.UnHook(); 141 | g_pPanelVMT.UnHook(); 142 | 143 | Sleep(2000); 144 | 145 | FreeConsole(); 146 | SendMessage(FindWindow(0, "DebugMessages"), WM_CLOSE, NULL, NULL); 147 | 148 | FreeLibraryAndExitThread(hModule, 0); 149 | } 150 | } 151 | }*/ 152 | 153 | #include "ReflectiveLoader.h" 154 | #include "ReflectiveDLLInjection.h" 155 | 156 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved) 157 | { 158 | if(dwReason == DLL_PROCESS_ATTACH) 159 | { 160 | #ifdef DEBUGMODE 161 | Base::Debug::AttachDebugConsole(); 162 | #endif 163 | CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)InitDllThread, hinstDLL, NULL, NULL); 164 | 165 | g_CVARS.Init(hinstDLL); 166 | 167 | g_CVARS.SetDefaultConfig(); 168 | 169 | //g_CVARS.CvarList[Triggerbot] = 0; 170 | 171 | /*HW_PROFILE_INFO hwProfileInfo; 172 | 173 | GetCurrentHwProfile(&hwProfileInfo); 174 | 175 | char szFile[2048]; 176 | sprintf(szFile,"%s\\hwid.txt",g_CVARS.szIniFilePath); 177 | 178 | std::ofstream fNew(szFile,std::ios::app); 179 | fNew.write(hwProfileInfo.szHwProfileGuid,strlen(hwProfileInfo.szHwProfileGuid)); 180 | fNew.close();*/ 181 | 182 | //HandleConfig("flick.ini",LoadConfig); 183 | } 184 | else if(dwReason == DLL_QUERY_HMODULE && lpReserved != NULL) 185 | *(HMODULE*)lpReserved = hinstDLL; 186 | 187 | return TRUE; 188 | } -------------------------------------------------------------------------------- /DllMain.h: -------------------------------------------------------------------------------- 1 | #define _CRT_SECURE_NO_WARNINGS 2 | 3 | #include 4 | #pragma comment(lib, "ws2_32.lib" ) 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "xor.h" 24 | #include "vector.h" 25 | #include "CMath.h" 26 | #include "checksum_crc.h" 27 | #include "sdk.h" 28 | #include "Utils.h" 29 | #include "CValve.h" 30 | #include "CDraw.h" 31 | #include "CWinsock.h" 32 | #include "mouse.h" 33 | #include "menu.h" 34 | 35 | //CSGO 36 | #include "Surface.h" 37 | #include "client.h" 38 | #include "CESP.h" 39 | #include "CNoSpread.h" 40 | #include "CGameEventManager.h" 41 | #include "CAimbot.h" 42 | #include "CVARS.h" 43 | 44 | typedef struct 45 | { 46 | int damage; 47 | int targetId; 48 | DWORD animTimer; 49 | } healthInfo_t; 50 | 51 | extern std::vectorg_healthInfo; 52 | 53 | #pragma warning( disable : 4409 ) 54 | #pragma warning( disable : 4244 ) 55 | #pragma warning( disable : 4018 ) 56 | #pragma warning( disable : 4101 ) 57 | #pragma warning( disable : 4405 ) 58 | #pragma warning( disable : 4244 ) 59 | 60 | //#define DEBUGMODE 61 | 62 | extern CValve g_Valve; 63 | extern CDraw g_Draw; 64 | extern CMath g_Math; -------------------------------------------------------------------------------- /HLClient.h: -------------------------------------------------------------------------------- 1 | /* 2 | HLClient rebuild 3 | 22.08.2014 4 | */ 5 | namespace ValveSDK 6 | { 7 | class HLCLient 8 | { 9 | public: 10 | ClientClass* GetAllClasses(VOID) 11 | { 12 | typedef ClientClass* (__thiscall* OriginalFn)(PVOID); 13 | return getvfunc(this, 8)(this); 14 | } 15 | 16 | /*int GetScreenWidth(VOID) 17 | { 18 | typedef int (__thiscall* OriginalFn)(PVOID); 19 | return getvfunc(this, 56)(this); 20 | } 21 | 22 | int GetScreenHeight(VOID) 23 | { 24 | typedef int (__thiscall* OriginalFn)(PVOID); 25 | return getvfunc(this, 57)(this); 26 | }*/ 27 | 28 | /*int IN_KeyEvent(int eventcode, ButtonCode_t keynum, const char *pszCurrentBinding) 29 | { 30 | typedef int(__thiscall* OriginalFn)(PVOID, int, ButtonCode_t, const char*); 31 | return getvfunc(this, 20)(this, eventcode, keynum, pszCurrentBinding); 32 | }*/ 33 | }; 34 | } -------------------------------------------------------------------------------- /IGameEvent.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class IGameEvent 4 | { 5 | public: 6 | const char* GetName() 7 | { 8 | typedef const char* (__thiscall* OriginalFn)(PVOID); 9 | return getvfunc(this, 1)(this); 10 | } 11 | 12 | int GetInt(const char *keyName, int defaultValue) 13 | { 14 | typedef int(__thiscall* OriginalFn)(PVOID, const char *, int); 15 | return getvfunc(this, 6)(this, keyName, defaultValue); 16 | } 17 | 18 | const char *GetString(const char *keyName, const char *defaultValue) 19 | { 20 | typedef const char* (__thiscall* OriginalFn)(PVOID, const char *, const char*); 21 | return getvfunc(this, 8)(this, keyName, defaultValue); 22 | } 23 | }; 24 | } -------------------------------------------------------------------------------- /IGameEventListener2.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class IGameEventListener2 4 | { 5 | public: 6 | virtual ~IGameEventListener2(void) {}; 7 | 8 | // FireEvent is called by EventManager if event just occured 9 | // KeyValue memory will be freed by manager if not needed anymore 10 | virtual void FireGameEvent(IGameEvent *event) = 0; 11 | }; 12 | 13 | } -------------------------------------------------------------------------------- /IGameEventManager.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class IGameEventManager 4 | { 5 | public: 6 | bool AddListener(IGameEventListener2 *listener, const char *name, bool bServerSide) 7 | { 8 | typedef bool(__thiscall* OriginalFn)(PVOID, IGameEventListener2*, const char*, bool); 9 | return getvfunc(this, 3)(this, listener, name, bServerSide); 10 | } 11 | 12 | bool FireEventClientSide(IGameEvent *event) 13 | { 14 | typedef bool(__thiscall* OriginalFn)(PVOID, IGameEvent*); 15 | return getvfunc(this, 8)(this, event); 16 | } 17 | }; 18 | 19 | } -------------------------------------------------------------------------------- /IMoveHelper.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class ImoveHelper 4 | { 5 | public: 6 | void SetHost(CBaseEntity *pPlayer) 7 | { 8 | typedef void(__thiscall* OriginalFn)(PVOID, CBaseEntity *pPlayer); 9 | getvfunc(this, 1)(this, pPlayer); 10 | } 11 | }; 12 | } -------------------------------------------------------------------------------- /IPanel.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | class IPanel 4 | { 5 | public: 6 | unsigned int GetPanel(int type) 7 | { 8 | typedef unsigned int(__thiscall *tGetPanel)(void*, int type); 9 | return getvfunc(this, 1)(this, type); 10 | } 11 | const char *GetName(unsigned int vguiPanel) 12 | { 13 | typedef const char* (__thiscall* OriginalFn)(PVOID, unsigned int); 14 | return getvfunc(this, 36)(this, vguiPanel); 15 | } 16 | }; 17 | } -------------------------------------------------------------------------------- /ISurface.h: -------------------------------------------------------------------------------- 1 | namespace ValveSDK 2 | { 3 | enum OverrideType_t 4 | { 5 | OVERRIDE_NORMAL = 0, 6 | OVERRIDE_BUILD_SHADOWS, 7 | OVERRIDE_DEPTH_WRITE, 8 | OVERRIDE_WHATEVER 9 | }; 10 | 11 | struct DrawModelState_t 12 | { 13 | studiohdr_t* m_pStudioHdr; 14 | PVOID m_pStudioHWData; 15 | PVOID m_pRenderable; 16 | const matrix3x4_t *m_pModelToWorld; 17 | int m_decals; 18 | int m_drawFlags; 19 | int m_lod; 20 | }; 21 | 22 | struct ModelRenderInfo_t 23 | { 24 | Vector origin; 25 | Vector angles; 26 | char pad[ 4 ]; 27 | PVOID pRenderable; 28 | const model_t *pModel; 29 | const matrix3x4_t *pModelToWorld; 30 | const matrix3x4_t *pLightingOffset; 31 | const Vector *pLightingOrigin; 32 | int flags; 33 | int entity_index; 34 | int skin; 35 | int body; 36 | int hitboxset; 37 | unsigned short instance; 38 | 39 | ModelRenderInfo_t() 40 | { 41 | pModelToWorld = NULL; 42 | pLightingOffset = NULL; 43 | pLightingOrigin = NULL; 44 | } 45 | }; 46 | 47 | enum MaterialVarFlags_t 48 | { 49 | MATERIAL_VAR_DEBUG = (1 << 0), 50 | MATERIAL_VAR_NO_DEBUG_OVERRIDE = (1 << 1), 51 | MATERIAL_VAR_NO_DRAW = (1 << 2), 52 | MATERIAL_VAR_USE_IN_FILLRATE_MODE = (1 << 3), 53 | 54 | MATERIAL_VAR_VERTEXCOLOR = (1 << 4), 55 | MATERIAL_VAR_VERTEXALPHA = (1 << 5), 56 | MATERIAL_VAR_SELFILLUM = (1 << 6), 57 | MATERIAL_VAR_ADDITIVE = (1 << 7), 58 | MATERIAL_VAR_ALPHATEST = (1 << 8), 59 | MATERIAL_VAR_MULTIPASS = (1 << 9), 60 | MATERIAL_VAR_ZNEARER = (1 << 10), 61 | MATERIAL_VAR_MODEL = (1 << 11), 62 | MATERIAL_VAR_FLAT = (1 << 12), 63 | MATERIAL_VAR_NOCULL = (1 << 13), 64 | MATERIAL_VAR_NOFOG = (1 << 14), 65 | MATERIAL_VAR_IGNOREZ = (1 << 15), 66 | MATERIAL_VAR_DECAL = (1 << 16), 67 | MATERIAL_VAR_ENVMAPSPHERE = (1 << 17), 68 | MATERIAL_VAR_NOALPHAMOD = (1 << 18), 69 | MATERIAL_VAR_ENVMAPCAMERASPACE = (1 << 19), 70 | MATERIAL_VAR_BASEALPHAENVMAPMASK = (1 << 20), 71 | MATERIAL_VAR_TRANSLUCENT = (1 << 21), 72 | MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK = (1 << 22), 73 | MATERIAL_VAR_NEEDS_SOFTWARE_SKINNING = (1 << 23), 74 | MATERIAL_VAR_OPAQUETEXTURE = (1 << 24), 75 | MATERIAL_VAR_ENVMAPMODE = (1 << 25), 76 | MATERIAL_VAR_SUPPRESS_DECALS = (1 << 26), 77 | MATERIAL_VAR_HALFLAMBERT = (1 << 27), 78 | MATERIAL_VAR_WIREFRAME = (1 << 28), 79 | MATERIAL_VAR_ALLOWALPHATOCOVERAGE = (1 << 29), 80 | 81 | // NOTE: Only add flags here that either should be read from 82 | // .vmts or can be set directly from client code. Other, internal 83 | // flags should to into the flag enum in IMaterialInternal.h 84 | }; 85 | 86 | class IMaterial 87 | { 88 | public: 89 | // Get the name of the material. This is a full path to 90 | // the vmt file starting from "hl2/materials" (or equivalent) without 91 | // a file extension. 92 | virtual const char* GetName( ) const = 0; 93 | 94 | virtual const char* GetTextureGroupName( ) const = 0; 95 | 96 | // Get the preferred size/bitDepth of a preview image of a material. 97 | // This is the sort of image that you would use for a thumbnail view 98 | // of a material, or in WorldCraft until it uses materials to render. 99 | // separate this for the tools maybe 100 | virtual /*PreviewImageRetVal_t*/int GetPreviewImageProperties( int* width, int* height, /*ImageFormat**/void* imageFormat, bool* isTranslucent ) const = 0; 101 | 102 | // Get a preview image at the specified width/height and bitDepth. 103 | // Will do resampling if necessary.(not yet!!! :) ) 104 | // Will do color format conversion. (works now.) 105 | virtual /*PreviewImageRetVal_t*/int GetPreviewImage( unsigned char* data, int width, int height, char imageFormat ) const = 0; 106 | 107 | // 108 | virtual int GetMappingWidth( ) = 0; 109 | 110 | virtual int GetMappingHeight( ) = 0; 111 | 112 | virtual int GetNumAnimationFrames( ) = 0; 113 | 114 | // For material subrects (material pages). Offset(u,v) and scale(u,v) are normalized to texture. 115 | virtual bool InMaterialPage( void ) = 0; 116 | 117 | virtual void GetMaterialOffset( float* pOffset ) = 0; 118 | 119 | virtual void GetMaterialScale( float* pScale ) = 0; 120 | 121 | virtual IMaterial* GetMaterialPage( void ) = 0; 122 | 123 | // find a vmt variable. 124 | // This is how game code affects how a material is rendered. 125 | // The game code must know about the params that are used by 126 | // the shader for the material that it is trying to affect. 127 | virtual /*IMaterialVar**/void* FindVar( const char* varName, bool* found, bool complain = true ) = 0; 128 | 129 | // The user never allocates or deallocates materials. Reference counting is 130 | // used instead. Garbage collection is done upon a call to 131 | // IMaterialSystem::UncacheUnusedMaterials. 132 | virtual void IncrementReferenceCount( void ) = 0; 133 | 134 | virtual void DecrementReferenceCount( void ) = 0; 135 | 136 | inline void AddRef( ) 137 | { 138 | IncrementReferenceCount( ); 139 | } 140 | 141 | inline void Release( ) 142 | { 143 | DecrementReferenceCount( ); 144 | } 145 | 146 | // Each material is assigned a number that groups it with like materials 147 | // for sorting in the application. 148 | virtual int GetEnumerationID( void ) const = 0; 149 | 150 | virtual void GetLowResColorSample( float s, float t, float* color ) const = 0; 151 | 152 | // This computes the state snapshots for this material 153 | virtual void RecomputeStateSnapshots( ) = 0; 154 | 155 | // Are we translucent? 156 | virtual bool IsTranslucent( ) = 0; 157 | 158 | // Are we alphatested? 159 | virtual bool IsAlphaTested( ) = 0; 160 | 161 | // Are we vertex lit? 162 | virtual bool IsVertexLit( ) = 0; 163 | 164 | // Gets the vertex format 165 | virtual /*VertexFormat_t*/int GetVertexFormat( ) const = 0; 166 | 167 | // returns true if this material uses a material proxy 168 | virtual bool HasProxy( void ) const = 0; 169 | 170 | virtual bool UsesEnvCubemap( void ) = 0; 171 | 172 | virtual bool NeedsTangentSpace( void ) = 0; 173 | 174 | virtual bool NeedsPowerOfTwoFrameBufferTexture( bool bCheckSpecificToThisFrame = true ) = 0; 175 | 176 | virtual bool NeedsFullFrameBufferTexture( bool bCheckSpecificToThisFrame = true ) = 0; 177 | 178 | // returns true if the shader doesn't do skinning itself and requires 179 | // the data that is sent to it to be preskinned. 180 | virtual bool NeedsSoftwareSkinning( void ) = 0; 181 | 182 | // Apply constant color or alpha modulation 183 | virtual void AlphaModulate( float alpha ) = 0; 184 | 185 | virtual void ColorModulate( float r, float g, float b ) = 0; 186 | 187 | // Material Var flags... 188 | virtual void SetMaterialVarFlag( MaterialVarFlags_t flag, bool on ) = 0; 189 | 190 | virtual bool GetMaterialVarFlag( MaterialVarFlags_t flag ) const = 0; 191 | 192 | // Gets material reflectivity 193 | virtual void GetReflectivity( Vector& reflect ) = 0; 194 | 195 | // Gets material property flags 196 | virtual bool GetPropertyFlag( /*MaterialPropertyTypes_t*/int type ) = 0; 197 | 198 | // Is the material visible from both sides? 199 | virtual bool IsTwoSided( ) = 0; 200 | 201 | // Sets the shader associated with the material 202 | virtual void SetShader( const char* pShaderName ) = 0; 203 | 204 | // Can't be const because the material might have to precache itself. 205 | virtual int GetNumPasses( void ) = 0; 206 | 207 | // Can't be const because the material might have to precache itself. 208 | virtual int GetTextureMemoryBytes( void ) = 0; 209 | 210 | // Meant to be used with materials created using CreateMaterial 211 | // It updates the materials to reflect the current values stored in the material vars 212 | virtual void Refresh( ) = 0; 213 | 214 | // GR - returns true is material uses lightmap alpha for blending 215 | virtual bool NeedsLightmapBlendAlpha( void ) = 0; 216 | 217 | // returns true if the shader doesn't do lighting itself and requires 218 | // the data that is sent to it to be prelighted 219 | virtual bool NeedsSoftwareLighting( void ) = 0; 220 | 221 | // Gets at the shader parameters 222 | virtual int ShaderParamCount( ) const = 0; 223 | 224 | virtual /*IMaterialVar***/void** GetShaderParams( void ) = 0; 225 | 226 | // Returns true if this is the error material you get back from IMaterialSystem::FindMaterial if 227 | // the material can't be found. 228 | virtual bool IsErrorMaterial( ) const = 0; 229 | 230 | virtual void Unused( ) = 0; 231 | 232 | // Gets the current alpha modulation 233 | virtual float GetAlphaModulation( ) = 0; 234 | 235 | virtual void GetColorModulation( float* r, float* g, float* b ) = 0; 236 | 237 | // Is this translucent given a particular alpha modulation? 238 | virtual bool IsTranslucentUnderModulation( float fAlphaModulation = 1.0f ) const = 0; 239 | 240 | // fast find that stores the index of the found var in the string table in local cache 241 | virtual /*IMaterialVar**/void* FindVarFast( char const* pVarName, unsigned int* pToken ) = 0; 242 | 243 | // Sets new VMT shader parameters for the material 244 | virtual void SetShaderAndParams( void* pKeyValues ) = 0; 245 | 246 | virtual const char* GetShaderName( ) const = 0; 247 | 248 | virtual void DeleteIfUnreferenced( ) = 0; 249 | 250 | virtual bool IsSpriteCard( ) = 0; 251 | 252 | virtual void CallBindProxy( void* proxyData ) = 0; 253 | 254 | virtual void RefreshPreservingMaterialVars( ) = 0; 255 | 256 | virtual bool WasReloadedFromWhitelist( ) = 0; 257 | 258 | virtual bool SetTempExcluded( bool bSet, int nExcludedDimensionLimit ) = 0; 259 | 260 | virtual int GetReferenceCount( ) const = 0; 261 | }; 262 | 263 | class Color 264 | { 265 | public: 266 | Color(int r,int g,int b,int a) 267 | { 268 | _color[0] = (unsigned char)r; 269 | _color[1] = (unsigned char)g; 270 | _color[2] = (unsigned char)b; 271 | _color[3] = (unsigned char)a; 272 | } 273 | 274 | unsigned char _color[4]; 275 | }; 276 | 277 | typedef unsigned short MaterialHandle_t; 278 | 279 | class IMaterialSystem 280 | { 281 | public: 282 | /*void UncacheMaterials() 283 | { 284 | typedef void(__thiscall* OriginalFn)(PVOID); 285 | getvfunc(this, 65)(this); 286 | }*/ 287 | 288 | IMaterial *CreateMaterial(const char *pMaterialName, PVOID pVMTKeyValues) 289 | { 290 | typedef IMaterial*(__thiscall* OriginalFn)(PVOID,const char*,PVOID); 291 | return getvfunc(this, 83)(this,pMaterialName,pVMTKeyValues); 292 | } 293 | 294 | IMaterial *FindMaterial(char const* pMaterialName, const char *pTextureGroupName, bool complain = true, const char *pComplainPrefix = NULL) 295 | { 296 | typedef IMaterial*(__thiscall* OriginalFn)(PVOID,char const*,const char*,bool,const char*); 297 | return getvfunc(this, 84)(this,pMaterialName,pTextureGroupName,complain,pComplainPrefix); 298 | } 299 | 300 | /*bool IsMaterialLoaded(const char *pMaterialName) 301 | { 302 | typedef bool(__thiscall* OriginalFn)(PVOID,const char*); 303 | return getvfunc(this, 72)(this,pMaterialName); 304 | }*/ 305 | 306 | MaterialHandle_t FirstMaterial() 307 | { 308 | typedef MaterialHandle_t(__thiscall* OriginalFn)(PVOID); 309 | return getvfunc(this, 86)(this); 310 | } 311 | 312 | MaterialHandle_t NextMaterial(MaterialHandle_t h) 313 | { 314 | typedef MaterialHandle_t(__thiscall* OriginalFn)(PVOID,MaterialHandle_t); 315 | return getvfunc(this, 87)(this,h); 316 | } 317 | 318 | MaterialHandle_t InvalidMaterial() 319 | { 320 | typedef MaterialHandle_t(__thiscall* OriginalFn)(PVOID); 321 | return getvfunc(this, 88)(this); 322 | } 323 | 324 | IMaterial *GetMaterial(MaterialHandle_t h) 325 | { 326 | typedef IMaterial*(__thiscall* OriginalFn)(PVOID,MaterialHandle_t); 327 | return getvfunc(this, 89)(this,h); 328 | } 329 | 330 | int GetNumMaterials() 331 | { 332 | typedef int(__thiscall* OriginalFn)(PVOID); 333 | return getvfunc(this, 90)(this); // unknown 334 | } 335 | }; 336 | 337 | class IVModelRender 338 | { 339 | public: 340 | virtual int vfunc00() = 0; 341 | virtual void ForcedMaterialOverride( IMaterial *newMaterial, OverrideType_t nOverrideType = OVERRIDE_NORMAL, int a = 0 ) = 0; 342 | virtual bool vfunc02() = 0; 343 | virtual int vfunc03() = 0; 344 | virtual int vfunc04() = 0; 345 | virtual int vfunc05() = 0; 346 | virtual int vfunc06() = 0; 347 | virtual int vfunc07() = 0; 348 | virtual int vfunc08() = 0; 349 | virtual int vfunc09() = 0; 350 | virtual int vfunc10() = 0; 351 | virtual int vfunc11() = 0; 352 | virtual int vfunc12() = 0; 353 | virtual int vfunc13() = 0; 354 | virtual int vfunc14() = 0; 355 | virtual int vfunc15() = 0; 356 | virtual int vfunc16() = 0; 357 | virtual int vfunc17() = 0; 358 | virtual int vfunc18() = 0; 359 | virtual void a( ) = 0; 360 | virtual void b( ) = 0; 361 | virtual void DrawModelExecute(void* rendercontext, const DrawModelState_t &state, const ModelRenderInfo_t &pInfo, matrix3x4_t *pCustomBoneToWorld = NULL ) = 0; 362 | }; 363 | 364 | class IVRenderView 365 | { 366 | public: 367 | 368 | virtual void vfunc00() = 0; 369 | virtual void vfunc01() = 0; 370 | virtual void vfunc02() = 0; 371 | virtual void vfunc03() = 0; 372 | 373 | virtual void SetBlend( float blend ) = 0; 374 | virtual float GetBlend( void ) = 0; 375 | 376 | virtual void SetColorModulation( float const* blend ) = 0; 377 | virtual void GetColorModulation( float* blend ) = 0; 378 | }; 379 | 380 | class ISurface 381 | { 382 | public: 383 | void DrawSetColor(int r, int g, int b, int a) 384 | { 385 | typedef void(__thiscall* OriginalFn)(PVOID, int, int, int, int); 386 | getvfunc(this, 15)(this, r, g, b, a); 387 | } 388 | 389 | void DrawFilledRect(int x0, int y0, int x1, int y1) 390 | { 391 | typedef void(__thiscall* OriginalFn)(PVOID, int, int, int, int); 392 | getvfunc(this, 16)(this, x0, y0, x1, y1); 393 | } 394 | 395 | void DrawLine(int x0, int y0, int x1, int y1) 396 | { 397 | typedef void(__thiscall* OriginalFn)(PVOID, int, int, int, int); 398 | getvfunc(this, 19)(this, x0, y0, x1, y1); 399 | } 400 | 401 | void DrawSetTextFont(unsigned long font) 402 | { 403 | typedef void(__thiscall* OriginalFn)(PVOID, unsigned long); 404 | getvfunc(this, 23)(this, font); 405 | } 406 | 407 | void DrawSetTextColor(Color col) 408 | { 409 | typedef void(__thiscall* OriginalFn)(PVOID, int, int, int, int); 410 | getvfunc(this, 25)(this, col._color[0], col._color[ 1 ], col._color[ 2 ], col._color[ 3 ] ); 411 | } 412 | 413 | void DrawSetTextPos(int x, int y) 414 | { 415 | typedef void(__thiscall* OriginalFn)(PVOID, int, int); 416 | getvfunc(this, 26)(this, x, y); 417 | } 418 | 419 | void DrawPrintText(const wchar_t *text, int textLen) 420 | { 421 | typedef void(__thiscall* OriginalFn)(PVOID, const wchar_t *, int, int); 422 | return getvfunc(this, 28)(this, text, textLen, 0); 423 | } 424 | 425 | unsigned long CreateFont() 426 | { 427 | typedef unsigned int(__thiscall* OriginalFn)(PVOID); 428 | return getvfunc(this, 71)(this); 429 | } 430 | 431 | void SetFontGlyphSet(unsigned long &font, const char *windowsFontName, int tall, int weight, int blur, int scanlines, int flags) 432 | { 433 | typedef void(__thiscall* OriginalFn)(PVOID, unsigned long, const char*, int, int, int, int, int, int, int); 434 | getvfunc(this, 72)(this, font, windowsFontName, tall, weight, blur, scanlines, flags, 0, 0); 435 | } 436 | 437 | void GetTextSize(unsigned long font, const wchar_t *text, int &wide, int &tall) 438 | { 439 | typedef void(__thiscall* OriginalFn)(void*, unsigned long font, const wchar_t *text, int &wide, int &tall); 440 | getvfunc(this, 79)(this, font, text, wide, tall); 441 | } 442 | 443 | void UnlockCursor( ) 444 | { 445 | getvfunc( this, 66 )( this ); 446 | } 447 | }; 448 | } -------------------------------------------------------------------------------- /MD5.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | 3 | /* 4 | ================== 5 | MD5Init 6 | 7 | Start MD5 accumulation. Set bit count to 0 and buffer to mysterious initialization constants. 8 | ================== 9 | */ 10 | void MD5Init(MD5Context_t *ctx) 11 | { 12 | ctx->buf[0] = 0x67452301; 13 | ctx->buf[1] = 0xefcdab89; 14 | ctx->buf[2] = 0x98badcfe; 15 | ctx->buf[3] = 0x10325476; 16 | 17 | ctx->bits[0] = 0; 18 | ctx->bits[1] = 0; 19 | } 20 | 21 | /* 22 | =================== 23 | MD5Update 24 | 25 | Update context to reflect the concatenation of another buffer full of bytes. 26 | =================== 27 | */ 28 | void MD5Update(MD5Context_t *ctx, unsigned char const *buf, unsigned int len) 29 | { 30 | unsigned int t; 31 | 32 | /* Update bitcount */ 33 | 34 | t = ctx->bits[0]; 35 | if ((ctx->bits[0] = t + ((unsigned int) len << 3)) < t) 36 | ctx->bits[1]++; /* Carry from low to high */ 37 | ctx->bits[1] += len >> 29; 38 | 39 | t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ 40 | 41 | /* Handle any leading odd-sized chunks */ 42 | 43 | if (t) 44 | { 45 | unsigned char *p = (unsigned char *) ctx->in + t; 46 | 47 | t = 64 - t; 48 | if (len < t) 49 | { 50 | memcpy(p, buf, len); 51 | return; 52 | } 53 | memcpy(p, buf, t); 54 | //byteReverse(ctx->in, 16); 55 | MD5Transform(ctx->buf, (unsigned int *) ctx->in); 56 | buf += t; 57 | len -= t; 58 | } 59 | /* Process data in 64-byte chunks */ 60 | 61 | while (len >= 64) 62 | { 63 | memcpy(ctx->in, buf, 64); 64 | //byteReverse(ctx->in, 16); 65 | MD5Transform(ctx->buf, (unsigned int *) ctx->in); 66 | buf += 64; 67 | len -= 64; 68 | } 69 | 70 | /* Handle any remaining bytes of data. */ 71 | memcpy(ctx->in, buf, len); 72 | } 73 | 74 | /* 75 | =============== 76 | MD5Final 77 | 78 | 79 | Final wrapup - pad to 64-byte boundary with the bit pattern 80 | 1 0* (64-bit count of bits processed, MSB-first) 81 | =============== 82 | */ 83 | void MD5Final(unsigned char digest[16], MD5Context_t *ctx) 84 | { 85 | unsigned count; 86 | unsigned char *p; 87 | 88 | /* Compute number of bytes mod 64 */ 89 | count = (ctx->bits[0] >> 3) & 0x3F; 90 | 91 | /* Set the first char of padding to 0x80. This is safe since there is 92 | always at least one byte free */ 93 | p = ctx->in + count; 94 | *p++ = 0x80; 95 | 96 | /* Bytes of padding needed to make 64 bytes */ 97 | count = 64 - 1 - count; 98 | 99 | /* Pad out to 56 mod 64 */ 100 | if (count < 8) 101 | { 102 | /* Two lots of padding: Pad the first block to 64 bytes */ 103 | memset(p, 0, count); 104 | //byteReverse(ctx->in, 16); 105 | MD5Transform(ctx->buf, (unsigned int *) ctx->in); 106 | 107 | /* Now fill the next block with 56 bytes */ 108 | memset(ctx->in, 0, 56); 109 | } 110 | else 111 | { 112 | /* Pad block to 56 bytes */ 113 | memset(p, 0, count - 8); 114 | } 115 | //byteReverse(ctx->in, 14); 116 | 117 | /* Append length in bits and transform */ 118 | ((unsigned int *) ctx->in)[14] = ctx->bits[0]; 119 | ((unsigned int *) ctx->in)[15] = ctx->bits[1]; 120 | 121 | MD5Transform(ctx->buf, (unsigned int *) ctx->in); 122 | //byteReverse((unsigned char *) ctx->buf, 4); 123 | memcpy(digest, ctx->buf, 16); 124 | memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ 125 | } 126 | 127 | /* The four core functions - F1 is optimized somewhat */ 128 | /* #define F1(x, y, z) (x & y | ~x & z) */ 129 | #define F1(x, y, z) (z ^ (x & (y ^ z))) 130 | #define F2(x, y, z) F1(z, x, y) 131 | #define F3(x, y, z) (x ^ y ^ z) 132 | #define F4(x, y, z) (y ^ (x | ~z)) 133 | 134 | /* This is the central step in the MD5 algorithm. */ 135 | #define MD5STEP(f, w, x, y, z, data, s) \ 136 | ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) 137 | 138 | /* 139 | ================= 140 | MD5Transform 141 | 142 | The core of the MD5 algorithm, this alters an existing MD5 hash to 143 | reflect the addition of 16 longwords of new data. MD5Update blocks 144 | the data and converts bytes into longwords for this routine. 145 | ================= 146 | */ 147 | void MD5Transform(unsigned int buf[4], unsigned int const in[16]) 148 | { 149 | register unsigned int a, b, c, d; 150 | 151 | a = buf[0]; 152 | b = buf[1]; 153 | c = buf[2]; 154 | d = buf[3]; 155 | 156 | MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); 157 | MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); 158 | MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); 159 | MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); 160 | MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); 161 | MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); 162 | MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); 163 | MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); 164 | MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); 165 | MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); 166 | MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); 167 | MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); 168 | MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); 169 | MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); 170 | MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); 171 | MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); 172 | 173 | MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); 174 | MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); 175 | MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); 176 | MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); 177 | MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); 178 | MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); 179 | MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); 180 | MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); 181 | MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); 182 | MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); 183 | MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); 184 | MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); 185 | MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); 186 | MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); 187 | MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); 188 | MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); 189 | 190 | MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); 191 | MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); 192 | MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); 193 | MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); 194 | MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); 195 | MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); 196 | MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); 197 | MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); 198 | MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); 199 | MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); 200 | MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); 201 | MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); 202 | MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); 203 | MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); 204 | MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); 205 | MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); 206 | 207 | MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); 208 | MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); 209 | MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); 210 | MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); 211 | MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); 212 | MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); 213 | MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); 214 | MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); 215 | MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); 216 | MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); 217 | MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); 218 | MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); 219 | MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); 220 | MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); 221 | MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); 222 | MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); 223 | 224 | buf[0] += a; 225 | buf[1] += b; 226 | buf[2] += c; 227 | buf[3] += d; 228 | } 229 | 230 | unsigned int MD5_PseudoRandom(unsigned int nSeed) 231 | { 232 | MD5Context_t ctx; 233 | unsigned char digest[MD5_DIGEST_LENGTH]; // The MD5 Hash 234 | 235 | memset( &ctx, 0, sizeof( ctx ) ); 236 | 237 | MD5Init(&ctx); 238 | MD5Update(&ctx, (unsigned char*)&nSeed, sizeof(nSeed) ); 239 | MD5Final(digest, &ctx); 240 | 241 | return *(unsigned int*)(digest+6); // use 4 middle bytes for random value 242 | } -------------------------------------------------------------------------------- /MD5.h: -------------------------------------------------------------------------------- 1 | #define MD5_DIGEST_LENGTH 16 // 16 bytes == 128 bit digest 2 | 3 | // MD5 Hash 4 | typedef struct 5 | { 6 | unsigned int buf[4]; 7 | unsigned int bits[2]; 8 | unsigned char in[64]; 9 | } MD5Context_t; 10 | 11 | void MD5Init( MD5Context_t *context ); 12 | void MD5Update( MD5Context_t *context, unsigned char const *buf, unsigned int len ); 13 | void MD5Final( unsigned char digest[ MD5_DIGEST_LENGTH ], MD5Context_t *context ); 14 | void MD5Transform(unsigned int buf[4], unsigned int const in[16]); 15 | unsigned int MD5_PseudoRandom(unsigned int nSeed); 16 | -------------------------------------------------------------------------------- /Netvars.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | CNetworkedVariableManager g_NetworkedVariableManager; 3 | 4 | void CNetworkedVariableManager::Init(void) 5 | { 6 | m_tables.clear(); 7 | m_savedproxy.clear(); 8 | 9 | ValveSDK::ClientClass *clientClass = g_Valve.pClient->GetAllClasses(); //g_InterfaceManager->Client()->GetOriginalMethod( INDEX_GETALLCLASSES )( g_InterfaceManager->Client()->thisptr() ); 10 | 11 | if (!clientClass) 12 | { 13 | #ifdef DEBUGMODE 14 | Base::Debug::LOG("ClientClass was not found"); 15 | #endif 16 | return; 17 | } 18 | 19 | while (clientClass) 20 | { 21 | RecvTable *recvTable = clientClass->GetTable(); 22 | 23 | m_tables.push_back(recvTable); 24 | 25 | clientClass = clientClass->NextClass(); 26 | } 27 | } 28 | 29 | CNetworkedVariableManager::~CNetworkedVariableManager(void) 30 | { 31 | for(int i = 0; i < m_savedproxy.size(); i++) 32 | { 33 | RecvProp *recvProp = 0; 34 | GetProp(m_savedproxy[i].szTableName, m_savedproxy[i].szPropName, &recvProp); 35 | 36 | if (!recvProp) 37 | return; 38 | 39 | recvProp->m_ProxyFn = m_savedproxy[i].SavedProxy; 40 | } 41 | } 42 | 43 | // calls GetProp wrapper to get the absolute offset of the prop 44 | int CNetworkedVariableManager::GetOffset(const char *tableName, const char *propName) 45 | { 46 | int offset = GetProp(tableName, propName); 47 | 48 | if (!offset) 49 | { 50 | #ifdef DEBUGMODE 51 | printf("Failed to find offset for prop: %s from table: %s\n", propName, tableName); 52 | #endif 53 | return 0; 54 | } 55 | 56 | return offset; 57 | } 58 | 59 | 60 | // calls GetProp wrapper to get prop and sets the proxy of the prop 61 | bool CNetworkedVariableManager::HookProp(const char *tableName, const char *propName, RecvVarProxyFn function) 62 | { 63 | RecvProp *recvProp = 0; 64 | GetProp(tableName, propName, &recvProp); 65 | 66 | if (!recvProp) 67 | { 68 | #ifdef DEBUGMODE 69 | Base::Debug::LOG("HookProp failed"); 70 | #endif 71 | return false; 72 | } 73 | 74 | //kolonote: 75 | //make a list of hooked proxies, then when we eject dll we dont have to worry about proxies that point to a pointer where the pointee doesnt exist 76 | Oldproxy_t oldproxyinfo; 77 | 78 | strcpy(oldproxyinfo.szTableName,tableName); 79 | strcpy(oldproxyinfo.szPropName,propName); 80 | 81 | oldproxyinfo.SavedProxy = recvProp->m_ProxyFn; 82 | 83 | m_savedproxy.push_back(oldproxyinfo); 84 | 85 | //kolonote: 86 | //now we replace without worries 87 | recvProp->m_ProxyFn = function; 88 | 89 | return true; 90 | } 91 | 92 | 93 | // wrapper so we can use recursion without too much performance loss 94 | int CNetworkedVariableManager::GetProp(const char *tableName, const char *propName, RecvProp **prop) 95 | { 96 | RecvTable *recvTable = GetTable(tableName); 97 | 98 | if (!recvTable) 99 | { 100 | #ifdef DEBUGMODE 101 | printf("Failed to find table: %s", tableName); 102 | #endif 103 | return 0; 104 | } 105 | 106 | 107 | int offset = GetProp(recvTable, propName, prop); 108 | 109 | if (!offset) 110 | { 111 | #ifdef DEBUGMODE 112 | printf("Failed to find prop: %s from table: %s", propName, tableName); 113 | #endif 114 | return 0; 115 | } 116 | 117 | 118 | return offset; 119 | } 120 | 121 | 122 | // uses recursion to return a the relative offset to the given prop and sets the prop param 123 | int CNetworkedVariableManager::GetProp(RecvTable *recvTable, const char *propName, RecvProp **prop) 124 | { 125 | int extraOffset = 0; 126 | 127 | for (int i = 0; i < recvTable->m_nProps; ++i) 128 | { 129 | RecvProp *recvProp = &recvTable->m_pProps[i]; 130 | 131 | 132 | RecvTable *child = recvProp->m_pDataTable; 133 | 134 | if (child 135 | && (child->m_nProps > 0)) 136 | { 137 | int tmp = GetProp(child, propName, prop); 138 | 139 | if (tmp) 140 | { 141 | extraOffset += (recvProp->m_Offset + tmp); 142 | } 143 | } 144 | 145 | 146 | if (_stricmp(recvProp->m_pVarName, propName)) 147 | { 148 | continue; 149 | } 150 | 151 | 152 | if (prop) 153 | { 154 | *prop = recvProp; 155 | } 156 | 157 | return (recvProp->m_Offset + extraOffset); 158 | } 159 | 160 | return extraOffset; 161 | } 162 | 163 | 164 | RecvTable *CNetworkedVariableManager::GetTable(const char *tableName) 165 | { 166 | if (m_tables.empty()) 167 | { 168 | #ifdef DEBUGMODE 169 | printf("Failed to find table: %s (m_tables is empty)", tableName); 170 | #endif 171 | return 0; 172 | } 173 | 174 | 175 | for each (RecvTable *table in m_tables) 176 | { 177 | if (!table) 178 | { 179 | continue; 180 | } 181 | 182 | 183 | if (_stricmp(table->m_pNetTableName, tableName) == 0) 184 | { 185 | return table; 186 | } 187 | } 188 | 189 | return 0; 190 | } 191 | 192 | //kolonote: 193 | //this is a bit dirty as i wrote it in 2013 -.-'' 194 | static float fOldYaw[66]; 195 | void YawEyeAngleProxy(const CRecvProxyData *pData, void *pStruct, void *pOut) 196 | { 197 | float yawenz = pData->m_Value.m_Float; 198 | 199 | CBaseEntity *pEnt = (CBaseEntity*)pStruct; 200 | 201 | int i = pEnt->GetIndex(); 202 | 203 | //yaw/pitch mod which ill implement later when playerlist done 204 | if(g_Aimbot.fIsSelected[i] != 0) 205 | { 206 | if( yawenz > 180.0 ) 207 | yawenz -= 360.0; 208 | else if( yawenz < -180.0 ) 209 | yawenz += 360.0; 210 | 211 | if( fOldYaw[ i ] > 180.0 ) 212 | fOldYaw[ i ] -= 360.0; 213 | else if( fOldYaw[ i ] < -180.0 ) 214 | fOldYaw[ i ] += 360.0; 215 | 216 | float fYawDiff = yawenz - fOldYaw[ i ]; 217 | 218 | if( ( abs( fYawDiff ) > 178.0f&& abs( fYawDiff ) < 182.0f ) ) 219 | { 220 | yawenz += fYawDiff; 221 | 222 | if( yawenz > 180.0 ) 223 | yawenz -= 360.0; 224 | else if( yawenz < -180.0 ) 225 | yawenz += 360.0; 226 | 227 | fOldYaw[ i ] = yawenz - fYawDiff; 228 | } 229 | else 230 | { 231 | fOldYaw[ i ] = yawenz; 232 | } 233 | 234 | yawenz -= g_Aimbot.fYawMod[i]; 235 | 236 | if ( yawenz > 180.0 ) 237 | yawenz -= 360.0; 238 | else if ( yawenz < -180.0 ) 239 | yawenz += 360.0; 240 | } 241 | 242 | *(PFLOAT)pOut = yawenz; 243 | } 244 | 245 | void PitchEyeAngleProxy(const CRecvProxyData *pData, void *pStruct, void *pOut) 246 | { 247 | CBaseEntity* pEnt = ( CBaseEntity* )pStruct; 248 | 249 | int i = pEnt->GetIndex( ); 250 | 251 | float p = pData->m_Value.m_Float; 252 | 253 | if( g_Aimbot.fIsSelected[ i ] != 0 ) 254 | { 255 | //I KNOW I HAVE TO NORMALIZE THE ANGLE BUT CBA ATM HEHE 256 | if( ( ( p > 89.0f ) && ( p <= 180.087936f ) ) ) 257 | p = 89.0f; 258 | 259 | if( ( p < 271.0f ) && ( p > 180.087936f ) ) 260 | p = 271.0f; 261 | 262 | if( g_Aimbot.fPitchMod[ i ] == 1 ) 263 | p = 271.0f; 264 | else if( g_Aimbot.fPitchMod[ i ] == 2 ) 265 | p = 89.0f; 266 | else if( g_Aimbot.fPitchMod[ i ] == 3 ) 267 | p = 0.0f; 268 | } 269 | 270 | *(PFLOAT)pOut = p; 271 | } -------------------------------------------------------------------------------- /ReflectiveDLLInjection.h: -------------------------------------------------------------------------------- 1 | //===============================================================================================// 2 | // Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com) 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are permitted 6 | // provided that the following conditions are met: 7 | // 8 | // * Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other materials provided 13 | // with the distribution. 14 | // 15 | // * Neither the name of Harmony Security nor the names of its contributors may be used to 16 | // endorse or promote products derived from this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 | // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | //===============================================================================================// 28 | #ifndef _REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H 29 | #define _REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H 30 | //===============================================================================================// 31 | #define WIN32_LEAN_AND_MEAN 32 | #include 33 | 34 | // we declare some common stuff in here... 35 | 36 | #define DLL_METASPLOIT_ATTACH 4 37 | #define DLL_METASPLOIT_DETACH 5 38 | #define DLL_QUERY_HMODULE 6 39 | 40 | #define DEREF( name )*(UINT_PTR *)(name) 41 | #define DEREF_64( name )*(DWORD64 *)(name) 42 | #define DEREF_32( name )*(DWORD *)(name) 43 | #define DEREF_16( name )*(WORD *)(name) 44 | #define DEREF_8( name )*(BYTE *)(name) 45 | 46 | typedef ULONG_PTR (WINAPI * REFLECTIVELOADER)( VOID ); 47 | typedef BOOL (WINAPI * DLLMAIN)( HINSTANCE, DWORD, LPVOID ); 48 | 49 | #define DLLEXPORT __declspec( dllexport ) 50 | 51 | //===============================================================================================// 52 | #endif 53 | //===============================================================================================// 54 | -------------------------------------------------------------------------------- /ReflectiveLoader.h: -------------------------------------------------------------------------------- 1 | //===============================================================================================// 2 | // Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com) 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without modification, are permitted 6 | // provided that the following conditions are met: 7 | // 8 | // * Redistributions of source code must retain the above copyright notice, this list of 9 | // conditions and the following disclaimer. 10 | // 11 | // * Redistributions in binary form must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other materials provided 13 | // with the distribution. 14 | // 15 | // * Neither the name of Harmony Security nor the names of its contributors may be used to 16 | // endorse or promote products derived from this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 19 | // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 21 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 | // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | // POSSIBILITY OF SUCH DAMAGE. 27 | //===============================================================================================// 28 | #ifndef _REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H 29 | #define _REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H 30 | //===============================================================================================// 31 | #define WIN32_LEAN_AND_MEAN 32 | #include 33 | #include 34 | #include 35 | 36 | #include "ReflectiveDLLInjection.h" 37 | 38 | typedef HMODULE (WINAPI * LOADLIBRARYA)( LPCSTR ); 39 | typedef FARPROC (WINAPI * GETPROCADDRESS)( HMODULE, LPCSTR ); 40 | typedef LPVOID (WINAPI * VIRTUALALLOC)( LPVOID, SIZE_T, DWORD, DWORD ); 41 | typedef DWORD (NTAPI * NTFLUSHINSTRUCTIONCACHE)( HANDLE, PVOID, ULONG ); 42 | 43 | #define KERNEL32DLL_HASH 0x6A4ABC5B 44 | #define NTDLLDLL_HASH 0x3CFA685D 45 | 46 | #define LOADLIBRARYA_HASH 0xEC0E4E8E 47 | #define GETPROCADDRESS_HASH 0x7C0DFCAA 48 | #define VIRTUALALLOC_HASH 0x91AFCA54 49 | #define NTFLUSHINSTRUCTIONCACHE_HASH 0x534C0AB8 50 | 51 | #define IMAGE_REL_BASED_ARM_MOV32A 5 52 | #define IMAGE_REL_BASED_ARM_MOV32T 7 53 | 54 | #define ARM_MOV_MASK (DWORD)(0xFBF08000) 55 | #define ARM_MOV_MASK2 (DWORD)(0xFBF08F00) 56 | #define ARM_MOVW 0xF2400000 57 | #define ARM_MOVT 0xF2C00000 58 | 59 | #define HASH_KEY 13 60 | //===============================================================================================// 61 | #pragma intrinsic( _rotr ) 62 | 63 | __forceinline DWORD ror( DWORD d ) 64 | { 65 | return _rotr( d, HASH_KEY ); 66 | } 67 | 68 | __forceinline DWORD hash( char * c ) 69 | { 70 | register DWORD h = 0; 71 | do 72 | { 73 | h = ror( h ); 74 | h += *c; 75 | } while( *++c ); 76 | 77 | return h; 78 | } 79 | //===============================================================================================// 80 | typedef struct _UNICODE_STR 81 | { 82 | USHORT Length; 83 | USHORT MaximumLength; 84 | PWSTR pBuffer; 85 | } UNICODE_STR, *PUNICODE_STR; 86 | 87 | // WinDbg> dt -v ntdll!_LDR_DATA_TABLE_ENTRY 88 | //__declspec( align(8) ) 89 | typedef struct _LDR_DATA_TABLE_ENTRY 90 | { 91 | //LIST_ENTRY InLoadOrderLinks; // As we search from PPEB_LDR_DATA->InMemoryOrderModuleList we dont use the first entry. 92 | LIST_ENTRY InMemoryOrderModuleList; 93 | LIST_ENTRY InInitializationOrderModuleList; 94 | PVOID DllBase; 95 | PVOID EntryPoint; 96 | ULONG SizeOfImage; 97 | UNICODE_STR FullDllName; 98 | UNICODE_STR BaseDllName; 99 | ULONG Flags; 100 | SHORT LoadCount; 101 | SHORT TlsIndex; 102 | LIST_ENTRY HashTableEntry; 103 | ULONG TimeDateStamp; 104 | } LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY; 105 | 106 | // WinDbg> dt -v ntdll!_PEB_LDR_DATA 107 | typedef struct _PEB_LDR_DATA //, 7 elements, 0x28 bytes 108 | { 109 | DWORD dwLength; 110 | DWORD dwInitialized; 111 | LPVOID lpSsHandle; 112 | LIST_ENTRY InLoadOrderModuleList; 113 | LIST_ENTRY InMemoryOrderModuleList; 114 | LIST_ENTRY InInitializationOrderModuleList; 115 | LPVOID lpEntryInProgress; 116 | } PEB_LDR_DATA, * PPEB_LDR_DATA; 117 | 118 | // WinDbg> dt -v ntdll!_PEB_FREE_BLOCK 119 | typedef struct _PEB_FREE_BLOCK // 2 elements, 0x8 bytes 120 | { 121 | struct _PEB_FREE_BLOCK * pNext; 122 | DWORD dwSize; 123 | } PEB_FREE_BLOCK, * PPEB_FREE_BLOCK; 124 | 125 | // struct _PEB is defined in Winternl.h but it is incomplete 126 | // WinDbg> dt -v ntdll!_PEB 127 | typedef struct __PEB // 65 elements, 0x210 bytes 128 | { 129 | BYTE bInheritedAddressSpace; 130 | BYTE bReadImageFileExecOptions; 131 | BYTE bBeingDebugged; 132 | BYTE bSpareBool; 133 | LPVOID lpMutant; 134 | LPVOID lpImageBaseAddress; 135 | PPEB_LDR_DATA pLdr; 136 | LPVOID lpProcessParameters; 137 | LPVOID lpSubSystemData; 138 | LPVOID lpProcessHeap; 139 | PRTL_CRITICAL_SECTION pFastPebLock; 140 | LPVOID lpFastPebLockRoutine; 141 | LPVOID lpFastPebUnlockRoutine; 142 | DWORD dwEnvironmentUpdateCount; 143 | LPVOID lpKernelCallbackTable; 144 | DWORD dwSystemReserved; 145 | DWORD dwAtlThunkSListPtr32; 146 | PPEB_FREE_BLOCK pFreeList; 147 | DWORD dwTlsExpansionCounter; 148 | LPVOID lpTlsBitmap; 149 | DWORD dwTlsBitmapBits[2]; 150 | LPVOID lpReadOnlySharedMemoryBase; 151 | LPVOID lpReadOnlySharedMemoryHeap; 152 | LPVOID lpReadOnlyStaticServerData; 153 | LPVOID lpAnsiCodePageData; 154 | LPVOID lpOemCodePageData; 155 | LPVOID lpUnicodeCaseTableData; 156 | DWORD dwNumberOfProcessors; 157 | DWORD dwNtGlobalFlag; 158 | LARGE_INTEGER liCriticalSectionTimeout; 159 | DWORD dwHeapSegmentReserve; 160 | DWORD dwHeapSegmentCommit; 161 | DWORD dwHeapDeCommitTotalFreeThreshold; 162 | DWORD dwHeapDeCommitFreeBlockThreshold; 163 | DWORD dwNumberOfHeaps; 164 | DWORD dwMaximumNumberOfHeaps; 165 | LPVOID lpProcessHeaps; 166 | LPVOID lpGdiSharedHandleTable; 167 | LPVOID lpProcessStarterHelper; 168 | DWORD dwGdiDCAttributeList; 169 | LPVOID lpLoaderLock; 170 | DWORD dwOSMajorVersion; 171 | DWORD dwOSMinorVersion; 172 | WORD wOSBuildNumber; 173 | WORD wOSCSDVersion; 174 | DWORD dwOSPlatformId; 175 | DWORD dwImageSubsystem; 176 | DWORD dwImageSubsystemMajorVersion; 177 | DWORD dwImageSubsystemMinorVersion; 178 | DWORD dwImageProcessAffinityMask; 179 | DWORD dwGdiHandleBuffer[34]; 180 | LPVOID lpPostProcessInitRoutine; 181 | LPVOID lpTlsExpansionBitmap; 182 | DWORD dwTlsExpansionBitmapBits[32]; 183 | DWORD dwSessionId; 184 | ULARGE_INTEGER liAppCompatFlags; 185 | ULARGE_INTEGER liAppCompatFlagsUser; 186 | LPVOID lppShimData; 187 | LPVOID lpAppCompatInfo; 188 | UNICODE_STR usCSDVersion; 189 | LPVOID lpActivationContextData; 190 | LPVOID lpProcessAssemblyStorageMap; 191 | LPVOID lpSystemDefaultActivationContextData; 192 | LPVOID lpSystemAssemblyStorageMap; 193 | DWORD dwMinimumStackCommit; 194 | } _PEB, * _PPEB; 195 | 196 | typedef struct 197 | { 198 | WORD offset:12; 199 | WORD type:4; 200 | } IMAGE_RELOC, *PIMAGE_RELOC; 201 | //===============================================================================================// 202 | #endif 203 | //===============================================================================================// -------------------------------------------------------------------------------- /Surface.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | 3 | CDraw g_Draw; 4 | CESP g_ESP; 5 | 6 | bool bMenu = false; 7 | 8 | std::vector vecMapMaterials; 9 | std::vector vecOldMapMaterials; 10 | std::vector vecSkyMaterials; 11 | ValveSDK::IMaterial *pHands = NULL; 12 | 13 | bool bGetMaterials = true; 14 | 15 | void __stdcall hkdPaintTraverse(unsigned vguiPanel, bool forceRepaint, bool allowForce) 16 | { 17 | ( ( ( void( __thiscall* )( void*, unsigned, bool, bool ) )( g_pPanelVMT.dwGetMethodAddress( 41 ) ) )( g_Valve.pPanel, vguiPanel, forceRepaint, allowForce ) ); 18 | 19 | static bool bDidOnce = false; 20 | 21 | static unsigned FocusOverlayPanel = 0; 22 | 23 | if (bDidOnce == false) 24 | { 25 | g_Draw.InitFonts(); 26 | 27 | #ifdef DEBUGMODE 28 | Base::Debug::LOG("Font initalized"); 29 | #endif 30 | bDidOnce = true; 31 | } 32 | 33 | //if (!(pszPanelName[0] == 'M' && pszPanelName[3] == 'S' && pszPanelName[9] == 'T' && pszPanelName[12] == 'P')) 34 | // return; 35 | static std::string sPanel = /*FocusOverlayPanel*/XorStr<0xDB,18,0xB1284984>("\x9D\xB3\xBE\xAB\xAC\xAF\x97\x87\x91\x88\x84\x9F\xB7\x89\x87\x8F\x87"+0xB1284984).s; 36 | 37 | if( !FocusOverlayPanel ) 38 | { 39 | if (!strcmp( g_Valve.pPanel->GetName( vguiPanel ), sPanel.c_str())) 40 | FocusOverlayPanel = vguiPanel; 41 | } 42 | 43 | if( vguiPanel != FocusOverlayPanel ) return; 44 | 45 | static bool flip = false; 46 | flip = !flip; 47 | if( !flip ) return; 48 | 49 | //static std::string sXor = /*INTERWEBZ CSS*/XorStr<0x8C,14,0x50D39DA3>("\xC5\xC3\xDA\xCA\xC2\xC6\xD7\xD1\xCE\xB5\xD5\xC4\xCB"+0x50D39DA3).s; 50 | static std::string sXor = /*INTERWEBZ CS:GO*/XorStr<0xA2, 16, 0x50A8FBB9>( "\xEB\xED\xF0\xE0\xF4\xF0\xED\xEB\xF0\x8B\xEF\xFE\x94\xE8\xFF" + 0x50A8FBB9 ).s; 51 | 52 | // hehe 53 | //static std::string sXor = "INTERWEBZ CSGO cracked by deathcore2013"; 54 | 55 | g_Draw.DrawStringA( g_Draw.m_WatermarkFont, true, 250, 20, 255, 255, 255, 255, sXor.data( ) ); 56 | 57 | if(GetAsyncKeyState(VK_INSERT) & 1) 58 | bMenu = !bMenu; 59 | 60 | if(bMenu) 61 | { 62 | g_Mouse.Update(); 63 | 64 | int copy_x, copy_y; 65 | int copy_w, copy_h; 66 | 67 | g_Menu.GetMenuPos(copy_x,copy_y); 68 | g_Menu.GetMenuSize(copy_w,copy_h); 69 | 70 | g_Menu.DrawMenu(); 71 | 72 | g_Mouse.Drag(g_Mouse.bDragged[0], 73 | !g_Menu.IsHandlingItem(), 74 | g_Mouse.LeftClick(copy_x,copy_y,copy_w,copy_h),copy_x,copy_y,g_Mouse.iDiffX[0],g_Mouse.iDiffY[0]); 75 | 76 | g_Menu.SetMenuPos(copy_x,copy_y); 77 | 78 | if(g_Menu.IsHandlingItem()) 79 | g_Menu.RemoveMenuFlag(FL_DISABLEDRAG);//enable menu dragging 80 | 81 | //DRAW MENU HEREEEEEEEEEE 82 | //concept window by me (to show dragging for example) 83 | //--------------------------------------------------------------------------------------- 84 | /*static int winx = 100, winy = 100, winw = 100, winh = winw; 85 | 86 | //position (almost whole box) 87 | g_Mouse.Drag(g_Mouse.bDragged[0],//0 dragobject 88 | !(g_Mouse.bDragged[1] || g_Mouse.bDragged[2]), 89 | g_Mouse.LeftClick(winx,winy,winw-25,winh-25),winx,winy,g_Mouse.iDiffX[0],g_Mouse.iDiffY[0]); 90 | 91 | //resize (bottom and left side) 92 | g_Mouse.Drag(g_Mouse.bDragged[1],//next dragobject is 1 93 | !(g_Mouse.bDragged[0] || g_Mouse.bDragged[2]),//check all other drag objects being dragged or smth 94 | (g_Mouse.LeftClick(winx,winy+winh-25,winw,25) || g_Mouse.LeftClick(winx+winw-25,winy,25,winh)),//bottom and right side are the spots to resize we reserved 25 pixels for that 95 | winw,winh,g_Mouse.iDiffX[1],g_Mouse.iDiffY[1]);//same number dragobject we used for bDragged 96 | 97 | if(winh < 100) 98 | winh = 100; 99 | 100 | if(winw < 100) 101 | winw = 100; 102 | 103 | g_Draw.FillRGBA(winx,winy,winw,winh,200,70,70,255); 104 | //---------------------------------------------------------------------------------------*/ 105 | 106 | //this comes at end so we overdraw menu 107 | g_Mouse.DrawMouse(); 108 | } 109 | else if(g_Mouse.bReturn)//do this once as buymenu enables/disables mouse same way we do 110 | { 111 | g_Mouse.bReturn = false; 112 | } 113 | 114 | static bool bNosky; 115 | static bool bAsus; 116 | 117 | if(!g_Valve.pEngine->IsInGame() || !g_Valve.pEngine->IsConnected()) 118 | { 119 | bGetMaterials = true; 120 | bNosky = false; 121 | bAsus = false; 122 | 123 | return; 124 | } 125 | 126 | if(bGetMaterials) 127 | { 128 | vecSkyMaterials.clear(); 129 | vecMapMaterials.clear(); 130 | 131 | for(ValveSDK::MaterialHandle_t h = 0; h < g_Valve.pMaterialSystem->GetNumMaterials(); h++) 132 | { 133 | ValveSDK::IMaterial *pFirstMaterial = g_Valve.pMaterialSystem->GetMaterial(h); 134 | 135 | if(!pFirstMaterial) 136 | continue; 137 | 138 | if(strstr(pFirstMaterial->GetTextureGroupName(),XorStr<0xA4,7,0xFAF2E307>("\xF7\xCE\xDF\xE5\xC7\xD1"+0xFAF2E307).s)) 139 | vecSkyMaterials.push_back(pFirstMaterial); 140 | else if(strstr(pFirstMaterial->GetTextureGroupName(),XorStr<0x8A,6,0x3FB546ED>("\xDD\xE4\xFE\xE1\xEA"+0x3FB546ED).s)) 141 | vecMapMaterials.push_back(pFirstMaterial); 142 | else if(strstr(pFirstMaterial->GetName(),/*arms*/XorStr<0x88, 5, 0x52F78D1D>( "\xE9\xFB\xE7\xF8" + 0x52F78D1D ).s )) 143 | pHands = pFirstMaterial; 144 | } 145 | 146 | bGetMaterials = false; 147 | } 148 | 149 | static float fOldStrength; 150 | 151 | if(g_CVARS.CvarList[Asus]) 152 | { 153 | if((!bAsus || g_CVARS.CvarList[AsusAmount] != fOldStrength) && !vecMapMaterials.empty()) 154 | { 155 | for(int iTex = 0; iTex < vecMapMaterials.size(); iTex++) 156 | { 157 | if(!vecMapMaterials[iTex]) 158 | continue; 159 | 160 | vecMapMaterials[ iTex ]->AlphaModulate( ( g_CVARS.CvarList[ AsusAmount ] / 255.f ) ); 161 | 162 | if(iTex == (vecMapMaterials.size()-1)) 163 | { 164 | bAsus = true; 165 | fOldStrength = g_CVARS.CvarList[AsusAmount]; 166 | } 167 | } 168 | } 169 | } 170 | else 171 | { 172 | if(bAsus && !vecMapMaterials.empty()) 173 | { 174 | for(int iTex = 0; iTex < vecMapMaterials.size(); iTex++) 175 | { 176 | if(!vecMapMaterials[iTex]) 177 | continue; 178 | 179 | vecMapMaterials[iTex]->AlphaModulate(1.0f); 180 | 181 | if(iTex == (vecMapMaterials.size()-1)) 182 | bAsus = false; 183 | } 184 | } 185 | } 186 | 187 | if(g_CVARS.CvarList[NoSky]) 188 | { 189 | if(!bNosky && !vecSkyMaterials.empty()) 190 | { 191 | for(int iTex = 0; iTex < vecSkyMaterials.size(); iTex++) 192 | { 193 | if(!vecSkyMaterials[iTex]) 194 | continue; 195 | 196 | vecSkyMaterials[iTex]->ColorModulate(0.0f,0.0f,0.0f); 197 | 198 | if(iTex == (vecSkyMaterials.size()-1)) 199 | bNosky = true; 200 | } 201 | } 202 | } 203 | else 204 | { 205 | if(bNosky && !vecSkyMaterials.empty()) 206 | { 207 | for(int iTex = 0; iTex < vecSkyMaterials.size(); iTex++) 208 | { 209 | if(!vecSkyMaterials[iTex]) 210 | continue; 211 | 212 | vecSkyMaterials[iTex]->ColorModulate(1.0f,1.0f,1.0f); 213 | 214 | if(iTex == (vecSkyMaterials.size()-1)) 215 | bNosky = false; 216 | } 217 | } 218 | } 219 | 220 | //CSS only - we just use findmaterial 221 | static bool bHands; 222 | 223 | if(g_CVARS.CvarList[NoHands] && !bHands) 224 | { 225 | if(!pHands->GetMaterialVarFlag(ValveSDK::MATERIAL_VAR_NO_DRAW)) 226 | pHands->SetMaterialVarFlag(ValveSDK::MATERIAL_VAR_NO_DRAW,true); 227 | 228 | bHands = true; 229 | } 230 | else if(!g_CVARS.CvarList[NoHands] && bHands) 231 | { 232 | if(pHands->GetMaterialVarFlag(ValveSDK::MATERIAL_VAR_NO_DRAW)) 233 | pHands->SetMaterialVarFlag(ValveSDK::MATERIAL_VAR_NO_DRAW,false); 234 | 235 | bHands = false; 236 | } 237 | 238 | if(g_CVARS.CvarList[EnableESP]) 239 | g_ESP.draw(); 240 | } 241 | 242 | void InitKeyValues( KeyValues* keyvalues, const char* type ) 243 | { 244 | typedef void( __thiscall* InitKeyValuesFn )( void*, const char*, void*, int ); 245 | 246 | static auto address = Base::Utils::PatternSearch(/*client*/XorStr<0x41, 7, 0xAFB21C5E>( "\x22\x2E\x2A\x21\x2B\x32" + 0xAFB21C5E ).s,( PBYTE )"\x55\x8B\xEC\x56\x8B\xF1\x33\xC0\x8B\x4D\x0C\x81", "xxxxxxxxxxxx", 0, 0 ); 247 | #ifdef DEBUGMODE 248 | char log[ 256 ]; 249 | sprintf_s( log, "InitKeyValues: 0x%X", address ); 250 | Base::Debug::LOG( log ); 251 | #endif 252 | 253 | static auto function = ( InitKeyValuesFn )( address ); 254 | function( keyvalues, type, 0, 0 ); 255 | } 256 | 257 | void LoadFromBuff( KeyValues* pThis, const char* pszFirst, const char* pszSecond ) 258 | { 259 | typedef void( __thiscall* LoadFromBufferFn )( KeyValues*, const char*, const char*, void*, const char*, void*, void* ); 260 | static auto address = Base::Utils::PatternSearch(/*client*/XorStr<0x41, 7, 0xAFB21C5E>( "\x22\x2E\x2A\x21\x2B\x32" + 0xAFB21C5E ).s,(PBYTE)"\x55\x8B\xEC\x83\xE4\xF8\x83\xEC\x34\x53\x8B\x5D\x0C\x89", /*xxxxxxxxxxxxxx*/XorStr<0xB6, 15, 0xE36349CC>( "\xCE\xCF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xB8\xB9\xBA\xBB" + 0xE36349CC ).s, NULL, NULL ); 261 | 262 | #ifdef DEBUGMODE 263 | char szLog[256]; 264 | sprintf(szLog,"LoadFromBuffer: 0x%x",address); 265 | Base::Debug::LOG(szLog); 266 | #endif 267 | 268 | static auto function = ( LoadFromBufferFn )( address ); 269 | function( pThis, pszFirst, pszSecond, 0, 0, 0, 0 ); 270 | } 271 | 272 | void ChamModel( float r, float g, float b, ValveSDK::IMaterial *pMat) 273 | { 274 | float fColor[4] = { r/255, g/255, b/255, 1.0f }; 275 | 276 | static float fGetColor[4]; 277 | 278 | g_Valve.pRenderView->GetColorModulation(fGetColor); 279 | 280 | if(fGetColor[0] != fColor[0] || fGetColor[1] != fColor[1] || fGetColor[2] != fColor[2]) 281 | g_Valve.pRenderView->SetColorModulation( fColor ); 282 | 283 | if(pMat) 284 | g_Valve.pModelRender->ForcedMaterialOverride(pMat); 285 | } 286 | 287 | void FullCham( ValveSDK::IMaterial *pMat, const ValveSDK::ModelRenderInfo_t &pInfo, int r, int g, int b, int r2, int g2, int b2, bool bDeadIgnorez) 288 | { 289 | CBaseEntity *pBaseEnt = g_Valve.pEntList->GetClientEntity(pInfo.entity_index); 290 | 291 | if(!pBaseEnt) 292 | { 293 | g_Valve.pModelRender->ForcedMaterialOverride(NULL); 294 | return; 295 | } 296 | 297 | if(pBaseEnt->GetHealth() >= 1)//regular lifestate checking didnt work -.-'''' 298 | { 299 | int iTeamNum = pBaseEnt->GetTeamNum(); 300 | 301 | CBaseEntity *pLocal = g_Valve.pEntList->GetClientEntity(g_Valve.pEngine->GetLocalPlayer()); 302 | 303 | int iMyTeamNum = pLocal->GetTeamNum(); 304 | 305 | if(g_CVARS.CvarList[ChamsEnemyOnly] && iTeamNum == iMyTeamNum) 306 | return; 307 | 308 | if( iTeamNum == 3 ) 309 | ChamModel(r, g, b, pMat); 310 | else if( iTeamNum == 2 ) 311 | ChamModel(r2, g2, b2, pMat); 312 | else 313 | g_Valve.pModelRender->ForcedMaterialOverride(NULL); 314 | } 315 | else if(!bDeadIgnorez) 316 | ChamModel(255, 255, 255, pMat);//if deed then they white hehe 317 | } 318 | 319 | //kolonote: 320 | //macro c&p from my REAAAAALY old source (tbh kiro didnt make this first as i made it already in 2010 hah ownd - yes i did give him my code why ? hehe) 321 | #define MAT( _TYPE_ ) "\"" + _TYPE_ + "\"\n{\n\t\"$basetexture\" \"vgui/white_additive\"\n\t\"$ignorez\" \"0\"\n\t\"$nofog\" \"1\"\n\t\"$halflambert\" \"1\"\n}" 322 | #define MAT_IGNOREZ( _TYPE_ ) "\"" + _TYPE_ + "\"\n{\n\t\"$basetexture\" \"vgui/white_additive\"\n\t\"$ignorez\" \"1\"\n\t\"$nofog\" \"1\"\n\t\"$halflambert\" \"1\"\n}" 323 | 324 | void GenerateRandomString(char *s, const int len) 325 | { 326 | static const char alphanum[] = 327 | "0123456789" 328 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 329 | "abcdefghijklmnopqrstuvwxyz"; 330 | 331 | for (int i = 0; i < len; i++) 332 | { 333 | s[i] = alphanum[rand() % (sizeof(alphanum) - 1)]; 334 | } 335 | 336 | s[len] = 0; 337 | } 338 | 339 | ValveSDK::IMaterial *CreateMaterial(BOOL bFullbright, BOOL bIgnorez) 340 | { 341 | std::string type = (bFullbright ? /*UnlitGeneric*/XorStr<0xAF,13,0x932BA6F1>("\xFA\xDE\xDD\xDB\xC7\xF3\xD0\xD8\xD2\xCA\xD0\xD9"+0x932BA6F1).s : /*VertexLitGeneric*/XorStr<0xFD,17,0x1247276C>("\xAB\x9B\x8D\x74\x64\x7A\x4F\x6D\x71\x41\x62\x66\x6C\x78\x62\x6F"+0x1247276C).s); 342 | std::string tmp( (bIgnorez ? MAT_IGNOREZ(type) : MAT(type)) ); 343 | 344 | KeyValues *pKeyValues = new KeyValues(type.c_str()); 345 | 346 | InitKeyValues( pKeyValues, type.c_str( ) ); 347 | 348 | //generate some random file name for the .vmt (residing only in memory) 349 | char szMaterialName[128]; 350 | GenerateRandomString(szMaterialName,17); 351 | //strcat(szMaterialName,/*.vmt*/XorStr<0x26,5,0x8CB78199>("\x08\x51\x45\x5D"+0x8CB78199).s); 352 | 353 | LoadFromBuff(pKeyValues,szMaterialName,tmp.data()); 354 | 355 | ValveSDK::IMaterial *pNew = g_Valve.pMaterialSystem->CreateMaterial(szMaterialName,(PVOID)pKeyValues); 356 | 357 | if(pNew) 358 | pNew->IncrementReferenceCount(); 359 | 360 | #ifdef DEBUGMODE 361 | char szNewMaterial[1024]; 362 | sprintf(szNewMaterial,"Created new Valve Material Type[%s] Fullbright[%i] Ignorez[%i]",szMaterialName,bFullbright,bIgnorez); 363 | Base::Debug::LOG(szNewMaterial); 364 | #endif 365 | 366 | return pNew; 367 | } -------------------------------------------------------------------------------- /Surface.h: -------------------------------------------------------------------------------- 1 | extern void FullCham( ValveSDK::IMaterial *pMat, const ValveSDK::ModelRenderInfo_t &pInfo, int r, int g, int b, int r2, int g2, int b2, bool bDeadIgnorez = false); 2 | extern ValveSDK::IMaterial *CreateMaterial(BOOL bFullbright, BOOL bIgnorez); 3 | extern void GenerateRandomString(char *s, const int len); 4 | extern void ChamModel( float r, float g, float b, ValveSDK::IMaterial *pMat); 5 | 6 | extern bool bMenu; 7 | extern bool bGetMaterials; -------------------------------------------------------------------------------- /Utils.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | namespace Base 3 | { 4 | namespace Utils 5 | { 6 | ULONG PatternSearch(std::string sModuleName, PBYTE pbPattern, std::string sMask, 7 | ULONG uCodeBase, ULONG uSizeOfCode) 8 | { 9 | BOOL bPatternDidMatch = FALSE; 10 | HMODULE hModule = GetModuleHandle(sModuleName.c_str()); 11 | 12 | if (!hModule) 13 | return 0x0; 14 | 15 | PIMAGE_DOS_HEADER pDsHeader = PIMAGE_DOS_HEADER(hModule); 16 | PIMAGE_NT_HEADERS pPeHeader = PIMAGE_NT_HEADERS(LONG(hModule) + pDsHeader->e_lfanew); 17 | PIMAGE_OPTIONAL_HEADER pOptionalHeader = &pPeHeader->OptionalHeader; 18 | 19 | if (uCodeBase == 0x0) 20 | uCodeBase = (ULONG)hModule + pOptionalHeader->BaseOfCode; 21 | 22 | if (uSizeOfCode == 0x0) 23 | uSizeOfCode = pOptionalHeader->SizeOfCode; 24 | 25 | ULONG uArraySize = sMask.length(); 26 | 27 | if (!uCodeBase || !uSizeOfCode || !uArraySize) 28 | return 0x0; 29 | 30 | for (size_t i = uCodeBase; i <= uCodeBase + uSizeOfCode; i++) 31 | { 32 | for (size_t t = 0; t < uArraySize; t++) 33 | { 34 | if (*((PBYTE)i + t) == pbPattern[t] || sMask.c_str()[t] == '?') 35 | bPatternDidMatch = TRUE; 36 | 37 | else 38 | { 39 | bPatternDidMatch = FALSE; 40 | break; 41 | } 42 | } 43 | 44 | if (bPatternDidMatch) 45 | return i; 46 | } 47 | 48 | return 0x0; 49 | } 50 | 51 | HMODULE GetModuleHandleSafe(const char* pszModuleName) 52 | { 53 | HMODULE hmModuleHandle = NULL; 54 | 55 | do 56 | { 57 | hmModuleHandle = GetModuleHandle(pszModuleName); 58 | Sleep(1); 59 | } while (hmModuleHandle == NULL); 60 | 61 | return hmModuleHandle; 62 | } 63 | 64 | } 65 | 66 | #ifdef DEBUGMODE 67 | namespace Debug 68 | { 69 | bool AttachDebugConsole(void) 70 | { 71 | FILE* g_pConStream; 72 | 73 | if (!AttachConsole(ATTACH_PARENT_PROCESS)) 74 | { 75 | if (!AllocConsole()) 76 | return false; 77 | } 78 | 79 | if (!SetConsoleTitle("DebugMessages")) 80 | return false; 81 | 82 | errno_t err = freopen_s(&g_pConStream, "CONOUT$", "w", stdout); 83 | 84 | if (err != 0) 85 | return false; 86 | 87 | return true; 88 | } 89 | void LOG(const char* output) 90 | { 91 | printf(output); 92 | printf("\n"); 93 | } 94 | } 95 | #endif 96 | } -------------------------------------------------------------------------------- /Utils.h: -------------------------------------------------------------------------------- 1 | namespace Base 2 | { 3 | namespace Utils 4 | { 5 | class CVMTHookManager 6 | { 7 | public: 8 | CVMTHookManager(void) 9 | { 10 | memset(this, 0, sizeof(CVMTHookManager)); 11 | } 12 | 13 | CVMTHookManager(PDWORD* ppdwClassBase) 14 | { 15 | bInitialize(ppdwClassBase); 16 | } 17 | 18 | ~CVMTHookManager(void) 19 | { 20 | UnHook(); 21 | } 22 | 23 | bool bInitialize(PDWORD* ppdwClassBase) 24 | { 25 | m_ppdwClassBase = ppdwClassBase; 26 | m_pdwOldVMT = *ppdwClassBase; 27 | m_dwVMTSize = dwGetVMTCount(*ppdwClassBase); 28 | m_pdwNewVMT = new DWORD[m_dwVMTSize]; 29 | memcpy(m_pdwNewVMT, m_pdwOldVMT, sizeof(DWORD) * m_dwVMTSize); 30 | *ppdwClassBase = m_pdwNewVMT; 31 | return true; 32 | } 33 | 34 | bool bInitialize(PDWORD** pppdwClassBase) 35 | { 36 | return bInitialize(*pppdwClassBase); 37 | } 38 | 39 | void UnHook(void) 40 | { 41 | if (m_ppdwClassBase) 42 | { 43 | *m_ppdwClassBase = m_pdwOldVMT; 44 | } 45 | } 46 | 47 | void ReHook(void) 48 | { 49 | if (m_ppdwClassBase) 50 | { 51 | *m_ppdwClassBase = m_pdwNewVMT; 52 | } 53 | } 54 | 55 | int iGetFuncCount(void) 56 | { 57 | return (int)m_dwVMTSize; 58 | } 59 | 60 | DWORD dwGetMethodAddress(int Index) 61 | { 62 | if (Index >= 0 && Index <= (int)m_dwVMTSize && m_pdwOldVMT != NULL) 63 | { 64 | return m_pdwOldVMT[Index]; 65 | } 66 | return NULL; 67 | } 68 | 69 | PDWORD pdwGetOldVMT(void) 70 | { 71 | return m_pdwOldVMT; 72 | } 73 | 74 | DWORD dwHookMethod(DWORD dwNewFunc, unsigned int iIndex) 75 | { 76 | if (m_pdwNewVMT && m_pdwOldVMT && iIndex <= m_dwVMTSize && iIndex >= 0) 77 | { 78 | m_pdwNewVMT[iIndex] = dwNewFunc; 79 | return m_pdwOldVMT[iIndex]; 80 | } 81 | return NULL; 82 | } 83 | 84 | private: 85 | DWORD dwGetVMTCount(PDWORD pdwVMT) 86 | { 87 | DWORD dwIndex = 0; 88 | 89 | for (dwIndex = 0; pdwVMT[dwIndex]; dwIndex++) 90 | { 91 | if (IsBadCodePtr((FARPROC)pdwVMT[dwIndex])) 92 | { 93 | break; 94 | } 95 | } 96 | return dwIndex; 97 | } 98 | PDWORD* m_ppdwClassBase; 99 | PDWORD m_pdwNewVMT, m_pdwOldVMT; 100 | DWORD m_dwVMTSize; 101 | }; 102 | 103 | extern ULONG PatternSearch(std::string ModuleName, PBYTE Pattern, std::string Mask, 104 | ULONG uCodeBase, ULONG uSizeOfCode); 105 | extern HMODULE GetModuleHandleSafe(const char* pszModuleName); 106 | } 107 | 108 | namespace Debug 109 | { 110 | extern bool AttachDebugConsole(void); 111 | extern void LOG(const char* output); 112 | } 113 | } 114 | 115 | 116 | -------------------------------------------------------------------------------- /Vector.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #define CHECK_VALID( _v ) 0 5 | #define Assert( _exp ) ((void)0) 6 | 7 | class Vector 8 | { 9 | public: 10 | float x, y, z; 11 | Vector(void); 12 | Vector(float X, float Y, float Z); 13 | void Init(float ix=0.0f, float iy=0.0f, float iz=0.0f); 14 | bool IsValid() const; 15 | float operator[](int i) const; 16 | float& operator[](int i); 17 | inline void Zero(); 18 | bool operator==(const Vector& v) const; 19 | bool operator!=(const Vector& v) const; 20 | __forceinline Vector& operator+=(const Vector &v); 21 | __forceinline Vector& operator-=(const Vector &v); 22 | __forceinline Vector& operator*=(const Vector &v); 23 | __forceinline Vector& operator*=(float s); 24 | __forceinline Vector& operator/=(const Vector &v); 25 | __forceinline Vector& operator/=(float s); 26 | __forceinline Vector& operator+=(float fl); 27 | __forceinline Vector& operator-=(float fl); 28 | inline float Length() const; 29 | __forceinline float LengthSqr(void) const 30 | { 31 | CHECK_VALID(*this); 32 | return (x*x + y*y + z*z); 33 | } 34 | bool IsZero( float tolerance = 0.01f ) const 35 | { 36 | return (x > -tolerance && x < tolerance && 37 | y > -tolerance && y < tolerance && 38 | z > -tolerance && z < tolerance); 39 | } 40 | void NormalizeInPlace(); 41 | __forceinline float DistToSqr(const Vector &vOther) const; 42 | float Dot(const Vector& vOther) const; 43 | float Length2D(void) const; 44 | float Length2DSqr(void) const; 45 | Vector& operator=(const Vector &vOther); 46 | Vector operator-(void) const; 47 | Vector operator+(const Vector& v) const; 48 | Vector operator-(const Vector& v) const; 49 | Vector operator*(const Vector& v) const; 50 | Vector operator/(const Vector& v) const; 51 | Vector operator*(float fl) const; 52 | Vector operator/(float fl) const; 53 | }; 54 | //=============================================== 55 | inline void Vector::Init( float ix, float iy, float iz ) 56 | { 57 | x = ix; y = iy; z = iz; 58 | CHECK_VALID(*this); 59 | } 60 | //=============================================== 61 | inline Vector::Vector(float X, float Y, float Z) 62 | { 63 | x = X; y = Y; z = Z; 64 | CHECK_VALID(*this); 65 | } 66 | //=============================================== 67 | inline Vector::Vector(void){ } 68 | //=============================================== 69 | inline void Vector::Zero() 70 | { 71 | x = y = z = 0.0f; 72 | } 73 | //=============================================== 74 | inline void VectorClear( Vector& a ) 75 | { 76 | a.x = a.y = a.z = 0.0f; 77 | } 78 | //=============================================== 79 | inline Vector& Vector::operator=(const Vector &vOther) 80 | { 81 | CHECK_VALID(vOther); 82 | x=vOther.x; y=vOther.y; z=vOther.z; 83 | return *this; 84 | } 85 | //=============================================== 86 | inline float& Vector::operator[](int i) 87 | { 88 | Assert( (i >= 0) && (i < 3) ); 89 | return ((float*)this)[i]; 90 | } 91 | //=============================================== 92 | inline float Vector::operator[](int i) const 93 | { 94 | Assert( (i >= 0) && (i < 3) ); 95 | return ((float*)this)[i]; 96 | } 97 | //=============================================== 98 | inline bool Vector::operator==( const Vector& src ) const 99 | { 100 | CHECK_VALID(src); 101 | CHECK_VALID(*this); 102 | return (src.x == x) && (src.y == y) && (src.z == z); 103 | } 104 | //=============================================== 105 | inline bool Vector::operator!=( const Vector& src ) const 106 | { 107 | CHECK_VALID(src); 108 | CHECK_VALID(*this); 109 | return (src.x != x) || (src.y != y) || (src.z != z); 110 | } 111 | //=============================================== 112 | __forceinline void VectorCopy( const Vector& src, Vector& dst ) 113 | { 114 | CHECK_VALID(src); 115 | dst.x = src.x; 116 | dst.y = src.y; 117 | dst.z = src.z; 118 | } 119 | //=============================================== 120 | __forceinline Vector& Vector::operator+=(const Vector& v) 121 | { 122 | CHECK_VALID(*this); 123 | CHECK_VALID(v); 124 | x+=v.x; y+=v.y; z += v.z; 125 | return *this; 126 | } 127 | //=============================================== 128 | __forceinline Vector& Vector::operator-=(const Vector& v) 129 | { 130 | CHECK_VALID(*this); 131 | CHECK_VALID(v); 132 | x-=v.x; y-=v.y; z -= v.z; 133 | return *this; 134 | } 135 | //=============================================== 136 | __forceinline Vector& Vector::operator*=(float fl) 137 | { 138 | x *= fl; 139 | y *= fl; 140 | z *= fl; 141 | CHECK_VALID(*this); 142 | return *this; 143 | } 144 | //=============================================== 145 | __forceinline Vector& Vector::operator*=(const Vector& v) 146 | { 147 | CHECK_VALID(v); 148 | x *= v.x; 149 | y *= v.y; 150 | z *= v.z; 151 | CHECK_VALID(*this); 152 | return *this; 153 | } 154 | //=============================================== 155 | __forceinline Vector& Vector::operator+=(float fl) 156 | { 157 | x += fl; 158 | y += fl; 159 | z += fl; 160 | CHECK_VALID(*this); 161 | return *this; 162 | } 163 | //=============================================== 164 | __forceinline Vector& Vector::operator-=(float fl) 165 | { 166 | x -= fl; 167 | y -= fl; 168 | z -= fl; 169 | CHECK_VALID(*this); 170 | return *this; 171 | } 172 | //=============================================== 173 | __forceinline Vector& Vector::operator/=(float fl) 174 | { 175 | Assert( fl != 0.0f ); 176 | float oofl = 1.0f / fl; 177 | x *= oofl; 178 | y *= oofl; 179 | z *= oofl; 180 | CHECK_VALID(*this); 181 | return *this; 182 | } 183 | //=============================================== 184 | __forceinline Vector& Vector::operator/=(const Vector& v) 185 | { 186 | CHECK_VALID(v); 187 | Assert( v.x != 0.0f && v.y != 0.0f && v.z != 0.0f ); 188 | x /= v.x; 189 | y /= v.y; 190 | z /= v.z; 191 | CHECK_VALID(*this); 192 | return *this; 193 | } 194 | //=============================================== 195 | inline float Vector::Length(void) const 196 | { 197 | CHECK_VALID(*this); 198 | 199 | float root = 0.0f; 200 | 201 | float sqsr = x*x + y*y + z*z; 202 | 203 | __asm 204 | { 205 | sqrtss xmm0, sqsr 206 | movss root, xmm0 207 | } 208 | 209 | return root; 210 | } 211 | //=============================================== 212 | inline float Vector::Length2D(void) const 213 | { 214 | CHECK_VALID(*this); 215 | 216 | float root = 0.0f; 217 | 218 | float sqst = x*x + y*y; 219 | 220 | __asm 221 | { 222 | sqrtss xmm0, sqst 223 | movss root, xmm0 224 | } 225 | 226 | return root; 227 | } 228 | //=============================================== 229 | inline float Vector::Length2DSqr(void) const 230 | { 231 | return (x*x + y*y); 232 | } 233 | //=============================================== 234 | inline Vector CrossProduct(const Vector& a, const Vector& b) 235 | { 236 | 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 ); 237 | } 238 | //=============================================== 239 | float Vector::DistToSqr(const Vector &vOther) const 240 | { 241 | Vector delta; 242 | 243 | delta.x = x - vOther.x; 244 | delta.y = y - vOther.y; 245 | delta.z = z - vOther.z; 246 | 247 | return delta.LengthSqr(); 248 | } 249 | //=============================================== 250 | inline void Vector::NormalizeInPlace() 251 | { 252 | Vector& v = *this; 253 | 254 | float iradius = 1.f / ( this->Length() + 1.192092896e-07F ); //FLT_EPSILON 255 | 256 | v.x *= iradius; 257 | v.y *= iradius; 258 | v.z *= iradius; 259 | } 260 | //=============================================== 261 | inline Vector Vector::operator+(const Vector& v) const 262 | { 263 | Vector res; 264 | res.x = x + v.x; 265 | res.y = y + v.y; 266 | res.z = z + v.z; 267 | return res; 268 | } 269 | //=============================================== 270 | inline Vector Vector::operator-(const Vector& v) const 271 | { 272 | Vector res; 273 | res.x = x - v.x; 274 | res.y = y - v.y; 275 | res.z = z - v.z; 276 | return res; 277 | } 278 | //=============================================== 279 | inline Vector Vector::operator*(float fl) const 280 | { 281 | Vector res; 282 | res.x = x * fl; 283 | res.y = y * fl; 284 | res.z = z * fl; 285 | return res; 286 | } 287 | //=============================================== 288 | inline Vector Vector::operator*(const Vector& v) const 289 | { 290 | Vector res; 291 | res.x = x * v.x; 292 | res.y = y * v.y; 293 | res.z = z * v.z; 294 | return res; 295 | } 296 | //=============================================== 297 | inline Vector Vector::operator/(float fl) const 298 | { 299 | Vector res; 300 | res.x = x / fl; 301 | res.y = y / fl; 302 | res.z = z / fl; 303 | return res; 304 | } 305 | //=============================================== 306 | inline Vector Vector::operator/(const Vector& v) const 307 | { 308 | Vector res; 309 | res.x = x / v.x; 310 | res.y = y / v.y; 311 | res.z = z / v.z; 312 | return res; 313 | } 314 | inline float Vector::Dot( const Vector& vOther ) const 315 | { 316 | const Vector& a = *this; 317 | 318 | return( a.x*vOther.x + a.y*vOther.y + a.z*vOther.z ); 319 | } 320 | 321 | #define DECL_ALIGN(x) __declspec(align(x)) 322 | #define ALIGN16 DECL_ALIGN(16) 323 | 324 | class ALIGN16 VectorAligned : public Vector 325 | { 326 | public: 327 | VectorAligned( ) 328 | { 329 | x = y = z = 0; 330 | } 331 | 332 | VectorAligned( const Vector& in ) 333 | { 334 | x = in.x; 335 | y = in.y; 336 | z = in.z; 337 | } 338 | 339 | float w; 340 | }; 341 | -------------------------------------------------------------------------------- /checksum_crc.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mr-nv/interwebz-csgo/229af391c05d22451ef31e8806518952bf521de5/checksum_crc.cpp -------------------------------------------------------------------------------- /checksum_crc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mr-nv/interwebz-csgo/229af391c05d22451ef31e8806518952bf521de5/checksum_crc.h -------------------------------------------------------------------------------- /client.h: -------------------------------------------------------------------------------- 1 | void __fastcall hkdCreateMove(void* ecx, void* edx, int sequence_number, float input_sample_frametime, bool active); 2 | void __stdcall hkdRunCommand(CBaseEntity* pEntity, ValveSDK::CInput::CUserCmd* pUserCmd, void* moveHelper); 3 | void __fastcall hkdFrameStageNotify(void* ecx, void*, ClientFrameStage_t curStage); 4 | void __stdcall hkdPaintTraverse(unsigned vguiPanel, bool forceRepaint, bool allowForce); 5 | void __stdcall hkdDrawModelExecute(void* rendercontext, const ValveSDK::DrawModelState_t &state, const ValveSDK::ModelRenderInfo_t &pInfo, matrix3x4_t *pCustomBoneToWorld = NULL); 6 | ValveSDK::CInput::CUserCmd* __fastcall hkdGetUserCmd( void* ecx, void*, int slot, int sequence_number ); 7 | int __stdcall hkdIN_KeyEvent(int eventcode,ValveSDK::ButtonCode_t keynum,const char *pszCurrentBinding); 8 | void __stdcall hkdFinishMove(CBaseEntity *player, ValveSDK::CInput::CUserCmd *ucmd, PVOID move); 9 | void __fastcall hkdLockCursor( void* ecx, void* ); 10 | 11 | extern DWORD dwOriginCreateMove; 12 | extern Base::Utils::CVMTHookManager g_pClientVMT; 13 | extern Base::Utils::CVMTHookManager g_pPanelVMT; 14 | extern Base::Utils::CVMTHookManager g_pPredictionVMT; 15 | extern Base::Utils::CVMTHookManager g_pModelRenderVMT; 16 | extern Base::Utils::CVMTHookManager g_pInputVMT; 17 | extern Base::Utils::CVMTHookManager g_pSurfaceVMT; -------------------------------------------------------------------------------- /dt_common2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mr-nv/interwebz-csgo/229af391c05d22451ef31e8806518952bf521de5/dt_common2.h -------------------------------------------------------------------------------- /dt_recv2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mr-nv/interwebz-csgo/229af391c05d22451ef31e8806518952bf521de5/dt_recv2.h -------------------------------------------------------------------------------- /menu.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mr-nv/interwebz-csgo/229af391c05d22451ef31e8806518952bf521de5/menu.cpp -------------------------------------------------------------------------------- /menu.h: -------------------------------------------------------------------------------- 1 | #define NUM_OF_TABS 5 2 | #define NUM_OF_CFGS 6 3 | #define NUM_OF_TOTAL_LISTITEMS 13 4 | 5 | 6 | enum 7 | { 8 | FL_DISABLEDRAG = (1 << 1) 9 | }; 10 | 11 | enum 12 | { 13 | DEFAULTCFG, 14 | LEGITCFG, 15 | RAGECFG, 16 | HVHCFG, 17 | MMCFG, 18 | CUSTOMCFG 19 | }; 20 | 21 | enum 22 | { 23 | AIMBOTTAB, 24 | ESPTAB, 25 | MISCTAB, 26 | SPECIALTAB, 27 | COLORTAB 28 | }; 29 | 30 | enum 31 | { 32 | SMALL_CHAMSTAB, 33 | SMALL_GLOWTAB, 34 | SMALL_ESPTAB, 35 | SMALL_PLAYERLISTTAB, 36 | SMALL_MODIFIEDTAB 37 | }; 38 | 39 | enum 40 | { 41 | ONOFF, 42 | DROPDOWN, 43 | SLIDER, 44 | BUTTON, 45 | ADDER 46 | }; 47 | 48 | typedef struct 49 | { 50 | char szName[128]; 51 | int iSpecialValue; 52 | } ListItem_t; 53 | 54 | //pseudo itemlist by kolo ehi ehi 55 | //this will be dynamic so we will refresh it every frame. i know its slow but who carezz ? 56 | class cListItem 57 | { 58 | public: 59 | void Draw(int x, int y, int w, int h); 60 | 61 | void OnlyList() 62 | { 63 | bOnlyListOnPage = true; 64 | } 65 | 66 | bool IsOnlyListOnPage() 67 | { 68 | return bOnlyListOnPage; 69 | } 70 | 71 | void ClearList() 72 | { 73 | vecListItems.clear(); 74 | 75 | bOnlyListOnPage = false; 76 | } 77 | 78 | int GetNumberOfItems() 79 | { 80 | return vecListItems.size(); 81 | } 82 | 83 | void AddItem(const char *pszName, int iSpecialValue, bool bSelected = false) 84 | { 85 | ListItem_t liNew; 86 | 87 | strcpy(liNew.szName,pszName); 88 | 89 | liNew.iSpecialValue = iSpecialValue; 90 | 91 | vecListItems.push_back(liNew); 92 | } 93 | 94 | bool IsScrollingNeeded() 95 | { 96 | return bScrollingNeeded; 97 | } 98 | 99 | bool IsFocused() 100 | { 101 | return bListInFocus; 102 | } 103 | 104 | void SetFocus(bool bCondition) 105 | { 106 | bListInFocus = bCondition; 107 | } 108 | 109 | ListItem_t GetSelectedItem() 110 | { 111 | return vecListItems[iSelectedIndex]; 112 | } 113 | 114 | ListItem_t GetTopItem() 115 | { 116 | return vecListItems[iTopIndex]; 117 | } 118 | 119 | ListItem_t GetItemFromIndex(int index) 120 | { 121 | return vecListItems[index]; 122 | } 123 | 124 | int GetSpecialValueFromIndex(int index) 125 | { 126 | return vecListItems[index].iSpecialValue; 127 | } 128 | 129 | void Select(int index) 130 | { 131 | iSelectedIndex = index; 132 | } 133 | 134 | bool IsSelected(int index) 135 | { 136 | return (iSelectedIndex == index); 137 | } 138 | 139 | void MoveUp(int amount = 2) 140 | { 141 | iTopIndex -= amount; 142 | 143 | if(iTopIndex < 0) 144 | iTopIndex = 0; 145 | } 146 | 147 | void MoveDown(int amount = 2) 148 | { 149 | iTopIndex += amount; 150 | 151 | //just following rules of itemlists which are scrollable 152 | int iLastPossibleTopIndex = abs(GetNumberOfItems() - HowManyToDisplayPerPage()) - 1; 153 | 154 | if(iTopIndex > iLastPossibleTopIndex) 155 | iTopIndex = iLastPossibleTopIndex; 156 | } 157 | 158 | int HowManyToDisplayPerPage() 159 | { 160 | return iDisplayPerPage; 161 | } 162 | 163 | void DisplayPerPage(int amount) 164 | { 165 | iDisplayPerPage = amount; 166 | } 167 | 168 | private: 169 | std::vector vecListItems; 170 | 171 | int iTopIndex; 172 | int iSelectedIndex; 173 | int iDisplayPerPage; 174 | 175 | bool bListInFocus; 176 | bool bOnlyListOnPage; 177 | bool bScrollingNeeded; 178 | }; 179 | 180 | typedef struct DropDown_s 181 | { 182 | int x, y; 183 | int iCount; 184 | 185 | float *fValues; 186 | float *cvar; 187 | 188 | char **ppszNames; 189 | } DropDown_t; 190 | 191 | class cMenuSection 192 | { 193 | public: 194 | void Draw(int x, int y, int w, int h, const char *pszSectionName); 195 | 196 | void AddElement(int iType, int add_to_x, const char *pszElementName, const char *pszComment, float *cvar, float min = 0, float max = 1, float step = 1, float fToValue = -1, int increment = 1); 197 | 198 | void DrawAllDropDowns(); 199 | 200 | void PostSection() 201 | { 202 | DrawAllDropDowns(); 203 | } 204 | 205 | void ClearSection() 206 | { 207 | vecDropDowns.clear(); 208 | 209 | RestartSection(); 210 | } 211 | 212 | void RestartSection() 213 | { 214 | iSection = 0; 215 | } 216 | 217 | void PostElement(int increment = 1) 218 | { 219 | iSection += increment; 220 | } 221 | 222 | void SetISection(int newvalue = 1) 223 | { 224 | iSection = newvalue; 225 | } 226 | 227 | void SetColorDummy(int r, int g, int b, int a) 228 | { 229 | fColDummy[0] = r; 230 | fColDummy[1] = g; 231 | fColDummy[2] = b; 232 | fColDummy[3] = a; 233 | } 234 | 235 | void SetSlider(int &iCurrentSlider, bool bValue = false, bool bColor = false, int iColIdx = -1, bool bSetDummy = false, int r = 255, int g = 255, int b = 255, int a = 255, bool bCham = false, float fLen = 360.0f) 236 | { 237 | if(bSetDummy) 238 | SetColorDummy(r,g,b,a); 239 | 240 | iColorIndex = iColIdx; 241 | 242 | bColored = bColor; 243 | bShowValue = bValue; 244 | bChams = bCham; 245 | 246 | fLength = fLen; 247 | 248 | iCurrentSlider++; 249 | } 250 | 251 | void SetSectionPos(int x, int y) 252 | { 253 | s_x = x; 254 | s_y = y; 255 | } 256 | 257 | void SetValueNames(char **szArrayArray, float *fArray, int iCount) 258 | { 259 | ppszValueNames = szArrayArray; 260 | fValueList = fArray; 261 | iValueCount = iCount; 262 | } 263 | 264 | void ClearAllElementSpecifics() 265 | { 266 | SetValueNames(NULL,NULL,0); 267 | } 268 | 269 | //slider specifics 270 | //---------------------- 271 | float fColDummy[4]; 272 | //---------------------- 273 | 274 | private: 275 | void AddDropDownToDrawList(DropDown_t ddNew) 276 | { 277 | vecDropDowns.push_back(ddNew); 278 | } 279 | 280 | int iSection; 281 | int s_x, s_y; 282 | 283 | //dropdown specifics 284 | //---------------------- 285 | float *fValueList; 286 | char **ppszValueNames; 287 | int iValueCount; 288 | bool bActiveDropDown[50]; 289 | std::vector vecDropDowns; 290 | //---------------------- 291 | 292 | //slider specifics 293 | //---------------------- 294 | int iColorIndex; 295 | 296 | bool bColored; 297 | bool bShowValue; 298 | bool bChams; 299 | 300 | float fLength; 301 | //---------------------- 302 | }; 303 | 304 | class cMenu 305 | { 306 | public: 307 | cMenu(int x, int y, int w, int h); 308 | 309 | //this will differ in different games 310 | void InitMenuElements(); 311 | 312 | void DrawMenu(); 313 | 314 | void DrawHeaderComment(int e_x, int e_y, const char *pszComment, bool bSlider = false); 315 | 316 | void SetMenuPos(int x, int y) 317 | { 318 | m_x = x; 319 | m_y = y; 320 | } 321 | 322 | void GetMenuPos(int &out_x, int &out_y) 323 | { 324 | out_x = m_x; 325 | out_y = m_y; 326 | } 327 | 328 | void GetMenuSize(int &out_w, int &out_h) 329 | { 330 | out_w = m_w; 331 | out_h = m_h; 332 | } 333 | 334 | bool IsHandlingItem() 335 | { 336 | return (iMenuFlags & FL_DISABLEDRAG); 337 | } 338 | 339 | void AddMenuFlag(int iFlag) 340 | { 341 | iMenuFlags |= iFlag; 342 | } 343 | 344 | void RemoveMenuFlag(int iFlag) 345 | { 346 | iMenuFlags &= ~iFlag; 347 | } 348 | 349 | void HandlingItem() 350 | { 351 | AddMenuFlag(FL_DISABLEDRAG); 352 | } 353 | 354 | void NotHandlingItem() 355 | { 356 | RemoveMenuFlag(FL_DISABLEDRAG); 357 | } 358 | 359 | int GetConfigIndex(int iCfgIdx = 0) 360 | { 361 | return iConfigIndex[iCfgIdx]; 362 | } 363 | 364 | void SetConfigIndex(int index, int iCfgIdx = 0) 365 | { 366 | iConfigIndex[iCfgIdx] = index; 367 | } 368 | 369 | const char *GetCurrentConfigName(int iCfgIdx = 0) 370 | { 371 | return sCurrentConfigName[iConfigIndex[iCfgIdx]].data(); 372 | } 373 | 374 | std::string GetCurrentConfig(int iCfgIdx = 0) 375 | { 376 | return sCurrentConfig[iConfigIndex[iCfgIdx]]; 377 | } 378 | 379 | int GetTabIndex() 380 | { 381 | return iTabIndex; 382 | } 383 | 384 | void SetTabIndex(int index) 385 | { 386 | iTabIndex = index; 387 | } 388 | 389 | int GetSmallTabIndex(int i = 0) 390 | { 391 | return iSmallTab[i]; 392 | } 393 | 394 | private: 395 | void DrawTab(int index, int &setindex, int x, int y, const char *pszTitle); 396 | void DrawSmallTab(int index, int &setindex, int x, int y, const char *pszTitle); 397 | void DrawAConfig(int index, int cfgidx, int x, int y, std::string sString); 398 | 399 | int m_x, m_y, m_w, m_h; 400 | int iMenuFlags; 401 | int iTabIndex; 402 | int iConfigIndex[2]; 403 | int iSmallTab[5]; 404 | 405 | std::string sCurrentConfig[NUM_OF_CFGS]; 406 | std::string sCurrentConfigName[NUM_OF_CFGS]; 407 | }; 408 | 409 | extern cMenu g_Menu; 410 | extern cListItem ListItemArray[NUM_OF_TOTAL_LISTITEMS]; -------------------------------------------------------------------------------- /mouse.cpp: -------------------------------------------------------------------------------- 1 | #include "DllMain.h" 2 | 3 | cMouse g_Mouse; 4 | 5 | //not mine 6 | 7 | //parameters: 8 | //bDrag : pass a new boolean for it as this only handles if drag object is being dragged (change MAX_DRAG_OBJECTS and pass the bDragged from gmouse) 9 | //bCheck : a check if any other drag objects are being dragged (to prevent dragging other objects while current one is being dragged, so pass in other bDrag booleans) 10 | //bDragCheck : basically pass mouse.leftclick(x,y,w,h) as the param(the place where you have to hold down mouse to drag) 11 | //x : dragobject's x axis location on screen which we wanna modify 12 | //y : dragobject's y axis location on screen which we wanna modify 13 | //xdif : pass an empty int (change MAX_DRAG_OBJECTS and pass the iDiffX from gmouse here) 14 | //ydif : pass an empty int (change MAX_DRAG_OBJECTS and pass the iDiffY from gmouse here) 15 | 16 | void cMouse::Drag(bool& bDrag, bool bCheck, bool bDragCheck,int& x, int& y, int& xdif, int& ydif) 17 | { 18 | if(bCheck) 19 | { 20 | if(bDragCheck || (mouse1pressed && bDrag)) 21 | { 22 | if(!bDrag) 23 | bDrag = true; 24 | 25 | if(xdif == -1 || ydif == -1) 26 | { 27 | xdif = mouse_x - x; 28 | ydif = mouse_y - y; 29 | } 30 | 31 | x += mouse_x - (xdif + x); 32 | y += mouse_y - (ydif + y); 33 | } 34 | else 35 | { 36 | if(bDrag) 37 | bDrag = false; 38 | 39 | xdif = -1; 40 | ydif = -1; 41 | } 42 | } 43 | } 44 | 45 | //not mine 46 | void cMouse::DrawMouse() 47 | { 48 | //kolonote: we gotta implement pat0's COLORCODE macros 49 | static int default_r = 3, default_g = 6, default_b = 26, default_a = 215; 50 | 51 | g_Draw.FillRGBA(mouse_x + 1, mouse_y, 1, 17, default_r, default_g, default_b, default_a); 52 | 53 | for(int i = 0; i < 11; i++) 54 | g_Draw.FillRGBA(mouse_x + 2 + i, mouse_y + 1 + i, 1, 1, default_r, default_g, default_b, default_a); 55 | g_Draw.FillRGBA(mouse_x + 7, mouse_y + 12, 6, 1, default_r, default_g, default_b, default_a); 56 | g_Draw.FillRGBA(mouse_x + 6, mouse_y + 12, 1, 1, default_r, default_g, default_b, default_a); 57 | g_Draw.FillRGBA(mouse_x + 5, mouse_y + 13, 1, 1, default_r, default_g, default_b, default_a); 58 | g_Draw.FillRGBA(mouse_x + 4, mouse_y + 14, 1, 1, default_r, default_g, default_b, default_a); 59 | g_Draw.FillRGBA(mouse_x + 3, mouse_y + 15, 1, 1, default_r, default_g, default_b, default_a); 60 | g_Draw.FillRGBA(mouse_x + 2, mouse_y + 16, 1, 1, default_r, default_g, default_b, default_a); 61 | 62 | static int mouse_r = 255, mouse_g = 255, mouse_b = 255, mouse_a = 255; 63 | 64 | for(int i = 0; i < 4; i++) 65 | g_Draw.FillRGBA(mouse_x + 2 + i, mouse_y + 2 + i, 1, 14 - (i * 2), mouse_r,mouse_g,mouse_b,mouse_a); 66 | g_Draw.FillRGBA(mouse_x + 6, mouse_y + 6, 1, 6, mouse_r,mouse_g,mouse_b,mouse_a); 67 | g_Draw.FillRGBA(mouse_x + 7, mouse_y + 7, 1, 5, mouse_r,mouse_g,mouse_b,mouse_a); 68 | g_Draw.FillRGBA(mouse_x + 8, mouse_y + 8, 1, 4, mouse_r,mouse_g,mouse_b,mouse_a); 69 | g_Draw.FillRGBA(mouse_x + 9, mouse_y + 9, 1, 3, mouse_r,mouse_g,mouse_b,mouse_a); 70 | g_Draw.FillRGBA(mouse_x + 10, mouse_y + 10, 1, 2, mouse_r,mouse_g,mouse_b,mouse_a); 71 | g_Draw.FillRGBA(mouse_x + 11, mouse_y + 11, 1, 1, mouse_r,mouse_g,mouse_b,mouse_a); 72 | } 73 | 74 | bool cMouse::LeftClick(int x,int y,int w,int h) 75 | { 76 | return (mouse1pressed && IsOver(x,y,w,h)); 77 | } 78 | 79 | bool cMouse::RightClick(int x,int y,int w,int h) 80 | { 81 | return (mouse2pressed && IsOver(x,y,w,h)); 82 | } 83 | 84 | bool cMouse::OneLeftClick(int x,int y,int w,int h) 85 | { 86 | return (mouse1released && IsOver(x,y,w,h)); 87 | } 88 | 89 | bool cMouse::OneRightClick(int x,int y,int w,int h) 90 | { 91 | return (mouse2released && IsOver(x,y,w,h)); 92 | } 93 | 94 | bool cMouse::IsOver(int x,int y,int w,int h) 95 | { 96 | return (mouse_x > x && w+x > mouse_x && mouse_y > y && h+y > mouse_y); 97 | } 98 | 99 | //kolonote: 100 | //now the credits to this go to someone that posted it on GD in 2004 i think i forgot his name 101 | void cMouse::Update() 102 | { 103 | //static ValveSDK::ConVar *pRawInput = g_Valve.pConVar->FindVar(/*m_rawinput*/XorStr<0x63,11,0x160FA730>("\x0E\x3B\x17\x07\x10\x01\x07\x1A\x1E\x18"+0x160FA730).s); 104 | 105 | ////IMPORTANT FIX DONT REMOVE ME 106 | //if(pRawInput->GetInt()) 107 | // pRawInput->SetValue(0); 108 | 109 | int width, height; 110 | g_Valve.pEngine->GetScreenSize( width, height ); 111 | 112 | int winX = width * 0.5; 113 | int winY = height * 0.5; 114 | 115 | //3 winapi calls is all we need 116 | static auto csgo = FindWindowA( 0, "Counter-Strike: Global Offensive" ); 117 | 118 | tagPOINT tp; 119 | GetCursorPos(&tp); 120 | 121 | LPPOINT pPoint = &tp; 122 | ScreenToClient( csgo, pPoint ); 123 | 124 | mouse_x = pPoint->x; 125 | mouse_y = pPoint->y; 126 | 127 | //the mouse coordinates depending on the screen size 128 | if(mouse_x > width) 129 | mouse_x = width; 130 | 131 | if(mouse_x < 0) 132 | mouse_x = 0; 133 | 134 | if(mouse_y > height) 135 | mouse_y = height; 136 | 137 | if(mouse_y < 0) 138 | mouse_y = 0; 139 | 140 | //HANDLING: 141 | 142 | //handle mouse1 143 | if(GetAsyncKeyState(VK_LBUTTON)) 144 | mouse1pressed = true; 145 | else if(!GetAsyncKeyState(VK_LBUTTON)) 146 | { 147 | if(mouse1pressed) 148 | mouse1released = true; 149 | else 150 | mouse1released = false; 151 | 152 | mouse1pressed = false; 153 | } 154 | 155 | //handle mouse2 156 | if(GetAsyncKeyState(VK_RBUTTON)) 157 | mouse2pressed = true; 158 | else if(!GetAsyncKeyState(VK_RBUTTON)) 159 | { 160 | if(mouse2pressed) 161 | mouse2released = true; 162 | else 163 | mouse2released = false; 164 | 165 | mouse2pressed = false; 166 | } 167 | } -------------------------------------------------------------------------------- /mouse.h: -------------------------------------------------------------------------------- 1 | #define MAX_DRAG_OBJECTS 3 2 | 3 | class cMouse 4 | { 5 | public: 6 | 7 | //called after menu drawn 8 | void DrawMouse(); 9 | 10 | //called when menu on/whatever 11 | void Update(); 12 | 13 | bool LeftClick(int x,int y,int w,int h); 14 | bool OneLeftClick(int x,int y,int w,int h); 15 | bool RightClick(int x,int y,int w,int h); 16 | bool OneRightClick(int x,int y,int w,int h); 17 | bool IsOver(int x,int y,int w,int h); 18 | 19 | void Drag(bool& bDrag, bool bCheck, bool bDragCheck,int& x, int& y, int& xdif, int& ydif); 20 | 21 | void GetMousePosition(int &posx, int &posy) 22 | { 23 | posx = mouse_x; 24 | posy = mouse_y; 25 | } 26 | 27 | bool HasMouseOneJustBeenReleased() 28 | { 29 | return mouse1released; 30 | } 31 | 32 | bool IsMouseTwoBeingHeld() 33 | { 34 | return mouse2pressed; 35 | } 36 | 37 | bool bReturn; 38 | 39 | bool bDragged[MAX_DRAG_OBJECTS]; 40 | int iDiffX[MAX_DRAG_OBJECTS]; 41 | int iDiffY[MAX_DRAG_OBJECTS]; 42 | 43 | private: 44 | int mouse_x, mouse_y; 45 | 46 | bool mouse1pressed; 47 | bool mouse1released; 48 | bool mouse2pressed; 49 | bool mouse2released; 50 | }; 51 | 52 | extern cMouse g_Mouse; 53 | -------------------------------------------------------------------------------- /netvars.h: -------------------------------------------------------------------------------- 1 | //Credits: Kiro 2 | 3 | typedef struct 4 | { 5 | char szTableName[256]; 6 | char szPropName[256]; 7 | RecvVarProxyFn SavedProxy; 8 | } Oldproxy_t; 9 | 10 | class CNetworkedVariableManager 11 | { 12 | public: 13 | 14 | ~CNetworkedVariableManager(void); 15 | 16 | // stores all tables, and all props inside those 17 | void Init(); 18 | 19 | // calls GetProp wrapper to get the absolute offset of the prop 20 | int GetOffset(const char *tableName, const char *propName); 21 | 22 | // calls GetProp wrapper to get prop and sets the proxy of the prop 23 | bool HookProp(const char *tableName, const char *propName, RecvVarProxyFn function); 24 | 25 | private: 26 | 27 | // wrapper so we can use recursion without too much performance loss 28 | int GetProp(const char *tableName, const char *propName, RecvProp **prop = 0); 29 | 30 | // uses recursion to return a the relative offset to the given prop and sets the prop param 31 | int GetProp(RecvTable *recvTable, const char *propName, RecvProp **prop = 0); 32 | 33 | RecvTable *GetTable(const char *tableName); 34 | 35 | std::vector m_tables; 36 | 37 | std::vector m_savedproxy; 38 | }; 39 | 40 | extern void YawEyeAngleProxy(const CRecvProxyData *pData, void *pStruct, void *pOut); 41 | extern void PitchEyeAngleProxy(const CRecvProxyData *pData, void *pStruct, void *pOut); 42 | 43 | extern CNetworkedVariableManager g_NetworkedVariableManager; -------------------------------------------------------------------------------- /sdk.h: -------------------------------------------------------------------------------- 1 | //Credits: Casualhacker 2 | inline void**& getvtable(void* inst, size_t offset = 0) 3 | { 4 | return *reinterpret_cast((size_t)inst + offset); 5 | } 6 | inline const void** getvtable(const void* inst, size_t offset = 0) 7 | { 8 | return *reinterpret_cast((size_t)inst + offset); 9 | } 10 | template< typename Fn > 11 | inline Fn getvfunc(const void* inst, size_t index, size_t offset = 0) 12 | { 13 | return reinterpret_cast(getvtable(inst, offset)[index]); 14 | } 15 | 16 | typedef float matrix3x4[3][4]; 17 | typedef float matrix4x4[4][4]; 18 | typedef void* (__cdecl* CreateInterface_t)(const char*, int*); 19 | typedef void* (*CreateInterfaceFn)(const char *pName, int *pReturnCode); 20 | 21 | inline void VectorSubtract(const Vector& a, const Vector& b, Vector& c) 22 | { 23 | CHECK_VALID(a); 24 | CHECK_VALID(b); 25 | c.x = a.x - b.x; 26 | c.y = a.y - b.y; 27 | c.z = a.z - b.z; 28 | } 29 | 30 | //SRC SDK VECTORADD 31 | inline void VectorAdd(const Vector& a, const Vector& b, Vector& c) 32 | { 33 | CHECK_VALID(a); 34 | CHECK_VALID(b); 35 | c.x = a.x + b.x; 36 | c.y = a.y + b.y; 37 | c.z = a.z + b.z; 38 | } 39 | 40 | //USERCMD OFFSETS 41 | #define USERCMDOFFSET 0xF0 42 | #define VERIFIEDCMDOFFSET 0xF4 43 | #define MULTIPLAYER_BACKUP 150 44 | //#define CURRENTCOMMANDOFFSET 0x100C 45 | //#define CURRENTPLAYERCOMMANDOFFSET 0x1640 46 | #define PREIDCTIONSEEDOFFSET 0x1A 47 | #define PREDICTIONPLAYEROFFSET 0x2D 48 | #define GLOBALSOFFSET 0xA 49 | //#define INPUTOFFSET 0x20 50 | /*#define GETSPREADOFFSET 0x5CC 51 | #define GETCONEOFFSET 0x5D0 52 | #define UPDATEACCURACYPENALTYOFFSET 0x5D4 53 | #define WEAPONIDOFFSET 0x5A0*/ 54 | //#define APPSYSTEMFACTORYOFFSET 0x2A 55 | //#define CLIENTFACTORYOFFSET 0x67 56 | 57 | //LIFESTATE 58 | #define LIFE_ALIVE 0 59 | #define LIFE_DYING 1 60 | #define LIFE_DEAD 2 61 | #define LIFE_RESPAWNABLE 3 62 | #define LIFE_DISCARDBODY 4 63 | 64 | //Player flags 65 | #define FL_ONGROUND (1<<0) // At rest / on the ground 66 | #define FL_DUCKING (1<<1) // Player flag -- Player is fully crouched 67 | #define FL_WATERJUMP (1<<3) // player jumping out of water 68 | #define FL_ONTRAIN (1<<4) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction. 69 | #define FL_INRAIN (1<<5) // Indicates the entity is standing in rain 70 | #define FL_FROZEN (1<<6) // Player is frozen for 3rd person camera 71 | #define FL_ATCONTROLS (1<<7) // Player can't move, but keeps key inputs for controlling another entity 72 | #define FL_CLIENT (1<<8) // Is a player 73 | #define FL_FAKECLIENT (1<<9) // Fake client, simulated server side; don't send network messages to them 74 | #define FL_INWATER (1<<10) // In water 75 | 76 | 77 | //USERCMD BUTTONS 78 | #define IN_ATTACK (1 << 0) 79 | #define IN_JUMP (1 << 1) 80 | #define IN_DUCK (1 << 2) 81 | #define IN_FORWARD (1 << 3) 82 | #define IN_BACK (1 << 4) 83 | #define IN_USE (1 << 5) 84 | #define IN_CANCEL (1 << 6) 85 | #define IN_LEFT (1 << 7) 86 | #define IN_RIGHT (1 << 8) 87 | #define IN_MOVELEFT (1 << 9) 88 | #define IN_MOVERIGHT (1 << 10) 89 | #define IN_ATTACK2 (1 << 11) 90 | #define IN_RUN (1 << 12) 91 | #define IN_RELOAD (1 << 13) 92 | #define IN_ALT1 (1 << 14) 93 | #define IN_ALT2 (1 << 15) 94 | #define IN_SCORE (1 << 16) // Used by client.dll for when scoreboard is held down 95 | #define IN_SPEED (1 << 17) // Player is holding the speed key 96 | #define IN_WALK (1 << 18) // Player holding walk key 97 | #define IN_ZOOM (1 << 19) // Zoom key for HUD zoom 98 | #define IN_WEAPON1 (1 << 20) // weapon defines these bits 99 | #define IN_WEAPON2 (1 << 21) // weapon defines these bits 100 | #define IN_BULLRUSH (1 << 22) 101 | #define IN_GRENADE1 (1 << 23) // grenade 1 102 | #define IN_GRENADE2 (1 << 24) // grenade 2 103 | 104 | enum ClientFrameStage_t 105 | { 106 | FRAME_UNDEFINED = -1, // (haven't run any frames yet) 107 | FRAME_START, 108 | 109 | // A network packet is being recieved 110 | FRAME_NET_UPDATE_START, 111 | // Data has been received and we're going to start calling PostDataUpdate 112 | FRAME_NET_UPDATE_POSTDATAUPDATE_START, 113 | // Data has been received and we've called PostDataUpdate on all data recipients 114 | FRAME_NET_UPDATE_POSTDATAUPDATE_END, 115 | // We've received all packets, we can now do interpolation, prediction, etc.. 116 | FRAME_NET_UPDATE_END, 117 | 118 | // We're about to start rendering the scene 119 | FRAME_RENDER_START, 120 | // We've finished rendering the scene. 121 | FRAME_RENDER_END 122 | }; 123 | 124 | struct mstudiobbox_t 125 | { 126 | int bone; 127 | int group; 128 | Vector bbmin; 129 | Vector bbmax; 130 | int szhitboxnameindex; 131 | Vector offsetorientation; 132 | float radius; 133 | byte unused[0x10]; 134 | 135 | const char* pszHitboxName() const 136 | { 137 | if (szhitboxnameindex == 0) 138 | return ""; 139 | 140 | return ((const char*)this) + szhitboxnameindex; 141 | } 142 | }; 143 | 144 | struct mstudiohitboxset_t 145 | { 146 | int sznameindex; 147 | inline char* const pszName(void) const { return ((char*)this) + sznameindex; } 148 | int numhitboxes; 149 | int hitboxindex; 150 | inline mstudiobbox_t* pHitbox(int i) const { return (mstudiobbox_t*)(((BYTE*)this) + hitboxindex) + i; }; 151 | }; 152 | 153 | struct studiohdr_t 154 | { 155 | int id; 156 | int version; 157 | long checksum; 158 | char name_char_array[ 64 ]; 159 | int length; 160 | Vector eye_pos; 161 | Vector illium_pos; 162 | Vector hull_mins; 163 | Vector hull_maxs; 164 | Vector mins; 165 | Vector maxs; 166 | int flags; 167 | int bones_count; 168 | int bone_index; 169 | int bone_controllers_count; 170 | int bone_controller_index; 171 | int numhitboxsets; 172 | int hitboxsetindex; 173 | 174 | mstudiohitboxset_t* pHitboxSet(int i) const 175 | { 176 | return (mstudiohitboxset_t*)(((BYTE*)this) + hitboxsetindex) + i; 177 | }; 178 | 179 | inline mstudiobbox_t* pHitbox(int i, int set) const 180 | { 181 | mstudiohitboxset_t const* s = pHitboxSet(set); 182 | 183 | if (!s) 184 | return NULL; 185 | 186 | return s->pHitbox(i); 187 | }; 188 | 189 | inline int iHitboxCount(int set) const 190 | { 191 | mstudiohitboxset_t const* s = pHitboxSet(set); 192 | 193 | if (!s) 194 | return 0; 195 | 196 | return s->numhitboxes; 197 | }; 198 | }; 199 | 200 | enum MoveType_t 201 | { 202 | MOVETYPE_NONE = 0, 203 | MOVETYPE_ISOMETRIC, 204 | MOVETYPE_WALK, 205 | MOVETYPE_STEP, 206 | MOVETYPE_FLY, 207 | MOVETYPE_FLYGRAVITY, 208 | MOVETYPE_VPHYSICS, 209 | MOVETYPE_PUSH, 210 | MOVETYPE_NOCLIP, 211 | MOVETYPE_LADDER, 212 | MOVETYPE_OBSERVER, 213 | MOVETYPE_CUSTOM, 214 | MOVETYPE_LAST = MOVETYPE_CUSTOM, 215 | MOVETYPE_MAX_BITS = 4, 216 | MAX_MOVETYPE 217 | }; 218 | 219 | class CBaseEntity; 220 | class model_t; 221 | 222 | typedef struct 223 | { 224 | byte r, g, b, a; 225 | } color32; 226 | 227 | #include "dt_recv2.h" 228 | #include "netvars.h" 229 | #include "CBaseCombatWeapon.h" 230 | #include "CBaseEntity.h" 231 | #include "ClientClass.h" 232 | #include "HLClient.h" 233 | #include "CEngineClient.h" 234 | #include "ISurface.h" 235 | #include "IPanel.h" 236 | #include "CEntityList.h" 237 | #include "CInput.h" 238 | #include "CPrediction.h" 239 | #include "CGameMovement.h" 240 | #include "CDebugOverlay.h" 241 | #include "CModelInfo.h" 242 | #include "CTrace.h" 243 | #include "ConVar.h" 244 | #include "CGlobalVars.h" 245 | #include "IMoveHelper.h" 246 | #include "IGameEvent.h" 247 | #include "IGameEventListener2.h" 248 | #include "IGameEventManager.h" 249 | #include "MD5.h" 250 | 251 | -------------------------------------------------------------------------------- /valve_off.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mr-nv/interwebz-csgo/229af391c05d22451ef31e8806518952bf521de5/valve_off.h -------------------------------------------------------------------------------- /valve_on.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mr-nv/interwebz-csgo/229af391c05d22451ef31e8806518952bf521de5/valve_on.h -------------------------------------------------------------------------------- /wchartypes.h: -------------------------------------------------------------------------------- 1 | //========= Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: All of our code is completely Unicode. Instead of char, you should 4 | // use wchar, uint8, or char8, as explained below. 5 | // 6 | // $NoKeywords: $ 7 | //=============================================================================// 8 | 9 | 10 | #ifndef WCHARTYPES_H 11 | #define WCHARTYPES_H 12 | #ifdef _WIN32 13 | #pragma once 14 | #endif 15 | 16 | #ifdef _INC_TCHAR 17 | #error ("Must include tier0 type headers before tchar.h") 18 | #endif 19 | 20 | // Temporarily turn off Valve defines 21 | #include "valve_off.h" 22 | 23 | #if !defined(_WCHAR_T_DEFINED) && !defined( __WCHAR_TYPE__ ) && !defined(GNUC) 24 | typedef unsigned short wchar_t; 25 | #define _WCHAR_T_DEFINED 26 | #endif 27 | 28 | // char8 29 | // char8 is equivalent to char, and should be used when you really need a char 30 | // (for example, when calling an external function that's declared to take 31 | // chars). 32 | typedef char char8; 33 | 34 | // uint8 35 | // uint8 is equivalent to byte (but is preferred over byte for clarity). Use this 36 | // whenever you mean a byte (for example, one byte of a network packet). 37 | typedef unsigned char uint8; 38 | typedef unsigned char BYTE; 39 | typedef unsigned char byte; 40 | 41 | // wchar 42 | // wchar is a single character of text (currently 16 bits, as all of our text is 43 | // Unicode). Use this whenever you mean a piece of text (for example, in a string). 44 | typedef wchar_t wchar; 45 | //typedef char wchar; 46 | 47 | // __WFILE__ 48 | // This is a Unicode version of __FILE__ 49 | #define WIDEN2(x) L ## x 50 | #define WIDEN(x) WIDEN2(x) 51 | #define __WFILE__ WIDEN(__FILE__) 52 | 53 | #ifdef STEAM 54 | #ifndef _UNICODE 55 | #define FORCED_UNICODE 56 | #endif 57 | #define _UNICODE 58 | #endif 59 | 60 | #if defined( POSIX ) 61 | #define _tcsstr strstr 62 | #define _tcsicmp stricmp 63 | #define _tcscmp strcmp 64 | #define _tcscpy strcpy 65 | #define _tcsncpy strncpy 66 | #define _tcsrchr strrchr 67 | #define _tcslen strlen 68 | #define _tfopen fopen 69 | #define _stprintf sprintf 70 | #define _ftprintf fprintf 71 | #define _vsntprintf _vsnprintf 72 | #define _tprintf printf 73 | #define _sntprintf _snprintf 74 | #define _T(s) s 75 | #else 76 | #include 77 | #endif 78 | 79 | #if defined(_UNICODE) 80 | typedef wchar tchar; 81 | #define tstring wstring 82 | #define __TFILE__ __WFILE__ 83 | #define TCHAR_IS_WCHAR 84 | #else 85 | typedef char tchar; 86 | #define tstring string 87 | #define __TFILE__ __FILE__ 88 | #define TCHAR_IS_CHAR 89 | #endif 90 | 91 | #ifdef FORCED_UNICODE 92 | #undef _UNICODE 93 | #endif 94 | 95 | // Turn valve defines back on 96 | #include "valve_on.h" 97 | 98 | 99 | #endif // WCHARTYPES 100 | 101 | 102 | -------------------------------------------------------------------------------- /xor.h: -------------------------------------------------------------------------------- 1 | template 2 | class XorStr 3 | { 4 | private: 5 | XorStr(); 6 | public: 7 | char s[BUFLEN]; 8 | 9 | XorStr(const char* xs); 10 | ~XorStr() 11 | { 12 | for(int i=0; i < BUFLEN; i++) s[i] = 0; 13 | } 14 | }; 15 | 16 | template 17 | XorStr::XorStr(const char* xs) 18 | { 19 | int xvalue = XORSTART; 20 | int i = 0; 21 | for(; i < (BUFLEN - 1); i++) 22 | { 23 | s[i] = xs[i - XREFKILLER] ^ xvalue; 24 | xvalue += 1; 25 | xvalue %= 256; 26 | } 27 | s[BUFLEN-1] = (2 * 2 - 3) - 1; 28 | } --------------------------------------------------------------------------------