Code:
#include <windows.h>
#define Addy1 0xRECOILADDY
#define Addy2 0xNOSPREADADDY
void NoSprecoil(bool what)
{
DWORD oldprotect;
if (what == true)
{
VirtualProtect((LPVOID)(Addy1), 4, PAGE_EXECUTE_READWRITE, &oldprotect);
memcpy((LPVOID)Addy1, "\xBYTEON", 1); // change 1 to 2 if you have to replace both bytes.
memcpy((LPVOID)Addy2, "\xBYTEON", 1); // change 1 to 2 if you have to replace both bytes.
VirtualProtect((LPVOID)(Addy1), 4, oldprotect, &oldprotect);
}
else
{
VirtualProtect((LPVOID)(Addy1), 4, PAGE_EXECUTE_READWRITE, &oldprotect);
memcpy((LPVOID)Addy1, "\xBYTEOFF", 1); // change 1 to 2 if you have to replace both bytes.
memcpy((LPVOID)Addy2, "\xBYTEOFF", 1); // change 1 to 2 if you have to replace both bytes.
VirtualProtect((LPVOID)(Addy1), 4, oldprotect, &oldprotect);
}
}
DWORD WINAPI Loop()
{
for (;; Sleep(125))
{
if (GetAsyncKeyState(VK_F3))
{
NoSprecoil(true);
}
if (GetAsyncKeyState(VK_F4))
{
NoSprecoil(false);
}
}
}
BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpvReserved)
{
switch (dwReason)
{
case 1:
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Loop, 0, 0, 0);
break;
}
return true;
}