C++:
#include <kthook/kthook.hpp>
bool state = false;
kthook::kthook_simple<unsigned(__stdcall*)(void*, unsigned, unsigned, unsigned)> hook{
0x747EB0,
[](const auto& hook, void* hwnd, unsigned umsg, unsigned wparam, unsigned lparam) {
if (uMsg == WM_KEYDOWN && wparam == VK_F2 && !(lparam & KF_REPEAT)) {
state = !state;
for (auto value : {0x5109AC, 0x5109C5, 0x5231A6, 0x52322D, 0x5233BA}) {
unsigned old;
VirtualProtect(reinterpret_cast<void*>(value), 1, PAGE_READWRITE, &old);
if (state) *reinterpret_cast<unsigned char*>(value) = 0xEB;
else *reinterpret_cast<unsigned char*>(value) = (value <= 0x5109C5) ? 0x7A : 0x75;
VirtualProtect(reinterpret_cast<void*>(value), 1, old, &old);
}
}
return hook.get_trampoline()(hwnd, umsg, wparam, lparam);
}
}