Вопрос Desync resolver dont working

Пользователь
Статус
Оффлайн
Регистрация
20 Июл 2017
Сообщения
203
Реакции[?]
116
Поинты[?]
0
Здравствуйте, кто-нибудь поможет мне с desync resolver?
Не работает и падение

код:
Resolver.cpp
Код:
Resolver g_Resolver;
std::vector<std::pair<C_BaseEntity*, Vector>> player_data;
/*
my attempt at fixing desync and i was pretty successful
it can resolve static desync pretty perfectly
and can resolve some jitter desync but
it still gets rekt by other things
*/



namespace g
{
    CUserCmd* pCmd = nullptr;
    C_BaseEntity* pLocalEntity = nullptr;
    std::uintptr_t uRandomSeed = NULL;
    Vector         OriginalView;
    bool           bSendPacket = true;
    bool           LagPeek = false;
    int            TargetIndex = -1;
    Vector         EnemyEyeAngs[65];
    Vector         AimbotHitbox[65][28];
    Vector         RealAngle;
    Vector         FakeAngle;
    bool           Shot[65];
    bool           Hit[65];
    int            Shots[65];
    int            MissedShots[65];
    bool           PreserveDelete;
    int            flHurtTime;
    bool           fakeducked = false;
    bool           isfakeducking = false;
    bool           IsFakewalking = false;
    bool           IsSlowwalking = false;
    bool           FreezeTime = false;
    int            kills = 0;
    float          killtime = 0.0f;
    int            globalAlpha = 0;
    float          GoalLby = 0;
    int            hits = 0;
    int            shots = 0;
    bool           knifeapply;
    float          viewMatrix[4][4];

    DWORD grenade;
    DWORD Tahoma;
    DWORD TahomaSmall;
    DWORD EspTahoma;
    DWORD EspSmallText;
    DWORD WeaponIcons;
    DWORD SansSerif;
    DWORD SansSerifBold;
    DWORD Indicators;
    DWORD Watermark;
    DWORD KillCounter;
    DWORD x88Font;

    //Remastered Esp
    DWORD ReEspText;
}

/*
void Resolver::handle()
{
    if (g_Options.Misc.resolver)
    {
        for (int i = 1; i < g_GlobalVars->maxClients; i++)
        {
            auto p_entity = (C_BasePlayer*)g_EntityList->GetClientEntity(i);
            if (p_entity && !p_entity->IsDormant())
            {
                auto feet_yaw = p_entity->GetPlayerAnimState()->m_flCurrentFeetYaw;
                auto body_max_rotation = p_entity->GetPlayerAnimState()->pad10[516];
                if (feet_yaw <= 58)
                {
                    if (-58 > feet_yaw)
                        p_entity->m_angEyeAngles().yaw = body_max_rotation + p_entity->m_angEyeAngles().yaw;
                }
                else
                {
                    p_entity->m_angEyeAngles().yaw = body_max_rotation - p_entity->m_angEyeAngles().yaw;
                }
                if (p_entity->GetAnimOverlay(6)->m_flPlaybackRate > 0.1)
                {
                    for (int resolve_delta = 58.f; resolve_delta < -58.f; resolve_delta = resolve_delta - 20.f)
                    {
                        p_entity->m_angEyeAngles().yaw = resolve_delta;
                    }
                }
            }
        }
    }
}
*/

float GRD_TO_BOG(float GRD) {
    return (M_PI / 180) * GRD;
}
#ifndef max
#define max(a,b)            (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b)            (((a) < (b)) ? (a) : (b))
#endif

