-
Автор темы
- #1
Enjoy doubletap for xy0 pastas
Код:
GlobalVars.cpp:
int m_nTickbaseShift;
bool bInSendMove;
int32_t nSinceUse;
bool bFirstSendMovePack;
GlobalVars.h:
extern int m_nTickbaseShift;
extern bool bInSendMove;
extern int32_t nSinceUse;
extern bool bFirstSendMovePack;
CInput.h under m_pVerifiedCommands:
inline CUserCmd * GetUserCmd (int nSlot, int sequence_number);
CInput.h up to JoyAxis_t:
CUserCmd * CInput :: GetUserCmd (int nSlot, int sequence_number)
{
typedef CUserCmd * (__thiscall * GetUserCmd_t) (void *, int, int);
return Utils :: GetVFunc <GetUserCmd_t> (this, 8) (this, nSlot, sequence_number);
// return & m_pCommands [sequence_number% MULTIPLAYER_BACKUP];
}
Hooks.h under PaintTraverse_t:
typedef bool (__ thiscall * WriteUsercmdDeltaToBufferFn) (void *, int, void *, int, int, bool);
Hooks.h under LockCursor:
static bool __fastcall hkdWriteUsercmdDeltaToBuffer (void * ecx, void *, int slot, bf_write * buf, int from, int to, bool isnewcommand);
Hooks.cpp:
bool __fastcall Hooks :: hkdWriteUsercmdDeltaToBuffer (void * ecx, void *, int slot, bf_write * buf, int from, int to, bool isnewcommand)
{
static auto ofunct = g_Hooks.pClientHook-> GetOriginal <WriteUsercmdDeltaToBufferFn> (24);
if (Globals :: m_nTickbaseShift <= 0)
return ofunct (ecx, slot, buf, from, to, isnewcommand);
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);
};
int * pNumBackupCommands = (int *) (reinterpret_cast <uintptr_t> (buf) - 0x30);
int * pNumNewCommands = (int *) (reinterpret_cast <uintptr_t> (buf) - 0x2C);
auto net_channel = * reinterpret_cast <NetChannel * *> (reinterpret_cast <uintptr_t> (g_pClientState) + 0x9C);
int32_t new_commands = * pNumNewCommands;
if (! Globals :: bInSendMove) {
if (new_commands <= 0)
return false;
Globals :: bInSendMove = true;
Globals :: bFirstSendMovePack = true;
Globals :: m_nTickbaseShift + = new_commands;
while (Globals :: m_nTickbaseShift> 0) {
CL_SendMove ();
Globals :: bFirstSendMovePack = false;
}
Globals :: bInSendMove = false;
return false;
}
if (! Globals :: bFirstSendMovePack) {
int32_t loss = min (Globals :: m_nTickbaseShift, 10);
Globals :: m_nTickbaseShift - = loss;
net_channel-> m_nOutSequenceNr + = loss;
}
int32_t next_cmdnr = g_pClientState-> m_nLastOutgoingCommand + g_pClientState-> m_nChokedCommands + 1;
int32_t total_new_commands = min (Globals :: m_nTickbaseShift, 62);
Globals :: m_nTickbaseShift - = total_new_commands;
from = -1;
* pNumNewCommands = total_new_commands;
* pNumBackupCommands = 0;
for (to = next_cmdnr - new_commands + 1; to <= next_cmdnr; to ++) {
if (! ofunct (ecx, slot, buf, from, to, isnewcommand))
return false;
from = to;
}
CUserCmd * last_realCmd = g_GameInput-> GetUserCmd (slot, from);
CUserCmd fromCmd;
if (last_realCmd)
fromCmd = * last_realCmd;
CUserCmd toCmd = fromCmd;
toCmd.command_number ++;
toCmd.tick_count + = 200;
for (int i = new_commands; i <= total_new_commands; i ++) {
WriteUsercmd (buf, & toCmd, & fromCmd);
fromCmd = toCmd;
toCmd.command_number ++;
toCmd.tick_count ++;
}
return true;
Hooks.cpp under FrameStageNotify hooking:
g_Hooks.pClientHook -> Hook (24, Hooks :: hkdWriteUsercmdDeltaToBuffer);
Hooks.cpp in Createmove:
if (c_config::get().doubletap && (Globals::pCmd->buttons & IN_ATTACK))
{
if (Globals::nSinceUse++ <3)
Globals::m_nTickbaseShift = TIME_TO_TICKS(2.0f);
}
else {
Globals::nSinceUse = 0;
}
} [/ CODE]