Escalation Project
-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
bool __fastcall hooks::hooked_writeusercmddeltatobuffer(void* ecx, void* edx, int slot, bf_write* buf, int from, int to, bool is_new_command)
{
static auto original_fn = client_hook->get_func_address <WriteUsercmdDeltaToBuffer_t>(24);
if (!g_ctx.globals.tickbase_shift)
return original_fn(ecx, slot, buf, from, to, is_new_command);
if (from != -1)
return true;
auto final_from = -1;
uintptr_t frame_ptr{};
__asm {
mov frame_ptr, ebp;
}
int* backup_commands = reinterpret_cast<int*>(frame_ptr + 0xFD8);
int* new_commands = reinterpret_cast<int*>(frame_ptr + 0xFDC);
int32_t newcmds = *new_commands;
auto shift_amt = g_ctx.globals.tickbase_shift;
g_ctx.globals.tickbase_shift = 0;
*backup_commands = 0;
int choked_modifier = newcmds + shift_amt;
if (choked_modifier > 62)
choked_modifier = 62;
*new_commands = choked_modifier;
const int next_cmdnr = m_clientstate()->iChokedCommands + m_clientstate()->nLastOutgoingCommand + 1;
int _to = next_cmdnr - newcmds + 1;
if (_to <= next_cmdnr)
{
while (original_fn(ecx, slot, buf, final_from, _to, true))
{
final_from = _to++;
if (_to > next_cmdnr)
{
goto LABEL_11; // jump out of scope.
}
}
return false;
}
LABEL_11:
auto* ucmd = m_input()->GetUserCmd(final_from);
if (!ucmd)
return true;
CUserCmd to_cmd{};
CUserCmd from_cmd{};
from_cmd = *ucmd;
to_cmd = from_cmd;
++to_cmd.m_command_number;
to_cmd.m_tickcount += 1.f / m_globals()->m_intervalpertick * 2;
if (newcmds > choked_modifier)
return true;
for (int i = (choked_modifier - newcmds + 1); i > 0; --i)
{
WriteUserСmd(buf, &to_cmd, &from_cmd);
from_cmd = to_cmd;
++to_cmd.m_command_number;
++to_cmd.m_tickcount;
}
return true;
}
Последнее редактирование: