?? client.cpp
字號:
//
// Online Game Cheats Client.dll hook
// Copyright (c) system 2001-2002
// Copyright (c) bunny771 2001-2002
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// NOTE:
// GNU license doesn't cover Engine directory.
// Content of Engine directory is copyrighted (c) 1999, 2000, by Valve LLC
// and it is licensed under Valve's proprietary license (see original HL SDK).
//
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mmsystem.h>
#pragma warning (disable:4786) // vc++ stl "truncated browser info"
#pragma warning (disable:4244) // float to int
#pragma warning (disable:4731) // ebp modified
#include <map>
#include <vector>
#include <list>
#undef NDEBUG
#include <assert.h>
#include "engine/wrect.h"
#include "engine/cl_dll.h"
#include "engine/cdll_int.h"
#include "engine/const.h"
#include "engine/progdefs.h"
#include "engine/eiface.h"
#include "engine/edict.h"
#include "engine/studio_event.h"
#include "engine/entity_types.h"
#include "engine/pmtrace.h"
#include "common/ref_params.h"
#include "common/screenfade.h"
#include "common/event_api.h"
#include "common/com_model.h"
#include "misc/parsemsg.h"
#include "misc/sprites.h"
#include "r_studioint.h"
#include "engine/triangleapi.h"
#include "engine/pm_defs.h"
#include "engine/r_efx.h"
#include "sprites.h"
#include "common/net_api.h"
#include <time.h>
#include <gl/gl.h>
#include "stdafx.h"
using namespace std;
#include <tlhelp32.h>
#include <fstream>
#include "cvar.h"
#include "attack.h"
#include "calcscreen.h"
#include "timehandling.h"
#include "stringfinder.h"
#include "color.h"
#include "aimbot.h"
#include "playeritems.h"
#include "bind.h"
#include "interpreter.h"
#include "client.h"
#include "menu.h"
#include "snake.h"
#include "console.h"
#include "hookqueue.h"
#include "Winamp.h"
#include "engine/studio.h"
#include "GenericPatch.h"
extern GenericPatch commandPatch;
extern GenericPatch soundPatch;
extern GenericPatch loaderPatch;
GenericPatch chasePatch;
#include "AutoMove.h"
#pragma warning (disable:4005)
#pragma warning (disable:4800)
#pragma optimize("gt",on)
#ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
#define OGC_VERSION "9.01"
//#define pInitialize f_dummy6
//#define pHUD_Redraw f_dummy2
//#define pHUD_AddEntity f_dummy3
//#define pHUD_PlayerMove f_dummy5
//#define pV_CalcRefdef f_dummy7
//#define pCL_CreateMove f_dummy8
//#define pHUD_TempEntUpdate f_dummy10
//#define pHUD_GetStudioModelInterface f_dummy11
using namespace std;
#define LOG(str)
//ofstream logfile2("c:\\tmpaxx\\call-log-hookqueue.txt");
//#define LOG(str) logfile2<<#str<<endl;
bool bDontAutoHook=false;
// hooking stuff
dllfuncs_t* hw_client_dllfuncs = NULL;
r_studio_interface_s* hw_client_studio_ptr = NULL;
cl_enginefunc_t * client_enginefuncs = NULL;
SCREENINFO screeninfo;
// Hostage Info Structure
struct hostage_info
{
cl_entity_s *ent;
};
// A Global to store the engine functions
struct cl_enginefuncs_s gEngfuncs;
struct cl_enginefuncs_s gHookedEngfuncs;
// client.dll exports
struct dllfuncs_t gClientExports;
struct dllfuncs_t gHookedClientExports;
bool bIsHooked=false;
// A Global to store the hooked engine functions
struct cl_enginefuncs_s gHookEnginefuncs;
// A Global to store the Effects API
struct efx_api_s gHookEfxApi;
// A Global to store the Studio API
engine_studio_api_t IEngineStudio;
engine_studio_api_t* pIEngineStudio=0;
// A Global to store the local player info
local_player_info me;
// A Global for all the Players
VecPlayers vPlayers;
// A Global for all the Entities
vector<hostage_info> vEntity;
// Global for the Aiming Randomizer Class
AimingRandomizer gAimingRandomizer;
// A list of commands being blocked
StringFinder blockCommand;
// The Method of blocking used
enum { CMDBLOCK_ALL, CMDBLOCK_RELPATH };
// Rear View Mirror
// TODO: Make the name definition not be as a member
bool m_bReversed;
bool bNewFrame=false;
// should movement be stopped e.g. for shooting?
bool bStopMovement=false;
// dont draw sniper blackout if true
bool sniper=false;
// Bomb Timer Stuff
bool bBombIsPlanted=false;
float fBombPlantedTime=0;
int iC4Timer=0;
// Rounds counter
int iRounds=0;
// Blinking for Radar/Esp
StopTimer blinkTimer;
bool blinkPhase = false;
// Local Players Items
// TODO: Move into local_player_info
PlayerItems playerItems;
// Logging
ofstream commandLogFile;
bool commandLogFileOpened = false;
// HUD Message
char gHudMessage[256]="";
StopTimer gHudTimer;
// Script Message (text ..., txt ...)
char gHudMessage2[256]="";
StopTimer gHudTimer2;
// Scheduled Commands (later x blabla)
struct ScheduledCommand
{
string cmd;
RunningStopTimer timer;
};
typedef list<ScheduledCommand> ScheduleList;
ScheduleList scheduleList;
// Nice Firing stuff
enum { FIRESEQ_INACTIVE = 0,
FIRESEQ_STARTDELAY = 1,
FIRESEQ_ACTIVE = 2,
FIRESEQ_RELEASEDELAY = 3 };
static bool bAttacking = false;
static bool bAttack2 = false;
static bool bPressedUse = false;
static int nFireSequence = FIRESEQ_INACTIVE;
static bool bFireCycle = true;
// Death Info
struct DeathInfos{
DeathInfos():active(false) {}
bool active;
float from[3];
float to[3];
string killerName;
string weaponName;
};
DeathInfos deathInfos;
static bool bGotHeadshot=false;
// Current WeaponID see attack.h
int currentWeaponID=0;
// Current FOV as float and int
int iCurrentFOV=90;
float fCurrentFOV=90.0;
// Burst Info
BurstInfo burstInfo;
// HL.exe or CSTRIKE.exe
HANDLE hProcess=0;
// HW.dll offset
DWORD hw_dll_offset=0;
// CLIENT.dll offset
HMODULE hClientDll=0;
DWORD client_dll_offset=0;
DWORD client_dll_end=0;
// sequence info data
int Cstrike_SequenceInfo[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0..9
0, 1, 2, 0, 1, 2, 0, 1, 2, 0, // 10..19
1, 2, 0, 1, 1, 2, 0, 1, 1, 2, // 20..29
0, 1, 2, 0, 1, 2, 0, 1, 2, 0, // 30..39
1, 2, 0, 1, 2, 0, 1, 2, 0, 1, // 40..49
2, 0, 1, 2, 0, 0, 0, 4, 0, 4, // 50..59
0, 5, 0, 5, 0, 0, 1, 1, 2, 0, // 60..69
1, 1, 2, 0, 1, 0, 1, 0, 1, 2, // 70..79
0, 1, 2, 3, 3, 3, 3, 3, 3, 3, // 80..89
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 90..99
3
};
enum { SEQUENCE_SHOOT=1, SEQUENCE_RELOAD=2, SEQUENCE_DIE=3, SEQUENCE_THROW=4, SEQUENCE_ARM_C4=5 };
char* Cstrike_infotext[] = {"", "- PENG -", "- RELOADING -", "", "*** THROWING ***", "- ARMING C4 -" };
// points system
struct PointSystemEntry { char description[16]; float points; };
PointSystemEntry pointSystem[] = {
"shoot_at_me", +600.0 , // 0
"aim_at_me" , +500.0 , // 1
"visible" , +250.0 , // 2
"bestplayer" , +75.0 , // 3
"arm_c4" , +50.0 , // 4
"behind_me" , -250.0 , // 5
"dist_factor", +180000.0 , // 6 // factor/distance = addvalue
"fov_factor" , -15.0 , // 7
"awp_bonus" , +100.0 , // 8
"",0.0
};
// should current Aimbot calculated view angles be used?
bool Aimbot_active=false;
// Lock var with in min and max
#define BOUND_VALUE(var,min,max) if((var)>(max)){(var)=(max);};if((var)<(min)){(var)=(min);}
// Find the Highest Value out of a,b and c
#define MAX_VALUE(a,b,c) ( a>b? (a>c?a:(b>c?b:c)) : (b>c?b:c) )
// ====== sound data
static ColorEntry dummycolor;
class SoundMarker
{
public:
SoundMarker() : color(&dummycolor),priority(0) {} // "snd_default"
float origin[3];
char description[16];
StopTimer timer;
ColorEntry* color;
int priority; // 0/1/2
};
typedef vector<SoundMarker> SoundMarkerVector;
SoundMarkerVector vecSoundMarker(65);
int soundMarkerCurrentIndex = 0;
// ====== directories
char ogcdir [256]=""; // set in dllmain
char hldir [256]=""; // set in dllmain
// beamindex (sprites/beam.spr)
int beamindex = 0;
// mod info
enum{ MOD_UNKNOWN=0,MOD_CSTRIKE=1,MOD_DOD=2 };
int mod=MOD_UNKNOWN;
//========================================================================================
string getOgcDirFile(const char* basename)
{
if(strstr(basename,"..")){ return ":*?\\/<>\""; }
string ret = ogcdir;
return (ret+basename);
}
//========================================================================================
void deleteMultipleFiles(const char* basedir, const char* wildcard)
{
WIN32_FIND_DATA findData;
HANDLE hFindFile;
char* fileName = findData.cFileName;
string searchPattern = basedir;
searchPattern += wildcard;
hFindFile = FindFirstFile( searchPattern.c_str(), &findData );
if( hFindFile == INVALID_HANDLE_VALUE){ return; }
do{
string fullname = basedir;
fullname += fileName;
DeleteFile(fullname.c_str());
} while( FindNextFile(hFindFile,&findData) );
}
//========================================================================================
void cleanupWindowsTempFiles()
{
//bool IsNT = ((HIWORD(::GetVersion()) & 0x8000) == 0);
//char dir[400];
//GetWindowsDirectory(dir,390);
//char* pastepos = dir+strlen(dir);
//
//if(IsNT)
//{
// strcpy(pastepos,"\\Prefetch\\");
// deleteMultipleFiles(dir,"ogc*.*");
// deleteMultipleFiles(dir,"newldr*.*");
//}
//else
//{
// strcpy(pastepos,"\\applog\\");
// deleteMultipleFiles(dir,"*.*");
// deleteMultipleFiles(dir,"*.*");
//}
}
//========================================================================================
inline float GetPseudoDistance(const float* const pos1, const float* const pos2)
{
return
fabs(pos1[0]-pos2[0])+
fabs(pos1[1]-pos2[1])+
fabs(pos1[2]-pos2[2]);
}
//========================================================================================
inline float GetDistanceFrom(float* pos)
{
register double a = pos[0] - me.pmEyePos[0];
register double b = pos[1] - me.pmEyePos[1];
register double c = pos[2] - me.pmEyePos[2];
return sqrt(a*a + b*b + c*c);
}
//========================================================================================
bool __fastcall CalcScreen(float *origin,float *vecScreen)
{
return NewCalcScreen(origin, vecScreen);
}
//========================================================================================
void gDrawFilledBoxAtLocation( float* origin, DWORD color, int radius)
{
float vecScreen[2];
if( !CalcScreen(origin, vecScreen) ) { return; }
int red = (color>>24);
int green = (color>>16)&0xFF;
int blue = (color>>8)&0xFF;
int alpha = (color)&0xFF;
int radius2 = radius<<1;
gEngfuncs.pfnFillRGBA(vecScreen[0]-radius,vecScreen[1]-radius,radius2,radius2,red,green,blue,alpha);
}
//========================================================================================
void SPR_Draw (int frame, int x, int y, const wrect_t *prc)
{
if (!sniper) gEngfuncs.pfnSPR_Draw (frame, x, y, prc);
}
//========================================================================================
void SPR_DrawHoles (int frame, int x, int y, const wrect_t *prc)
{
if (!sniper) gEngfuncs.pfnSPR_DrawHoles (frame, x, y, prc);
}
//========================================================================================
HSPRITE sprset_hsprite = 0;
int sprset_r, sprset_g, sprset_b;
extern bool oglSubtractive;
void SPR_DrawAdditive( int frame, int x, int y, const wrect_t *prc )
{
if(cvar.hud) gEngfuncs.pfnSPR_Set (sprset_hsprite,sprset_r,sprset_g,sprset_b);
gEngfuncs.pfnSPR_DrawAdditive(frame,x,y,prc);
}
//========================================================================================
void FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a )
{
if(cvar.hud)
{
register ColorEntry* color = colorList.get(5);
gEngfuncs.pfnFillRGBA(x,y,width,height,color->r,color->g,color->b,a);
} else {
gEngfuncs.pfnFillRGBA(x,y,width,height,r,g,b,a);
}
}
//========================================================================================
int DrawCharacter( int x, int y, int number, int r, int g, int b )
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -