From 0376637e065860568395a0dfeee282ba7467ae6b Mon Sep 17 00:00:00 2001 From: Huoji's <1296564236@qq.com> Date: Tue, 10 Oct 2023 03:00:15 +0800 Subject: [PATCH] add vscript patch --- csgo2/offset.cpp | 21 +++++++++++++++++++++ csgo2/offset.h | 1 + 2 files changed, 22 insertions(+) diff --git a/csgo2/offset.cpp b/csgo2/offset.cpp index a288b19..3c46d2a 100644 --- a/csgo2/offset.cpp +++ b/csgo2/offset.cpp @@ -49,12 +49,33 @@ auto SafeDelayInit(void* ctx) -> void { LOG("m_bForceTeamChangeSilent: %d \n", InterFaces::CCSGameRulesInterFace->m_bForceTeamChangeSilent()); } +auto PathVscript() -> void { + CModule vscript_old("vscript_old.dll"); + CModule vscript("vscript.dll"); + + uint64_t vscriptPathAddr = 0; + if (vscript_old.IsLoaded() == true) { + vscript_old.FindPattern(pattern_VscriptPath).Get(vscriptPathAddr); + } + else { + vscript.FindPattern(pattern_VscriptPath).Get(vscriptPathAddr); + } + if (vscriptPathAddr != 0) { + const static char PatchVScriptEnable[] = {0xBE, 0x02}; + DWORD oldProtect; + VirtualProtect(reinterpret_cast(vscriptPathAddr), sizeof(PatchVScriptEnable), PAGE_EXECUTE_READWRITE, &oldProtect); + memcpy(reinterpret_cast(vscriptPathAddr), PatchVScriptEnable, sizeof(PatchVScriptEnable)); + VirtualProtect(reinterpret_cast(vscriptPathAddr), sizeof(PatchVScriptEnable), oldProtect, &oldProtect); + LOG("success patch vscript at %llx \n", vscriptPathAddr); + } +} auto Init() -> bool { CModule server("server.dll"); CModule schemasystem("schemasystem.dll"); CModule engine("engine2.dll"); CModule localize("localize.dll"); CModule tier0("tier0.dll"); + PathVscript(); // engine.dll engine.FindPattern(pattern_MaxPlayerNumsPtr) diff --git a/csgo2/offset.h b/csgo2/offset.h index ef16fee..e52d4fc 100644 --- a/csgo2/offset.h +++ b/csgo2/offset.h @@ -44,6 +44,7 @@ extern ISource2Server* ISource2ServerInterFace; extern CCSGameRules* CCSGameRulesInterFace; extern ICvar* IVEngineCvar; }; // namespace InterFaces +static const auto pattern_VscriptPath = THE_GAME_SIG("BE 01 ?? ?? ?? 2B D6 74 ?? 3B D6"); static const auto pattern_CGameEventManager = THE_GAME_SIG( "48 ?? ?? ?? ?? ?? ?? 48 89 ?? ?? ?? 48 89 01 48 8B D9 48 ?? ?? ?? ?? ?? " "?? 48 89 ?? ?? E8 ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ??");