Подпишитесь на наш Telegram-канал, чтобы всегда быть в курсе важных обновлений! Перейти

C++ EnginePrediction for weave

Статус
В этой теме нельзя размещать новые ответы.
Забаненный
Забаненный
Статус
Оффлайн
Регистрация
1 Фев 2021
Сообщения
42
Реакции
5
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
Expand Collapse Copy
int post_think(IBasePlayer* player) {
    getvfunc<void(__thiscall*)(void*)>(interfaces.model_cache, 33)(interfaces.model_cache);

    //hueta ebanay
    if (player->isAlive()
        || *reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(player) + 0x3A81)) {
        getvfunc<void(__thiscall*)(void*)>(player, 339)(player);

        player->GetFlags()& FL_ONGROUND ? player->GetFallVelocity() = 0.f : 0;

        player->GetSequence() == -1 ? getvfunc<void(__thiscall*)(void*, int)>(player, 218)(player, 0) : 0;

        getvfunc<void(__thiscall*)(void*)>(player, 219)(player);

        static auto post_think_v_physics = reinterpret_cast <bool(__thiscall*)(IBasePlayer*)> (csgo->Utils.FindPatternIDA(GetModuleHandleA(g_Modules[fnv::hash(hs::client_dll::s().c_str())].c_str()),
            hs::post_think_v_physics::s().c_str()));
        post_think_v_physics(player);
    }

    static auto simulate_player_simulated_entities = reinterpret_cast <bool(__thiscall*)(IBasePlayer*)> (csgo->Utils.FindPatternIDA(GetModuleHandleA(g_Modules[fnv::hash(hs::client_dll::s().c_str())].c_str()),
        hs::simulate_player_simulated_entities::s().c_str()));
    simulate_player_simulated_entities(player);

    return getvfunc<int(__thiscall*)(void*)>(interfaces.model_cache, 34)(interfaces.model_cache);
}

void CEnginePrediction::Start(CUserCmd* cmd, IBasePlayer* local) {

    old_vars.curtime = interfaces.global_vars->curtime;
    old_vars.frametime = interfaces.global_vars->frametime;
    old_vars.tickcount = interfaces.global_vars->tickcount;
    auto old_in_prediction = interfaces.prediction->bInPrediction;
    auto old_first_prediction = interfaces.prediction->bIsFirstTimePredicted;

    interfaces.global_vars->curtime = TICKS_TO_TIME(local->GetTickBase());
    interfaces.global_vars->frametime = interfaces.global_vars->interval_per_tick;
    interfaces.global_vars->tickcount = TIME_TO_TICKS(interfaces.global_vars->curtime);


    //*reinterpret_cast<CUserCmd**>(uint32_t(local) + 0x3334) = cmd;
    //*reinterpret_cast<CUserCmd**>(uint32_t(local) + 0x3288) = cmd;

    interfaces.prediction->bIsFirstTimePredicted = false;
    interfaces.prediction->bInPrediction = true;

    if (cmd->impulse)
        *reinterpret_cast<uint32_t*>(uint32_t(local) + 0x31FC) = cmd->impulse;

    cmd->buttons |= *reinterpret_cast<uint32_t*>(uint32_t(local) + 0x3330);

    auto v16 = cmd->buttons;
    auto* unk02 = reinterpret_cast<int*>(uint32_t(local) + 0x31F8);
    auto v17 = v16 ^ *unk02;

    *reinterpret_cast<int*>(uint32_t(local) + 0x31EC) = *unk02;
    *reinterpret_cast<int*>(uint32_t(local) + 0x31F8) = v16;
    *reinterpret_cast<int*>(uint32_t(local) + 0x31F0) = v16 & v17;
    *reinterpret_cast<int*>(uint32_t(local) + 0x31F4) = v17 & ~v16;

    interfaces.prediction->CheckMovingGround(local, interfaces.global_vars->frametime);

    interfaces.move_helper->SetHost(local);

    interfaces.prediction->SetupMove(local, cmd, interfaces.move_helper, &data);

    interfaces.game_movement->ProcessMovement(local, (CMoveData*)&data);

    interfaces.prediction->FinishMove(local, cmd, &data);

    interfaces.move_helper->ProcessImpacts();
}

