#ifndef MAIN_H #define MAIN_H #include "DLL.h" #include #define no_optimize __attribute__((optimize("O0"))) void WriteFarJMP(void* source, void* destination); void Popup(const char* title, const char* msg ); void PrintLoadedMods(); #define MUST_IMPORT(dllname, name)\ dllname->name = GetProcAddress(dllname->handle, #name);\ if (!dllname->name) {\ char ERROR_MESSAGE_POPUP[512] = {0};\ sprintf(ERROR_MESSAGE_POPUP, "%s does not export " #name ".\n", dllname->fileName.c_str());\ Popup("Error", ERROR_MESSAGE_POPUP);\ exit(1);\ } #define IMPORT(dllname, name)\ dllname->name = GetProcAddress(dllname->handle, #name); #define PUSH_ALL "push rax\npush rbx\npush rcx\npush rdx\npush rsi\npush rdi\npush rbp\npush r8\npush r9\npush r10\npush r11\npush r12\npush r13\npush r14\npush r15\n" #define POP_ALL "pop r15\npop r14\npop r13\npop r12\npop r11\npop r10\npop r9\npop r8\npop rbp\npop rdi\npop rsi\npop rdx\npop rcx\npop rbx\npop rax\n" #define PREPARE_STACK "mov rax, rsp \n and rsp, 0xFFFFFFFFFFFFFFF0 \n push rax \n sub rsp, 0x28 \n" #define RESTORE_STACK "add rsp, 0x28 \n pop rsp \n" #define GETTER_VAR(vartype, varname)\ static __attribute__((used)) vartype varname;\ extern "C" vartype Get_##varname(){return varname;} #define DEREF_JMP(varname)\ "sub rsp, 8 \n"\ "push rax \n"\ "call Get_"#varname" \n"\ "mov [rsp+8], rax \n"\ "pop rax \n"\ "ret \n" #define global static __attribute__((used)) void* Offset(void* x1, uint64_t x2); #endif // MAIN_H