Fix Amiibo file names with non-ASCII characters displaying as garbled text in F1 menu

This commit is contained in:
美樹杏子 committed 2026-11-08 18:39:21 +08:00
1 parent ae30a61b7b
commit 9382686c12
3 files changed
+59 -1

No files matched your search

+7 -1
View File
@@ -58,6 +58,7 @@ extern const char rt_port_version[];
void cheats_frame(uint64_t frame); // cheats.c
bool tab_cheats(float scale); // ui/cheats_tab.cpp; true: restart into the rebuild
int playtime_get(uint64_t *total_s, uint64_t *session_s); // playtime.c
bool amiibo_check_font_rebuild(void); // ui/amiibo_page.cpp; check and clear font rebuild request
}
// Roboto Medium (Apache-2.0, ui/fonts/LICENSE-Roboto.txt) with Latin and Cyrillic glyphs.
@@ -353,6 +354,9 @@ static int fonts_up(float scale) {
if (const CheatInfo *ci = cheats_info(k); ci && ci->name) b.AddText(ci->name);
for (int k = 0; k < mods_count(); k++)
if (const ModInfo *mi = mods_at(k); mi) b.AddText(mi->name);
// Add amiibo filenames so they display correctly in the menu
amiibo_collect_filenames(add_row_glyphs, &b);
b.BuildRanges(&ranges[i]);
ImFontConfig mc;
mc.MergeMode = true;
@@ -1536,7 +1540,9 @@ extern "C" int menu_overlay_frame(uint64_t frame, const MenuTarget *t, const cha
uint64_t t0 = plat_now_ns();
if (!g_ctx_ok) make_context();
float scale = menu_scale(t->height);
if (!vk_up(t) || (g_font_scale != scale && !fonts_up(scale))) {
// Check if amiibo page requested font rebuild (e.g., after refreshing directory with new files)
bool amiibo_rebuild = amiibo_check_font_rebuild();
if (!vk_up(t) || (g_font_scale != scale && !fonts_up(scale)) || (amiibo_rebuild && !fonts_up(scale))) {
rt_log("menu: Dear ImGui Vulkan back end set-up failed; the menu stays closed");
g_failed.store(1);
set_open(0);