notgoodusename/OsirisAndExtra

small help lol

Closed this issue · 16 comments

If y'all ask so imma too.

I added to my cheat everything what is possible in this game, but I have trouble with Anim Fix. When I jump with enabled Antiaim + desync, game crashes cuz of memory access violation on debug build. On release build crashes almost instantly when i move, so I use my cheat for hvh with no anims lol.
Question is, what should I also hook/paste tbh, to avoid crashing. I dont need perfect anim fix. I just wanna see where local looks at and that's all.
I hook these detours:

- shouldSkipAnimationFrameHook
- calculateViewHook
- buildTransformationsHook
- doExtraBoneProcessingHook
- standardBlendingRulesHook
- eyeAnglesHook
- updateStateHook
- resetStateHook

Animations.cpp is mixed This PR and with original code , but It does change nothing cuz with only original code, It crashed anyway.

you have to integrate animations.cpp and animstate.cpp (copy helpers too) also hook this https://github.com/notgoodusename/OsirisAndExtra/blob/main/Osiris/Hooks.cpp#L1539-L1552 and delete that pr code, it's hella outdated

you have to integrate animations.cpp and animstate.cpp (copy helpers too) also hook this https://github.com/notgoodusename/OsirisAndExtra/blob/main/Osiris/Hooks.cpp#L1539-L1552 and delete that pr code, it's hella outdated

Had small problem with desync in ur recent code so was experimenting with ur old code in osiris's pr
my recent anim.cpp code looks like this

#include "Animations.h"
#include "AntiAim.h"

#include "../Memory.h"
#include "../MemAlloc.h"
#include "../Interfaces.h"

#include "../SDK/LocalPlayer.h"
#include "../SDK/Cvar.h"
#include "../SDK/GlobalVars.h"
#include "../SDK/Entity.h"
#include "../SDK/UserCmd.h"
#include "../SDK/ConVar.h"
#include "../SDK/Input.h"
#include <Hacks/Extra.h>
#include <SDK/GameEvent.h>

static std::array<matrix3x4, MAXSTUDIOBONES> lagmatrix{};
static std::array<matrix3x4, MAXSTUDIOBONES> autoPeekmatrix{};
static std::array<matrix3x4, MAXSTUDIOBONES> hitmatrix{};
static bool gotMatrixLag{ false };
static bool gotMatrixPeak{ false };
static bool gotMatrixHit{ false };

Animations::Datas Animations::data;

void Animations::update(UserCmd* cmd, bool& sendPacket) noexcept
{
    if (!localPlayer || !localPlayer->isAlive())
        return;

    static auto threadedBoneSetup = interfaces->cvar->findVar("cl_threaded_bone_setup");
    threadedBoneSetup->setValue(1);

    data.viewangles = cmd->viewangles;
    data.sendPacket = sendPacket;

}

