diff --git a/runtime/ov_probe.c b/runtime/ov_probe.c index b5315f08..709fc871 100644 --- a/runtime/ov_probe.c +++ b/runtime/ov_probe.c @@ -1002,11 +1002,14 @@ static void probe_fonts(void) { CHECK(got == sizeof head && size && size + 8 == (uint64_t)len, "shared font 0: size %llu, file %lld bytes", (unsigned long long)size, (long long)len); const uint8_t *p = (const uint8_t *)(uintptr_t)addr; - CHECK(addr && !memcmp(p - 8, head, sizeof head) && ov_bfttf_size(p - 8, size + 8) == size, - "shared font 0: the address is not 8 bytes into the BFTTF file"); + // The pl shared memory layout: the file's BFTTF header unchanged at Address - 8, the decoded sfnt font at Address. + CHECK(addr && !memcmp(p - 8, head, 8) && ov_bfttf_size(head, size + 8) == size, + "shared font 0: the address is not 8 bytes past the file's BFTTF header"); + CHECK(!memcmp(p, "\0\1\0\0", 4) || !memcmp(p, "OTTO", 4), + "shared font 0: the data at the address is not plain sfnt: %02x %02x %02x %02x", p[0], p[1], p[2], p[3]); CHECK(CALL("pl.GetSharedFontAddress", 0) == addr, "shared font 0: the address changed"); - printf("pl: shared font 0 (Standard) at %#llx, %llu bytes, BFTTF header checked (%s)\n", (unsigned long long)addr, - (unsigned long long)size, path); + printf("pl: shared font 0 (Standard) at %#llx, %llu bytes, BFTTF header and decoded sfnt checked (%s)\n", + (unsigned long long)addr, (unsigned long long)size, path); } // The host catalog (ui_text.c): every menu id has its own English, Russian, Brazilian Portuguese and Simplified diff --git a/runtime/ov_system.c b/runtime/ov_system.c index 5aeabed2..1c4bc109 100644 --- a/runtime/ov_system.c +++ b/runtime/ov_system.c @@ -775,10 +775,15 @@ static void ov_user_difference(Cpu *c) { // ==== nn::pl shared fonts (shared_font.c). TotK asks for them only from its font loader, only with Simplified Chinese, // Korean or Traditional Chinese text, and only for type 0; tools/extract_fonts.py writes -// them from the user's firmware. Each type is read on first use into guest-visible memory as the BFTTF file the pl -// shared memory holds; Address is 8 bytes past the file start (after the BFTTF header) and Size the decoded font size, -// as in MNG. The load state is always Loaded: the game spins until it is, so missing files stop with a named fatal at -// Address/Size instead of a hang. TOTK_SHARED_FONTS=