sv_pure bypass is now separated into module

This commit is contained in:
TotallyNotElite 2019-03-17 18:36:31 +01:00
parent 21a889301e
commit 171a3815b8
3 changed files with 39 additions and 19 deletions

View File

@ -32,6 +32,7 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/MiscPlayerInfo.cpp"
"${CMAKE_CURRENT_LIST_DIR}/NavBot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Noisemaker.cpp"
"${CMAKE_CURRENT_LIST_DIR}/PureBypass.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Trigger.cpp"
"${CMAKE_CURRENT_LIST_DIR}/UberSpam.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Walkbot.cpp"

37
src/hacks/PureBypass.cpp Normal file
View File

@ -0,0 +1,37 @@
#include <settings/Bool.hpp>
#include "common.hpp"
static settings::Bool enabled{ "pure-bypass.enable", "false" };
static void *pure_orig, **pure_addr;
static void toggle(bool on)
{
if (on)
{
if (!pure_addr)
{
pure_addr = *reinterpret_cast<void ***>(gSignatures.GetEngineSignature("A1 ? ? ? ? 85 C0 74 ? C7 44 24 ? ? ? ? ? 89 04 24") + 1);
if (!pure_addr)
{
logging::InfoConsole("Pure bypass broken, failed to find signature");
return;
}
}
if (*pure_addr)
pure_orig = *pure_addr;
*pure_addr = nullptr;
}
else if (pure_orig)
{
*pure_addr = pure_orig;
pure_orig = nullptr;
}
}
static InitRoutine init([] {
toggle(*enabled);
enabled.installChangeCallback([](settings::VariableBase<bool> &, bool on) {
toggle(on);
});
});

View File

@ -8,7 +8,6 @@
#include "HookedMethods.hpp"
#include "CatBot.hpp"
static settings::Bool pure_bypass{ "visual.sv-pure-bypass", "false" };
static settings::Int software_cursor_mode{ "visual.software-cursor-mode", "0" };
static settings::Int waittime{ "debug.join-wait-time", "2500" };
@ -25,11 +24,9 @@ CatCommand join_spam("join_spam", "Spam joins server for X seconds", [](const CC
});
CatCommand join("mm_join", "Join mm Match", []() {
auto gc = re::CTFGCClientSystem::GTFGCClientSystem();
if (gc)
gc->JoinMMMatch();
if (gc)
});
void *pure_orig = nullptr;
void **pure_addr = nullptr;
bool replaced = false;
namespace hooked_methods
@ -90,21 +87,6 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_, unsigned int pane
no_report_limit.Patch();
replaced = true;
}
if (pure_bypass)
{
if (!pure_addr)
{
pure_addr = *reinterpret_cast<void ***>(gSignatures.GetEngineSignature("A1 ? ? ? ? 85 C0 74 ? C7 44 24 ? ? ? ? ? 89 04 24") + 1);
}
if (*pure_addr)
pure_orig = *pure_addr;
*pure_addr = (void *) 0;
}
else if (pure_orig)
{
*pure_addr = pure_orig;
pure_orig = (void *) 0;
}
call_default = true;
if (isHackActive() && (panel_scope || motd_panel || motd_panel_sd) && ((no_zoom && panel == panel_scope) || (hacks::shared::catbot::catbotmode && hacks::shared::catbot::anti_motd && (panel == motd_panel || panel == motd_panel_sd))))
call_default = false;