void Animations::fake() noexcept
{
    static AnimState* fakeanimstate = nullptr;
    static bool updatefakeanim = true;
    static bool initfakeanim = true;
    static float spawnTime = 0.f;

    if (!interfaces->engine->isInGame())
    {
        updatefakeanim = true;
        initfakeanim = true;
        spawnTime = 0.f;
        fakeanimstate = nullptr;
        return;
    }

    if (!localPlayer || !localPlayer->isAlive())
        return;

    if (spawnTime != localPlayer.get()->spawnTime() || updatefakeanim)
    {
        spawnTime = localPlayer.get()->spawnTime();
        initfakeanim = false;
        updatefakeanim = false;
    }

    if (!initfakeanim)
    {
        fakeanimstate = static_cast<AnimState*>(memory->memalloc->Alloc(sizeof(AnimState)));

        if (fakeanimstate != nullptr)
            localPlayer.get()->createState(fakeanimstate);

        initfakeanim = true;
    }

    if (!fakeanimstate) return;

    if (data.sendPacket)
    {
        data.canFakeUpdate = true;

        std::array<AnimationLayer, 13> networkedLayers;

        std::memcpy(&networkedLayers, localPlayer.get()->animOverlays(), sizeof(AnimationLayer) * localPlayer->getAnimationLayersCount());
        auto backup_abs_angles = localPlayer.get()->getAbsAngle();
        auto backup_poses = localPlayer.get()->poseParameters();
        
        localPlayer.get()->updateState(fakeanimstate, data.viewangles);
        localPlayer.get()->invalidateBoneCache();
        memory->setAbsAngle(localPlayer.get(), Vector{ 0, fakeanimstate->footYaw, 0 });
        std::memcpy(localPlayer.get()->animOverlays(), &networkedLayers, sizeof(AnimationLayer) * localPlayer->getAnimationLayersCount());
        localPlayer.get()->getAnimationLayer(12)->weight = std::numeric_limits<float>::epsilon();
        
        if (Extra::isQuickPeekKeyDown() && localPlayer->isOnGround())
            gotMatrixPeak = localPlayer->setupBones(autoPeekmatrix.data(), localPlayer->getBoneCache().size, 0x7FF00, memory->globalVars->currenttime);

        gotMatrixLag = localPlayer->setupBones(lagmatrix.data(), localPlayer->getBoneCache().size, 0x7FF00, memory->globalVars->currenttime);
        data.gotMatrix = localPlayer.get()->setupBones(data.fakematrix, localPlayer->getBoneCache().size, 0x7FF00, memory->globalVars->currenttime);
        const auto origin = localPlayer.get()->getRenderOrigin();
        if (data.gotMatrix)
        {
            for (auto& i : data.fakematrix)
            {
                i[0][3] -= origin.x;
                i[1][3] -= origin.y;
                i[2][3] -= origin.z;
            }
        }
        std::memcpy(localPlayer.get()->animOverlays(), &networkedLayers, sizeof(AnimationLayer) * localPlayer->getAnimationLayersCount());
        localPlayer.get()->poseParameters() = backup_poses;
        memory->setAbsAngle(localPlayer.get(), Vector{ 0,backup_abs_angles.y, AntiAim::RollValue()});
        data.canFakeUpdate = false;
    }
}

void Animations::real() noexcept
{

    if (!localPlayer)
        return;

    if (!localPlayer->isAlive())
    {
        localPlayer.get()->clientSideAnimation() = true;
        return;
    }

    if (!memory->input->isCameraInThirdPerson) {
        localPlayer.get()->clientSideAnimation() = true;
        localPlayer.get()->updateClientSideAnimation();
        localPlayer.get()->clientSideAnimation() = false;
        return;
    }

    data.canUpdate = true;

    static auto backupPoseParameters = localPlayer.get()->poseParameters();
    static auto backupAbs = localPlayer.get()->getAnimstate()->footYaw;

    static std::array<AnimationLayer, 13> sendPacketLayers;

    while (localPlayer.get()->getAnimstate()->lastUpdateFrame == memory->globalVars->framecount)
        localPlayer.get()->getAnimstate()->lastUpdateFrame -= 1;

    localPlayer->getEFlags() &= ~0x1000;
    localPlayer->getAbsVelocity() = EnginePrediction::getVelocity();

    localPlayer->updateState(localPlayer->getAnimstate(), data.viewangles);
    localPlayer->updateClientSideAnimation();

    if (memory->globalVars->newTick())
    {
        std::memcpy(&sendPacketLayers, localPlayer.get()->animOverlays(), sizeof(AnimationLayer) * localPlayer->getAnimationLayersCount());
        localPlayer.get()->clientSideAnimation() = true;
        localPlayer.get()->updateState(localPlayer->getAnimstate(), data.viewangles);
        localPlayer.get()->updateClientSideAnimation();
        localPlayer.get()->clientSideAnimation() = false;
        if (data.sendPacket)
        {
            backupPoseParameters = localPlayer.get()->poseParameters();
            backupAbs = localPlayer.get()->getAnimstate()->footYaw;
        }
    }
    localPlayer.get()->getAnimstate()->moveWeight = 0.f;
    memory->setAbsAngle(localPlayer.get(), Vector{ 0, backupAbs, 0 });
    std::memcpy(localPlayer.get()->animOverlays(), &sendPacketLayers, sizeof(AnimationLayer) * localPlayer->getAnimationLayersCount());
    localPlayer.get()->poseParameters() = backupPoseParameters;

    data.canUpdate = false;
}

