From 00633841440353b4593be80e91c8e9663aa09ab2 Mon Sep 17 00:00:00 2001 From: James Osborne Date: Fri, 15 May 2026 23:43:47 -0400 Subject: [PATCH] Resend selected patch-menu functions after loading --- src/ReceiveCommands.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index 0ee3266b..45e6b862 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -5497,6 +5497,26 @@ static asio::awaitable on_6F(shared_ptr c, Channel::Message& msg) if ((msg.command == 0x006F) && (c->lobby_client_id != l->leader_id)) { l->assign_inventory_and_bank_item_ids(c, true); } + + if (c->login && c->login->account && c->check_flag(Client::Flag::HAS_SEND_FUNCTION_CALL) && + c->check_flag(Client::Flag::SEND_FUNCTION_CALL_ACTUALLY_RUNS_CODE) && + !c->login->account->auto_patches_enabled.empty()) { + auto s = c->require_server_state(); + unordered_set> functions_to_send; + for (const auto& patch_name : c->login->account->auto_patches_enabled) { + try { + functions_to_send.emplace(s->client_functions->get(patch_name, c->specific_version)); + } catch (const out_of_range&) { + c->log.warning_f("Client has selected patch {} enabled, but it is not available for specific_version {}", + patch_name, str_for_specific_version(c->specific_version)); + } + } + + if (!functions_to_send.empty()) { + c->log.info_f("Resending {} selected patch-menu function(s) after loading", functions_to_send.size()); + co_await send_function_call_multi(c, functions_to_send); + } + } } if (l->ep3_server && l->ep3_server->battle_finished) {