float MaxDelta(C_BaseEntity* pEnt) {

    auto animstate = uintptr_t(local_player->AnimState());

    float duckammount = *(float*)(animstate + 0xA4);
    float speedfraction = max(0, min(*reinterpret_cast<float*>(animstate + 0xF8), 1));

    float speedfactor = max(0, min(1, *reinterpret_cast<float*> (animstate + 0xFC)));

    float unk1 = ((*reinterpret_cast<float*> (animstate + 0x11C) * -0.30000001f) - 0.19999999f)* speedfraction;
    float unk2 = unk1 + 1.f;
    float unk3;

    if (duckammount > 0) {
        unk2 += ((duckammount * speedfactor) * (0.5f - unk2));
    }

    unk3 = *(float*)(animstate + 0x334) * unk2;

    return unk3;
}
void Resolver::AnimationFix(C_BasePlayer* pEnt)
{
    //who needs structs or classes not me lol
    static float oldSimtime[65];
    static float storedSimtime[65];
    static float ShotTime[65];
    static float SideTime[65][3];
    static int LastDesyncSide[65];
    static bool Delaying[65];
    static AnimationLayer StoredLayers[64][15];
    static CCSGOPlayerAnimState* StoredAnimState[65];
    static float StoredPosParams[65][24];
    static Vector oldEyeAngles[65];
    static float oldGoalfeetYaw[65];
    float* PosParams = (float*)((uintptr_t)pEnt + 0x2774);
    bool update = false;
    bool shot = false;

    static bool jittering[65];

    auto* AnimState = pEnt->AnimState();
    if (!AnimState || !pEnt->AnimOverlays() || !PosParams)
        return;

    auto RemapVal = [](float val, float A, float B, float C, float D) -> float
    {
        if (A == B)
            return val >= B ? D : C;
        return C + (D - C) * (val - A) / (B - A);
    };

    if (storedSimtime[pEnt->EntIndex()] != pEnt->m_flSimulationTime())
    {
        jittering[pEnt->EntIndex()] = false;
        pEnt->ClientAnimations(true);
        pEnt->UpdateClientAnimation();

        memcpy(StoredPosParams[pEnt->EntIndex()], PosParams, sizeof(float) * 24);
        memcpy(StoredLayers[pEnt->EntIndex()], pEnt->AnimOverlays(), (sizeof(AnimationLayer) * pEnt->NumOverlays()));

        oldGoalfeetYaw[pEnt->EntIndex()] = AnimState->m_flGoalFeetYaw;

        if (pEnt->m_hActiveWeapon() && !pEnt->IsKnifeorNade())
        {
            if (ShotTime[pEnt->EntIndex()] != pEnt->m_hActiveWeapon()->GetLastShotTime())
            {
                shot = true;
                ShotTime[pEnt->EntIndex()] = pEnt->m_hActiveWeapon()->GetLastShotTime();
            }
            else
                shot = false;
        }
        else
        {
            shot = false;
            ShotTime[pEnt->EntIndex()] = 0.f;
        }

        float angToLocal = Math::NormalizeYaw(Math::CalcAngle(g::pLocalEntity->m_vecOrigin(), pEnt->m_vecOrigin()).yaw);

        float Back = Math::NormalizeYaw(angToLocal);
        float DesyncFix = 0;
        float Resim = Math::NormalizeYaw((0.24f / (pEnt->m_flSimulationTime() - oldSimtime[pEnt->EntIndex()])) * (oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));

        if (Resim > MaxDelta(pEnt))
            Resim = MaxDelta(pEnt);
        if (Resim < -MaxDelta(pEnt))
            Resim = -MaxDelta(pEnt);

        if (pEnt->m_vecVelocity().Length2D() > 0.5f && !shot)
        {
            float Delta = Math::NormalizeYaw(Math::NormalizeYaw(Math::CalcAngle(Vector(0, 0, 0), pEnt->m_vecVelocity()).yaw) - Math::NormalizeYaw(Math::NormalizeYaw(AnimState->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60)) + Resim));

            int CurrentSide = 0;

            if (Delta < 0)
            {
                CurrentSide = 1;
                SideTime[pEnt->EntIndex()][1] = g_GlobalVars->curtime;
            }
            else if (Delta > 0)
            {
                CurrentSide = 2;
                SideTime[pEnt->EntIndex()][2] = g_GlobalVars->curtime;
            }

            if (LastDesyncSide[pEnt->EntIndex()] == 1)
            {
                Resim += (MaxDelta(pEnt) - Resim);
                DesyncFix += (MaxDelta(pEnt) - Resim);
            }
            if (LastDesyncSide[pEnt->EntIndex()] == 2)
            {
                Resim += (-MaxDelta(pEnt) - Resim);
                DesyncFix += (-MaxDelta(pEnt) - Resim);
            }

            if (LastDesyncSide[pEnt->EntIndex()] != CurrentSide)
            {
                Delaying[pEnt->EntIndex()] = true;

                if (.5f < (g_GlobalVars->curtime - SideTime[pEnt->EntIndex()][LastDesyncSide[pEnt->EntIndex()]]))
                {
                    LastDesyncSide[pEnt->EntIndex()] = CurrentSide;
                    Delaying[pEnt->EntIndex()] = false;
                }
            }

            if (!Delaying[pEnt->EntIndex()])
                LastDesyncSide[pEnt->EntIndex()] = CurrentSide;
        }
        else if (!shot)
        {
            float Brute = UseFreestandAngle[pEnt->EntIndex()] ? Math::NormalizeYaw(Back + FreestandAngle[pEnt->EntIndex()]) : pEnt->GetLowerBodyYaw();

            float Delta = Math::NormalizeYaw(Math::NormalizeYaw(Brute - Math::NormalizeYaw(Math::NormalizeYaw(AnimState->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60))) + Resim));

            if (Delta > MaxDelta(pEnt))
                Delta = MaxDelta(pEnt);
            if (Delta < -MaxDelta(pEnt))
                Delta = -MaxDelta(pEnt);

            Resim += Delta;
            DesyncFix += Delta;

            if (Resim > MaxDelta(pEnt))
                Resim = MaxDelta(pEnt);
            if (Resim < -MaxDelta(pEnt))
                Resim = -MaxDelta(pEnt);
        }

        float Equalized = Math::NormalizeYaw(Math::NormalizeYaw(AnimState->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60)) + Resim);

        float JitterDelta = fabs(Math::NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));

        if (JitterDelta >= 70.f && !shot)
            jittering[pEnt->EntIndex()] = true;

        if (pEnt != g::pLocalEntity && pEnt->GetTeam() != g::pLocalEntity->GetTeam() && (pEnt->m_fFlags() & FL_ONGROUND) && g_Options.Misc.resolver)
        {
            if (jittering[pEnt->EntIndex()])
                AnimState->m_flGoalFeetYaw = Math::NormalizeYaw(pEnt->GetEyeAngles().y + DesyncFix);
            else
                AnimState->m_flGoalFeetYaw = Equalized;

            pEnt->SetLowerBodyYaw(AnimState->m_flGoalFeetYaw);
        }

        StoredAnimState[pEnt->EntIndex()] = AnimState;

        oldEyeAngles[pEnt->EntIndex()] = pEnt->GetEyeAngles();

        oldSimtime[pEnt->EntIndex()] = storedSimtime[pEnt->EntIndex()];

        storedSimtime[pEnt->EntIndex()] = pEnt->m_flSimulationTime();

        update = true;
    }

    pEnt->ClientAnimations(false);

    /*if (pEnt != g::pLocalEntity && pEnt->GetTeam() != g::pLocalEntity->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND) && g_Menu.Config.Resolver)
        pEnt->SetLowerBodyYaw(AnimState->m_flGoalFeetYaw);*/

    AnimState = StoredAnimState[pEnt->EntIndex()];

    memcpy((void*)PosParams, &StoredPosParams[pEnt->EntIndex()], (sizeof(float) * 24));
    memcpy(pEnt->AnimOverlays(), StoredLayers[pEnt->EntIndex()], (sizeof(AnimationLayer) * pEnt->NumOverlays()));

    if (pEnt != g::pLocalEntity && pEnt->GetTeam() != g::pLocalEntity->GetTeam() && (pEnt->m_fFlags() & FL_ONGROUND) && g_Options.Misc.resolver && jittering[pEnt->EntIndex()])
        pEnt->SetAbsAngles2(Vector(0, pEnt->GetEyeAngles().y, 0));
    else
        pEnt->SetAbsAngles2(Vector(0, oldGoalfeetYaw[pEnt->EntIndex()], 0));

    /*if (pEnt == g::pLocalEntity && pEnt->GetVelocity().Length2D() < 45.f && !(g::IsSlowwalking || g::IsFakewalking))
    {
        AnimState->m_flUnknownFraction = 0.f;
        AnimState->m_flLeanAmount = 0.f;
        g::pLocalEntity->SetSequence(0);
        if (g_Menu.Config.ShowAccurateLby)
            pEnt->SetLowerBodyYaw(pEnt->GetEyeAngles().y);
        pEnt->ClientAnimations(false);
    }*/

    * reinterpret_cast<int*>(uintptr_t(pEnt) + 0xA30) = g_GlobalVars->framecount;
    *reinterpret_cast<int*>(uintptr_t(pEnt) + 0xA28) = 0;
}

