diff --git a/simple-ipc b/simple-ipc index 94a287d6..dd569c63 160000 --- a/simple-ipc +++ b/simple-ipc @@ -1 +1 @@ -Subproject commit 94a287d6faa00d44e1084b04e602842849858443 +Subproject commit dd569c63b2ca85e8d9d395a586d54464bb0e1916 diff --git a/src/common.h b/src/common.h index b8cf4bc2..53c166de 100644 --- a/src/common.h +++ b/src/common.h @@ -38,6 +38,9 @@ #include "aftercheaders.h" +#include "macros.hpp" +#include "colors.hpp" + #ifndef TEXTMODE extern "C" { @@ -55,8 +58,6 @@ extern "C" { #endif -#include "macros.hpp" -#include "colors.hpp" #include "profiler.h" #include "offsets.hpp" #include "entitycache.h" diff --git a/src/hacks/AutoJoin.cpp b/src/hacks/AutoJoin.cpp index cc2afc83..14e8d235 100644 --- a/src/hacks/AutoJoin.cpp +++ b/src/hacks/AutoJoin.cpp @@ -11,6 +11,10 @@ namespace hacks { namespace shared { namespace autojoin { +/* + * Credits to Blackfire for helping me with auto-requeue! + */ + CatEnum classes_enum({ "DISABLED", "SCOUT", "SNIPER", "SOLDIER", "DEMOMAN", "MEDIC", "HEAVY", "PYRO", "SPY", "ENGINEER" }); CatVar autojoin_team(CV_SWITCH, "autojoin_team", "0", "AutoJoin", "Automatically joins a team"); CatVar preferred_class(classes_enum, "autojoin_class", "0", "AutoJoin class", "You will pick a class automatically"); @@ -26,6 +30,7 @@ CatCommand debug_startsearch("debug_startsearch", "DEBUG StartSearch", []() { }); CatCommand debug_casual("debug_casual", "DEBUG Casual", []() { logging::Info("%d", g_TFGCClientSystem->RequestSelectWizardStep(6)); + g_TFGCClientSystem->LoadSearchCriteria(); }); CatCommand debug_readytosearch("debug_gcstate", "DEBUG GCState", []() { @@ -52,6 +57,10 @@ void UpdateSearch() { if (g_TFGCClientSystem->GetState() == 6) { logging::Info("Sending MM request"); g_TFGCClientSystem->RequestSelectWizardStep(4); + } else if (g_TFGCClientSystem->GetState() == 5) { + g_IEngine->ExecuteClientCmd("OpenMatchmakingLobby casual"); + g_TFGCClientSystem->LoadSearchCriteria(); + logging::Info("%d", g_TFGCClientSystem->RequestSelectWizardStep(6)); } last_check = std::chrono::system_clock::now(); @@ -71,6 +80,8 @@ void Update() { if (int(preferred_class) < 10) g_IEngine->ExecuteClientCmd(format("join_class ", classnames[int(preferred_class) - 1]).c_str()); } + + last_check = std::chrono::system_clock::now(); } }}} diff --git a/src/hacks/Walkbot.cpp b/src/hacks/Walkbot.cpp index 20dff8c1..6e568882 100644 --- a/src/hacks/Walkbot.cpp +++ b/src/hacks/Walkbot.cpp @@ -940,7 +940,7 @@ void Move() { Load("default"); if (nodes.size() == 0) { static auto last_abandon = std::chrono::system_clock::from_time_t(0); - auto s = std::chrono::duration_cast(std::chrono::system_clock::now() - last_abandon).count(); + auto s = std::chrono::duration_cast(std::chrono::system_clock::now() - last_abandon).count(); if (s < 3) { return; diff --git a/src/ipc.cpp b/src/ipc.cpp index ed8eed86..3095bbf2 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -136,6 +136,7 @@ void UpdateServerAddress(bool shutdown) { } void StoreClientData() { + UpdateServerAddress(); peer_t::MutexLock lock(peer); user_data_s& data = peer->memory->peer_user_data[peer->client_id]; data.friendid = g_ISteamUser->GetSteamID().GetAccountID(); diff --git a/src/sdk/TFGCClientSystem.cpp b/src/sdk/TFGCClientSystem.cpp index 56644b4d..c28221bf 100644 --- a/src/sdk/TFGCClientSystem.cpp +++ b/src/sdk/TFGCClientSystem.cpp @@ -29,3 +29,11 @@ int TFGCClientSystem::SendExitMatchmaking(bool abandon) { logging::Info("Calling 0x%08x", SendExitMatchmaking_fn); return SendExitMatchmaking_fn(this, abandon); } + +int TFGCClientSystem::LoadSearchCriteria() { + static uintptr_t LoadSearchCriteria_loc = gSignatures.GetClientSignature("55 89 E5 57 56 53 8D 5D A8 81 EC DC 00 00 00 C7 44 24 0C 00 00 00 00 C7 44 24 08 00 00 00 00 C7 44 24 04 00 00 00 00 89 1C 24 E8 ? ? ? ? C7 44 24 08 01 00 00 00 C7 44 24 04 01 00 00 00 89 1C 24 E8 ? ? ? ? A1 ? ? ? ? 8D 50 04"); + typedef int(*LoadSearchCriteria_t)(TFGCClientSystem*); + static LoadSearchCriteria_t LoadSearchCriteria_fn = (LoadSearchCriteria_t)LoadSearchCriteria_loc; + logging::Info("Calling 0x%08x", LoadSearchCriteria_fn); + return LoadSearchCriteria_fn(this); +} diff --git a/src/sdk/TFGCClientSystem.hpp b/src/sdk/TFGCClientSystem.hpp index c49b063d..6280b809 100644 --- a/src/sdk/TFGCClientSystem.hpp +++ b/src/sdk/TFGCClientSystem.hpp @@ -13,5 +13,6 @@ public: int GetState(); /* 55 89 E5 57 56 8D 75 C8 53 81 EC 8C 00 00 00 8B 45 0C C7 04 24 ? ? ? ? 8B 5D 08 89 45 A4 0F B6 C0 89 44 24 04 E8 ? ? ? ? C7 44 24 04 91 18 00 00 89 34 24 E8 ? ? ? ? A1 ? ? ? ? */ int SendExitMatchmaking(bool abandon); + int LoadSearchCriteria(); };