Skip to content

applets-host (2026-10-27, cloud, Linux): generic firmware applet host and the applet stub rows

Branch claude/applets-host-2026-10-27; assignment orchestrations/applets-host.md. Status: tested on Linux, unbuilt on macOS.

What changed

  • Early hook (own commit, pushed first): libapplet_register_handler(uint32_t id, LibAppletHandler) in applet_lib_core.h (+ libapplet_find_handler, libapplet_clear_handlers, libapplet_dispatch, libapplet_call_set_out); ILibraryAppletAccessor::Start consults the registry before the built-in answers. applets-rare builds on it.
  • Generic firmware host: libapplet_program_for table (applet id → firmware program id), libapplet_firmware_enabled policy. Decision: only the Mii Maker (0x12) runs from firmware by default (that path is verified); swkbd 0x11, controller 0x0C, error 0x0E and player select 0x10 are opt-in (NAPPLE_FIRMWARE_APPLET_IDS, NAPPLE_FIRMWARE_APPLETS=all) because their HLE answers are the verified ones for games and the firmware versions are unverified; HLE is the fallback when the firmware is absent.
  • Interactive channel: host side stores/queues (iin<N>.bin to the applet, iout<N>.bin back), applet side (applet_ae.c) PopInteractiveInData, PushInteractiveOutData, the pop events; multi-storage output queue; GetResult returns the exit result (SetTerminateResult is kept and written to result.txt).
  • swkbd inline: background modes keep the keyboard running; requests (Calc, Finalize, dictionaries) are answered through applet_swkbd_inline_request (portable). Command / reply numbers are from libnx as remembered [unverified].
  • controller: honours min/max and the connected pads (already), plus the result field and cancel (NAPPLE_CONTROLLER_SUPPORT=cancel|strict). player select: several profiles through applet_set_profile_lister (the account service registers it; not done here, acc is not mine) and cancel. error: applet_set_error_hook (null default → the generic alert).
  • Stub rows 84 → 10: sleep lock + event, fatal section, window visibility, foreground rights, GPU time slice, auto sleep override, screenshot identity, request-to-display, illuminance (sensor absent until NAPPLE_ILLUMINANCE), multimedia error, suspended ticks + event, album user data, region, capture image slots (frame source hook, black when none), game play recording flags, copyright frame buffer, three system events with applet_signal_* hooks, RequestExit / Terminate / NeedsToExitProcess / PresetLibraryAppletGpuTimeSliceZero / RequestForAppletToGetForeground, TerminateAllLibraryApplets / AreAnyLibraryAppletsLeft (live accessor list), PushExtraStorage; appletAE: interactive rows, caller / main identity, storage id, launch reason, terminate result, in-memory theme storage, hid:sys 306.
  • Kept stubs (10): IsSystemBufferSharingEnabled, GetSystemSharedLayerHandle (no system compositor), PopLaunchParameter (only the preselected-account parameter exists), EnsureSaveData, GetSaveDataSize (data lives in fs.c), GetPreviousProgramIndex (no program switching), NotifyMessageToHomeMenuForDebug ×2 (no home menu), miiimg root and nfc:sys/nfp:sys root (catch-all objects; Mii / NFC areas).

Verified vs not

  • tested (Linux, runtime/tests/linux/run_applet.sh): test_svc_applet 67, test_svc_applet_libs 163, test_svc_applet_host 518 (success + cancel for swkbd/controller/player select/error, inline keyboard, firmware table with the NAPPLE_APPLET_EXE stand-in for ids 0x11 0x0C 0x0E 0x10 0x12 including interactive in/out, the former stub rows, handler registry), test_svc_applet_ae 52 checks; check_known_calls.py passes (380 rows).
  • unbuilt on macOS: everything above; the real firmware swkbd/controller/error/player select runs are not done (no firmware here).
  • proposed: command layouts marked [unverified] (capture image rows, GetCurrentIlluminanceEx, inline keyboard commands/replies, firmware program ids of 0x0A-0x1A except 0x12).

Files

runtime/src/services/applet.c, applet_ae.c, applet_core.[ch], applet_lib_core.[ch]; tests test_svc_applet_host.c, test_svc_applet_ae.c (new), test_svc_applet_libs.c; tests/linux/run_applet.sh + applet_stubs.c (Linux runner for the applet tests); docs/architecture/runtime-services.md (appended).