The last two posts discussed how to develop an Age of Mythology map hack. This was done by finding and reverse engineering the parts of the game responsible for toggling the map state (black overlay, fog of war, full reveal) and invoking those functions through a DLL that is injected into the game process. This short post will complete the series by providing the source code for an injector that will inject the newly developed hack DLL into the Age of Mythology process. The hack will work in multiplayer, and in the original game as well as the extended edition.
The code can be found here and is generally pretty self-explanatory. The map hack DLL exports a KeyboardProc callback, which handles the logic of toggling the map state depending on what keys the user enters (7, 8, 9, 0 keys). The injector installs a keyboard hook on the game process, which effectively injects the hack DLL into the game process and makes the KeyboardProc callback active. At this point, all keystrokes going to the game will be intercepted and checked against the four special toggle keys. If a toggle key is hit, then the corresponding function to set the map state will be invoked.
Missed the earlier posts?
Game Hacking (1/3): The Hard Way
Game Hacking (2/3): The Easy Way
Thanks for reading and follow on Twitter for more updates.
Hi there,
I’m having a little problem getting this to attach to the game process. There are no aom processes in the drop down box (neither EE or aot) and refresh won’t show them. If I type in the exe location directly, it just gives the error ‘Could not initalize game process.’.
Any ideas?
Thank you!
Comment by HollowFrank — June 30, 2022 @ 6:44 AM
Sorry, I simply had to give it access privilges.
It seems to be working well for the original game but EE whenever you press 7-0, it crashes the game.
Comment by HollowFrank — June 30, 2022 @ 7:15 AM
This should work for version 2.8.5288199 for the English version (not sure about other languages). The code is expecting the map reveal function to be at a certain offset from where the game is loaded. This will change for different versions of the game so that is the cause of the crash for you. You can follow the written posts and find the appropriate offset for your version of the game. I’ll likely revisit this and make it to work via signature scanning for the function so that patches aren’t a problem in the future, but no guarantee on a timeline for when that will happen.
Comment by admin — June 30, 2022 @ 7:36 AM