Исходник Weave dt to sup

Участник
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
339
Реакции[?]
209
Поинты[?]
115K
C++:
void copy_command( CUserCmd* cmd, int tickbase_shift ) {
    auto commands_to_add = 0;
    do {
        auto sequence_number = commands_to_add + cmd->m_command_number;

        auto command = g_csgo.m_input->GetUserCmd( sequence_number );
        auto verified_command = g_csgo.m_input->GetVerifiedCmd( sequence_number );

        memcpy( command, cmd, sizeof( CUserCmd ) );

        // fix command prediction
        if ( command->m_tick != INT_MAX && g_csgo.m_cl->m_delta_tick > 0 ) {
            g_csgo.m_prediction->Update( g_csgo.m_cl->m_delta_tick, true, g_csgo.m_cl->m_last_command_ack, g_csgo.m_cl->m_last_outgoing_command + g_csgo.m_cl->m_choked_commands );
        }

        // update command
        command->m_command_number = sequence_number;
        command->m_predicted = command->m_tick != INT_MAX;

        ++g_csgo.m_cl->m_choked_commands;

        // fix net channel
        if ( g_csgo.m_cl->m_net_channel ) {
            ++g_csgo.m_cl->m_net_channel->m_choked_packets;
            ++g_csgo.m_cl->m_net_channel->m_out_seq;
        }

        // normalize angles
        // command->m_view_angles = math::normalize( command->m_view_angles ); // im not sure if thats right

        // store commands
        memcpy( &verified_command->m_cmd, command, sizeof( CUserCmd ) );
        verified_command->m_crc = command->GetChecksum( );

        // add commands
        ++commands_to_add;
    } while ( commands_to_add != tickbase_shift );

    // setup prediction
    //g_csgo.m_prediction->previous_ack_had_errors = true;
    g_csgo.m_prediction->m_commands_predicted = 0;
}

void doubletap_weave::reset_value( ) {
    skip_ticks = 0;
    shift_amount = 0;
}

