C++ LW writeusercmddelta for WEAVE

Забаненный
Статус
Оффлайн
Регистрация
1 Фев 2021
Сообщения
42
Реакции[?]
5
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
bool __fastcall Hooked_WriteUsercmdDeltaToBuffer(void* ecx, void*, int slot, bf_write* buf, int from, int to, bool isnewcommand)
{
    static auto  original_fn = g_pClientHook->GetOriginal <WriteUsercmdDeltaToBufferFn>(24);

    static auto retn = csgo->Utils.FindPatternIDA(GetModuleHandleA(g_Modules[fnv::hash(hs::engine_dll::s().c_str())].c_str()),
        hs::write_user_cmd_retn::s().c_str());
    
    if ((_ReturnAddress()) != retn || csgo->DoUnload)
        return original_fn(ecx, slot, buf, from, to, isnewcommand);

    if (!csgo->m_nTickbaseShift)
        return original_fn(ecx, slot, buf, from, to, isnewcommand);

    if (interfaces.engine->IsConnected() && interfaces.engine->IsInGame())
        if (csgo->game_rules->IsFreezeTime())
            return original_fn(ecx, slot, buf, from, to, isnewcommand);

        if (csgo->m_nTickbaseShift <= 0 || csgo->client_state->iChokedCommands > 3)
            return original_fn(ecx, slot, buf, from, to, isnewcommand);
    if (from != -1)
        return true;

    auto final_from = -1;

    uintptr_t frame_ptr;
    __asm mov frame_ptr, ebp;

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

    auto newcmds = *new_commands;
    auto shift = csgo->m_nTickbaseShift;

    csgo->m_nTickbaseShift = 0;
    *backup_commands = 0;

    auto choked_modifier = newcmds + shift;

    if (choked_modifier > 62)
        choked_modifier = 62;

    *new_commands = choked_modifier;

    auto next_cmdnr =csgo->client_state->iChokedCommands + csgo->client_state->nLastOutgoingCommand + 1;
    auto final_to = next_cmdnr - newcmds + 1;





    {
        while (original_fn(ecx, slot, buf, final_from, final_to, true))
        {
            final_from = final_to++;

            if (final_to > next_cmdnr)
                goto next_cmd;
        }

        return false;
    }
next_cmd:

    auto user_cmd =interfaces.input->GetUserCmd(final_from);

    if (!user_cmd)
        return true;

    CUserCmd to_cmd;
    CUserCmd from_cmd;

    from_cmd = *user_cmd;
    to_cmd = from_cmd;

    to_cmd.command_number++;
    to_cmd.tick_count += 200;

    if (newcmds > choked_modifier)
        return true;

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

        from_cmd = to_cmd;
        to_cmd.command_number++;
        to_cmd.tick_count++;
    }

    return true;
}
 
Astty
Пользователь
Статус
Оффлайн
Регистрация
11 Окт 2020
Сообщения
435
Реакции[?]
56
Поинты[?]
0
C++:
bool __fastcall Hooked_WriteUsercmdDeltaToBuffer(void* ecx, void*, int slot, bf_write* buf, int from, int to, bool isnewcommand)
{
    static auto  original_fn = g_pClientHook->GetOriginal <WriteUsercmdDeltaToBufferFn>(24);

    static auto retn = csgo->Utils.FindPatternIDA(GetModuleHandleA(g_Modules[fnv::hash(hs::engine_dll::s().c_str())].c_str()),
        hs::write_user_cmd_retn::s().c_str());
   
    if ((_ReturnAddress()) != retn || csgo->DoUnload)
        return original_fn(ecx, slot, buf, from, to, isnewcommand);

    if (!csgo->m_nTickbaseShift)
        return original_fn(ecx, slot, buf, from, to, isnewcommand);

    if (interfaces.engine->IsConnected() && interfaces.engine->IsInGame())
        if (csgo->game_rules->IsFreezeTime())
            return original_fn(ecx, slot, buf, from, to, isnewcommand);

        if (csgo->m_nTickbaseShift <= 0 || csgo->client_state->iChokedCommands > 3)
            return original_fn(ecx, slot, buf, from, to, isnewcommand);
    if (from != -1)
        return true;

    auto final_from = -1;

    uintptr_t frame_ptr;
    __asm mov frame_ptr, ebp;

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

    auto newcmds = *new_commands;
    auto shift = csgo->m_nTickbaseShift;

    csgo->m_nTickbaseShift = 0;
    *backup_commands = 0;

    auto choked_modifier = newcmds + shift;

    if (choked_modifier > 62)
        choked_modifier = 62;

    *new_commands = choked_modifier;

    auto next_cmdnr =csgo->client_state->iChokedCommands + csgo->client_state->nLastOutgoingCommand + 1;
    auto final_to = next_cmdnr - newcmds + 1;





    {
        while (original_fn(ecx, slot, buf, final_from, final_to, true))
        {
            final_from = final_to++;

            if (final_to > next_cmdnr)
                goto next_cmd;
        }

        return false;
    }
next_cmd:

    auto user_cmd =interfaces.input->GetUserCmd(final_from);

    if (!user_cmd)
        return true;

    CUserCmd to_cmd;
    CUserCmd from_cmd;

    from_cmd = *user_cmd;
    to_cmd = from_cmd;

    to_cmd.command_number++;
    to_cmd.tick_count += 200;

    if (newcmds > choked_modifier)
        return true;

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

        from_cmd = to_cmd;
        to_cmd.command_number++;
        to_cmd.tick_count++;
    }

    return true;
}
Что поменялось?
 
Сверху Снизу