void Animations::hitChams(GameEvent& event) noexcept { //don't mind about this, cuz it doesnt event work and should be deleted asap

    if (!localPlayer) return;

    if (!localPlayer->isAlive()) return;

    static float lastHitTime = 0.0f;

    const auto userid = interfaces->entityList->getEntity(interfaces->engine->getPlayerForUserID(event.getInt("userid")));
    const auto attacker = interfaces->entityList->getEntity(interfaces->engine->getPlayerForUserID(event.getInt("attacker")));

    if (!userid) return;

    if (!attacker) return;

    if (localPlayer->getUserId() != attacker->getUserId() && localPlayer->getUserId() != userid->getUserId()) return;
    
    lastHitTime = memory->globalVars->realtime;
    data.hitChamsShow = true;
    gotMatrixHit = localPlayer->setupBones(hitmatrix.data(), localPlayer->getBoneCache().size, 0x7FF00, memory->globalVars->currenttime);

    if (lastHitTime + 4.f < memory->globalVars->realtime)
        data.hitChamsShow = false;
}

bool Animations::gotLagMatrix() noexcept
{
    return gotMatrixLag;
}

std::array<matrix3x4, MAXSTUDIOBONES> Animations::getLagMatrix() noexcept
{
    return lagmatrix;
}

bool Animations::gotHitMatrix() noexcept
{
    return gotMatrixHit;
}

std::array<matrix3x4, MAXSTUDIOBONES> Animations::getHitMatrix() noexcept
{
    return hitmatrix;
}

bool Animations::gotAutoPeekMatrix() noexcept
{
    return gotMatrixPeak;
}

std::array<matrix3x4, MAXSTUDIOBONES> Animations::getAutoPeekMatrix() noexcept
{
    return autoPeekmatrix;
}

I will spend some time again and try to copy animstate again, third time. Gave up after error spam in console.

copy the new funcs(even handle players) + replace the real func with the new one and place the hooks i mentioned also you need to copy backtrack.cpp

Roger. Will send result later.

image
image
image

ahh yee, back then It also crashed after while in this hook cuz of the animations::fake(). Now it crashes instantly after choosing team.

show your updateclientsideanimations hook and animations real func

image
in entity.h is on 224 index

unknown_2023.01.15-11.29.mp4

Updated whole entity.h class and started working. Although It still crashes when I jump or move. Sometimes cuz of svCheatsBool Hook.

Updated whole entity.h class and started working. Although It still crashes when I jump or move. Sometimes cuz of svCheatsBool Hook.

no idea tbh

what else I can do is update memory.cpp.

cleaned & updated memory.cpp seems to be working. Thanks a lot!

@notgoodusename What about that?
image

@notgoodusename What about that? image

https://github.com/OneshotGH/supremacy/blob/9817a4b59befcce6eb6b07bf3a32b2fe0d707eea/csgo.cpp#L181

try adding this. you just gotta make a new sig if im not mistakin

`EB 05 A0 ? ? ? ? 84 C0 74

\xEB\x05\xA0\x00\x00\x00\x00\x84\xC0\x74 xxx????xxx`

here ya go.

`EB 05 A0 ? ? ? ? 84 C0 74

\xEB\x05\xA0\x00\x00\x00\x00\x84\xC0\x74 xxx????xxx`

here ya go.

outdated