Skip to content

Handle corrupt/invalid NACP titles; fall back to eShop name - #21

Open
EkosFox wants to merge 1 commit into
llsc12:mainfrom
EkosFox:patch-1
Open

EkosFox wants to merge 1 commit into
llsc12:mainfrom
EkosFox:patch-1

Conversation

@EkosFox

@EkosFox EkosFox commented Nov 22, 2026

Copy link
Copy Markdown

Hello!

Some titles return a NACP name that isn't valid text (seen with The Legend of Zelda: Breath of the Wild at issue #15, TID 01007EF00011E000: the name field was random bytes, while the icon in the same control data was a valid JPEG). The bytes were sent to Discord as the activity name, which rejected the request with error 50109 ("The request body contains invalid JSON"), so no presence was shown.

Changes in utilities.cpp:

Validate NACP names (UTF-8, no control characters, bounded length) and try the other language entries if the system-language one is bad.

If no NACP name is usable, look the title up in Nintendo's EU eShop search (same endpoint as the icon lookup) and cache it in the existing icon cache under _name. If that fails too, fall back to Title .

The ~144 KB control-data buffer is freed before the eShop request. The sysmodule heap is only 512 KB, and the TLS request failed with "Out of memory" while the buffer was still held.

A failing nsGetApplicationControlData still returns NotFound, as before.

Diagnostics are logged once per title instead of every poll.

Tested on Switch OLED (22.5.0, AMS 1.12.3) with BOTW.

Limitations: names come from the EU eShop, like icons, and if the first lookup fails (for example, the network isn't ready), the name might not be updated until until the next presence refresh (every 15 minutes).

…titles

Some titles return a NACP name that isn't valid text (seen with The Legend of Zelda: Breath of the Wild, TID 01007EF00011E000: the name field was random bytes, while the icon in the same control data was a valid JPEG). The bytes were sent to Discord as the activity name, which rejected the request with error 50109 ("The request body contains invalid JSON"), so no presence was shown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant