Does it work for you? Also, how would I use a pointer for this? I never understood pointers, and I'm not all that big on C(*) languages, so I use other langs.
---------- Post added at 01:21 AM ---------- Previous post was at 01:20 AM ----------
I don't look at MW3 so sorry...
I also changed the degree domain, idk why I thought it was 160...
UPDATE:
Code:
// main.cpp
#include "main.h"
void pauseConsole(int sleepTime);
int main(int argc, char* argv[])
{
SetConsoleTitleA(TEXT("Modern Warfare 2 - Field of View Changer"));
HWND hWnd = FindWindow(NULL, TEXT("Modern Warfare 2"));
if(hWnd == NULL)
{
MessageBoxA(NULL, TEXT("Couldn't find Modern Warfare 2 window! Please start Modern Warfare 2 before this program"), TEXT("Error"), 0x00000010L | 0x00000000L);
}
else
{
DWORD pId;
GetWindowThreadProcessId(hWnd, &pId);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
if(!hProc)
{
MessageBoxA(NULL, TEXT("Couldn't open process"), TEXT("Error"), 0x00000010L | 0x00000000L);
}
else
{
for(;;)
{
std::cout << "What degree would you like to set your field of view? (Domain = 1-180): ";
std::cin >> fov;
if(fov > 180 || fov < 1)
{
std::cout << "Error: Cannont set field of view below 1, nor greater than 180, please only use values within the domain" << std::endl;
}
else
{
WriteProcessMemory(hProc, (LPVOID)0x063FB5C0, &fov, sizeof(fov), NULL);
WriteProcessMemory(hProc, (LPVOID)0x063FB5D0, &fov, sizeof(fov), NULL);
}
}
/* CloseHandle(hProc); */
}
}
return 0;
}
void pauseConsole(int sleepTime)
{
if(sleepTime == 0)
{
std::clog << "\nPress <Enter> to continue...";
std::cin.clear();
std::cin.ignore();
}
else
{
Sleep(sleepTime);
std::clog << "\nPress <Enter> to continue...";
std::cin.clear();
std::cin.ignore();
}
}
Code:
//main.h
#pragma once
#ifndef MAIN_H
#define MAIN_H
#include <iostream>
#include <windows.h>
float fov;
#endif