diff options
Diffstat (limited to 'aoe2hd/src/main.cpp')
-rwxr-xr-x | aoe2hd/src/main.cpp | 70 |
1 files changed, 54 insertions, 16 deletions
diff --git a/aoe2hd/src/main.cpp b/aoe2hd/src/main.cpp index 2e064f0..521563f 100755 --- a/aoe2hd/src/main.cpp +++ b/aoe2hd/src/main.cpp @@ -1,12 +1,3 @@ -/************************************ - * AoE2 HD Steam - * Minimap/NoFog-Hack (with a restriction) - * - * coded by lnslbrty/dev0, \x90 - * - * This hack may cause desyncs! - ************************************/ - #include <windows.h> #include <psapi.h> #include <stdio.h> @@ -28,20 +19,66 @@ extern "C" { } -int main(int argc, char **argv) +int main() { using namespace std; - (void) argc; - (void) argv; - native_data nd = {0}; initNativeData(&nd); assert(get_module_proc(&nd, "Age of Empires II: HD Edition")); - assert(get_module_base(&nd, "AoK HD.exe")); + assert(get_module_info(&nd, "AoK HD.exe")); ModuleMemory mm(nd); + printf("PlayerCurrent........: 0x%08lX\n", mm.scanProcMem("PlayerCurrent1", "C7 45 FC 01 00 00 00 C7 05 ?? ?? ?? ?? 00 00 00 00 8B 8E 30 01 00 00", 9)); + printf("PlayerCurrent........: 0x%08lX\n", mm.scanMappedMem("PlayerCurrent2", "C7 45 FC 01 00 00 00 C7 05 ?? ?? ?? ?? 00 00 00 00 8B 8E 30 01 00 00", 9)); + printf("PlayerNameArray......: 0x%08lX\n", mm.scanMappedMem("PlayerNameArray", "D8 1F ?? ?? 3E 00 00 00 80 2A ?? ?? 3E 00 00 00", 16)); + printf("PlayerNameArraySub1..: 0x%08lX\n", mm.getPtr("PlayerNameArraySub1", mm.getPtr("PlayerNameArray"), 0x5C)); + printf("PlayerStructArray....: 0x%08lX\n", mm.scanProcMem("PlayerStructArray", "01 34 47 30 01 AC A2 2E 01 00 00 00 00 9C F2 2F 01", -155)); + printf("PlayerStructArraySub1: 0x%08lX\n", mm.getPtr("PlayerStructArraySub1", mm.getPtr("PlayerStructArray"), 0xC8)); + printf("PlayerStructArraySub2: 0x%08lX\n", mm.getPtr("PlayerStructArraySub2", mm.getPtr("PlayerStructArraySub1"), 0x184)); + + mm.ptrSetDependency("PlayerNameArraySub1", "PlayerNameArray"); + mm.ptrSetDependency("PlayerStructArraySub1", "PlayerStructArray"); + mm.ptrSetDependency("PlayerStructArraySub2", "PlayerStructArraySub1"); + + for (unsigned long i = 1; i < 9; ++i) + { + stringstream player; + player << "Player" << i; + mm.getPtr(player.str(), (unsigned long) mm.getPtr("PlayerStructArraySub2"), 0x8 * i); + mm.ptrSetDependency(player.str(), "PlayerStructArraySub2"); + + stringstream player_res; + player_res << "Player" << i << "Resources"; + mm.getPtr(player_res.str(), (unsigned long) mm.getPtr(player.str()), 0x3C); + mm.ptrSetDependency(player_res.str(), player.str()); + + stringstream player_name; + player_name << "Player" << i << "Name"; + mm.getPtr(player_name.str(), (unsigned long) mm.getPtr("PlayerNameArraySub1"), 0xBC + (0x68 * (i-1))); + mm.ptrSetDependency(player_name.str(), "PlayerNameArraySub1"); + + printf("%s: 0x%08lX | Resources: 0x%08lX | Name: 0x%08lX\n", player.str().c_str(), mm.getPtr(player.str()), + mm.getPtr(player_res.str()), mm.getPtr(player_name.str())); + } + + printf("DRAW_HIGHSCORE_CALL..: 0x%08lX\n", mm.scanProcMem("DRAW_HIGHSCORE_CALL", "FF B5 7C FF FF FF 2B 8D 78 FF FF FF 8D 45 D8 50 51 52 8D 45 8C 50 8D 4D C0", 19, false)); + printf("DRAW_HIGHSCORE_FN....: 0x%08lX\n", mm.scanProcMem("DRAW_HIGHSCORE_FN", "55 8B EC 6A FF 68 ?? ?? ?? ?? 64 A1 ?? ?? ?? ?? 50 83 EC 38 A1 ?? ?? ?? ?? 33 C5 89 45 F0 53 56 57 50 8D 45 F4 64 A3 ?? ?? ?? ?? 8B F1 8B 5D 08", 0, false)); + + system("pause"); + + CodeInjector ci(nd); + assert(ci.allocCodeSegment("HighscoreHack")); + CodeGenerator original(nd), inject(nd); + + inject.addCode("8B 85 1C FF FF FF 8A 00 3C 89 0F 85 6B 00 00 00 60 8B 85 1C FF FF FF FF 48 05 83 85 14 FF FF FF 50" + "8B 85 14 FF FF FF C7 00 41 41 41 41 C7 40 04 42 42 42 42 FF B5 20 FF FF FF FF B5 1C FF FF FF" + "8B 85 14 FF FF FF 80 38 00 0F 84 03 00 00 00 40 EB F4 2B 85 14 FF FF FF 50 FF B5 14 FF FF FF" + "FF B5 10 FF FF FF E8 ?? ?? ?? ?? 61 8B 85 1C FF FF FF FF 40 05 83 AD 14 FF FF FF 50" + "E8 ?? ?? ?? ?? E9 ?? ?? ?? ??"); + +#if 0 mm.getPtr("MainClass", nd.proc.modbase, 0x009C7774); mm.getPtr("GameClass", mm.getPtr("MainClass"), 0x4); mm.getPtr("PlayerArray", mm.getPtr("GameClass"), 0x184); @@ -106,7 +143,7 @@ int main(int argc, char **argv) { original.addCode({DUMMY5}); injected.addCode({MAP_SMTH0}).addCode({MAP_SMTHI}).addCode({MAP_SMTH1}).addCode({DUMMY5}) - .addCode({DUMMY5,DUMMY5,DUMMY5,DUMMY5,DUMMY5}); + .addCode({DUMMY5,DUMMY5,DUMMY5,DUMMY5,DUMMY5}); assert(ci.addCode("MapCode", "Smth", injected.buildSize())); injected.setRel32JMP(3, MAP_SMTH, ci.getCodeAddr("MapCode", "Smth")); @@ -135,12 +172,13 @@ int main(int argc, char **argv) cout << cp.toString() << endl; cout << "[PRESS A KEY TO CONTINUE]" << endl; system("pause"); +#endif while (1) { cls( GetStdHandle( STD_OUTPUT_HANDLE )); - while (!mm.recheckPtr("MainClass")) + while (!mm.recheckPtr("PlayerStructArray")) { Sleep(1000); } |