Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
add vscript patch
Browse files Browse the repository at this point in the history
  • Loading branch information
huoji120 committed Oct 9, 2023
1 parent 56a4e14 commit 0376637
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions csgo2/offset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void*>(vscriptPathAddr), sizeof(PatchVScriptEnable), PAGE_EXECUTE_READWRITE, &oldProtect);
memcpy(reinterpret_cast<void*>(vscriptPathAddr), PatchVScriptEnable, sizeof(PatchVScriptEnable));
VirtualProtect(reinterpret_cast<void*>(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)
Expand Down
1 change: 1 addition & 0 deletions csgo2/offset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? ?? ?? ?? ?? ??");
Expand Down

0 comments on commit 0376637

Please sign in to comment.