mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-19 20:25:57 +00:00
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 <noreply@deepseek.com>
This commit is contained in:
1 parent
b94bacd6d5
commit
4223adcb72
1 file changed
+11
-7
+11
-7
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user