diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 6c279ec5..595026c6 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -145,6 +145,7 @@ int ClosestHitbox(CachedEntity* target) { static EAimbotLocalState local_state_last; void CreateMove() { + EAimbotLocalState local_state; float target_highest_score, scr, begincharge, charge; CachedEntity* ent; @@ -158,7 +159,7 @@ void CreateMove() { } else { state = EAimbotState::ENABLED; } - + RunEnginePrediction(RAW_ENT(LOCAL_E), g_pUserCmd); local_state = ShouldAim(); if (aimbot_debug) { diff --git a/src/helpers.cpp b/src/helpers.cpp index 25b0af6e..9ff472b9 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -10,6 +10,7 @@ #include "sdk.h" #include "profiler.h" +#include #include #include @@ -702,6 +703,46 @@ bool IsEntityVisiblePenetration(CachedEntity* entity, int hb) { 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(ent)); + oSetupMove(g_IPrediction, ent, ucmd, NULL, pMoveData); + g_IGameMovement->ProcessMovement(reinterpret_cast(ent), pMoveData); + oFinishMove(g_IPrediction, ent, ucmd, pMoveData); + g_IGameMovement->FinishTrackPredictionErrors(reinterpret_cast(ent)); + + NET_VAR(ent, 4188, CUserCmd*) = nullptr; + + g_GlobalVars->frametime = frameTime; + g_GlobalVars->curtime = curTime; + + return; +} + class CMoveData; diff --git a/src/helpers.h b/src/helpers.h index 15b119a4..7a9221d2 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -111,6 +111,8 @@ char GetChar(ButtonCode_t button); bool IsEntityVisiblePenetration(CachedEntity* entity, int hb); +void RunEnginePrediction(IClientEntity* ent, CUserCmd *ucmd); + //void RunEnginePrediction(IClientEntity* ent, CUserCmd *ucmd = NULL); //void StartPrediction(CUserCmd* cmd); //void EndPrediction(); diff --git a/src/interfaces.cpp b/src/interfaces.cpp index 418ed529..5a1d1e06 100644 --- a/src/interfaces.cpp +++ b/src/interfaces.cpp @@ -128,4 +128,10 @@ void CreateInterfaces() { logging::Info("BaseClientState: 0x%08x", g_IBaseClientState); g_IAchievementMgr = g_IEngine->GetAchievementMgr(); 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(sig + (uintptr_t)32); + } }