diff --git a/include/MiscTemporary.hpp b/include/MiscTemporary.hpp index 32c3dd62..a76b49ed 100755 --- a/include/MiscTemporary.hpp +++ b/include/MiscTemporary.hpp @@ -7,6 +7,7 @@ #include #include "common.hpp" +#include "DetourHook.hpp" #define MENU_COLOR (menu_color) @@ -44,6 +45,8 @@ extern int stored_buttons; #if ENABLE_VISUALS extern bool freecam_is_toggled; #endif +typedef void (*CL_SendMove_t)(); +extern DetourHook cl_warp_sendmovedetour; namespace hacks::tf2::misc_aimbot { bool ShouldHitBuilding(CachedEntity *ent); diff --git a/include/hacks/Warp.hpp b/include/hacks/Warp.hpp index 69ec257c..074ed178 100644 --- a/include/hacks/Warp.hpp +++ b/include/hacks/Warp.hpp @@ -3,4 +3,5 @@ class INetMessage; namespace hacks::tf2::warp { void SendNetMessage(INetMessage &msg); -} +void CL_SendMove_hook(); +} // namespace hacks::tf2::warp diff --git a/src/MiscTemporary.cpp b/src/MiscTemporary.cpp index 7678a3c5..e2262c17 100755 --- a/src/MiscTemporary.cpp +++ b/src/MiscTemporary.cpp @@ -4,6 +4,7 @@ */ #include "MiscTemporary.hpp" +#include "Warp.hpp" std::array timers{}; std::array bruteint{}; @@ -42,7 +43,13 @@ void color_callback(settings::VariableBase &, int) { menu_color = Color(*print_r, *print_g, *print_b, 255); } +DetourHook cl_warp_sendmovedetour; static InitRoutine misc_init([]() { + static auto cl_sendmove_addr = gSignatures.GetEngineSignature("55 89 E5 57 56 53 81 EC 2C 10 00 00 C6 85 ? ? ? ? 01"); + // Order matters! + cl_warp_sendmovedetour.Init(cl_sendmove_addr, (void *) hacks::tf2::warp::CL_SendMove_hook); + cl_nospread_sendmovedetour.Init(cl_sendmove_addr, (void *) hacks::tf2::nospread::CL_SendMove_hook); + static std::optional patch; static std::optional patch2; print_r.installChangeCallback(color_callback); @@ -104,6 +111,7 @@ static InitRoutine misc_init([]() { EC::Register( EC::Shutdown, []() { + cl_warp_sendmovedetour.Shutdown(); if (backup_lerp) { cl_interp->SetValue(backup_lerp); diff --git a/src/hacks/Warp.cpp b/src/hacks/Warp.cpp index f00ae8fc..e2900afc 100644 --- a/src/hacks/Warp.cpp +++ b/src/hacks/Warp.cpp @@ -552,8 +552,6 @@ void rvarCallback(settings::VariableBase &, bool) yaw_selections.push_back(90.0f); } -DetourHook cl_sendmove_detour; -typedef void (*CL_SendMove_t)(); void CL_SendMove_hook() { byte data[4000]; @@ -624,8 +622,6 @@ void CL_Move_hook(float accumulated_extra_samples, bool bFinalTick) } static InitRoutine init([]() { - static auto cl_sendmove_addr = gSignatures.GetEngineSignature("55 89 E5 57 56 53 81 EC 2C 10 00 00 C6 85 ? ? ? ? 01"); - cl_sendmove_detour.Init(cl_sendmove_addr, (void *) CL_SendMove_hook); static auto cl_move_addr = gSignatures.GetEngineSignature("55 89 E5 57 56 53 81 EC 9C 00 00 00 83 3D ? ? ? ? 01"); cl_move_detour.Init(cl_move_addr, (void *) CL_Move_hook); @@ -636,7 +632,6 @@ static InitRoutine init([]() { EC::Shutdown, []() { g_IEventManager2->RemoveListener(&listener); - cl_sendmove_detour.Shutdown(); cl_move_detour.Shutdown(); }, "warp_shutdown");