-
Автор темы
- #1
Recently I have been working on rapid fire by manipulating my tickbase using WriteUsercmdDeltaToBuffer hook.
The double tap works but it also lags me on community servers like this -
if i am on local server it works fine without lag.
Is there a way to minimize / remove the lag or is there any information regarding this?
Hook -
[CODE = cpp] bool __fastcall Hooks :: WriteUsercmdDeltaToBuffer_hook (void * ECX, void * EDX, int nSlot, bf_write * buf, int from, int to, bool isNewCmd)
{
static DWORD WriteUsercmdDeltaToBufferReturn = (DWORD) Utils :: FindSignature ("engine.dll", "84 C0 74 04 B0 01 EB 02 32 C0 8B FE 46 3B F3 7E C9 84 C0 0F 84);
static auto sendmovecall = Utils :: FindSignature ("engine.dll", "84 C0 74 04 B0 01 EB 02 32 C0 8B FE 46 3B F3 7E C9 84 C0 0F 84????");
static auto ofunct = g_Hooks.pClientHook-> GetOriginal <WriteUsercmdDeltaToBufferFn> (24);
if (_ReturnAddress ()! = (void *) sendmovecall ||
g :: tickbaseshift <= 0)
{
g :: tickbaseshift = 0;
return ofunct (ECX, nSlot, buf, from, to, isNewCmd);
}
if (from! = -1)
return true;
auto CL_SendMove = [] () {
using CL_SendMove_t = void (__ fastcall *) (void);
static CL_SendMove_t CL_SendMoveF = (CL_SendMove_t) Utils :: FindSignature ("engine.dll", "55 8B EC A1???? 81 EC???? B9???? 53 8B 98");
CL_SendMoveF ();
};
auto WriteUsercmd = [] (bf_write * buf, CUserCmd * in, CUserCmd * out) {
using WriteUsercmd_t = void (__ fastcall *) (bf_write *, CUserCmd *, CUserCmd *);
static WriteUsercmd_t WriteUsercmdF = (WriteUsercmd_t) Utils :: FindSignature ("client_panorama.dll", "55 8B EC 83 E4 F8 51 53 56 8B D9 8B 0D");
WriteUsercmdF (buf, in, out);
};
// number of backup and new commands
int * pNumBackupCommands = (int *) ((std :: uintptr_t) buf - 0x30);
int * pNumNewCommands = (int *) ((std :: uintptr_t) buf - 0x2C);
auto net_channel = * reinterpret_cast <NetChannel * *> (reinterpret_cast <uintptr_t> (g_pClientState) + 0x9C);
int32_t new_commands = * pNumNewCommands;
// Manipulate CLC_Move
auto nextcmdnumber = g_pClientState-> lastoutgoingcommand + g_pClientState-> chokedcommands + 1;
auto totalnewcommands = std :: min (g :: tickbaseshift, 16);
g :: tickbaseshift - = totalnewcommands;
from = -1;
* pNumNewCommands = totalnewcommands;
* pNumBackupCommands = 0;
// generate real cmd's
for (to = nextcmdnumber - new_commands + 1; to <= nextcmdnumber; to ++)
{
if (! ofunct (ECX, nSlot, buf, from, to, true))
return false;
from = to;
}
auto lastrealcmd = g_pInput-> GetUserCmd (nSlot, from);
CUserCmd fromcmd;
if (lastrealcmd)
fromcmd = * lastrealcmd;
CUserCmd tocmd = fromcmd;
tocmd.command_number ++;
tocmd.tick_count + = (TIME_TO_TICKS (0.5f) + nextcmdnumber);
// generate fake cmd's
for (int i = new_commands; i <= totalnewcommands; i ++)
{
WriteUsercmd (buf, & tocmd, & fromcmd);
fromcmd = tocmd;
tocmd.command_number ++;
tocmd.tick_count ++;
}
// send them in all together
CL_SendMove ();
transmit (true); // works without this
return true;
} [/ CODE]
create move -
The double tap works but it also lags me on community servers like this -
Пожалуйста, авторизуйтесь для просмотра ссылки.
if i am on local server it works fine without lag.
Is there a way to minimize / remove the lag or is there any information regarding this?
Hook -
[CODE = cpp] bool __fastcall Hooks :: WriteUsercmdDeltaToBuffer_hook (void * ECX, void * EDX, int nSlot, bf_write * buf, int from, int to, bool isNewCmd)
{
static DWORD WriteUsercmdDeltaToBufferReturn = (DWORD) Utils :: FindSignature ("engine.dll", "84 C0 74 04 B0 01 EB 02 32 C0 8B FE 46 3B F3 7E C9 84 C0 0F 84);
static auto sendmovecall = Utils :: FindSignature ("engine.dll", "84 C0 74 04 B0 01 EB 02 32 C0 8B FE 46 3B F3 7E C9 84 C0 0F 84????");
static auto ofunct = g_Hooks.pClientHook-> GetOriginal <WriteUsercmdDeltaToBufferFn> (24);
if (_ReturnAddress ()! = (void *) sendmovecall ||
g :: tickbaseshift <= 0)
{
g :: tickbaseshift = 0;
return ofunct (ECX, nSlot, buf, from, to, isNewCmd);
}
if (from! = -1)
return true;
auto CL_SendMove = [] () {
using CL_SendMove_t = void (__ fastcall *) (void);
static CL_SendMove_t CL_SendMoveF = (CL_SendMove_t) Utils :: FindSignature ("engine.dll", "55 8B EC A1???? 81 EC???? B9???? 53 8B 98");
CL_SendMoveF ();
};
auto WriteUsercmd = [] (bf_write * buf, CUserCmd * in, CUserCmd * out) {
using WriteUsercmd_t = void (__ fastcall *) (bf_write *, CUserCmd *, CUserCmd *);
static WriteUsercmd_t WriteUsercmdF = (WriteUsercmd_t) Utils :: FindSignature ("client_panorama.dll", "55 8B EC 83 E4 F8 51 53 56 8B D9 8B 0D");
WriteUsercmdF (buf, in, out);
};
// number of backup and new commands
int * pNumBackupCommands = (int *) ((std :: uintptr_t) buf - 0x30);
int * pNumNewCommands = (int *) ((std :: uintptr_t) buf - 0x2C);
auto net_channel = * reinterpret_cast <NetChannel * *> (reinterpret_cast <uintptr_t> (g_pClientState) + 0x9C);
int32_t new_commands = * pNumNewCommands;
// Manipulate CLC_Move
auto nextcmdnumber = g_pClientState-> lastoutgoingcommand + g_pClientState-> chokedcommands + 1;
auto totalnewcommands = std :: min (g :: tickbaseshift, 16);
g :: tickbaseshift - = totalnewcommands;
from = -1;
* pNumNewCommands = totalnewcommands;
* pNumBackupCommands = 0;
// generate real cmd's
for (to = nextcmdnumber - new_commands + 1; to <= nextcmdnumber; to ++)
{
if (! ofunct (ECX, nSlot, buf, from, to, true))
return false;
from = to;
}
auto lastrealcmd = g_pInput-> GetUserCmd (nSlot, from);
CUserCmd fromcmd;
if (lastrealcmd)
fromcmd = * lastrealcmd;
CUserCmd tocmd = fromcmd;
tocmd.command_number ++;
tocmd.tick_count + = (TIME_TO_TICKS (0.5f) + nextcmdnumber);
// generate fake cmd's
for (int i = new_commands; i <= totalnewcommands; i ++)
{
WriteUsercmd (buf, & tocmd, & fromcmd);
fromcmd = tocmd;
tocmd.command_number ++;
tocmd.tick_count ++;
}
// send them in all together
CL_SendMove ();
transmit (true); // works without this
return true;
} [/ CODE]
create move -
- if (GetAsyncKeyState ('I'))
- g :: tickbaseshift = TIME_TO_TICKS (2.0f);
- else
- g :: tickbaseshift = TIME_TO_TICKS (0.0f);