#include "stdafx.h"
#include <tlhelp32.h>
#define ENGLT 0x485E10
bool charPress, ptcFPS;
bool IsGameReadyForHook()
{
if( GetModuleHandleA( "d3d9.dll" ) != NULL
&& GetModuleHandleA( "ClientFX.fxd" ) != NULL
&& GetModuleHandleA( "CShell.dll" ) != NULL )
return true;
return false;
}
void RunConsoleCommand(char *command)
{
typedef int (__cdecl* RunConsoleCommand_t)(char *cmd);
RunConsoleCommand_t pRunConsoleCommand = (RunConsoleCommand_t) ENGLT;
pRunConsoleCommand(command);
delete command;
}
DWORD __stdcall Keys(LPVOID)
{
for(;;Sleep(20))
{
if (GetAsyncKeyState(VK_NUMPAD0))
{
ptcFPS = !ptcFPS;
charPress = true;
}
}
}
DWORD __stdcall Hacks(LPVOID)
{
while(!IsGameReadyForHook() )
{
Sleep(150);
}
for(;;Sleep(20))
{
if (charPress)
{
if (ptcFPS)
{
RunConsoleCommand("ShowFps 1");
}
else
{
RunConsoleCommand("ShowFps 0");
}
charPress = false;
}
}
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
{
ltFound = true;
ptcFPS = false;
charPress = false;
CreateThread(NULL, NULL, Keys, NULL, NULL, NULL);
CreateThread(NULL, NULL, Hacks, NULL, NULL, NULL);
}
return true;
}