void CEnginePrediction::Finish(IBasePlayer* local) {
    interfaces.game_movement->FinishTrackPredictionErrors(local);
    interfaces.move_helper->SetHost(nullptr);

    interfaces.global_vars->curtime = old_vars.curtime;
    interfaces.global_vars->frametime = old_vars.frametime;


    interfaces.game_movement->FinishTrackPredictionErrors(local);
    interfaces.move_helper->SetHost(nullptr);

    interfaces.global_vars->curtime = old_vars.curtime;
    interfaces.global_vars->frametime = old_vars.frametime;
    interfaces.global_vars->tickcount = old_vars.tickcount;

  
    interfaces.game_movement->Reset();
}
//we fix tickbase in our prediction so we can just use fixed curtime and the fix curtime help with other shit
int CEnginePrediction::GetTickbase(CUserCmd* pCmd, IBasePlayer* pLocal)
{
    static int iTick = 0;
    static CUserCmd* pLastCmd = nullptr;

    if (pCmd != nullptr)
    {
        // if command was not predicted - increment tickbase
        if (pLastCmd == nullptr || pLastCmd->hasbeenpredicted)
            iTick = pLocal->GetTickBase();
        else
            iTick++;

        pLastCmd = pCmd;
    }

    return iTick;
}
 
C++:
Expand Collapse Copy
int post_think(IBasePlayer* player) {
    getvfunc<void(__thiscall*)(void*)>(interfaces.model_cache, 33)(interfaces.model_cache);

    //hueta ebanay
    if (player->isAlive()
        || *reinterpret_cast<int*>(reinterpret_cast<uintptr_t>(player) + 0x3A81)) {
        getvfunc<void(__thiscall*)(void*)>(player, 339)(player);

        player->GetFlags()& FL_ONGROUND ? player->GetFallVelocity() = 0.f : 0;

        player->GetSequence() == -1 ? getvfunc<void(__thiscall*)(void*, int)>(player, 218)(player, 0) : 0;

        getvfunc<void(__thiscall*)(void*)>(player, 219)(player);

        static auto post_think_v_physics = reinterpret_cast <bool(__thiscall*)(IBasePlayer*)> (csgo->Utils.FindPatternIDA(GetModuleHandleA(g_Modules[fnv::hash(hs::client_dll::s().c_str())].c_str()),
            hs::post_think_v_physics::s().c_str()));
        post_think_v_physics(player);
    }

    static auto simulate_player_simulated_entities = reinterpret_cast <bool(__thiscall*)(IBasePlayer*)> (csgo->Utils.FindPatternIDA(GetModuleHandleA(g_Modules[fnv::hash(hs::client_dll::s().c_str())].c_str()),
        hs::simulate_player_simulated_entities::s().c_str()));
    simulate_player_simulated_entities(player);

    return getvfunc<int(__thiscall*)(void*)>(interfaces.model_cache, 34)(interfaces.model_cache);
}

void CEnginePrediction::Start(CUserCmd* cmd, IBasePlayer* local) {

    old_vars.curtime = interfaces.global_vars->curtime;
    old_vars.frametime = interfaces.global_vars->frametime;
    old_vars.tickcount = interfaces.global_vars->tickcount;
    auto old_in_prediction = interfaces.prediction->bInPrediction;
    auto old_first_prediction = interfaces.prediction->bIsFirstTimePredicted;

    interfaces.global_vars->curtime = TICKS_TO_TIME(local->GetTickBase());
    interfaces.global_vars->frametime = interfaces.global_vars->interval_per_tick;
    interfaces.global_vars->tickcount = TIME_TO_TICKS(interfaces.global_vars->curtime);


    //*reinterpret_cast<CUserCmd**>(uint32_t(local) + 0x3334) = cmd;
    //*reinterpret_cast<CUserCmd**>(uint32_t(local) + 0x3288) = cmd;

    interfaces.prediction->bIsFirstTimePredicted = false;
    interfaces.prediction->bInPrediction = true;

    if (cmd->impulse)
        *reinterpret_cast<uint32_t*>(uint32_t(local) + 0x31FC) = cmd->impulse;

    cmd->buttons |= *reinterpret_cast<uint32_t*>(uint32_t(local) + 0x3330);

    auto v16 = cmd->buttons;
    auto* unk02 = reinterpret_cast<int*>(uint32_t(local) + 0x31F8);
    auto v17 = v16 ^ *unk02;

    *reinterpret_cast<int*>(uint32_t(local) + 0x31EC) = *unk02;
    *reinterpret_cast<int*>(uint32_t(local) + 0x31F8) = v16;
    *reinterpret_cast<int*>(uint32_t(local) + 0x31F0) = v16 & v17;
    *reinterpret_cast<int*>(uint32_t(local) + 0x31F4) = v17 & ~v16;

    interfaces.prediction->CheckMovingGround(local, interfaces.global_vars->frametime);

    interfaces.move_helper->SetHost(local);

    interfaces.prediction->SetupMove(local, cmd, interfaces.move_helper, &data);

    interfaces.game_movement->ProcessMovement(local, (CMoveData*)&data);

    interfaces.prediction->FinishMove(local, cmd, &data);

    interfaces.move_helper->ProcessImpacts();
}

