From 4223adcb7270103c86de3ae3effda5a9f936dcd3 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 31 Oct 2026 09:58:16 +0800 Subject: [PATCH] Check the Chinese menu catalog in probe-services The probe asserts a zh-Hans row and the language setting that reaches it, so a catalog that loses its strings or a language map that stops resolving fails the self test. Co-authored-by: deepseek-v4.1-flash-1017 --- runtime/ov_probe.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/runtime/ov_probe.c b/runtime/ov_probe.c index 9a08a3e5..8be9c513 100644 --- a/runtime/ov_probe.c +++ b/runtime/ov_probe.c @@ -811,8 +811,8 @@ static void probe_fonts(void) { (unsigned long long)size, path); } -// The host catalog (ui_text.c): every menu id has its own English and Russian text, the software keyboard keeps its -// game-language rows, and menu_text follows TOTK_MENU_LANG. +// The host catalog (ui_text.c): every menu id has its own English, Russian and Simplified Chinese text, the software +// keyboard keeps its game-language rows, and menu_text follows TOTK_MENU_LANG. static void probe_menu_text(void) { static const char *const langs[] = {"en", "ja", "fr", "de", "it", "es", "nl", "pt", "ru", "zh-Hans", "zh-Hant", "ko"}; for (int id = UI_MENU_FIRST; id <= UI_MENU_LAST_ID; id++) { @@ -820,8 +820,10 @@ static void probe_menu_text(void) { CHECK(*ui_text_in("en", (UiTextId)id) && *ui_text_in("ru", (UiTextId)id), "menu text id %d is empty", id); // the description pane keeps the whole text and a note after it (option_rows.cpp desc_set) CHECK(strlen(ui_text_in("en", (UiTextId)id)) + 256 < UI_DESC_BYTES && - strlen(ui_text_in("ru", (UiTextId)id)) + 256 < UI_DESC_BYTES, "menu text id %d is too long for the " - "description pane", id); + strlen(ui_text_in("ru", (UiTextId)id)) + 256 < UI_DESC_BYTES && + strlen(ui_text_in("zh-Hans", (UiTextId)id)) + 256 < UI_DESC_BYTES, + "menu text id %d is too long for the description pane", id); + CHECK(ui_text_defined("zh-Hans", (UiTextId)id), "menu text id %d lacks Simplified Chinese", id); } CHECK(!ui_text_defined("en", UI_TEXT_COUNT) && !*ui_text_in("ru", UI_TEXT_COUNT), "an id past the catalog gives text"); // other languages fall back to English for the menu, and keep their own keyboard texts @@ -841,10 +843,12 @@ static void probe_menu_text(void) { CHECK(menu_text(UI_MENU_CONTINUE) == ui_text_in("ru", UI_MENU_CONTINUE), "menu_text ignores MENU_LANG=ru"); cfg_set("TOTK_MENU_LANG", "en"); CHECK(menu_text(UI_MENU_CONTINUE) == ui_text_in("en", UI_MENU_CONTINUE), "menu_text did not follow MENU_LANG=en"); + cfg_set("TOTK_MENU_LANG", "zh-Hans"); + CHECK(menu_text(UI_MENU_TITLE) == ui_text_in("zh-Hans", UI_MENU_TITLE), "menu_text ignores MENU_LANG=zh-Hans"); cfg_set("TOTK_MENU_LANG", ""); - const char *sys = plat_ui_language(); - int ru = !strncmp(sys, "ru", 2); - CHECK(menu_text(UI_MENU_CONTINUE) == ui_text_in(ru ? "ru" : "en", UI_MENU_CONTINUE), "menu_text auto ignores the system language"); + const char *sys_lang = ui_text_lang(plat_ui_language()); + const char *auto_lang = ui_text_defined(sys_lang, UI_MENU_TITLE) ? sys_lang : "en"; + CHECK(menu_text(UI_MENU_CONTINUE) == ui_text_in(auto_lang, UI_MENU_CONTINUE), "menu_text auto ignores the system language"); } static void probe_main(Cpu *c) {