From d81e2f8f0fdc817146d68cc86c38fa6cdf8aae7e Mon Sep 17 00:00:00 2001 From: wolf109909 <84360921+wolf109909@users.noreply.github.com> Date: Sun, 8 Sep 2024 12:29:49 +0800 Subject: [PATCH] add basic xgun compat check --- primedev/Northstar.cmake | 1 + primedev/client/xgun_compat.cpp | 24 ++++++++++++++++++++++++ primedev/ns_version.h | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 primedev/client/xgun_compat.cpp diff --git a/primedev/Northstar.cmake b/primedev/Northstar.cmake index e42009e8d..e3bb8ee81 100644 --- a/primedev/Northstar.cmake +++ b/primedev/Northstar.cmake @@ -25,6 +25,7 @@ add_library( "core/anticheat.cpp" "core/anticheat.h" + "client/xgun_compat.cpp" "client/igig/igig.cpp" "client/igig/igig.h" "client/igig/ime.cpp" diff --git a/primedev/client/xgun_compat.cpp b/primedev/client/xgun_compat.cpp new file mode 100644 index 000000000..f4ca17c95 --- /dev/null +++ b/primedev/client/xgun_compat.cpp @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +std::string GenerateMD5Hash(void* moduleBase, size_t moduleSize) { + MD5_CTX md5Context; + MD5_Init(&md5Context); + MD5_Update(&md5Context, moduleBase, moduleSize); + unsigned char hash[MD5_DIGEST_LENGTH]; + MD5_Final(hash, &md5Context); + + std::ostringstream oss; + for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) { + oss << std::hex << std::setw(2) << std::setfill('0') << static_cast(hash[i]); + } + + return oss.str(); +} +ON_DLL_LOAD("engine.dll", XGUNSignatureCheck, (CModule module)) +{ + std::string md5String = GenerateMD5Hash((void*)module.GetModuleBase(),module.GetModuleSize()); + spdlog::info("[XGUN] Loading XGUN DLL with Signature: {}", md5String); +} \ No newline at end of file diff --git a/primedev/ns_version.h b/primedev/ns_version.h index de51c2d1b..f92d2eddf 100644 --- a/primedev/ns_version.h +++ b/primedev/ns_version.h @@ -2,6 +2,6 @@ #ifndef NORTHSTAR_VERSION // Turning off clang-format here so it doesn't mess with style as it needs to be this way for regex-ing with CI // clang-format off -#define NORTHSTAR_VERSION 1,17,1,0 +#define NORTHSTAR_VERSION 1,17,3,0 // clang-format on #endif