Added engine prediction

This commit is contained in:
Julian Rowe 2017-05-25 00:30:37 -05:00
parent b0635ae943
commit 257a79f8f2
4 changed files with 51 additions and 1 deletions

View File

@ -145,6 +145,7 @@ int ClosestHitbox(CachedEntity* target) {
static EAimbotLocalState local_state_last; static EAimbotLocalState local_state_last;
void CreateMove() { void CreateMove() {
EAimbotLocalState local_state; EAimbotLocalState local_state;
float target_highest_score, scr, begincharge, charge; float target_highest_score, scr, begincharge, charge;
CachedEntity* ent; CachedEntity* ent;
@ -158,7 +159,7 @@ void CreateMove() {
} else { } else {
state = EAimbotState::ENABLED; state = EAimbotState::ENABLED;
} }
RunEnginePrediction(RAW_ENT(LOCAL_E), g_pUserCmd);
local_state = ShouldAim(); local_state = ShouldAim();
if (aimbot_debug) { if (aimbot_debug) {

View File

@ -10,6 +10,7 @@
#include "sdk.h" #include "sdk.h"
#include "profiler.h" #include "profiler.h"
#include <link.h>
#include <pwd.h> #include <pwd.h>
#include <sys/mman.h> #include <sys/mman.h>
@ -702,6 +703,46 @@ bool IsEntityVisiblePenetration(CachedEntity* entity, int hb) {
return false; return false;
} }
void RunEnginePrediction(IClientEntity* ent, CUserCmd *ucmd) {
if (!ent) return;
typedef void(*SetupMoveFn)(IPrediction*, IClientEntity *, CUserCmd *, class IMoveHelper *, CMoveData *);
typedef void(*FinishMoveFn)(IPrediction*, IClientEntity *, CUserCmd*, CMoveData*);
void **predictionVtable = *((void ***)g_IPrediction);
SetupMoveFn oSetupMove = (SetupMoveFn)(*(unsigned*)(predictionVtable + 19));
FinishMoveFn oFinishMove = (FinishMoveFn)(*(unsigned*)(predictionVtable + 20));
CMoveData *pMoveData = (CMoveData*)(sharedobj::client->lmap->l_addr + 0x1F69C0C);
float frameTime = g_GlobalVars->frametime;
float curTime = g_GlobalVars->curtime;
CUserCmd defaultCmd;
if(ucmd == NULL) {
ucmd = &defaultCmd;
}
NET_VAR(ent, 4188, CUserCmd*) = ucmd;
g_GlobalVars->curtime = g_GlobalVars->interval_per_tick * NET_INT(ent, netvar.nTickBase);
g_GlobalVars->frametime = g_GlobalVars->interval_per_tick;
*g_PredictionRandomSeed = MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF;
g_IGameMovement->StartTrackPredictionErrors(reinterpret_cast<CBasePlayer*>(ent));
oSetupMove(g_IPrediction, ent, ucmd, NULL, pMoveData);
g_IGameMovement->ProcessMovement(reinterpret_cast<CBasePlayer*>(ent), pMoveData);
oFinishMove(g_IPrediction, ent, ucmd, pMoveData);
g_IGameMovement->FinishTrackPredictionErrors(reinterpret_cast<CBasePlayer*>(ent));
NET_VAR(ent, 4188, CUserCmd*) = nullptr;
g_GlobalVars->frametime = frameTime;
g_GlobalVars->curtime = curTime;
return;
}
class CMoveData; class CMoveData;

View File

@ -111,6 +111,8 @@ char GetChar(ButtonCode_t button);
bool IsEntityVisiblePenetration(CachedEntity* entity, int hb); bool IsEntityVisiblePenetration(CachedEntity* entity, int hb);
void RunEnginePrediction(IClientEntity* ent, CUserCmd *ucmd);
//void RunEnginePrediction(IClientEntity* ent, CUserCmd *ucmd = NULL); //void RunEnginePrediction(IClientEntity* ent, CUserCmd *ucmd = NULL);
//void StartPrediction(CUserCmd* cmd); //void StartPrediction(CUserCmd* cmd);
//void EndPrediction(); //void EndPrediction();

View File

@ -128,4 +128,10 @@ void CreateInterfaces() {
logging::Info("BaseClientState: 0x%08x", g_IBaseClientState); logging::Info("BaseClientState: 0x%08x", g_IBaseClientState);
g_IAchievementMgr = g_IEngine->GetAchievementMgr(); g_IAchievementMgr = g_IEngine->GetAchievementMgr();
g_ISteamUserStats = g_ISteamClient->GetISteamUserStats(su, sp, "STEAMUSERSTATS_INTERFACE_VERSION011"); g_ISteamUserStats = g_ISteamClient->GetISteamUserStats(su, sp, "STEAMUSERSTATS_INTERFACE_VERSION011");
if (!g_PredictionRandomSeed) {
uintptr_t sig = gSignatures.GetClientSignature("89 1C 24 D9 5D D4 FF 90 3C 01 00 00 89 C7 8B 06 89 34 24 C1 E7 08 FF 90 3C 01 00 00 09 C7 33 3D ? ? ? ? 39 BB 34 0B 00 00 74 0E 89 BB 34 0B 00 00 89 3C 24 E8 ? ? ? ? C7 44 24 04 0F 27 00 00");
logging::Info("Random Seed: 0x%08x", sig + 32);
logging::Info("Random Seed: 0x%08x", *(int**)(sig + 32));
g_PredictionRandomSeed = *reinterpret_cast<int**>(sig + (uintptr_t)32);
}
} }