void CEnginePrediction::Finish(IBasePlayer* local) {
    interfaces.game_movement->FinishTrackPredictionErrors(local);
    interfaces.move_helper->SetHost(nullptr);

    interfaces.global_vars->curtime = old_vars.curtime;
    interfaces.global_vars->frametime = old_vars.frametime;


    interfaces.game_movement->FinishTrackPredictionErrors(local);
    interfaces.move_helper->SetHost(nullptr);

    interfaces.global_vars->curtime = old_vars.curtime;
    interfaces.global_vars->frametime = old_vars.frametime;
    interfaces.global_vars->tickcount = old_vars.tickcount;


    interfaces.game_movement->Reset();
}
//we fix tickbase in our prediction so we can just use fixed curtime and the fix curtime help with other shit
int CEnginePrediction::GetTickbase(CUserCmd* pCmd, IBasePlayer* pLocal)
{
    static int iTick = 0;
    static CUserCmd* pLastCmd = nullptr;

    if (pCmd != nullptr)
    {
        // if command was not predicted - increment tickbase
        if (pLastCmd == nullptr || pLastCmd->hasbeenpredicted)
            iTick = pLocal->GetTickBase();
        else
            iTick++;

        pLastCmd = pCmd;
    }

    return iTick;
}
А че в вейви все еще кто то кодит?
го под лв
 
Последнее редактирование:
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
can you drop EnginePrediction.h as well? thx
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
can you drop EnginePrediction.h as well? thx
C++:
Expand Collapse Copy
#pragma once
#include "hooks.h"

struct backup
{
    int flags = 0;
    Vector velocity = Vector(0, 0, 0);
};

class CEnginePrediction : public Singleton<CEnginePrediction>
{
public:
    void Start(CUserCmd* cmd, IBasePlayer* local);
    void Finish(IBasePlayer* local);

    int GetTickbase(CUserCmd* pCmd, IBasePlayer* pLocal);

    backup backup_data;
private:
    CMoveData data;
    CUserCmd* last_cmd{};
    int32_t tick_base{};
    struct {
        float curtime, frametime;
        int tickcount, tickbase;
        bool m_in_prediction, m_first_time_predicted;
    }old_vars;
    int* prediction_random_seed = nullptr;
    int* prediction_player = nullptr;
};
 
C++:
Expand Collapse Copy
#pragma once
#include "hooks.h"

struct backup
{
    int flags = 0;
    Vector velocity = Vector(0, 0, 0);
};

class CEnginePrediction : public Singleton<CEnginePrediction>
{
public:
    void Start(CUserCmd* cmd, IBasePlayer* local);
    void Finish(IBasePlayer* local);

    int GetTickbase(CUserCmd* pCmd, IBasePlayer* pLocal);

    backup backup_data;
private:
    CMoveData data;
    CUserCmd* last_cmd{};
    int32_t tick_base{};
    struct {
        float curtime, frametime;
        int tickcount, tickbase;
        bool m_in_prediction, m_first_time_predicted;
    }old_vars;
    int* prediction_random_seed = nullptr;
    int* prediction_player = nullptr;
};
дай и post_think_v_physics, simulate_player_simulated_entities )
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху Снизу