Skip to content

host/pl: take over GetBuiltInFontDataSet for Switch 2 font types - #2548

Closed
FifteenPen wants to merge 1 commit into
seedds:mainfrom
FifteenPen:pr/builtin-fontset
Closed

FifteenPen wants to merge 1 commit into
seedds:mainfrom
FifteenPen:pr/builtin-fontset

Conversation

@FifteenPen

Copy link
Copy Markdown
Contributor

What and why

Symptom: Kirby and the Forgotten Land's Nintendo Switch 2 Edition (program 04004D300C5AE001, v65536, SDK 21) aborts at boot, connecting to pl:u.

Cause: it asks for its built-in fonts with nn::pl::GetBuiltInFontDataSet, the list form of GetBuiltInFontData, which the host already takes over. Unhooked, the SDK goes to pl:u, which the host does not serve.

What the SDK does (its own GetBuiltInFontDataSet, sdk+0x4fc780 in that build):

  • It takes at most 6 types and sends them to pl:u as one byte each (an in-buffer of n bytes).
  • It fills *count entries of 0x18 bytes (BuiltInFontDataOunce) in order.
  • It returns whether the service answered (a bool, not a Result).

Change (dm/host/hle_sdk16.c): a takeover of the Switch 2 overload.

  • Each type is filled as the GetBuiltInFontData takeover fills it, with the same stand-in fonts, in the order asked.
  • A type with no stand-in font is left out of the count.
  • The Switch 1 overload (BuiltInFontTypeNx) is not hooked: no game at hand imports it.

The reference entry Built-in fonts and the audio device notification of SDK 21 covers the new call. Kirby's game note links it under "Found on this game".

Checked

  • Tests:
    • make -C dm/host/tests GAME=01004D300C5AE000 build/t_shared_font: 144 checks, 0 failed. The new checks cover the entries, their order, the limit of 6 and the case with no fonts.
    • dm/tools/tests/test_docs.py: OK.
  • Games run: Kirby and the Forgotten Land Nintendo Switch 2 Edition (04004D300C5AE001, v65536). It reached play past frame 1800 with its fonts loaded (the log's shared font lines), and no abort. The text on screen was not compared with the console.
  • Devices and OS: Apple M4 Pro, macOS 27.2.1.
  • Regression check: none run. The takeover only runs in a game that imports GetBuiltInFontDataSet.
    • scripts/regress.py impact finds 0 profiled games that use it, and the 4 with usage manifests are not affected.
    • Of the game builds at hand, only this Switch 2 Edition imports it, and it has no profile on main.

Docs

  • The finding is in its docs/reference/services.md entry and Kirby's game note, and python3 dm/tools/docs_symptoms.py was run (the symptom index did not change)
  • A chain tool changed: not applicable
  • No game files, keys or data extracted from a game in the change or the attachments

Kirby and the Forgotten Land's Nintendo Switch 2 Edition (program 04004D300C5AE001, v65536, SDK 21) asks for its built-in fonts at boot with nn::pl::GetBuiltInFontDataSet, the list form of GetBuiltInFontData. Unhooked, the SDK connects to pl:u, which the host does not serve, and aborts.

The SDK's own version (sdk+0x4fc780 in that build) takes at most 6 types, sends them to pl:u as one byte each, then fills *count entries of 0x18 bytes in order and returns whether the service answered. The takeover fills each type as the GetBuiltInFontData takeover does, with the same stand-in fonts, in the order asked, and leaves out a type with no stand-in font. The Switch 1 overload (BuiltInFontTypeNx) is not hooked: no game at hand imports it.

t_shared_font checks the entries, their order, the limit of 6 and the case with no fonts. The game reached play past frame 1800 on a Mac build of main plus seedds#1639 (Program 1 packing) and this change. services.md's entry on SDK 21's built-in fonts covers the new call.
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) docs Documentation game: 01004D300C5AE000 Kirby and the Forgotten Land labels Nov 13, 2026
seedds added a commit that referenced this pull request Nov 14, 2026
Kirby and the Forgotten Land's Nintendo Switch 2 Edition (program 04004D300C5AE001, v65536, SDK 21) asks for its built-in fonts at boot with nn::pl::GetBuiltInFontDataSet, the list form of GetBuiltInFontData. Unhooked, the SDK connects to pl:u, which the host does not serve, and aborts.

The SDK's own versions (Splatoon Raiders' sdk+0x59a3c0 for Switch 2 types, sdk+0x59a720 for Switch 1 types; sdk+0x4fc780 in Kirby's) take at most 6 or 7 types, send them to pl:u as one byte each, fill *count entries of 0x18 bytes in order and return whether the fonts are loaded; a failed request aborts. The Switch 2 overload has the service write *count whatever the answer, the Switch 1 overload writes it only when the fonts are loaded. Both takeovers share one helper that fills each type as the GetBuiltInFontData takeover does, with the same stand-in fonts, in the order asked, and leaves out a type with no stand-in font.

t_shared_font checks the entries, their order, both limits and the case with no fonts (146 checks). The game reached play past frame 1800 on a Mac build of main plus #1639 (Program 1 packing) and the Switch 2 overload's takeover. services.md's entry on SDK 21's built-in fonts covers both overloads.

Co-authored-by: FifteenPen <354289956+FifteenPen@users.noreply.github.com>
@seedds

seedds commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Landed as f0dba3b on main, with you credited as co-author. Thanks for the clear diagnosis. Two additions on top: the SDK's disassembly (Splatoon Raiders' SDK 21, sdk+0x59a3c0) shows the return value is whether the fonts are loaded (a failed request aborts), so the comment and services.md now say that; and the Switch 1 overload (sdk+0x59a720: at most 7 types, *count set only when the fonts are loaded) is taken over too, through a helper the two share, with checks in t_shared_font (146 pass).

@seedds seedds closed this Nov 14, 2026
Kayyluhh added a commit to Kayyluhh/nxnative that referenced this pull request Nov 14, 2026
… types is answered by the host: Kirby and the Forgotten Land's Switch 2 Edition no longer aborts at boot connecting to pl:u
Kayyluhh added a commit to Kayyluhh/nxnative that referenced this pull request Nov 14, 2026
…: on main in its own form as f0dba3b, both overloads
Kayyluhh added a commit to Kayyluhh/nxnative that referenced this pull request Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation game: 01004D300C5AE000 Kirby and the Forgotten Land host The Horizon host: SVCs, services, threads, memory (dm/host)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants