#include <windows.h>
#include <stdio.h>
int addr_tgm = 0x0107BA65;
int addr_tfc = 0x1808172E;
int addr_tcl = 0x0106CAFD;
int addr_tcl2 = 0x010F2C7C;
void Read(HANDLE *handle)
{
int tgm;
int tfc;
int tcl,tcl2;
ReadProcessMemory(handle, (void*)addr_tgm, &tgm,sizeof(int), NULL);
ReadProcessMemory(handle, (void*)addr_tfc, &tfc,sizeof(int), NULL);
ReadProcessMemory(handle, (void*)addr_tcl, &tcl,sizeof(int), NULL);
ReadProcessMemory(handle, (void*)addr_tcl2, &tcl2,sizeof(int), NULL);
printf("TGM: %d\n", tgm & 0x01);
printf("TCL: %d\t", tcl & 0x01);
printf("TCL2: %d\n", tcl2 & 0x01);
printf("TFC: %d\n", tfc & 0x01);
}
void toggle(HANDLE handle, int addr)
{
int data;
ReadProcessMemory(handle, (void*)addr, &data, sizeof(int), NULL);
data ^= 0x01;
WriteProcessMemory(handle,(void*)addr, &data, sizeof(int), NULL);
}
int main()
{
HWND hwnd;
DWORD pid;
hwnd = FindWindowEx(NULL,NULL,NULL,"Fallout3");
if(hwnd == NULL) return 1;
GetWindowThreadProcessId(hwnd, &pid);
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);
char command[32];
while(1)
{
gets(command);
if(!strcmp(command,"read"))
Read(handle);
else if(!strcmp(command,"tgm"))
toggle(handle, addr_tgm);
else if(!strcmp(command,"tfc"))
toggle(handle, addr_tgm);
else if(!strcmp(command,"tcl"))
{
toggle(handle, addr_tcl);
toggle(handle, addr_tcl2);
}
else break;
}
return 0;
}