void HandleHits(C_BasePlayer* pEnt)
{
    auto NetChannel = g_EngineClient->GetNetChannelInfo();

    if (!NetChannel)
        return;

    static float predTime[65];
    static bool init[65];

    if (g::Shot[pEnt->EntIndex()])
    {
        if (init[pEnt->EntIndex()])
        {
            g_Resolver.pitchHit[pEnt->EntIndex()] = pEnt->GetEyeAngles().x;
            predTime[pEnt->EntIndex()] = g_GlobalVars->curtime + NetChannel->GetAvgLatency(FLOW_INCOMING) + NetChannel->GetAvgLatency(FLOW_OUTGOING) + TICKS_TO_TIME(1) + TICKS_TO_TIME(g_EngineClient->GetNetChannel()->m_nChokedPackets);
            init[pEnt->EntIndex()] = false;
        }

        if (g_GlobalVars->curtime > predTime[pEnt->EntIndex()] && !g::Hit[pEnt->EntIndex()])
        {
            g::MissedShots[pEnt->EntIndex()] += 1;
            g::Shot[pEnt->EntIndex()] = false;
        }
        else if (g_GlobalVars->curtime <= predTime[pEnt->EntIndex()] && g::Hit[pEnt->EntIndex()])
            g::Shot[pEnt->EntIndex()] = false;

    }
    else
        init[pEnt->EntIndex()] = true;

    g::Hit[pEnt->EntIndex()] = false;
}

