Lesser projaim impr, ischema
This commit is contained in:
parent
570eabd340
commit
6d82ab4c0f
@ -7,6 +7,8 @@ bind l clearcond_taunt
|
||||
no fakelag shoot
|
||||
|
||||
fullbright toggle
|
||||
Hunter Rifle
|
||||
inspect shit
|
||||
instant taunt
|
||||
TTS
|
||||
noise spam
|
||||
|
@ -53,7 +53,7 @@
|
||||
#ifndef CATHOOK_BUILD_NUMBER
|
||||
#define CATHOOK_BUILD_NUMBER "LATEST"
|
||||
#endif
|
||||
#define CATHOOK_BUILD_NAME "Cinnamon Pie"
|
||||
#define CATHOOK_BUILD_NAME "Butterscotch Pie"
|
||||
|
||||
#define CON_NAME "cat"
|
||||
#define CON_PREFIX CON_NAME "_"
|
||||
|
@ -140,6 +140,13 @@ void CMenuWindow::AddElements() {
|
||||
ADDCVAR(g_Settings.flForceFOV);
|
||||
ADDCVAR(g_Settings.sDisconnectMsg);
|
||||
ADDCVAR(g_phMisc->v_bCleanChat);
|
||||
if (TF2) {
|
||||
CBaseButton* but = new CBaseButton("schema", tab, "Load Custom Schema", [this](CBaseButton*) {
|
||||
Schema_Reload();
|
||||
});
|
||||
but->Props()->SetString("tooltip", "Loads a custom item schema from ~/.cathook/\nitems_game.txt");
|
||||
tab->AddChild(but);
|
||||
}
|
||||
if (TF2C) ADDCVAR(g_phMisc->v_bMinigunJump);
|
||||
//ADDCVAR(g_phMisc->v_bDebugInfo);
|
||||
if (HL2DM) ADDCVAR(g_phMisc->v_bFlashlightSpam);
|
||||
|
@ -386,7 +386,7 @@ int Aimbot::ShouldTarget(CachedEntity* entity) {
|
||||
if (!GetHitbox(entity, hitbox, resultAim)) return 13;
|
||||
if (!IsEntityVisible(entity, hitbox)) return 14;
|
||||
}
|
||||
resultAim = ProjectilePrediction(entity, hitbox, m_flProjSpeed, m_flProjGravity);
|
||||
resultAim = ProjectilePrediction(entity, hitbox, m_flProjSpeed, m_flProjGravity, PlayerGravityMod(entity));
|
||||
} else {
|
||||
if (!GetHitbox(entity, hitbox, resultAim)) return 15;
|
||||
}
|
||||
@ -456,7 +456,8 @@ bool Aimbot::Aim(CachedEntity* entity, CUserCmd* cmd) {
|
||||
m_flProjSpeed = v_fOverrideProjSpeed->GetFloat();
|
||||
if (v_fOverrideProjGravity->GetBool())
|
||||
m_flProjGravity = v_fOverrideProjGravity->GetFloat();
|
||||
hit = ProjectilePrediction(entity, hitbox, m_flProjSpeed, m_flProjGravity);
|
||||
bool succ = false;
|
||||
hit = ProjectilePrediction(entity, hitbox, m_flProjSpeed, m_flProjGravity, PlayerGravityMod(entity));
|
||||
}
|
||||
//logging::Info("ayyming!");
|
||||
Vector tr = (hit - g_pLocalPlayer->v_Eye);
|
||||
|
@ -9,10 +9,18 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <pwd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "../hack.h"
|
||||
#include "../common.h"
|
||||
#include <checksum_md5.h>
|
||||
#include "../sdk.h"
|
||||
#include "../netmessage.h"
|
||||
#include "../copypasted/CSignature.h"
|
||||
|
||||
DEFINE_HACK_SINGLETON(Misc);
|
||||
|
||||
@ -243,6 +251,35 @@ void CC_DumpConds(const CCommand& args) {
|
||||
logging::Info("0x%08x 0x%08x 0x%08x 0x%08x", d2.cond_0, d2.cond_1, d2.cond_2, d2.cond_3);
|
||||
}
|
||||
|
||||
void Schema_Reload() {
|
||||
static uintptr_t InitSchema_s = gSignatures.GetClientSignature("89 44 24 04 89 34 24 74 7B E8 FE DC FB FF 88 45 C7 80 7D C7 00 74 7B 8B 76 0C 39 F3 0F 85 BA 00 00 00 8B 5D D4 83 EB 01 8D 34 9D 00 00 00 00 EB 15 8D 76 00") - 0x54;
|
||||
typedef void(*InitSchema_t)(void*, void*, CUtlBuffer& buffer, bool byte, unsigned version);
|
||||
static InitSchema_t InitSchema = (InitSchema_t)InitSchema_s;
|
||||
static uintptr_t GetItemSchema_s = gSignatures.GetClientSignature("55 89 E5 83 EC 18 89 5D F8 8B 1D ? ? ? ? 89 7D FC 85 DB 74 12 89 D8 8B 7D FC 8B 5D F8 89 EC 5D C3 8D B6 00 00 00 00 C7 04 24 A8 06 00 00 E8 ? ? ? ? B9 AA 01 00 00 89 C3 31 C0 89 DF");
|
||||
typedef void*(*GetItemSchema_t)(void);
|
||||
static GetItemSchema_t GetItemSchema = (GetItemSchema_t)GetItemSchema_s;//(*(uintptr_t*)GetItemSchema_s + GetItemSchema_s + 4);
|
||||
void* itemschema = (GetItemSchema() + 4);
|
||||
void* data;
|
||||
passwd* pwd = getpwuid(getuid());
|
||||
char* user = pwd->pw_name;
|
||||
char* path = strfmt("/home/%s/.cathook/items_game.txt", user);
|
||||
FILE* file = fopen(path, "r");
|
||||
delete [] path;
|
||||
fseek(file, 0L, SEEK_END);
|
||||
char buffer[4 * 1000 * 1000];
|
||||
size_t len = ftell(file);
|
||||
rewind(file);
|
||||
buffer[len + 1] = 0;
|
||||
fread(&buffer, sizeof(char), len, file);
|
||||
fclose(file);
|
||||
CUtlBuffer buf(&buffer, 4 * 1000 * 1000, 9);
|
||||
InitSchema(0, itemschema, buf, false, 0xDEADCA7);
|
||||
}
|
||||
|
||||
void CC_Misc_Schema(const CCommand& args) {
|
||||
Schema_Reload();
|
||||
}
|
||||
|
||||
Misc::Misc() {
|
||||
if (TF2C) v_bMinigunJump = new CatVar(CV_SWITCH, "minigun_jump", "0", "Minigun Jump", NULL, "Allows you to jump while with minigun spun up");
|
||||
v_bDebugInfo = new CatVar(CV_SWITCH, "misc_debug", "0", "Debug info", NULL, "Log stuff to console, enable this if tf2 crashes");
|
||||
@ -269,6 +306,7 @@ Misc::Misc() {
|
||||
CreateConCommand(CON_PREFIX "set", CC_SetValue, "Set ConVar value (if third argument is 1 the ^'s will be converted into newlines)");
|
||||
//v_bDebugCrits = new CatVar(CV_SWITCH, "debug_crits", "0", "Debug Crits", NULL, "???");
|
||||
v_bCleanChat = new CatVar(CV_SWITCH, "clean_chat", "1", "Remove newlines from messages", NULL, "Removes newlines from messages, at least it should do that. Might be broken.");
|
||||
if (TF2) c_Schema = CreateConCommand(CON_PREFIX "schema", CC_Misc_Schema, "Load item schema");
|
||||
//interfaces::eventManager->AddListener(&listener, "player_death", false);
|
||||
}
|
||||
|
||||
@ -294,8 +332,24 @@ float RemapValClampedNC( float val, float A, float B, float C, float D)
|
||||
}
|
||||
|
||||
|
||||
bool ciac_s = false;
|
||||
|
||||
bool Misc::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
static bool flswitch = false;
|
||||
/*static uintptr_t critsig = gSignatures.GetClientSignature("89 1C 24 E8 ? ? ? ? 0F B6 83 0E 0B 00 00 89 74 24 04 C7 04 24 ? ? ? ? 89 44 24 08 E8 ? ? ? ? 8B 03 89 1C 24 FF 90 F8 06 00 00 83 F8 12 74 0A C7 83 FC 0A 00 00 00 00 00 00");
|
||||
static uintptr_t critfnp = critsig + 4;
|
||||
typedef void(*C_TFWeaponBase__CalcIsAttackCritical_t)(IClientEntity*);
|
||||
static C_TFWeaponBase__CalcIsAttackCritical_t ciac = (C_TFWeaponBase__CalcIsAttackCritical_t)(*(uintptr_t*)critfnp + critfnp + 4);
|
||||
if (CE_GOOD(LOCAL_W)) {
|
||||
static float lastcheck = interfaces::gvars->curtime;
|
||||
if (interfaces::gvars->curtime - lastcheck >= 1.0f) {
|
||||
RandomSeed(cmd->random_seed);
|
||||
ciac(RAW_ENT(LOCAL_W));
|
||||
//logging::Info("0x%08x", *(unsigned char*)(RAW_ENT(LOCAL_W) + 0x0B0E));
|
||||
ciac_s = !!*(unsigned char*)(RAW_ENT(LOCAL_W) + 0x0B0E);
|
||||
}
|
||||
//if (ciac_s) cmd->buttons |= IN_ATTACK;
|
||||
}*/
|
||||
g_Settings.bSendPackets->SetValue(true);
|
||||
if (v_iFakeLag->GetInt()) {
|
||||
static int fakelag = 0;
|
||||
@ -400,6 +454,7 @@ void Misc::PaintTraverse(void*, unsigned int, bool, bool) {
|
||||
GetProjectileData(g_pLocalPlayer->weapon(), speed, gravity);
|
||||
AddSideString(colors::white, "Speed: %f", speed);
|
||||
AddSideString(colors::white, "Gravity: %f", gravity);
|
||||
AddSideString(colors::white, "CIAC: %i", ciac_s);
|
||||
//AddSideString(colors::white, "IsZoomed: %i", g_pLocalPlayer->bZoomed);
|
||||
//AddSideString(colors::white, "CanHeadshot: %i", CanHeadshot());
|
||||
//AddSideString(colors::white, "IsThirdPerson: %i", interfaces::iinput->CAM_IsThirdPerson());
|
||||
|
@ -41,11 +41,13 @@ public:
|
||||
ConCommand* c_DumpConds;
|
||||
ConCommand* c_Reset;
|
||||
ConCommand* c_Disconnect;
|
||||
ConCommand* c_Schema;
|
||||
ConCommand* c_DisconnectVAC;
|
||||
|
||||
CatVar* v_bCleanChat;
|
||||
};
|
||||
|
||||
void Schema_Reload();
|
||||
void CC_Misc_Disconnect_VAC();
|
||||
|
||||
DECLARE_HACK_SINGLETON(Misc);
|
||||
|
@ -19,6 +19,7 @@ void NetVars::Init() {
|
||||
this->hActiveWeapon = gNetvars.get_offset("DT_BaseCombatCharacter", "m_hActiveWeapon");
|
||||
this->iHitboxSet = gNetvars.get_offset("DT_BaseAnimating", "m_nHitboxSet");
|
||||
this->vVelocity = gNetvars.get_offset("DT_BasePlayer", "localdata", "m_vecVelocity[0]");
|
||||
this->movetype = gNetvars.get_offset("DT_BaseEntity", "movetype");
|
||||
if (TF2) {
|
||||
this->bGlowEnabled = gNetvars.get_offset("DT_TFPlayer", "m_bGlowEnabled");
|
||||
this->iMaxBuffedHealth = gNetvars.get_offset("DT_TFPlayerResource", "m_iMaxBuffedHealth");
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
offset_t iHitboxSet;
|
||||
offset_t vVelocity;
|
||||
offset_t bGlowEnabled;
|
||||
offset_t movetype;
|
||||
offset_t iGlowIndex;
|
||||
offset_t iReloadMode;
|
||||
offset_t iMaxHealth;
|
||||
|
@ -7,8 +7,22 @@
|
||||
|
||||
#include "prediction.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "sdk.h"
|
||||
#include <bspflags.h>
|
||||
#include <cdll_int.h>
|
||||
#include <cmodel.h>
|
||||
#include <engine/IEngineTrace.h>
|
||||
#include <icliententity.h>
|
||||
#include <inetchannelinfo.h>
|
||||
#include <mathlib/ssemath.h>
|
||||
#include <mathlib/vector.h>
|
||||
|
||||
#include "conditions.h"
|
||||
#include "entitycache.h"
|
||||
#include "helpers.h"
|
||||
#include "interfaces.h"
|
||||
#include "localplayer.h"
|
||||
#include "netvars.h"
|
||||
#include "trace.h"
|
||||
|
||||
// TODO there is a Vector() object created each call.
|
||||
|
||||
@ -22,62 +36,72 @@ Vector SimpleLatencyPrediction(CachedEntity* ent, int hb) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector ProjectilePrediction(CachedEntity* ent, int hb, float speed, float gravitymod) {
|
||||
float PlayerGravityMod(CachedEntity* player) {
|
||||
int movetype = CE_INT(player, netvar.movetype);
|
||||
if (movetype == MOVETYPE_FLY || movetype == MOVETYPE_NOCLIP) return 0.0f;
|
||||
if (HasCondition(player, TFCond_Parachute)) return 0.448f;
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
bool PerformProjectilePrediction(CachedEntity* target, int hitbox) {
|
||||
Vector src, vel, hit; ;
|
||||
//src = vfunc<Vector(*)(IClientEntity*)>(RAW_ENT(target), 299)(RAW_ENT(target));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Vector ProjectilePrediction(CachedEntity* ent, int hb, float speed, float gravitymod, float entgmod) {
|
||||
if (!ent) return Vector();
|
||||
Vector result = ent->m_vecOrigin;
|
||||
Vector result = SimpleLatencyPrediction(ent, hb);
|
||||
if (speed == 0.0f) return Vector();
|
||||
float dtg = DistanceToGround(result);
|
||||
int flags = CE_INT(ent, netvar.iFlags);
|
||||
bool ground = (flags & (1 << 0));
|
||||
if (ground) dtg = 0;
|
||||
GetHitbox(ent, hb, result);
|
||||
Vector vel = CE_VECTOR(ent, netvar.vVelocity);
|
||||
float dtg = DistanceToGround(ent);
|
||||
Vector vel = ent->m_vecVelocity;
|
||||
// TODO ProjAim
|
||||
float ott = g_pLocalPlayer->v_Eye.DistTo(result) / speed + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING);
|
||||
float tt = ott - 0.5f;
|
||||
if (tt <= 0.0f) tt = 0.01f;
|
||||
float besttime = tt;
|
||||
float medianTime = g_pLocalPlayer->v_Eye.DistTo(result) / speed;
|
||||
float range = 1.5f;
|
||||
float currenttime = medianTime - range;
|
||||
if (currenttime <= 0.0f) currenttime = 0.01f;
|
||||
float besttime = currenttime;
|
||||
float mindelta = 65536.0f;
|
||||
Vector bestpos = result;
|
||||
int maxsteps = 100;
|
||||
for (int steps = 0; steps < maxsteps; steps++, tt += ((float)1 / (float)maxsteps)) {
|
||||
int maxsteps = 300;
|
||||
for (int steps = 0; steps < maxsteps; steps++, currenttime += ((float)(2 * range) / (float)maxsteps)) {
|
||||
Vector curpos = result;
|
||||
curpos += vel * tt;
|
||||
curpos += vel * currenttime;
|
||||
if (dtg > 0.0f) {
|
||||
curpos.z -= tt * tt * 400;
|
||||
curpos.z -= currenttime * currenttime * 400 * entgmod;
|
||||
if (curpos.z < result.z - dtg) curpos.z = result.z - dtg;
|
||||
}
|
||||
float rockettime = g_pLocalPlayer->v_Eye.DistTo(curpos) / speed + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING);
|
||||
//logging::Info("RocketTime: %.2f TT: %.2f Step: %i BestTime: %.2f", rockettime, tt, steps, besttime);
|
||||
if (fabs(rockettime - tt) < mindelta) {
|
||||
//if (mindelta != 65536.0) logging::Info("got better delta: %.2f at step %i (time: %.2f)", fabs(rockettime - tt), steps, tt);
|
||||
besttime = tt;
|
||||
float rockettime = g_pLocalPlayer->v_Eye.DistTo(curpos) / speed;
|
||||
if (fabs(rockettime - currenttime) < mindelta) {
|
||||
besttime = currenttime;
|
||||
bestpos = curpos;
|
||||
mindelta = fabs(rockettime - tt);
|
||||
mindelta = fabs(rockettime - currenttime);
|
||||
}
|
||||
}
|
||||
|
||||
/*float dtt = g_pLocalPlayer->v_Eye.DistTo(result);
|
||||
float ttt = dtt / speed + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
float oz = result.z;
|
||||
int flags = CE_INT(ent, netvar.iFlags);
|
||||
bool ground = (flags & (1 << 0));
|
||||
if (!ground) result.z -= ttt * ttt * 400;
|
||||
result += vel * ttt;
|
||||
if (!ground) if (oz - result.z > dtg) { result.z = oz - dtg; }
|
||||
*/
|
||||
bestpos.z += (400 * besttime * besttime * gravitymod);
|
||||
// S = at^2/2 ; t = sqrt(2S/a)*/
|
||||
return bestpos;
|
||||
}
|
||||
|
||||
float DistanceToGround(CachedEntity* ent) {
|
||||
if (ent->m_Type == ENTITY_PLAYER) {
|
||||
if (CE_INT(ent, netvar.iFlags) & FL_ONGROUND) return 0;
|
||||
}
|
||||
Vector& origin = ent->m_vecOrigin;
|
||||
float v1 = DistanceToGround(origin + Vector(10.0f, 10.0f, 0.0f));
|
||||
float v2 = DistanceToGround(origin + Vector(-10.0f, 10.0f, 0.0f));
|
||||
float v3 = DistanceToGround(origin + Vector(10.0f, -10.0f, 0.0f));
|
||||
float v4 = DistanceToGround(origin + Vector(-10.0f, -10.0f, 0.0f));
|
||||
return MIN(v1, MIN(v2, MIN(v3, v4)));
|
||||
}
|
||||
|
||||
float DistanceToGround(Vector origin) {
|
||||
static trace_t* ground_trace = new trace_t();
|
||||
Ray_t ray;
|
||||
Vector endpos = origin;
|
||||
endpos.z -= 8192;
|
||||
ray.Init(origin, endpos);
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, trace::g_pFilterNoPlayer, ground_trace);
|
||||
return ground_trace->startpos.DistTo(ground_trace->endpos);
|
||||
interfaces::trace->TraceRay(ray, MASK_PLAYERSOLID, trace::g_pFilterNoPlayer, ground_trace);
|
||||
return 8192.0f * ground_trace->fraction;
|
||||
}
|
||||
|
@ -14,8 +14,14 @@ class CachedEntity;
|
||||
class Vector;
|
||||
|
||||
Vector SimpleLatencyPrediction(CachedEntity* ent, int hb);
|
||||
Vector ProjectilePrediction(CachedEntity* ent, int hb, float speed, float gravitymod);
|
||||
|
||||
bool PerformProjectilePrediction(CachedEntity* target, int hitbox);
|
||||
|
||||
Vector ProjectilePrediction(CachedEntity* ent, int hb, float speed, float gravitymod, float entgmod);
|
||||
|
||||
float PlayerGravityMod(CachedEntity* player);
|
||||
|
||||
float DistanceToGround(CachedEntity* ent);
|
||||
float DistanceToGround(Vector origin);
|
||||
|
||||
#endif /* PREDICTION_H_ */
|
||||
|
1794
cathook/src/sdk/utlbuffer.cpp
Normal file
1794
cathook/src/sdk/utlbuffer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user