diff --git a/README.md b/README.md index 5ebd583f..8ec5fb66 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ You will want to update these files if you wish to have an updated menu. ## Followbots `cathook-ipc-server` allows you to run and control Followbots to do your evil bidding in-game. The installation for Followbots is quite complex, and will not be covered on this page. Obviously, you must have several user accounts ready to run TF2. -A guide for Followbots can be found here: [How to setup and use followbots.](https://www.youtube.com/watch?v=kns5-nw7xUg) +A guide for Followbots can be found here: [How to setup followbots.](https://github.com/nullifiedcat/cathook/wiki/Setting-up-Followbots) [How to use followbots.](https://github.com/nullifiedcat/cathook/wiki/Using-Followbots) You may also ask someone in our discord server to help you out. The installation script is as followed: diff --git a/makefile b/makefile index ad5065d4..e25d84fb 100644 --- a/makefile +++ b/makefile @@ -1,19 +1,32 @@ +ifndef CLANG CXX=$(shell sh -c "which g++-6 || which g++") CC=$(shell sh -c "which gcc-6 || which gcc") +LD=$(CXX) +else +CXX=clang++ +CC=clang +LD=ld.lld +endif DEFINES=_GLIBCXX_USE_CXX11_ABI=0 _POSIX=1 FREETYPE_GL_USE_VAO RAD_TELEMETRY_DISABLED LINUX=1 USE_SDL _LINUX=1 POSIX=1 GNUC=1 NO_MALLOC_OVERRIDE WARNING_FLAGS=-pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -COMMON_FLAGS=-fpermissive -O3 -shared -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC -march=native +COMMON_FLAGS=-fpermissive -O3 -shared -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC -march=native -mtune=native + +ifdef CLANG +COMMON_FLAGS+=-Wno-c++11-narrowing +endif ifdef BUILD_DEBUG COMMON_FLAGS+=-g3 -ggdb else +ifndef CLANG COMMON_FLAGS+=-flto endif +endif CFLAGS=$(COMMON_FLAGS) -CXXFLAGS=-std=gnu++1z $(COMMON_FLAGS) +CXXFLAGS=-std=gnu++14 $(COMMON_FLAGS) ifndef NO_WARNINGS CFLAGS+=$(WARNING_FLAGS) @@ -27,11 +40,19 @@ SDKFOLDER=$(realpath source-sdk-2013/mp/src) SIMPLE_IPC_DIR = $(realpath simple-ipc/src/include) INCLUDES=-Iucccccp -isystemsrc/freetype-gl -isystemsrc/imgui -isystem/usr/local/include/freetype2 -isystem/usr/include/freetype2 -I$(SIMPLE_IPC_DIR) -isystem$(SDKFOLDER)/public -isystem$(SDKFOLDER)/mathlib -isystem$(SDKFOLDER)/common -isystem$(SDKFOLDER)/public/tier1 -isystem$(SDKFOLDER)/public/tier0 -isystem$(SDKFOLDER) LIB_DIR=lib -LDFLAGS=-m32 -fno-gnu-unique -D_GLIBCXX_USE_CXX11_ABI=0 -shared -L$(realpath $(LIB_DIR)) +LDFLAGS=-shared -L$(realpath $(LIB_DIR)) +ifdef CLANG +LDFLAGS+=-melf_i386 +else +LDFLAGS+=-m32 -fno-gnu-unique +endif + ifndef BUILD_DEBUG +ifndef CLANG LDFLAGS+=-flto endif -LDLIBS=-static -lc -lstdc++ -ltier0 -lvstdlib -l:libSDL2-2.0.so.0 -static -lGLEW -lfreetype -lpthread +endif +LDLIBS=-l:libSDL2-2.0.so.0 -static -l:libc.so.6 -static -l:libstdc++.so.6 -l:libtier0.so -l:libvstdlib.so -static -l:libGLEW.so -l:libfreetype.so SRC_DIR = src RES_DIR = res OUT_NAME = libcathook.so @@ -126,7 +147,7 @@ src/sdk/utlbuffer.o : CFLAGS+=-w $(TARGET): $(OBJECTS) @echo Building cathook - @$(CXX) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $(TARGET) + $(LD) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(LDLIBS) clean: find src -type f -name '*.o' -delete diff --git a/simple-ipc b/simple-ipc index e532876f..94a287d6 160000 --- a/simple-ipc +++ b/simple-ipc @@ -1 +1 @@ -Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839 +Subproject commit 94a287d6faa00d44e1084b04e602842849858443 diff --git a/src/cvwrapper.cpp b/src/cvwrapper.cpp index 50c42572..b70cd9f9 100644 --- a/src/cvwrapper.cpp +++ b/src/cvwrapper.cpp @@ -12,6 +12,74 @@ int CatVar::last_id { 0 }; +int rebased_count { 0 }; + +int GetRebasedCatVarCount() { + return rebased_count; +} + +static CatCommand cfg_rebase("cfg_setbase", "Rebase config", []() { + for (auto& cv : CatVarList()) { + std::string value(cv->GetString()); + if (value != cv->defaults) { + cv->current_base = value; + rebased_count++; + } + } + logging::Info("Successfully rebased %d variables", rebased_count); +}); + +static CatCommand cfg_resetbase("cfg_resetbase", "Reset config base", []() { + for (auto& cv : CatVarList()) { + cv->current_base = cv->defaults; + } + rebased_count = 0; +}); + +static CatCommand save_settings("save", "Save settings (optional filename)", [](const CCommand& args) { + std::string filename("lastcfg"); + if (args.ArgC() > 1) { + filename = std::string(args.Arg(1)); + } + std::string path = format("tf/cfg/cat_", filename, ".cfg"); + logging::Info("Saving settings to %s", path.c_str()); + if (GetRebasedCatVarCount()) { + logging::Info("[Warning] %d CatVars are rebased!", GetRebasedCatVarCount()); + } + std::ofstream file(path, std::ios::out); + if (file.bad()) { + logging::Info("Couldn't open the file!"); + return; + } + for (const auto& i : CatVarList()) { + if (i->GetBase() != std::string(i->GetString())) { + file << CON_PREFIX << i->name << " \"" << i->GetString() << "\"\n"; + } + } + file.close(); +}); + +static CatCommand save_settings_complete("save_complete", "Save all settings (optional filename)", [](const CCommand& args) { + std::string filename("lastcfg"); + if (args.ArgC() > 1) { + filename = std::string(args.Arg(1)); + } + std::string path = format("tf/cfg/cat_", filename, ".cfg"); + logging::Info("Saving settings to %s", path.c_str()); + if (GetRebasedCatVarCount()) { + logging::Info("[Warning] %d CatVars are rebased!", GetRebasedCatVarCount()); + } + std::ofstream file(path, std::ios::out); + if (file.bad()) { + logging::Info("Couldn't open the file!"); + return; + } + for (const auto& i : CatVarList()) { + file << CON_PREFIX << i->name << " \"" << i->GetString() << "\"\n"; + } + file.close(); +}); + // Prevent initialization errors. std::vector& registrationArray() { static std::vector vector; @@ -94,6 +162,7 @@ void CatVar::Register() { id = last_id++; convar = CreateConVar(CON_PREFIX + name, defaults, desc_short); convar_parent = convar->m_pParent; + current_base = defaults; while (!callbacks.empty()) { callbacks.back()(this); callbacks.pop_back(); diff --git a/src/cvwrapper.h b/src/cvwrapper.h index 19fcd262..aa0602d3 100644 --- a/src/cvwrapper.h +++ b/src/cvwrapper.h @@ -94,6 +94,10 @@ public: return g_IInputSystem->IsButtonDown(static_cast(static_cast(*this))); } + inline const std::string& GetBase() const { + return current_base; + } + public: const CatVar_t type; const std::string name; @@ -102,6 +106,8 @@ public: const std::string desc_long { "" }; const CatEnum* const enum_type { nullptr }; + std::string current_base { "0" }; + bool restricted { false }; float min { 0.0f }; float max { 0.0f }; @@ -121,5 +127,6 @@ std::vector& commandRegistrationArray(); std::vector& CatVarList(); void RegisterCatVars(); +int GetRebasedCatVarCount(); #endif /* CVWRAPPER_H_ */ diff --git a/src/gui/im/Schema.cpp b/src/gui/im/Schema.cpp index c264a95f..3cbe0c50 100644 --- a/src/gui/im/Schema.cpp +++ b/src/gui/im/Schema.cpp @@ -7,6 +7,8 @@ #include "Schema.hpp" + +#include "../../helpers.h" #include "../../cvwrapper.h" #include "../../logging.h" @@ -23,13 +25,12 @@ CatVar* FindCatVar(const std::string name) { ListEntry_Dummy* FromJson(nlohmann::json json) { if (json.is_string()) { const std::string var_name = json; - logging::Info("[Debug] Variable: %s", var_name.c_str()); ListEntry_Dummy* cv; try { cv = (ListEntry_Dummy*)(new ListEntry_Variable(*FindCatVar(var_name))); } catch (std::runtime_error& er) { logging::Info("[Error] %s", er.what()); - cv = (ListEntry_Dummy*)(new ListEntry_Label("malformed object")); + cv = (ListEntry_Dummy*)(new ListEntry_Label(format("[", var_name, "]"))); } return cv; } else if (json.is_object()) { @@ -129,7 +130,7 @@ CatCommand reloadscheme("reloadscheme", "Reload Scheme", []() { } for (const auto& v : CatVarList()) { if (map_present.find(v) == map_present.end()) { - logging::Info("%s is not in any list!", v->name.c_str()); + logging::Info("%s is not present in the GUI!", v->name.c_str()); } } //TraverseList(&main_list); diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 8520b19a..24843770 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -98,6 +98,8 @@ static CatVar engine_projpred(CV_SWITCH, "debug_aimbot_engine_pp", "0", "Engine static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Spin up minigun if you can see target, useful for followbots"); static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automatically zoom in if you can see target, useful for followbots"); +static CatVar rageonly(CV_SWITCH, "aimbot_rage_only", "0", "Ignore non-rage targets", "Use playerlist to set up rage targets"); + // Current Entity int target_eid { 0 }; CachedEntity* target = 0; @@ -357,6 +359,11 @@ bool IsTargetStateGood(CachedEntity* entity) { if (EffectiveTargetingRange()) { if (entity->m_flDistance > EffectiveTargetingRange()) return false; } + if (rageonly) { + if (playerlist::AccessData(entity).state != playerlist::k_EState::RAGE) { + return false; + } + } IF_GAME (IsTF()) { // If settings allow waiting for charge, and current charge cant kill target, dont aim if (wait_for_charge && g_pLocalPlayer->holding_sniper_rifle) { diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index b6ecfbc1..9c61e0c8 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -401,6 +401,7 @@ void _FASTCALL ProcessEntity(CachedEntity* ent) { // only if bTeammatePowerup or bTeammates is true if (legit && ent->m_iTeam != g_pLocalPlayer->team && playerlist::IsDefault(info.friendsID)) { if (IsPlayerInvisible(ent)) return; + if (vischeck && !ent->IsVisible()) return; /*if (ent->m_lLastSeen > (unsigned)v_iLegitSeenTicks->GetInt()) { return; }*/ diff --git a/src/hacks/LagExploit.cpp b/src/hacks/LagExploit.cpp index 4799835d..09d4409e 100644 --- a/src/hacks/LagExploit.cpp +++ b/src/hacks/LagExploit.cpp @@ -12,7 +12,7 @@ namespace hacks { namespace shared { namespace lagexploit { CatVar toggle(CV_SWITCH, "removecond_toggle", "0", "Toggle Lag Exploit", "Toggle lag exploit (RemoveCond)"); CatVar key(CV_KEY, "removecond_key", "0", "RemoveCond Key"); CatVar lagMasterSwitch(CV_SWITCH, "removecond_master", "1", "Master Lag Exploit Switch", "Master switch for the lag exploit\nDisabling this disables everything else that uses remove conds"); -CatVar lagValue(CV_INT, "removecond_value", "450", "RemoveCond Value", "Value of user cmds to spam with"); +CatVar lagValue(CV_INT, "removecond_value", "900", "RemoveCond Value", "Value of user cmds to spam with"); CatCommand do_lagexploit("removecond", "RemoveCond (for use in scripts)", []() { AddExploitTicks(6); diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index db828fe2..da759281 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -491,27 +491,6 @@ CatCommand name("name_set", "Immediate name change", [](const CCommand& args) { ch->SendNetMsg(setname, false); } }); -CatCommand save_settings("save", "Save settings (optional filename)", [](const CCommand& args) { - std::string filename("lastcfg"); - if (args.ArgC() > 1) { - filename = std::string(args.Arg(1)); - } - std::string path = format("tf/cfg/cat_", filename, ".cfg"); - logging::Info("Saving settings to %s", path.c_str()); - std::ofstream file(path, std::ios::out); - if (file.bad()) { - logging::Info("Couldn't open the file!"); - return; - } - for (const auto& i : RegisteredVarsList()) { - if (i) { - if (strcmp(i->GetString(), i->GetDefault())) { - file << i->GetName() << " \"" << i->GetString() << "\"\n"; - } - } - } - file.close(); -}); CatCommand say_lines("say_lines", "Say with newlines (\\n)", [](const CCommand& args) { std::string message(args.ArgS()); ReplaceString(message, "\\n", "\n"); diff --git a/src/hacks/Trigger.cpp b/src/hacks/Trigger.cpp index ab0af204..f115b30e 100644 --- a/src/hacks/Trigger.cpp +++ b/src/hacks/Trigger.cpp @@ -27,7 +27,7 @@ static CatVar trigger_key_mode(trigger_key_modes_enum, "trigger_key_mode", "1", static CatEnum hitbox_mode_enum({ "AUTO-HEAD", "AUTO-CLOSEST", "Head only" }); static CatVar hitbox_mode(hitbox_mode_enum, "trigger_hitboxmode", "0", "Hitbox Mode", "Defines hitbox selection mode"); -static CatVar accuracy(CV_INT, "trigger_accuracy", "0", "Improve accuracy", "Improves triggerbot accuracy when aiming for specific hitbox"); +static CatVar accuracy(CV_INT, "trigger_accuracy", "0", "Improve accuracy", "Improves triggerbot accuracy when aiming for specific hitbox. Recommended to use with sniper rifle/ambassador"); static CatVar ignore_vaccinator(CV_SWITCH, "trigger_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets"); static CatVar ignore_hoovy(CV_SWITCH, "trigger_ignore_hoovy", "1", "Ignore Hoovies", "Triggerbot won't attack hoovies"); diff --git a/src/helpers.cpp b/src/helpers.cpp index 03fefa59..74398d80 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -726,7 +726,10 @@ void PrintChat(const char* fmt, ...) { vsprintf(buf, fmt, list); va_end(list); std::unique_ptr str(strfmt("\x07%06X[\x07%06XCAT\x07%06X]\x01 %s", 0x5e3252, 0xba3d9a, 0x5e3252, buf)); + // FIXME DEBUG LOG + logging::Info("%s", str.get()); chat->Printf(str.get()); + } else { } } diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 2a0cb6be..273b147b 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -281,7 +281,7 @@ bool StolenName(){ const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) { static const GetFriendPersonaName_t original = (GetFriendPersonaName_t)hooks::steamfriends.GetMethod(offsets::GetFriendPersonaName()); - + // Check User settings if namesteal is allowed if (namesteal && steamID == g_ISteamUser->GetSteamID()) { @@ -297,7 +297,8 @@ const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) { } } - if ((force_name.convar->m_StringLength > 3) && steamID == g_ISteamUser->GetSteamID()) { + if ((strlen(force_name.GetString()) > 1) && steamID == g_ISteamUser->GetSteamID()) { + return force_name_newlined; } return original(_this, steamID); diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 94ac78a4..6ca2e5ce 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -135,6 +135,7 @@ "type": "list", "name": "Triggerbot Preferences", "list": [ + "trigger_accuracy", "trigger_zoomed", "trigger_maxrange", "trigger_charge",