INNER CODE UNIT · C++
SendInput_detour
Chaoses-Ib/IbInputSimulator · Simulator/source/dllmain.cpp:35
static UINT WINAPI SendInput_detour(UINT cInputs, LPINPUT pInputs, int cbSize) {
if (!hook)
return SendInput_real(cInputs, pInputs, cbSize);
return main::send->send_input(pInputs, cInputs);
}
//#TODO: only needed when two or more AHK processes exist?
static inline decltype(GetAsyncKeyState)* GetAsyncKeyState_real = GetAsyncKeyState;
static SHORT WINAPI GetAsyncKeyState_detour(int vKey) {
if (!hook)
return GetAsyncKeyState_real(vKey);
if constexpr (debug)
DebugOStream() << L"GetAsyncKeyState: " << vKey << ", " << main::send->get_key_state(vKey) << std::endl;
return main::send->get_key_state(vKey);
}