From eb7457a436411be4676f48103e7e862c5c3dc421 Mon Sep 17 00:00:00 2001 From: James Osborne Date: Sun, 7 Jun 2026 11:49:46 -0400 Subject: [PATCH] Log PC patch menu function filtering --- src/ClientFunctionIndex.cc | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/ClientFunctionIndex.cc b/src/ClientFunctionIndex.cc index 27d4cc4c..273e2f17 100644 --- a/src/ClientFunctionIndex.cc +++ b/src/ClientFunctionIndex.cc @@ -455,15 +455,44 @@ std::shared_ptr ClientFunctionIndex::patch_switches_menu( auto map_it = this->functions_by_specific_version.find(specific_version); if (map_it != this->functions_by_specific_version.end()) { + client_functions_log.warning_f( + "Patch menu debug: building menu for specific_version={} with {} function entries", + str_for_specific_version(specific_version), + map_it->second.size()); + for (auto [name, fn] : map_it->second) { - if (fn->appears_in_patches_menu() && !server_auto_patches_enabled.count(fn->short_name)) { + bool appears = fn->appears_in_patches_menu(); + bool server_auto = server_auto_patches_enabled.count(fn->short_name); + bool client_enabled = client_auto_patches_enabled.count(fn->short_name); + bool dragon_debug = + (fn->short_name.find("Dragon") != std::string::npos) || + (fn->long_name.find("Dragon") != std::string::npos); + + if (dragon_debug || appears) { + client_functions_log.warning_f( + "Patch menu debug: key={} short={} long={} visibility={} appears={} server_auto={} client_enabled={} menu_item_id={:08X}", + name, + fn->short_name, + fn->long_name, + phosg::name_for_enum(fn->visibility), + appears, + server_auto, + client_enabled, + static_cast(fn->menu_item_id)); + } + + if (appears && !server_auto) { std::string item_text; - item_text.push_back(client_auto_patches_enabled.count(fn->short_name) ? '*' : '-'); + item_text.push_back(client_enabled ? '*' : '-'); item_text += fn->long_name.empty() ? fn->short_name : fn->long_name; ret->items.emplace_back( fn->menu_item_id, item_text, fn->description, MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL_RUNS_CODE); } } + } else { + client_functions_log.warning_f( + "Patch menu debug: no functions for specific_version={}", + str_for_specific_version(specific_version)); } return ret; }