From 54285adf59454b55d2a14fc699036d9f757f9dae Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Wed, 22 Jun 2022 22:36:02 +0200 Subject: [PATCH] Fix a bunch of issues due to the newest update --- include/hacks/AutoParty.hpp | 4 -- src/hacks/AutoParty.cpp | 104 ------------------------------------ src/hooks/Paint.cpp | 2 - src/hooks/nographics.cpp | 2 +- src/votelogger.cpp | 2 + 5 files changed, 3 insertions(+), 111 deletions(-) delete mode 100644 include/hacks/AutoParty.hpp diff --git a/include/hacks/AutoParty.hpp b/include/hacks/AutoParty.hpp deleted file mode 100644 index 3381ac47..00000000 --- a/include/hacks/AutoParty.hpp +++ /dev/null @@ -1,4 +0,0 @@ -namespace hacks::tf2::autoparty -{ -void joinMatch(); -} diff --git a/src/hacks/AutoParty.cpp b/src/hacks/AutoParty.cpp index 8b7ed483..e15d65f4 100644 --- a/src/hacks/AutoParty.cpp +++ b/src/hacks/AutoParty.cpp @@ -82,8 +82,6 @@ static settings::Boolean ipc_mode{ "autoparty.ipc-mode", "false" }; static settings::Int ipc_count{ "autoparty.ipc-count", "0" }; // How often to run the autoparty routine, in seconds static settings::Int timeout{ "autoparty.run-frequency", "60" }; -// Should we have bots bypass kicks? -static settings::Boolean kickbypass{ "autoparty.kick-bypass", "false" }; // Only run the autoparty routine once every N seconds static Timer routine_timer{}; // Populated by the routine when empty and by configuration changes @@ -100,7 +98,6 @@ static std::vector party_hosts = {}; * * */ -static settings::Boolean no_autojoin("misc.remove_invite_timer", "false"); // ha ha macros go brr #define log(...) \ @@ -240,10 +237,6 @@ void party_routine() re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient(); if (client) { - // Toggle anti-kick as needed - if (kickbypass) - no_autojoin = !is_host(); - int members = client->GetNumMembers(); // Are we in a party? if (members == 1) @@ -364,109 +357,12 @@ void party_routine() } } -#define IP_STARTSTR "PB_IP" - -// Received party message -void partyChatMessage(IGameEvent *event) -{ - if (!event->GetString("text")) - return; - - // Only parse actual chat messages - if (event->GetInt("type") != 1) - return; - - re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient(); - - if (!client) - return; - // And are we actually the leader? - // Get a list of party members, then check each one to determine the leader - uint32 leader_id = 0; - CSteamID id; - client->GetCurrentPartyLeader(id); - leader_id = id.GetAccountID(); - - // Party leader doesn't care, they just join - if (leader_id == g_ISteamUser->GetSteamID().GetAccountID() || client->GetNumMembers() == 1) - return; - - std::string chat_message = event->GetString("text"); - // Found Message about server IP - if (chat_message.find(IP_STARTSTR) == 0) - { - auto ip_string = "connect " + chat_message.substr(sizeof(IP_STARTSTR) - 1); - g_IEngine->ClientCmd_Unrestricted(ip_string.c_str()); - } -} - -class PartyEventListener : public IGameEventListener2 -{ - virtual void FireGameEvent(IGameEvent *event) - { - if (enabled && kickbypass) - partyChatMessage(event); - } -}; - -static PartyEventListener party_listener; - -void joinMatch() -{ - if (!enabled || !kickbypass) - return; - - re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient(); - - if (!client) - return; - - CSteamID id; - client->GetCurrentPartyLeader(id); - if (id.GetAccountID() != g_ISteamUser->GetSteamID().GetAccountID()) - return; - - INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo(); - std::string party_string = IP_STARTSTR; - party_string.append(ch->GetAddress()); - - client->SendPartyChat(party_string.c_str()); -} - static InitRoutine init( []() { - static BytePatch removeInviteTime(gSignatures.GetClientSignature, "55 89 e5 57 56 53 83 ec ? 8b ? ? 89 1c ? e8 ? ? ? ? f7 ? ? ? ? ? fd", 0x00, { 0xC3 }); - if (*no_autojoin) - removeInviteTime.Patch(); - no_autojoin.installChangeCallback( - [](settings::VariableBase &, bool new_val) - { - if (new_val) - removeInviteTime.Patch(); - else - removeInviteTime.Shutdown(); - }); - host_list.installChangeCallback([](settings::VariableBase &var, std::string after) { repopulate(after); }); ipc_mode.installChangeCallback([](settings::VariableBase &var, bool after) { party_hosts.clear(); }); - kickbypass.installChangeCallback( - [](settings::VariableBase &var, bool after) - { - if (*var && !after) - no_autojoin = false; - }); EC::Register(EC::Paint, party_routine, "paint_autoparty", EC::average); - g_IEventManager2->AddListener(&party_listener, "party_chat", false); - - EC::Register( - EC::Shutdown, - []() - { - removeInviteTime.Shutdown(); - g_IEventManager2->RemoveListener(&party_listener); - }, - "shutdown_autoparty"); }); } // namespace hacks::tf2::autoparty diff --git a/src/hooks/Paint.cpp b/src/hooks/Paint.cpp index 3e4fe515..b55d4a50 100644 --- a/src/hooks/Paint.cpp +++ b/src/hooks/Paint.cpp @@ -7,7 +7,6 @@ #include #include -#include "AutoParty.hpp" #include "common.hpp" #include "hitrate.hpp" #include "hack.hpp" @@ -42,7 +41,6 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode) #if ENABLE_IPC ipc::UpdateServerAddress(); #endif - hacks::tf2::autoparty::joinMatch(); } if (mode & PaintMode_t::PAINT_UIPANELS) diff --git a/src/hooks/nographics.cpp b/src/hooks/nographics.cpp index 533ad082..1728e61a 100755 --- a/src/hooks/nographics.cpp +++ b/src/hooks/nographics.cpp @@ -290,7 +290,7 @@ static InitRoutineEarly nullify_textmode([]() { auto setup_graphic_addr = e8call_direct(gSignatures.GetEngineSignature("E8 ? ? ? ? 8B 93 ? ? ? ? 85 D2 0F 84")) + 0x18; static BytePatch patch5(setup_graphic_addr, { 0x81, 0xC4, 0x6C, 0x20, 0x00, 0x00, 0x5B, 0x5E, 0x5F, 0x5D, 0xC3 }); // CMaterialSystem::SwapBuffers - static BytePatch patch6(sharedobj::materialsystem().Pointer(0x3ECB0), { 0x31, 0xC0, 0x40, 0xC3 }); + static BytePatch patch6(sharedobj::materialsystem().Pointer(0x3ed90), { 0x31, 0xC0, 0x40, 0xC3 }); // V_RenderView static BytePatch patch7(gSignatures.GetEngineSignature, "55 89 E5 56 53 83 C4 80 C7 45 ? 00 00 00 00 A1 ? ? ? ? C7 45 ? 00 00 00 00 85 C0", 0x1d3, { 0x90, 0x90, 0x90, 0x90, 0x90 }); diff --git a/src/votelogger.cpp b/src/votelogger.cpp index 348c344d..3fa935e0 100644 --- a/src/votelogger.cpp +++ b/src/votelogger.cpp @@ -79,6 +79,8 @@ void dispatchUserMessage(bf_read &buffer, int type) // TODO: Add always vote no/vote no on friends. Cvar is "vote option2" was_local_player = false; int team = buffer.ReadByte(); + // Some 4 bytes that are unknown currently. + int unk = buffer.ReadLong(); int caller = buffer.ReadByte(); char reason[64]; char name[64];