From 2602b55580711a5666dacaac7c51b8ec90ed4877 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Tue, 2 May 2017 20:36:34 +0300 Subject: [PATCH 1/3] Added basic AAA. Added cat_software_cursor_mode. --- src/gui/ncc/Menu.cpp | 2 ++ src/hooks/PaintTraverse.cpp | 28 +++++++++++++++++++++++++++- src/hooks/others.cpp | 14 ++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/gui/ncc/Menu.cpp b/src/gui/ncc/Menu.cpp index 9b7ab501..e8e37cf0 100644 --- a/src/gui/ncc/Menu.cpp +++ b/src/gui/ncc/Menu.cpp @@ -502,6 +502,7 @@ static const std::string list_tf2 = R"( "aa_spin" "aa_roll" "aa_no_clamp" + "resolver" "Anti-Anti-AA" [ "Anti-Anti-Anti-Aim Menu" "aa_aaaa_enabled" @@ -566,6 +567,7 @@ static const std::string list_tf2 = R"( "info" "Debug" [ "Debug Menu" + "software_cursor_mode" "enabled" "no_visuals" "debug_info" diff --git a/src/hooks/PaintTraverse.cpp b/src/hooks/PaintTraverse.cpp index c2a9ccca..f6e84874 100644 --- a/src/hooks/PaintTraverse.cpp +++ b/src/hooks/PaintTraverse.cpp @@ -23,6 +23,9 @@ CatVar pure_bypass(CV_SWITCH, "pure_bypass", "0", "Pure Bypass", "Bypass sv_pure void* pure_orig = nullptr; void** pure_addr = nullptr; +CatEnum software_cursor_enum({"KEEP", "ALWAYS", "NEVER", "MENU ON", "MENU OFF"}); +CatVar software_cursor_mode(software_cursor_enum, "software_cursor_mode", "1", "Software cursor", "Try to change this and see what works best for you"); + void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) { #if DEBUG_SEGV == true if (!segvcatch::handler_fpe || !segvcatch::handler_segv) { @@ -58,6 +61,28 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) { g_ISurface->SetCursorAlwaysVisible(vis); } + if (software_cursor_mode) { + static ConVar* software_cursor = g_ICvar->FindVar("cl_software_cursor"); + bool cur = software_cursor->GetBool(); + switch ((int)software_cursor_mode) { + case 1: + if (!software_cursor->GetBool()) software_cursor->SetValue(1); + break; + case 2: + if (software_cursor->GetBool()) software_cursor->SetValue(0); + break; + case 3: + if (cur != g_pGUI->Visible()) { + software_cursor->SetValue(g_pGUI->Visible()); + } + break; + case 4: + if (cur == g_pGUI->Visible()) { + software_cursor->SetValue(!g_pGUI->Visible()); + } + } + } + if (force_name.convar->m_StringLength > 2 && need_name_change) { INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo(); if (ch) { @@ -125,7 +150,8 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) { AddSideString("Press 'INSERT' key to open/close cheat menu.", GUIColor()); AddSideString("Use mouse to navigate in menu.", GUIColor()); if (!g_IEngine->IsInGame() || g_pGUI->Visible()) { - const char* name = (force_name.convar->m_StringLength > 2 ? force_name.GetString() : "*Not Set*"); + std::string name(force_name.GetString()); + if (name.length() < 3) name = "*Not Set*"; AddSideString(""); // foolish std::string name_stripped(name); // RIP fps ReplaceString(name_stripped, "\n", "\\n"); diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index ec6236ea..ab07173b 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -162,11 +162,25 @@ void Shutdown_hook(void* thisptr, const char* reason) { static CatVar glow_enabled(CV_SWITCH, "glow_old_enabled", "0", "Enable", "Make sure to enable glow_outline_effect_enable in tf2 settings"); static CatVar glow_alpha(CV_FLOAT, "glow_old_alpha", "1", "Alpha", "Glow Transparency", 0.0f, 1.0f); +static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); void FrameStageNotify_hook(void* thisptr, int stage) { SEGV_BEGIN; if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true; // TODO hack FSN hook + if (resolver && cathook && !g_Settings.bInvalid && stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) { + for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) { + if (i == g_IEngine->GetLocalPlayer()) continue; + IClientEntity* ent = g_IEntityList->GetClientEntity(i); + if (ent && !ent->IsDormant() && !NET_BYTE(ent, netvar.iLifeState)) { + Vector& angles = NET_VECTOR(ent, netvar.m_angEyeAngles); + if (angles.x >= 90) angles.x = -89; + if (angles.x <= -90) angles.x = 89; + while (angles.y > 180) angles.y -= 360; + while (angles.y < -180) angles.y += 360; + } + } + } if (TF && cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) { if (glow_enabled) { for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.m_Size; i++) { From 674a1353f257e0755c917647e5b5cc696e414c60 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Tue, 2 May 2017 20:38:51 +0300 Subject: [PATCH 2/3] rename anti-aim menu to anti-/anti-aim menu --- src/gui/ncc/Menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/ncc/Menu.cpp b/src/gui/ncc/Menu.cpp index e8e37cf0..9713580f 100644 --- a/src/gui/ncc/Menu.cpp +++ b/src/gui/ncc/Menu.cpp @@ -492,7 +492,7 @@ static const std::string list_tf2 = R"( ] ] -"Anti-Aim" [ +"Anti-/Anti-Aim" [ "Anti-Aim Menu" "aa_enabled" "aa_pitch" @@ -503,7 +503,7 @@ static const std::string list_tf2 = R"( "aa_roll" "aa_no_clamp" "resolver" - "Anti-Anti-AA" [ + "Anti-Anti-Anti-Aim" [ "Anti-Anti-Anti-Aim Menu" "aa_aaaa_enabled" "aa_aaaa_interval" From 641b1cfbb1f21fd84f109107031bb07a0cdff3e3 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Tue, 2 May 2017 21:55:30 +0300 Subject: [PATCH 3/3] fix?? name change timeout + fix crash on negative newlines --- src/hooks/PaintTraverse.cpp | 12 ------------ src/hooks/others.cpp | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/hooks/PaintTraverse.cpp b/src/hooks/PaintTraverse.cpp index f6e84874..bcfb49d0 100644 --- a/src/hooks/PaintTraverse.cpp +++ b/src/hooks/PaintTraverse.cpp @@ -83,18 +83,6 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) { } } - if (force_name.convar->m_StringLength > 2 && need_name_change) { - INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo(); - if (ch) { - logging::Info("Sending new name"); - NET_SetConVar setname("name", force_name.GetString()); - setname.SetNetChannel(ch); - setname.SetReliable(false); - ch->SendNetMsg(setname, false); - need_name_change = false; - } - } - if (call_default) SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar)); // To avoid threading problems. diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index ab07173b..64ce6c4d 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -107,7 +107,9 @@ static CatCommand minus_use_action_slot_item_server("-cat_use_action_slot_item_s g_IEngine->ServerCmdKeyValues(kv); }); -static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines", "Add # newlines before each your message"); +static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines", "Add # newlines before each your message", 0, 24); +// TODO replace \\n with \n +// TODO name \\n = \n //static CatVar queue_messages(CV_SWITCH, "chat_queue", "0", "Queue messages", "Use this if you want to use spam/killsay and still be able to chat normally (without having your msgs eaten by valve cooldown)"); bool SendNetMsg_hook(void* thisptr, INetMessage& msg, bool bForceReliable = false, bool bVoice = false) { @@ -181,6 +183,22 @@ void FrameStageNotify_hook(void* thisptr, int stage) { } } } + if (stage == FRAME_NET_UPDATE_START) { + if (force_name.convar->m_StringLength > 2 && need_name_change) { + INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo(); + if (ch) { + logging::Info("Sending new name"); + NET_SetConVar setname("name", force_name.GetString()); + setname.SetNetChannel(ch); + setname.SetReliable(false); + ch->SendNetMsg(setname, false); + need_name_change = false; + } + } + static ConVar* name_cv = g_ICvar->FindVar("name"); + name_cv->SetValue(force_name.GetString()); + name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString()); + } if (TF && cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) { if (glow_enabled) { for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.m_Size; i++) {