bool doubletap_weave::double_tap( ) {
    static int last_doubletap = 0;
    double_tap_enabled = true;
    static auto recharge_double_tap = false;

    if ( recharge_double_tap )
    {
        recharge_double_tap = false;
        recharging_double_tap = true;
        reset_value( );
        return false;
    }

    if ( recharging_double_tap )
    {
        if ( ( /*g_Ragebot->IsAbleToShoot( vars.ragebot.recharge_time ) ||*/ fabs( fixed_tickbase - last_doubletap ) > game::TIME_TO_TICKS( 0.5f ) ) /*&& !g_Ragebot->ShouldWork*/ )
        {
            last_doubletap = 0;

            recharging_double_tap = false;
            double_tap_key = true;
            dt_bullets = 0;
        }
        else if ( g_cl.m_cmd->m_buttons & IN_ATTACK ) {
            last_doubletap = fixed_tickbase;
            dt_bullets++;
        }
    }

    if ( !settings.enable )
    {
        double_tap_enabled = false;
        double_tap_key = false;
        reset_value( );
        return false;
    }

    static bool last_tick_enabled = false;
//    bool dt2;
    auto dt = UTILS::KeybindMethod( settings.m_dt_key, settings.dtstyle, &double_tap_key );

    if ( !dt ) {
        double_tap_enabled = false;
        double_tap_key = false;
        return false;
    }
    if ( g_csgo.m_gamerules->m_bFreezePeriod( ) || g_cl.m_local->m_fFlags( ) & FL_FROZEN ) {
        double_tap_enabled = false;
        if ( dt_bullets == 0 && last_tick_enabled ) {
            auto next_command_number = g_cl.m_cmd->m_command_number + 1;
            auto user_cmd = g_csgo.m_input->GetUserCmd( next_command_number );

            memcpy( user_cmd, g_cl.m_cmd, sizeof( CUserCmd ) );
            user_cmd->m_command_number = next_command_number;

            /*
                Vector vMove( user_cmd->forwardmove, user_cmd->sidemove, user_cmd->upmove );
                float flSpeed = sqrt( vMove.x * vMove.x + vMove.y * vMove.y ), flYaw;
                Vector vMove2;
                Math::VectorAngles( vMove, vMove2 );
                vMove2.Normalize( );
                flYaw = math::deg_to_rad( user_cmd->viewangles.y - csgo->original.y + vMove2.y );
                user_cmd->forwardmove = cos( flYaw ) * flSpeed;
                user_cmd->sidemove = sin( flYaw ) * flSpeed;
            */

            copy_command( user_cmd, 14 );

            recharge_double_tap = true;
            *g_cl.m_packet = true;
            last_tick_enabled = false;
        }
        reset_value( );
        return false;
    }
    last_tick_enabled = true;
    auto max_tickbase_shift = 14;
    bool can_dt = g_cl.m_weapon->IsGun( ) && g_cl.m_weapon->m_iItemDefinitionIndex( ) != ZEUS && g_cl.m_weapon->m_iItemDefinitionIndex( ) != REVOLVER;
    bool is_firing = g_cl.m_cmd->m_buttons & IN_ATTACK;

    if ( can_dt ) {
        if ( g_cl.m_cmd->m_buttons & IN_ATTACK ) {
            auto next_command_number = g_cl.m_cmd->m_command_number + 1;
            auto user_cmd = g_csgo.m_input->GetUserCmd( next_command_number );

            memcpy( user_cmd, g_cl.m_cmd, sizeof( CUserCmd ) );
            user_cmd->m_command_number = next_command_number;

            user_cmd->m_forward_move = 0.0f;
            user_cmd->m_side_move = 0.0f;

            auto cmd_backup = g_cl.m_cmd;
            g_cl.m_cmd = user_cmd;
    /*
            if ( g_Binds[bind_peek_assist ].active )
                g_Ragebot->FastStop( );
    */
            g_cl.m_cmd = cmd_backup;

            copy_command( user_cmd, max_tickbase_shift );

            recharge_double_tap = true;
            double_tap_enabled=false;
            double_tap_key=false;
            last_doubletap = fixed_tickbase;
            dt_bullets++;
        }
        else
            shift_amount = max_tickbase_shift;
    }

    return true;
}
C++:
    bool __fastcall write_user_cmd_delta_to_buffer( const std::uintptr_t ecx, const std::uintptr_t edx, const int slot, bf_write* const buffer, int from, int to, const bool is_new_cmd ) {
        if ( !g_cl.m_local || !g_cl.m_local->alive() )
            return nem_hooks::orig_write_user_cmd_delta_to_buffer( ecx, edx, slot, buffer, from, to, is_new_cmd );

        if ( !doubletap_weave::shift_amount )
            return nem_hooks::orig_write_user_cmd_delta_to_buffer( ecx, edx, slot, buffer, from, to, is_new_cmd );

        g_notify.add( "working 1" );

        if ( from != -1 )
            return true;

        auto final_from = -1;

        // fix frame_prt
        uintptr_t frame_ptr = 0;
        __asm mov frame_ptr, ebp;

        // backup commands
        auto backup_commands = reinterpret_cast < int* > ( frame_ptr + 0xFD8 );
        auto new_commands = reinterpret_cast < int* > ( frame_ptr + 0xFDC );


            auto newcmds = *new_commands;
        auto shift = doubletap_weave::shift_amount;

        doubletap_weave::shift_amount = 0;
        *backup_commands = 0;

        auto choked_modifier = newcmds + shift;
        if ( choked_modifier > 62 )
            choked_modifier = 62;

        *new_commands = choked_modifier;

        // next
        auto next_cmdnr = g_csgo.m_cl->m_choked_commands + g_csgo.m_cl->m_last_outgoing_command + 1;
        auto final_to = next_cmdnr - newcmds + 1;

        if ( final_to <= next_cmdnr ) {
            while ( nem_hooks::orig_write_user_cmd_delta_to_buffer( ecx, edx, slot, buffer, from, to, true ) ) {
                final_from = final_to++;
                g_notify.add( "working 2" );

                if ( final_to > next_cmdnr )
                    goto next_cmd;
            }

            return false;
        }
    next_cmd:
        // user cmd setup
        auto user_cmd = g_csgo.m_input->GetUserCmd( final_from );
        if ( !user_cmd )
            return true;

        g_notify.add( "working 3" );

        CUserCmd to_cmd;
        CUserCmd from_cmd;

        from_cmd = *user_cmd;
        to_cmd = from_cmd;

        to_cmd.m_command_number++;
        to_cmd.m_tick += 200;

        if ( newcmds > choked_modifier )
            return true;

        for ( auto i = choked_modifier - newcmds + 1; i > 0; --i ) {
            write_user_cmd( buffer, &to_cmd, &from_cmd );

            from_cmd = to_cmd;
            to_cmd.m_command_number++;
            to_cmd.m_tick++;
        }

        return true;
    }
 
Пользователь
Статус
Оффлайн
Регистрация
31 Дек 2016
Сообщения
81
Реакции[?]
30
Поинты[?]
2K
doubletap_weave::shift_amount
nem_hooks::orig_write_user_cmd_delta_to_buffer
??????????????????????????????????????????????????????????????????????????????
 
Сверху Снизу