void Resolver::OnCreateMove() // cancer v2
{
    if (!g_Options.Misc.resolver)
        return;
   
    C_BaseCombatWeapon* weapon;
    
    if (!local_player->IsAlive())
        return;

    if (!local_player->m_hActiveWeapon() || weapon->IsGun())
        return;


    for (int i = 1; i < g_EngineClient->GetMaxClients(); ++i)
    {
        auto pPlayerEntity = (C_BasePlayer*)g_EntityList->GetClientEntity(i);
        //C_BaseEntity* pPlayerEntity = g_EntityList->GetClientEntity(i);

        if (!pPlayerEntity
            || !pPlayerEntity->IsAlive()
            || pPlayerEntity->IsDormant()
            || pPlayerEntity == g::pLocalEntity
            || pPlayerEntity->GetTeam() == g::pLocalEntity->GetTeam())
        {
            UseFreestandAngle[i] = false;
            continue;
        }

        if (abs(pPlayerEntity->m_vecVelocity().Length2D()) > 29.f)
            UseFreestandAngle[pPlayerEntity->EntIndex()] = false;

        if (abs(pPlayerEntity->m_vecVelocity().Length2D()) <= 29.f && !UseFreestandAngle[pPlayerEntity->EntIndex()])
        {
            bool Autowalled = false, HitSide1 = false, HitSide2 = false;

            float angToLocal = Math::CalcAngle(g::pLocalEntity->m_vecOrigin(), pPlayerEntity->m_vecOrigin()).yaw;
            Vector ViewPoint = g::pLocalEntity->m_vecOrigin() + Vector(0, 0, 90);

            Vector2D Side1 = { (45 * sin(GRD_TO_BOG(angToLocal))),(45 * cos(GRD_TO_BOG(angToLocal))) };
            Vector2D Side2 = { (45 * sin(GRD_TO_BOG(angToLocal + 180))) ,(45 * cos(GRD_TO_BOG(angToLocal + 180))) };

            Vector2D Side3 = { (50 * sin(GRD_TO_BOG(angToLocal))),(50 * cos(GRD_TO_BOG(angToLocal))) };
            Vector2D Side4 = { (50 * sin(GRD_TO_BOG(angToLocal + 180))) ,(50 * cos(GRD_TO_BOG(angToLocal + 180))) };

            Vector Origin = pPlayerEntity->m_vecOrigin();

            Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };

            Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };

            for (int side = 0; side < 2; side++)
            {
                Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x,  Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
                Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x,  ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };

                if (Autowall::CanHitFloatingPoint(OriginAutowall, ViewPoint, g::pLocalEntity))
                {
                    if (side == 0)
                    {
                        HitSide1 = true;
                        FreestandAngle[pPlayerEntity->EntIndex()] = 90;
                    }
                    else if (side == 1)
                    {
                        HitSide2 = true;
                        FreestandAngle[pPlayerEntity->EntIndex()] = -90;
                    }

                    Autowalled = true;
                }
                else
                {
                    for (int side222 = 0; side222 < 2; side222++)
                    {
                        Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x,  Origin.y - OriginLeftRight[side222].y , Origin.z + 90 };

                        if (Autowall::CanHitFloatingPoint(OriginAutowall222, OriginAutowall2, g::pLocalEntity))
                        {
                            if (side222 == 0)
                            {
                                HitSide1 = true;
                                FreestandAngle[pPlayerEntity->EntIndex()] = 90;
                            }
                            else if (side222 == 1)
                            {
                                HitSide2 = true;
                                FreestandAngle[pPlayerEntity->EntIndex()] = -90;
                            }

                            Autowalled = true;
                        }
                    }
                }
            }

            if (Autowalled)
            {
                if (HitSide1 && HitSide2)
                    UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
                else
                    UseFreestandAngle[pPlayerEntity->EntIndex()] = true;
            }
        }
    }
}

void Resolver::FrameStage(ClientFrameStage_t stage)
{
    if (!g::pLocalEntity || !g_EngineClient->IsInGame())
        return;

    static bool  wasDormant[65];

    for (int i = 1; i < g_EngineClient->GetMaxClients(); ++i)
    {

        auto pPlayerEntity = (C_BasePlayer*)g_EntityList->GetClientEntity(i);
       
        if (!pPlayerEntity
            || !pPlayerEntity->IsAlive())
            continue;
        if (pPlayerEntity->IsDormant())
        {
            wasDormant[i] = true;
            continue;
        }

        if (stage == FRAME_RENDER_START)
        {
            HandleHits(pPlayerEntity);
            AnimationFix(pPlayerEntity);
        }

        if (stage == FRAME_NET_UPDATE_END && pPlayerEntity != g::pLocalEntity)
        {
            auto VarMap = reinterpret_cast<uintptr_t>(pPlayerEntity) + 36;
            auto VarMapSize = *reinterpret_cast<int*>(VarMap + 20);

            for (auto index = 0; index < VarMapSize; index++)
                *reinterpret_cast<uintptr_t*>(*reinterpret_cast<uintptr_t*>(VarMap) + index * 12) = 0;
        }

        wasDormant[i] = false;
    }
}
Resolver.hpp:
Код:
class Resolver
{
public:
    bool UseFreestandAngle[65];
    float FreestandAngle[65];

    float pitchHit[65];

    void OnCreateMove();
    void Yaw(C_BasePlayer* ent);
    void FrameStage(ClientFrameStage_t stage);
    void handle();
private:
    void AnimationFix(C_BasePlayer* pEnt);
};

extern Resolver g_Resolver;
hkReadPacketEntities hook:
Код:
g_Resolver.FrameStage(stage);
 
Последнее редактирование:
supremacy > all
Забаненный
Статус
Оффлайн
Регистрация
1 Ноя 2018
Сообщения
225
Реакции[?]
89
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
What about stop pasting shitty code hmm?
 
