Исходник Hijacking game's nade prediction

Начинающий
Статус
Оффлайн
Регистрация
7 Авг 2018
Сообщения
40
Реакции[?]
16
Поинты[?]
0
repost from uc (original post is still made by me) because people love reposting my shit on here, apparently
Пожалуйста, авторизуйтесь для просмотра ссылки.

got the idea to do this while trying to rewrite my old nade prediction. naturally i got lazy and i whipped up this solution in about 1 hour.

Пожалуйста, авторизуйтесь для просмотра ссылки.

ways to improve: access entity data directly in DrawNadePrediction hook - i just got lazy and didn't feel like wasting time reversing any more than i have to

sidenote: game's nade prediction is still pretty bad, but it's still better compared to most code floating around the community.

forcing cvar to be always on, but based
C++:
#include "../hooks.hh"

/* cvar get bool hook */
bool __fastcall csgo::hooks::hkGetBool ( x86reg ) {
    const static auto cl_grenadepreview_returnaddress = reinterpret_cast< void * >( SIG ( MODULE_CLIENT , _ ( "85 C0 74 7D 83 BF" ) ) );
    if ( cl_grenadepreview_returnaddress == _ReturnAddress ( ) )
        return 1;

    return originals::o_getbool ( x86regout );
}
DrawNadePrediction hook
C++:
#include "../hooks.hh"

#include "../hacks/visuals/nadepred.hh"

/* drawnadeprediction_address = SIG ( MODULE_CLIENT , _ ( "55 8B EC 83 E4 F8 83 EC 50 56 57 FF 75 08" ) ); */
void __fastcall csgo::hooks::hkDrawNadePrediction ( x86reg , int a2 , int a3 ) {
    /* clear old cache */
    csgo::hacks::nade_prediction->m_entries.clear ( );

    /* we're ready */
    csgo::hacks::nade_prediction->m_hijacking = true;
    originals::o_drawnadeprediction ( x86regout , a2 , a3 );
    csgo::hacks::nade_prediction->m_hijacking = false;
}
CDebugOverlay hooks - prevent game from drawing and get the data we need to draw our own cool lines instead
C++:
#include "../hooks.hh"

#include "../hacks/visuals/nadepred.hh"

void __fastcall csgo::hooks::hkAddSphereOverlay ( x86reg , const c_vector3 & origin , float radius , int theta , int phi , int r , int g , int b , int a , float duration ) {
    /* retn address if you're a weirdo: 5F 5E 8B E5 5D C2 ? ? CC CC CC CC CC CC CC CC CC CC CC CC CC 55 8B EC 83 E4 ? 83 EC ? 53 56 */
    if ( csgo::hacks::nade_prediction->m_hijacking ) {
        csgo::hacks::nadepredentry_t entry {};

        entry.m_worldpos = origin;
        entry.m_kind = 2;

        csgo::hacks::nade_prediction->m_entries.push_back ( entry );

        /* don't draw anything */
        return;
    }

    originals::o_addsphereoverlay ( x86regout , origin , radius , theta , phi , r , g , b , a , duration );
}

void __fastcall csgo::hooks::hkAddBoxOverlay ( x86reg , const c_vector3 & origin , const c_vector3 & mins , const c_vector3 & maxs , const c_vector3 & orientation , int r , int g , int b , int a , float duration ) {
    /* find retn address yourself */
    if ( csgo::hacks::nade_prediction->m_hijacking ) {
        csgo::hacks::nadepredentry_t entry {};

        entry.m_worldpos = origin;
        /* [MENTION=280760]Todo[/MENTION]: color check */
        entry.m_kind = 0;

        csgo::hacks::nade_prediction->m_entries.push_back ( entry );

        /* don't draw anything */
        return;
    }

    originals::o_addboxoverlay ( x86regout , origin , mins , maxs , orientation , r , g , b , a , duration );
}
and finally, draw everything
C++:
    struct nadepredentry_t {
        c_vector3 m_worldpos;

        /* something funny about the sphere rendering in CDebugOverlay - it doesn't ignore Z in contrast to everything else in CDebugOverlay */
        std::uint8_t m_kind; /* 0 - in air, 1 - hit wall, 2 - final sphere (doesn't always draw i think?) */
    };


        void paint ( ) {
            if ( this->m_entries.empty ( ) )
                return;

            this->m_drawing = true;

            for ( auto & iter : this->m_entries ) {
                c_vector3 screenpos {};

                if ( csgo::render::world_to_screen ( iter.m_worldpos , screenpos ) ) {
                    // use your imagination
                }
            }

            this->m_drawing = false;
        }
 
Начинающий
Статус
Оффлайн
Регистрация
7 Авг 2018
Сообщения
40
Реакции[?]
16
Поинты[?]
0
what is the point of this? just do breakability checks as the game does and fix bouncing from players
what does breakability checks have to do with hijacking game's nade prediction? just suggesting another solution to the "nade prediction" problem for lazy people such as myself
 
Забаненный
Статус
Оффлайн
Регистрация
27 Апр 2021
Сообщения
20
Реакции[?]
3
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Looks good
 
Сверху Снизу