Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 876 Bytes

File metadata and controls

35 lines (26 loc) · 876 Bytes

Always Jump hook

Posts:

SILLY Hook to "always" jump without the game being focused or the key being pressed, just clicking.

Grab og function:

typedef BOOL(WINAPI* tGetKeyboardState)(PBYTE);
tGetKeyboardState oGetKeyboardState = GetKeyboardState;
Our function:

bool alwaysJump = true; //could be toggleable in menu or using a keybind

BOOL WINAPI hkGetKeyboardState(PBYTE lpKeyState)
{
	BOOL result = oGetKeyboardState(lpKeyState);

	if (alwaysJump)
		lpKeyState[VK_CONTROL] |= 0x80;

	return result;
}

Then you can use your desired hook method (detours in my case)

DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)oGetKeyboardState, hkGetKeyboardState);
DetourTransactionCommit()