void WriteUsercmd(bf_write* buf, CUserCmd* in, CUserCmd* out) { static DWORD WriteUsercmdF = (DWORD)csgo->Utils.FindPatternIDA(GetModuleHandleA(g_Modules[fnv::hash(hs::client_dll::s().c_str())].c_str()), hs::write_user_cmd::s().c_str()); __asm { mov ecx, buf mov edx, in push out call WriteUsercmdF add esp, 4 } } bool __fastcall Hooked_WriteUsercmdDeltaToBuffer(void* ecx, void*, int slot, bf_write* buf, int from, int to, bool isnewcommand) { static auto ofunct = g_pClientHook->GetOriginal (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 ofunct(ecx, slot, buf, from, to, isnewcommand); if (interfaces.engine->IsConnected() && interfaces.engine->IsInGame()) { if (csgo->m_nTickbaseShift <= 0 || csgo->client_state->iChokedCommands > 3) return ofunct(ecx, slot, buf, from, to, isnewcommand); if (from != -1) return true; uintptr_t stackbase; __asm mov stackbase, ebp; CCLCMsg_Move_t* msg = reinterpret_cast(stackbase + 0xFCC); auto net_channel = *reinterpret_cast (reinterpret_cast (csgo->client_state) + 0x9C); int32_t new_commands = msg->m_nNewCommands; int32_t next_cmdnr = csgo->client_state->nLastOutgoingCommand + csgo->client_state->iChokedCommands + 1; int32_t total_new_commands = min(csgo->m_nTickbaseShift, 16); csgo->m_nTickbaseShift -= total_new_commands; from = -1; msg->m_nNewCommands = total_new_commands; msg->m_nBackupCommands = 0; for (to = next_cmdnr - new_commands + 1; to <= next_cmdnr; to++) { if (!ofunct(ecx, slot, buf, from, to, true)) return false; from = to; } CUserCmd* last_realCmd = interfaces.input->GetUserCmd(slot, from); CUserCmd fromCmd; if (last_realCmd) fromCmd = *last_realCmd; CUserCmd toCmd = fromCmd; toCmd.command_number++; toCmd.tick_count += interfaces.global_vars->tickcount + 2 * interfaces.global_vars->tickcount; for (int i = new_commands; i <= total_new_commands; i++) { WriteUsercmd(buf, &toCmd, &fromCmd); fromCmd = toCmd; toCmd.command_number++; toCmd.tick_count += interfaces.global_vars->tickcount + 2 * interfaces.global_vars->tickcount; } return true; } else return ofunct(ecx, slot, buf, from, to, isnewcommand); }