web dev
Пользователь
Статус
Оффлайн
Регистрация
26 Янв 2019
Сообщения
393
Реакции[?]
147
Поинты[?]
0
Здравствуйте, кто-нибудь поможет мне с desync resolver?
Не работает и падение

код:
Resolver.cpp
Код:
Resolver g_Resolver;
std::vector<std::pair<C_BaseEntity*, Vector>> player_data;
/*
my attempt at fixing desync and i was pretty successful
it can resolve static desync pretty perfectly
and can resolve some jitter desync but
it still gets rekt by other things
*/



namespace g
{
    CUserCmd* pCmd = nullptr;
    C_BaseEntity* pLocalEntity = nullptr;
    std::uintptr_t uRandomSeed = NULL;
    Vector         OriginalView;
    bool           bSendPacket = true;
    bool           LagPeek = false;
    int            TargetIndex = -1;
    Vector         EnemyEyeAngs[65];
    Vector         AimbotHitbox[65][28];
    Vector         RealAngle;
    Vector         FakeAngle;
    bool           Shot[65];
    bool           Hit[65];
    int            Shots[65];
    int            MissedShots[65];
    bool           PreserveDelete;
    int            flHurtTime;
    bool           fakeducked = false;
    bool           isfakeducking = false;
    bool           IsFakewalking = false;
    bool           IsSlowwalking = false;
    bool           FreezeTime = false;
    int            kills = 0;
    float          killtime = 0.0f;
    int            globalAlpha = 0;
    float          GoalLby = 0;
    int            hits = 0;
    int            shots = 0;
    bool           knifeapply;
    float          viewMatrix[4][4];

    DWORD grenade;
    DWORD Tahoma;
    DWORD TahomaSmall;
    DWORD EspTahoma;
    DWORD EspSmallText;
    DWORD WeaponIcons;
    DWORD SansSerif;
    DWORD SansSerifBold;
    DWORD Indicators;
    DWORD Watermark;
    DWORD KillCounter;
    DWORD x88Font;

    //Remastered Esp
    DWORD ReEspText;
}

/*
void Resolver::handle()
{
    if (g_Options.Misc.resolver)
    {
        for (int i = 1; i < g_GlobalVars->maxClients; i++)
        {
            auto p_entity = (C_BasePlayer*)g_EntityList->GetClientEntity(i);
            if (p_entity && !p_entity->IsDormant())
            {
                auto feet_yaw = p_entity->GetPlayerAnimState()->m_flCurrentFeetYaw;
                auto body_max_rotation = p_entity->GetPlayerAnimState()->pad10[516];
                if (feet_yaw <= 58)
                {
                    if (-58 > feet_yaw)
                        p_entity->m_angEyeAngles().yaw = body_max_rotation + p_entity->m_angEyeAngles().yaw;
                }
                else
                {
                    p_entity->m_angEyeAngles().yaw = body_max_rotation - p_entity->m_angEyeAngles().yaw;
                }
                if (p_entity->GetAnimOverlay(6)->m_flPlaybackRate > 0.1)
                {
                    for (int resolve_delta = 58.f; resolve_delta < -58.f; resolve_delta = resolve_delta - 20.f)
                    {
                        p_entity->m_angEyeAngles().yaw = resolve_delta;
                    }
                }
            }
        }
    }
}
*/

float GRD_TO_BOG(float GRD) {
    return (M_PI / 180) * GRD;
}
#ifndef max
#define max(a,b)            (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b)            (((a) < (b)) ? (a) : (b))
#endif

