From d8d19742326958c2ba38bd68f15c82a1ce34bbbd Mon Sep 17 00:00:00 2001 From: fed <58637860+fedddddd@users.noreply.github.com> Date: Thu, 6 Oct 2022 16:13:33 +0200 Subject: [PATCH] Experiments part 9 --- src/client/component/demonware.cpp | 3 +++ src/client/component/network.cpp | 4 ++-- src/client/component/party.cpp | 28 +++++++++++++++++++++------- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/client/component/demonware.cpp b/src/client/component/demonware.cpp index 1569e1b6..e0c4196b 100644 --- a/src/client/component/demonware.cpp +++ b/src/client/component/demonware.cpp @@ -531,6 +531,9 @@ namespace demonware utils::hook::set(0x52A6D0_b, 0xC3); utils::hook::jump(0x52B800_b, get_patching_status_stub); + // Skip some other thing in Live_SyncOnlineDataFlags + utils::hook::set(0x533390_b, 0xC301B0); + utils::hook::set(0xDC0C00_b, 0xC3); // Live_CheckForFullDisconnect // isProfanity diff --git a/src/client/component/network.cpp b/src/client/component/network.cpp index 4f35934e..71e4e348 100644 --- a/src/client/component/network.cpp +++ b/src/client/component/network.cpp @@ -410,7 +410,7 @@ namespace network utils::hook::jump(0xD57C7E_b, net_init_stub); // use our own protocol version - //utils::hook::jump(0xCE8290_b, get_protocol_version_stub); + utils::hook::jump(0xCE8290_b, get_protocol_version_stub); //utils::hook::set(0x4030F0_b, 0xC3); //utils::hook::nop(0x9B014B_b, 2); @@ -430,4 +430,4 @@ namespace network }; } -//REGISTER_COMPONENT(network::component) \ No newline at end of file +REGISTER_COMPONENT(network::component) \ No newline at end of file diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index 1424a56e..4783382a 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -40,7 +40,7 @@ namespace party //command::execute("entitlements_delay 0", true); } - void connect_to_party(const game::netadr_s& target, const std::string& mapname, const std::string& gametype) + void connect_to_party(const game::netadr_s& target, const std::string& mapname, const std::string& gametype, int sv_maxclients) { if (game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_MP && game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_CP) @@ -48,7 +48,7 @@ namespace party return; } - /*if (game::Live_SyncOnlineDataFlags(0) != 0) + if (game::Live_SyncOnlineDataFlags(0) != 0) { // initialize the game after onlinedataflags is 32 (workaround) if (game::Live_SyncOnlineDataFlags(0) == 32) @@ -58,7 +58,7 @@ namespace party command::execute("xstartprivateparty", true); command::execute("disconnect", true); // 32 -> 0 - connect_to_party(target, mapname, gametype); + connect_to_party(target, mapname, gametype, sv_maxclients); }, scheduler::pipeline::main, 1s); return; } @@ -66,14 +66,20 @@ namespace party { scheduler::once([=]() { - connect_to_party(target, mapname, gametype); + connect_to_party(target, mapname, gametype, sv_maxclients); }, scheduler::pipeline::main, 1s); return; } - }*/ + } + + const auto ui_maxclients = game::Dvar_FindVar("ui_maxclients"); + game::Dvar_SetInt(ui_maxclients, sv_maxclients); perform_game_initialization(); + // setup agent count + utils::hook::invoke(0xC19B00_b, gametype.data()); + // connect char session_info[0x100] = {}; game::CL_MainMP_ConnectAndPreloadMap(0, reinterpret_cast(session_info), &target, mapname.data(), gametype.data()); @@ -420,13 +426,21 @@ namespace party return; } + const auto sv_maxclients_str = info.get("sv_maxclients"); + const auto sv_maxclients = std::atoi(sv_maxclients_str.data()); + if (!sv_maxclients) + { + info_response_error("Invalid sv_maxclients."); + return; + } + //party::sv_motd = info.get("sv_motd"); //party::sv_maxclients = std::stoi(info.get("sv_maxclients")); - connect_to_party(target, mapname, gametype); + connect_to_party(target, mapname, gametype, sv_maxclients); }); } }; } -//REGISTER_COMPONENT(party::component) \ No newline at end of file +REGISTER_COMPONENT(party::component) \ No newline at end of file