#include "shadowhook.h" #include #define ADD_HOOK(name, addr) \ name##_Addr = reinterpret_cast(addr); \ if (addr) { \ auto stub = hookInstaller->InstallHook(reinterpret_cast(addr), \ reinterpret_cast(name##_Hook), \ reinterpret_cast(&name##_Orig)); \ if (stub == NULL) { \ int error_num = shadowhook_get_errno(); \ const char *error_msg = shadowhook_to_errmsg(error_num); \ Log::ErrorFmt("ADD_HOOK: %s at %p failed: %s", #name, addr, error_msg); \ } \ else { \ hookedStubs.emplace(stub); \ GakumasLocal::Log::InfoFmt("ADD_HOOK: %s at %p", #name, addr); \ } \ } \ else GakumasLocal::Log::ErrorFmt("Hook failed: %s is NULL", #name, addr); \ if (Config::lazyInit) UnityResolveProgress::classProgress.current++