float MaxDelta(C_BaseEntity* pEnt) {

    auto animstate = uintptr_t(local_player->AnimState());

    float duckammount = *(float*)(animstate + 0xA4);
    float speedfraction = max(0, min(*reinterpret_cast<float*>(animstate + 0xF8), 1));

    float speedfactor = max(0, min(1, *reinterpret_cast<float*> (animstate + 0xFC)));

    float unk1 = ((*reinterpret_cast<float*> (animstate + 0x11C) * -0.30000001f) - 0.19999999f)* speedfraction;
    float unk2 = unk1 + 1.f;
    float unk3;

    if (duckammount > 0) {
        unk2 += ((duckammount * speedfactor) * (0.5f - unk2));
    }

    unk3 = *(float*)(animstate + 0x334) * unk2;

    return unk3;
}
void Resolver::AnimationFix(C_BasePlayer* pEnt)
{
    //who needs structs or classes not me lol
    static float oldSimtime[65];
    static float storedSimtime[65];
    static float ShotTime[65];
    static float SideTime[65][3];
    static int LastDesyncSide[65];
    static bool Delaying[65];
    static AnimationLayer StoredLayers[64][15];
    static CCSGOPlayerAnimState* StoredAnimState[65];
    static float StoredPosParams[65][24];
    static Vector oldEyeAngles[65];
    static float oldGoalfeetYaw[65];
    float* PosParams = (float*)((uintptr_t)pEnt + 0x2774);
    bool update = false;
    bool shot = false;

    static bool jittering[65];

    auto* AnimState = pEnt->AnimState();
    if (!AnimState || !pEnt->AnimOverlays() || !PosParams)
        return;

    auto RemapVal = [](float val, float A, float B, float C, float D) -> float
    {
        if (A == B)
            return val >= B ? D : C;
        return C + (D - C) * (val - A) / (B - A);
    };

    if (storedSimtime[pEnt->EntIndex()] != pEnt->m_flSimulationTime())
    {
        jittering[pEnt->EntIndex()] = false;
        pEnt->ClientAnimations(true);
        pEnt->UpdateClientAnimation();

        memcpy(StoredPosParams[pEnt->EntIndex()], PosParams, sizeof(float) * 24);
        memcpy(StoredLayers[pEnt->EntIndex()], pEnt->AnimOverlays(), (sizeof(AnimationLayer) * pEnt->NumOverlays()));

        oldGoalfeetYaw[pEnt->EntIndex()] = AnimState->m_flGoalFeetYaw;

        if (pEnt->m_hActiveWeapon() && !pEnt->IsKnifeorNade())
        {
            if (ShotTime[pEnt->EntIndex()] != pEnt->m_hActiveWeapon()->GetLastShotTime())
            {
                shot = true;
                ShotTime[pEnt->EntIndex()] = pEnt->m_hActiveWeapon()->GetLastShotTime();
            }
            else
                shot = false;
        }
        else
        {
            shot = false;
            ShotTime[pEnt->EntIndex()] = 0.f;
        }

        float angToLocal = Math::NormalizeYaw(Math::CalcAngle(g::pLocalEntity->m_vecOrigin(), pEnt->m_vecOrigin()).yaw);

        float Back = Math::NormalizeYaw(angToLocal);
        float DesyncFix = 0;
        float Resim = Math::NormalizeYaw((0.24f / (pEnt->m_flSimulationTime() - oldSimtime[pEnt->EntIndex()])) * (oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));

        if (Resim > MaxDelta(pEnt))
            Resim = MaxDelta(pEnt);
        if (Resim < -MaxDelta(pEnt))
            Resim = -MaxDelta(pEnt);

        if (pEnt->m_vecVelocity().Length2D() > 0.5f && !shot)
        {
            float Delta = Math::NormalizeYaw(Math::NormalizeYaw(Math::CalcAngle(Vector(0, 0, 0), pEnt->m_vecVelocity()).yaw) - Math::NormalizeYaw(Math::NormalizeYaw(AnimState->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60)) + Resim));

            int CurrentSide = 0;

            if (Delta < 0)
            {
                CurrentSide = 1;
                SideTime[pEnt->EntIndex()][1] = g_GlobalVars->curtime;
            }
            else if (Delta > 0)
            {
                CurrentSide = 2;
                SideTime[pEnt->EntIndex()][2] = g_GlobalVars->curtime;
            }

            if (LastDesyncSide[pEnt->EntIndex()] == 1)
            {
                Resim += (MaxDelta(pEnt) - Resim);
                DesyncFix += (MaxDelta(pEnt) - Resim);
            }
            if (LastDesyncSide[pEnt->EntIndex()] == 2)
            {
                Resim += (-MaxDelta(pEnt) - Resim);
                DesyncFix += (-MaxDelta(pEnt) - Resim);
            }

            if (LastDesyncSide[pEnt->EntIndex()] != CurrentSide)
            {
                Delaying[pEnt->EntIndex()] = true;

                if (.5f < (g_GlobalVars->curtime - SideTime[pEnt->EntIndex()][LastDesyncSide[pEnt->EntIndex()]]))
                {
                    LastDesyncSide[pEnt->EntIndex()] = CurrentSide;
                    Delaying[pEnt->EntIndex()] = false;
                }
            }

            if (!Delaying[pEnt->EntIndex()])
                LastDesyncSide[pEnt->EntIndex()] = CurrentSide;
        }
        else if (!shot)
        {
            float Brute = UseFreestandAngle[pEnt->EntIndex()] ? Math::NormalizeYaw(Back + FreestandAngle[pEnt->EntIndex()]) : pEnt->GetLowerBodyYaw();

            float Delta = Math::NormalizeYaw(Math::NormalizeYaw(Brute - Math::NormalizeYaw(Math::NormalizeYaw(AnimState->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60))) + Resim));

            if (Delta > MaxDelta(pEnt))
                Delta = MaxDelta(pEnt);
            if (Delta < -MaxDelta(pEnt))
                Delta = -MaxDelta(pEnt);

            Resim += Delta;
            DesyncFix += Delta;

            if (Resim > MaxDelta(pEnt))
                Resim = MaxDelta(pEnt);
            if (Resim < -MaxDelta(pEnt))
                Resim = -MaxDelta(pEnt);
        }

        float Equalized = Math::NormalizeYaw(Math::NormalizeYaw(AnimState->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60)) + Resim);

        float JitterDelta = fabs(Math::NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));

        if (JitterDelta >= 70.f && !shot)
            jittering[pEnt->EntIndex()] = true;

        if (pEnt != g::pLocalEntity && pEnt->GetTeam() != g::pLocalEntity->GetTeam() && (pEnt->m_fFlags() & FL_ONGROUND) && g_Options.Misc.resolver)
        {
            if (jittering[pEnt->EntIndex()])
                AnimState->m_flGoalFeetYaw = Math::NormalizeYaw(pEnt->GetEyeAngles().y + DesyncFix);
            else
                AnimState->m_flGoalFeetYaw = Equalized;

            pEnt->SetLowerBodyYaw(AnimState->m_flGoalFeetYaw);
        }

        StoredAnimState[pEnt->EntIndex()] = AnimState;

        oldEyeAngles[pEnt->EntIndex()] = pEnt->GetEyeAngles();

        oldSimtime[pEnt->EntIndex()] = storedSimtime[pEnt->EntIndex()];

        storedSimtime[pEnt->EntIndex()] = pEnt->m_flSimulationTime();

        update = true;
    }

    pEnt->ClientAnimations(false);

    /*if (pEnt != g::pLocalEntity && pEnt->GetTeam() != g::pLocalEntity->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND) && g_Menu.Config.Resolver)
        pEnt->SetLowerBodyYaw(AnimState->m_flGoalFeetYaw);*/

    AnimState = StoredAnimState[pEnt->EntIndex()];

    memcpy((void*)PosParams, &StoredPosParams[pEnt->EntIndex()], (sizeof(float) * 24));
    memcpy(pEnt->AnimOverlays(), StoredLayers[pEnt->EntIndex()], (sizeof(AnimationLayer) * pEnt->NumOverlays()));

    if (pEnt != g::pLocalEntity && pEnt->GetTeam() != g::pLocalEntity->GetTeam() && (pEnt->m_fFlags() & FL_ONGROUND) && g_Options.Misc.resolver && jittering[pEnt->EntIndex()])
        pEnt->SetAbsAngles2(Vector(0, pEnt->GetEyeAngles().y, 0));
    else
        pEnt->SetAbsAngles2(Vector(0, oldGoalfeetYaw[pEnt->EntIndex()], 0));

    /*if (pEnt == g::pLocalEntity && pEnt->GetVelocity().Length2D() < 45.f && !(g::IsSlowwalking || g::IsFakewalking))
    {
        AnimState->m_flUnknownFraction = 0.f;
        AnimState->m_flLeanAmount = 0.f;
        g::pLocalEntity->SetSequence(0);
        if (g_Menu.Config.ShowAccurateLby)
            pEnt->SetLowerBodyYaw(pEnt->GetEyeAngles().y);
        pEnt->ClientAnimations(false);
    }*/

    * reinterpret_cast<int*>(uintptr_t(pEnt) + 0xA30) = g_GlobalVars->framecount;
    *reinterpret_cast<int*>(uintptr_t(pEnt) + 0xA28) = 0;
}

