Skip to content

Instantly share code, notes, and snippets.

@ohkeenan
Last active May 8, 2017 12:12
Show Gist options
  • Save ohkeenan/df5aac51ed8555a0a2f326cc852c17c8 to your computer and use it in GitHub Desktop.
Save ohkeenan/df5aac51ed8555a0a2f326cc852c17c8 to your computer and use it in GitHub Desktop.
Oldie HoMM3 unlimited walk & free castle buildings with hotkeys
/* HoMM3 version unknown - offsets are probably different in the HoMM3 Complete GoG
so don't bother. They're easy to find though with a memory searcher (Tsearch, Artmoney, CheatEngine, etc.)
This was made around 2002 and it's pretty basic but feel free to use it anyway */
#include <iostream>
#include <windows.h>
using namespace std;
bool f5tog = true;
bool f6tog = true;
int main ()
{
HWND hWnd;
DWORD dwID;
HANDLE hProcess;
hWnd = FindWindowA(NULL, "Heroes of Might and Magic III");
cout << "Searching HOMMIII Window...\n";
if(!hWnd){
hWnd = FindWindowA(NULL, "Heroes of Might and Magic III");
cout << "Couldn't find the window, try again :(\n";
system("pause");
return(0);
}
cout << "Found HOMMIII Window!!!\n";
GetWindowThreadProcessId(hWnd, &dwID);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, NULL, dwID);
cout << "Happy hacking :)\n";
while(1)
{
if(GetAsyncKeyState(VK_F5))
{
if (f5tog == true){
char f5on[3]={0x090,0x090,0x090};
WriteProcessMemory(hProcess,(LPVOID)0x0048118c,(LPVOID)&f5on,3,NULL);
cout << "Unlimited Walk ON ";
f5tog = false;
}
else {
char f5off[3]={0x089,0x056,0x04d};
WriteProcessMemory(hProcess,(LPVOID)0x0048118c,(LPVOID)&f5off,3,NULL);
cout << "Unlimited Walk OFF ";
f5tog = true;
}
}
if(GetAsyncKeyState(VK_F6))
{
if (f6tog == true){
char f6on[2]={0x090,0x090};
WriteProcessMemory(hProcess,(LPVOID)0x0048118c,(LPVOID)&f6on,2,NULL);
cout << "Free Castle Build ON ";
f6tog = false;
}
else {
char f6off[2]={0x029,0x011};
WriteProcessMemory(hProcess,(LPVOID)0x0048118c,(LPVOID)&f6off,2,NULL);
cout << "Free Castle Build OFF ";
f6tog = true;
}
}
Sleep(120);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment