add vscript patch
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 ?? ?? ?? ?? ?? ??");
|
||||
|
||||
Reference in New Issue
Block a user