void HandleHits(C_BasePlayer* pEnt)
{
    auto NetChannel = g_EngineClient->GetNetChannelInfo();

    if (!NetChannel)
        return;

    static float predTime[65];
    static bool init[65];

    if (g::Shot[pEnt->EntIndex()])
    {
        if (init[pEnt->EntIndex()])
        {
            g_Resolver.pitchHit[pEnt->EntIndex()] = pEnt->GetEyeAngles().x;
            predTime[pEnt->EntIndex()] = g_GlobalVars->curtime + NetChannel->GetAvgLatency(FLOW_INCOMING) + NetChannel->GetAvgLatency(FLOW_OUTGOING) + TICKS_TO_TIME(1) + TICKS_TO_TIME(g_EngineClient->GetNetChannel()->m_nChokedPackets);
            init[pEnt->EntIndex()] = false;
        }

        if (g_GlobalVars->curtime > predTime[pEnt->EntIndex()] && !g::Hit[pEnt->EntIndex()])
        {
            g::MissedShots[pEnt->EntIndex()] += 1;
            g::Shot[pEnt->EntIndex()] = false;
        }
        else if (g_GlobalVars->curtime <= predTime[pEnt->EntIndex()] && g::Hit[pEnt->EntIndex()])
            g::Shot[pEnt->EntIndex()] = false;

    }
    else
        init[pEnt->EntIndex()] = true;

    g::Hit[pEnt->EntIndex()] = false;
}

