Writing to a pointer and offsets
Hey, so I was messing around with an old game and found an address that when continuously written to with a new value in a loop, allows you to fly. Of course, the address changes each time the game starts so I've been trying to find a pointer and offsets to write to in-order to remove the hassle of finding the address each time in cheat engine. My process for this was pointer scanning with a couple different addresses, and I eventually found a pointer and offsets that return the right value each time I restart the game. Pic of that:
https://imgur.com/a/0Xj5HG5
So I have my pointer and offsets, but I've run into a couple issues. My first one is the "TTREngine.exe" + 022D4E14 (Can't see the second part on pic but it's there). I'm not sure how to get the value of TTREngine.exe, so I went into Pointer Scan and found this: https://imgur.com/a/Jqbvk0D
I'm guessing that that is the value for TTREngine.exe, but I might be wrong so that's my first question.
My next question is in the actual coding part, as I'm wondering how to correctly add the pointer and offsets.
This is my current code, which is not working:
Thanks for any help.
https://imgur.com/a/0Xj5HG5
So I have my pointer and offsets, but I've run into a couple issues. My first one is the "TTREngine.exe" + 022D4E14 (Can't see the second part on pic but it's there). I'm not sure how to get the value of TTREngine.exe, so I went into Pointer Scan and found this: https://imgur.com/a/Jqbvk0D
I'm guessing that that is the value for TTREngine.exe, but I might be wrong so that's my first question.
My next question is in the actual coding part, as I'm wondering how to correctly add the pointer and offsets.
This is my current code, which is not working:
Code:
#include <iostream>
#include <Windows.h>
#include <string>
using namespace std;
int main()
{
int readTest = 0;
DWORD val2;
long int newValue = 1095725740;
int valTest = 3238873159;
cout << newValue << endl;
Sleep(1000);
HWND hwnd = FindWindowA(NULL, "Toontown Rewritten");
if (hwnd == NULL)
{
cout << "Can't find window." << endl;
Sleep(3000);
return 0;
}
else
{
cout << "Found Window." << endl;
Sleep(3000);
DWORD procId;
GetWindowThreadProcessId(hwnd, &procId);
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procId);
DWORD valtoWrite = 0x001F0000 + 0x022D4E14+0x730+0x264+0x12C+0x50+0x154; // This is what I'm trying to write to
if (procId == NULL)
{
cout << "Process Not Found" << endl;
Sleep(3000);
return 0;
}
else
{
for (;;)
{
if (GetKeyState(VK_SPACE))
{
WriteProcessMemory(handle, (LPVOID)valtoWrite, &newValue, sizeof(newValue), 0);
cout << valtoWrite << endl;
}
Sleep(1);
}
}
}
}