diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-03-26 21:38:15 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-03-26 21:38:15 +0100 |
commit | 7658321752585beb05668257628bc2ec3ddc17ef (patch) | |
tree | 67aca50eaa093a462269eabb7c91ac9e8d14f228 /aoe2hd/include | |
parent | 65686da6fc1f91e3a831347703c758ea3ca97c3e (diff) |
replaced age2hd cheat with a actually working one.. or at least worked
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'aoe2hd/include')
-rwxr-xr-x | aoe2hd/include/CodeGenerator.h | 41 | ||||
-rwxr-xr-x | aoe2hd/include/CodeInjector.h | 63 | ||||
-rwxr-xr-x | aoe2hd/include/CodePatcher.h | 45 | ||||
-rwxr-xr-x | aoe2hd/include/ModuleMemory.h | 61 | ||||
-rwxr-xr-x | aoe2hd/include/aoe2hd.h | 58 | ||||
-rwxr-xr-x | aoe2hd/include/native.h | 64 | ||||
-rwxr-xr-x | aoe2hd/include/utils.h | 13 |
7 files changed, 0 insertions, 345 deletions
diff --git a/aoe2hd/include/CodeGenerator.h b/aoe2hd/include/CodeGenerator.h deleted file mode 100755 index 2d97d86..0000000 --- a/aoe2hd/include/CodeGenerator.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef CODEGENERATOR_H -#define CODEGENERATOR_H - -#include <string> -#include <vector> - -#include "CodeInjector.h" - - -std::vector<unsigned char> x86_relJump(unsigned long dst, - unsigned long src); - -class CodeGenerator -{ -public: - CodeGenerator(const native_data& nd); - virtual ~CodeGenerator(); - void clear() - { - codes.clear(); - } - bool hasCode(int index); - CodeGenerator& addCode(const std::vector<unsigned char>& code); - CodeGenerator& addCode(const std::string& code); - CodeGenerator& setCode(int index, const std::vector<unsigned char>& code); - CodeGenerator& setCodeSized(int index, const std::vector<unsigned char>& code); - CodeGenerator& setRel32JMP(int index, unsigned long dst, unsigned long src, bool reversed = false); - std::vector<unsigned char>::size_type buildSize(int maxCodes = -1); - std::vector<unsigned char> build(); - std::vector<unsigned char> buildAndClear(); - std::string toString(); -private: - const native_data& nd; - std::vector<std::vector<unsigned char>> codes; - unsigned long diffRel32JMP(bool reversed, int index = -1) - { - return (!reversed ? buildSize(index) - 0x5 : buildSize(index)); - } -}; - -#endif // CODEGENERATOR_H diff --git a/aoe2hd/include/CodeInjector.h b/aoe2hd/include/CodeInjector.h deleted file mode 100755 index bb4af85..0000000 --- a/aoe2hd/include/CodeInjector.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef CODEINJECTOR_H -#define CODEINJECTOR_H - -#include <vector> -#include <map> -#include <string> - -extern "C" { -#include "native.h" -} - - -typedef struct code_bin -{ - unsigned long addr; - unsigned long siz; - bool operator<(const code_bin& a) const - { - return addr < a.addr; - } -} code_bin; - -typedef struct code_seg -{ - unsigned long addr; - unsigned long siz; - std::map<const std::string, code_bin> children; -} code_seg; - -class CodeInjector -{ -public: - CodeInjector(const native_data& nd); - virtual ~CodeInjector(); - bool allocCodeSegment(const std::string& name, - unsigned long siz = 4096); - bool addCode(const std::string& name, const std::string& code_name, - const std::vector<unsigned char>& code); - bool addCode(const std::string& name, const std::string& code_name, - const std::string& code); - bool addCode(const std::string& name, const std::string& code_name, - unsigned long siz); - bool setCode(const std::string& name, const std::string& code_name, - const std::vector<unsigned char>& code, - unsigned long offset = 0); - bool delCode(const std::string& name, const std::string& code_name); - unsigned long getCodeAddr(const std::string& name, const std::string& code_name); - bool getCodeSeg(const std::string& name, code_seg *seg); - bool getCodeBin(const std::string& name, const std::string& code_name, code_bin *bin); - std::string toString(); -private: - const native_data& nd; - std::map<std::string, code_seg> code_map; - bool codeSegExists(const std::string& name) - { - return code_map.find(name) != code_map.end(); - } - bool codeBinExists(const std::string& name, const std::string& code_name); - std::vector<code_bin> convertCodeSegChildren(const std::string& name); - unsigned long findCodeCave(const std::string& name, unsigned long siz); -}; - -#endif // CODEINJECTOR_H diff --git a/aoe2hd/include/CodePatcher.h b/aoe2hd/include/CodePatcher.h deleted file mode 100755 index 1713b21..0000000 --- a/aoe2hd/include/CodePatcher.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef CODEPATCHER_H -#define CODEPATCHER_H - -#include <vector> -#include <map> - -extern "C" { -#include "native.h" -} - - -typedef struct code_patch -{ - unsigned long addr; - std::vector<unsigned char> old_code; - std::vector<unsigned char> new_code; - long new_offset; - long suspend; -} code_patch; - -class CodePatcher -{ -public: - CodePatcher(const native_data& nd); - virtual ~CodePatcher(); - bool addPatch(const std::string& name, - unsigned long addr, - const std::vector<unsigned char>& old_code, - const std::vector<unsigned char>& new_code, - long new_offset = 0); - void setPatchSuspend(const std::string& name, long doSuspend); - bool doPatch(const std::string& name, int doUnPatch); - bool autoPatch(const std::string& name); - std::string toString(); -private: - const native_data& nd; - std::map<std::string, code_patch> patch_map; - bool codePatchExists(const std::string& name) - { - return patch_map.find(name) != patch_map.end(); - } - bool codeCmp(unsigned long addr, std::vector<unsigned char> code); -}; - -#endif // CODEPATCHER_H diff --git a/aoe2hd/include/ModuleMemory.h b/aoe2hd/include/ModuleMemory.h deleted file mode 100755 index 4eac9b6..0000000 --- a/aoe2hd/include/ModuleMemory.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef PROCESSMEMORY_H -#define PROCESSMEMORY_H - -#include <map> -#include <set> -#include <string> - -extern "C" { -#include "native.h" -} - - -typedef struct target_ptr -{ - unsigned long base; - unsigned long offset; - unsigned long ptr; - std::string pattern; - bool valid; - std::string dependency; - std::set<std::string> children; -} target_ptr; - -class ModuleMemory -{ -public: - ModuleMemory(const native_data& nd); - virtual ~ModuleMemory(); - unsigned long scanProcMem(const std::string& name, const std::string& pattern, long offset = 0, bool getPtr = true); - unsigned long scanMappedMem(const std::string& name, const std::string& pattern, long offset = 0, bool getPtr = true); - unsigned long getPtr(const std::string& name); - unsigned long getPtr(const std::string& name, unsigned long *dest_ptr); - unsigned long getPtr(const std::string& name, unsigned long base, long offset = 0); - unsigned long recheckPtr(const std::string& name); - void revalidateAllPtr(); - bool ptrSetDependency(const std::string& name, const std::string& dependency); - bool getData(const std::string& name, void *buffer, unsigned long siz); - std::string toString(); - std::string toStringStats(); -private: - const native_data& nd; - std::map<std::string, target_ptr> ptr_map; - unsigned long ptr_read_count; - unsigned long ptr_invalid_count; - bool ptrExists(const std::string& name) - { - return ptr_map.find(name) != ptr_map.end(); - } - bool ptrValid(const std::string& name) - { - if (ptrExists(name) && ptr_map[name].valid) - { - return true; - } - else ++ptr_invalid_count; - return false; - } - unsigned long scanPattern(unsigned long addr, unsigned long size, const std::string& pattern); -}; - -#endif // PROCESSMEMORY_H diff --git a/aoe2hd/include/aoe2hd.h b/aoe2hd/include/aoe2hd.h deleted file mode 100755 index 424f71f..0000000 --- a/aoe2hd/include/aoe2hd.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef AOE2HD_H_INCLUDED -#define AOE2HD_H_INCLUDED - -#define DUMMY5 0x90,0x90,0x90,0x90,0x90 /* nop; nop; nop; nop; nop */ - -/* SAFE! */ -#define MAP_NOFOG 0x45BE43 -#define MAP_NOFOG0 0x8B,0x0C,0x81 /* mov ecx,[ecx+eax*4] */ -#define MAP_NOFOG1 0x8B,0x45,0x10 /* mov eax,[ebp+10] */ -#define MAP_NOFOGI 0x81,0xC9,0x00,0x04,0x00,0x00 /* or ecx,0x00000400 */ - -/* SAFE! */ -#define MAP_MINI 0x46CA33 -#define MAP_MINI0 0x8B,0x0C,0x88 /* mov ecx,[eax+ecx*4] */ -#define MAP_MINI1 0x8B,0x87,0x34,0x01,0x00,0x00 /* mov eax,[edi+00000134] */ -#define MAP_MINII 0x81,0xC9,0x00,0x00,0x00,0x04 /* or ecx,0x04000000 */ - -/* NOT SAFE -> DESYNC POSSIBLE! */ -#define MAP_SMTH 0x46CEE8 -#define MAP_SMTH0 0x8B,0x04,0x88 /* mov eax,[eax+ecx*4] */ -#define MAP_SMTH1 0x8B,0x8F,0x34,0x01,0x00,0x00 /* mov ecx,[edi+00000134] */ -#define MAP_SMTHI 0x0D,0x00,0x04,0x00,0x00 /* or eax,0x00000400 */ - -/* NOT SAFE! .> DESYNC POSSIBLE! */ -#define MAP_UNIT 0x47F851 -#define MAP_UNIT0 0x8B,0x01 /* mov eax,[ecx] */ -#define MAP_UNIT1 0x8B,0xD0,0x8B,0x8D,0x34,0xFF,0xFF,0xFF /* mov edx,eax; mov ecx,[ebp-000000CC] */ -#define MAP_UNITI 0x0D,0x00,0x04,0x00,0x00 /* or eax,0x00000400 */ - -/* MAP/MINIMAP FLAGS: - * NOFOG_BY_UNIT.....: 0x00000002 - * NOFOG_ALL.........: 0x00000400 - * DISCOVERED_BY_UNIT: 0x00020000 - * DISCOVERED_ALL....: 0x04000000 - * MAP_FULL_VISIABLE.: DISCOVERED_ALL | NOFOG_ALL - * MAP_SPY_LIKE......: DISCOVERED_BY_UNIT | NOFOG_BY_UNIT - */ - -struct resources -{ - float food; - float wood; - float stone; - float gold; - float remainingPop; - unsigned char garbage_1[4]; - float currentAge; - unsigned char garbage_2[16]; - float currentPop; -}; - -struct mapsize -{ - uint32_t cells_x; - uint32_t cells_y; -}; - -#endif // AOE2HD_H_INCLUDED diff --git a/aoe2hd/include/native.h b/aoe2hd/include/native.h deleted file mode 100755 index 297028a..0000000 --- a/aoe2hd/include/native.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef NATIVE_H_INCLUDED -#define NATIVE_H_INCLUDED - -#include <windows.h> -#include <stdbool.h> - -#define EXPORT __declspec(dllexport) - -typedef struct native_data native_data; - -typedef unsigned long(*alloc_mem_fn)(const native_data *nd, - unsigned long siz); -typedef bool(*read_mem_fn)(const native_data *nd, - unsigned long addr, void *buffer, - unsigned long siz); -typedef bool(*write_mem_fn)(const native_data *nd, - unsigned long addr, const void *buffer, - unsigned long siz); -typedef bool(*suspend_proc_fn)(const native_data *nd, - int doResume); -typedef unsigned long(*iterate_mem_fn)(const native_data *nd, - unsigned long *addr, - unsigned long *size); - -typedef struct win_proc -{ - DWORD pid; - HANDLE hndl; - HMODULE modbase; - DWORD modsize; -} win_proc; - -typedef struct native_data -{ - win_proc proc; - alloc_mem_fn alloc_fn; - read_mem_fn read_fn; - write_mem_fn write_fn; - suspend_proc_fn suspend_fn; - iterate_mem_fn iterate_fn; -} native_data; - -EXPORT void initNativeData(native_data *nd); -EXPORT void cls(HANDLE hConsole); -EXPORT bool get_module_proc(native_data *nd, - LPCTSTR window_name); -EXPORT bool get_module_info(native_data *nd, - LPCTSTR module_name); - -EXPORT unsigned long mem_alloc(const native_data *nd, - unsigned long siz); -EXPORT bool read_procmem(const native_data *nd, - unsigned long addr, void *buffer, - unsigned long siz); -EXPORT bool write_procmem(const native_data *nd, - unsigned long addr, const void *buffer, - unsigned long siz); -EXPORT bool suspendProcess(const native_data *nd, - int doResume); -EXPORT unsigned long iterate_mem(const native_data *nd, - unsigned long *addr, - unsigned long *size); - -#endif // NATIVE_H_INCLUDED diff --git a/aoe2hd/include/utils.h b/aoe2hd/include/utils.h deleted file mode 100755 index 1d71b90..0000000 --- a/aoe2hd/include/utils.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef UTILS_H -#define UTILS_H - -#include <vector> -#include <string> - - -namespace utils -{ -std::string convertBinToHexstr(const std::vector<unsigned char>& bin); -}; - -#endif // UTILS_H |