From 74bb7bcf0b4ff8dd559fefe48d9408d7f083165e Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Sat, 4 Feb 2023 16:04:22 +0100 Subject: [PATCH] Handle stats transfer for dedis Ugly workaround for #98 --- src/client/component/party.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index 9b9e42e2..d9385321 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -15,6 +15,7 @@ namespace party { namespace { + std::atomic_bool is_connecting_to_dedi{ false }; game::netadr_t connect_host{{}, {}, game::NA_BAD, {}}; struct server_query @@ -159,6 +160,8 @@ namespace party return; } + is_connecting_to_dedi = info.get("dedicated") == "1"; + const auto gamename = info.get("gamename"); if (gamename != "T7"s) { @@ -226,11 +229,27 @@ namespace party network::send(host, "getInfo", challenge); } + int should_transfer_stub(uint8_t* storage_file_info) + { + auto should_transfer = game::ShouldTransfer(storage_file_info); + + const auto offset = storage_file_info - reinterpret_cast(0x14343CDF0_g); + const auto index = offset / 120; + + if (is_connecting_to_dedi && index >= 12 && index <= 15) + { + should_transfer = !should_transfer; + } + + return should_transfer; + } + struct component final : client_component { void post_unpack() override { utils::hook::jump(0x141EE6030_g, connect_stub); + utils::hook::call(0x1422781E3_g, should_transfer_stub); network::on("infoResponse", [](const game::netadr_t& target, const network::data_view& data) {