void Resolver::OnCreateMove() // cancer v2
{
    if (!g_Options.Misc.resolver)
        return;
  
    C_BaseCombatWeapon* weapon;
   
    if (!local_player->IsAlive())
        return;

    if (!local_player->m_hActiveWeapon() || weapon->IsGun())
        return;


    for (int i = 1; i < g_EngineClient->GetMaxClients(); ++i)
    {
        auto pPlayerEntity = (C_BasePlayer*)g_EntityList->GetClientEntity(i);
        //C_BaseEntity* pPlayerEntity = g_EntityList->GetClientEntity(i);

        if (!pPlayerEntity
            || !pPlayerEntity->IsAlive()
            || pPlayerEntity->IsDormant()
            || pPlayerEntity == g::pLocalEntity
            || pPlayerEntity->GetTeam() == g::pLocalEntity->GetTeam())
        {
            UseFreestandAngle[i] = false;
            continue;
        }

        if (abs(pPlayerEntity->m_vecVelocity().Length2D()) > 29.f)
            UseFreestandAngle[pPlayerEntity->EntIndex()] = false;

        if (abs(pPlayerEntity->m_vecVelocity().Length2D()) <= 29.f && !UseFreestandAngle[pPlayerEntity->EntIndex()])
        {
            bool Autowalled = false, HitSide1 = false, HitSide2 = false;

            float angToLocal = Math::CalcAngle(g::pLocalEntity->m_vecOrigin(), pPlayerEntity->m_vecOrigin()).yaw;
            Vector ViewPoint = g::pLocalEntity->m_vecOrigin() + Vector(0, 0, 90);

            Vector2D Side1 = { (45 * sin(GRD_TO_BOG(angToLocal))),(45 * cos(GRD_TO_BOG(angToLocal))) };
            Vector2D Side2 = { (45 * sin(GRD_TO_BOG(angToLocal + 180))) ,(45 * cos(GRD_TO_BOG(angToLocal + 180))) };

            Vector2D Side3 = { (50 * sin(GRD_TO_BOG(angToLocal))),(50 * cos(GRD_TO_BOG(angToLocal))) };
            Vector2D Side4 = { (50 * sin(GRD_TO_BOG(angToLocal + 180))) ,(50 * cos(GRD_TO_BOG(angToLocal + 180))) };

            Vector Origin = pPlayerEntity->m_vecOrigin();

            Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };

            Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };

            for (int side = 0; side < 2; side++)
            {
                Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x,  Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
                Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x,  ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };

                if (Autowall::CanHitFloatingPoint(OriginAutowall, ViewPoint, g::pLocalEntity))
                {
                    if (side == 0)
                    {
                        HitSide1 = true;
                        FreestandAngle[pPlayerEntity->EntIndex()] = 90;
                    }
                    else if (side == 1)
                    {
                        HitSide2 = true;
                        FreestandAngle[pPlayerEntity->EntIndex()] = -90;
                    }

                    Autowalled = true;
                }
                else
                {
                    for (int side222 = 0; side222 < 2; side222++)
                    {
                        Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x,  Origin.y - OriginLeftRight[side222].y , Origin.z + 90 };

                        if (Autowall::CanHitFloatingPoint(OriginAutowall222, OriginAutowall2, g::pLocalEntity))
                        {
                            if (side222 == 0)
                            {
                                HitSide1 = true;
                                FreestandAngle[pPlayerEntity->EntIndex()] = 90;
                            }
                            else if (side222 == 1)
                            {
                                HitSide2 = true;
                                FreestandAngle[pPlayerEntity->EntIndex()] = -90;
                            }

                            Autowalled = true;
                        }
                    }
                }
            }

            if (Autowalled)
            {
                if (HitSide1 && HitSide2)
                    UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
                else
                    UseFreestandAngle[pPlayerEntity->EntIndex()] = true;
            }
        }
    }
}

void Resolver::FrameStage(ClientFrameStage_t stage)
{
    if (!g::pLocalEntity || !g_EngineClient->IsInGame())
        return;

    static bool  wasDormant[65];

    for (int i = 1; i < g_EngineClient->GetMaxClients(); ++i)
    {

        auto pPlayerEntity = (C_BasePlayer*)g_EntityList->GetClientEntity(i);
      
        if (!pPlayerEntity
            || !pPlayerEntity->IsAlive())
            continue;
        if (pPlayerEntity->IsDormant())
        {
            wasDormant[i] = true;
            continue;
        }

        if (stage == FRAME_RENDER_START)
        {
            HandleHits(pPlayerEntity);
            AnimationFix(pPlayerEntity);
        }

        if (stage == FRAME_NET_UPDATE_END && pPlayerEntity != g::pLocalEntity)
        {
            auto VarMap = reinterpret_cast<uintptr_t>(pPlayerEntity) + 36;
            auto VarMapSize = *reinterpret_cast<int*>(VarMap + 20);

            for (auto index = 0; index < VarMapSize; index++)
                *reinterpret_cast<uintptr_t*>(*reinterpret_cast<uintptr_t*>(VarMap) + index * 12) = 0;
        }

        wasDormant[i] = false;
    }
}
Resolver.hpp:
Код:
class Resolver
{
public:
    bool UseFreestandAngle[65];
    float FreestandAngle[65];

    float pitchHit[65];

    void OnCreateMove();
    void Yaw(C_BasePlayer* ent);
    void FrameStage(ClientFrameStage_t stage);
    void handle();
private:
    void AnimationFix(C_BasePlayer* pEnt);
};

extern Resolver g_Resolver;
hkReadPacketEntities hook:
Код:
g_Resolver.FrameStage(stage);
def xy0?
 
Сверху Снизу