Return EOS_NotImplemented when the EOS SDK is unavailable. The generic
import stub had reported success, leading the game to dereference a null
platform at boot. In local character selection, function-match the game
routine that still tries two EOS lobby updates and skip those calls.
Register the game and its 88 shaders. The split uses HenWorks' MGFX v10
and ZXNB reader, already credited in 3bcf8213.
Verified the opening, character selection, save and reload, and Episode 1
at 60 fps on an Apple M6. The unsigned IPA passed archive validation.
Hades passed the offline startup regression. iPhone gameplay is untested.
423 KiB
Services and SDK calls
SDK calls and system services the host answers (dm/host/hle_*.c). Each entry: symptom, cause, fix, the games it was found on. The symptom index lists every symptom.
Service connections
SDK calls that open a system service through sm
- Symptom:
sm::Initializeaborts right afterConnectToNamedPort(SVC 0x1F) andSendSyncRequest(0x21); abort insidenn::sm::Initialize, the log showingSVC 0x1f(ConnectToNamedPort, port namesm:) andSVC 0x21answered by placeholders, then annn::diagabort; abort with no message at start-up in a service call the host has no hook for (Breakfromsdk+…with annn::diagbacktrace). - Cause: an SDK path reached a system service the host doesn't replace: the SDK's IPC to the service fails and it calls
AbortImpl. Often it is an SDK call the host does not hook, for example a newer overload of a hooked call. - Fix: hook the public SDK entry point named in the backtrace (
HLE_FORCEin the relevanthle_*.c). Symbolize the abort backtrace against the SDK's exports to find the caller (resolve the frames withsdis.py --symon the decompressed module) and hook that name. List the game's imports of that service the host does not hook (Listing a game's unhooked imports before they are met) and add the ones that talk to a service; library helpers that only fill the game's own buffers need nothing. Look at how the game uses the result before choosing it (abcatmount failure is the game's own "nothing delivered" path). - Found on: Super Mario Galaxy (SDK 18):
nn::hid::InitializeTouchScreen(int, int), the SDK 18 overload of the hookedInitializeTouchScreen(); Super Mario Odyssey (SDK 7):account::OpenPreselectedUser, thenbcat::Initialize, thenaudio::AcquireAudioDeviceSwitchNotification, and a null read inaccount::GetLastOpenedUser. - Note: the same abort from other services:
ec::InitializeForShopServiceAccessors(Shop service accessors),pctl::IsFreeCommunicationAvailable(Parental controls and free communication),oe::FinishStartupLogo(The startup logo),hid::VibrationNode::Update(Vibration values flushed by the SDK's vibration graph),audio::GetAudioDeviceOutputVolume(Audio device output volume and names),capsrv::InitializeForApplication(Album calls fail with no album),settings::LanguageCode(Language codes), and the rest of this file.
SDK 3.6.0 answered as SDK 4
- SDK 3.6.0 booted to its frame loop with the provisional profile as generated and no host change: the services, the NVN API version (53, as for every SDK up to 10), the audio output and the heap all answered as for SDK 4.
- Found on: Bayonetta 2 (PlatinumGames' engine in its Wii U form): what it needed was graphics (Clears of attachments larger than the render pass,
Downsampleof a single-sample texture) and a reader for its CRI CPK archives (BNSH files in PlatinumGames DAT archives inside CRI CPK archives); Bayonetta, on the samesdkandsubsdk0builds, then needed no change at all (its profile is Bayonetta 2's with its own build row and tables, and the route from the boot to the first fight logged no red line). OCTOPATH TRAVELER's SDK 3.5.1 answered as SDK 4 as well (NVN 53.313); its audio renderer needed the update lock found withoutSdkMutexType(NoSdkMutexTypein SDK 3).
Listing a game's unhooked imports before they are met
Most service calls can be found before they crash, before the first boot or the next one: the calls that would abort in sm::Initialize (or read a null service object) are in the import list.
- Procedure: list
main'snn::imports (its undefined imports) that no host hook names, by namespace: the survey's import table (nso_syms.py), thenmain's undefinednn::symbols that no hook (HLE/HLE_FORCE) names (02), and read each one's SDK code. This gives the calls a game will make before they are met. The import list itself says where to look: diff the undefined symbols against the closest title the host already runs (and every other game's imports), drop what the host hooks, and the rest are the candidates. To find whichsdkfunction aborted, map the backtrace offsets to the nearest exported symbol (The Legend of Zelda: Tears of the Kingdom 1.4.3). - What needs nothing: most
nn::os/nn::memimports run natively insdk. Calls that are pure computations need nothing, nor do socket calls behind aSocket()that already fails offline, nor library helpers that only fill the game's own structures. - Hook names: hooks are
HLE_FORCE,SSF,SKF,IKB_IGNOREacrossdm/hostanddm/gfx.stringsmisses names the symbol table stores as the tail of a longer one, so list them withnso_syms.dynsyms. - The survey table's blind spots: it counts only names given to
HLE/HLE_FORCEdirectly: hooks made through macros (SKFandSSFinhle_net.c,TOUCH(N)inhle_hid.c) show as missing. The touch-screen states (GetTouchScreenState<16>) were already hooked by such a macro, which the import table does not see. It once listed every vi call as unhooked:nso_syms.py host_hooksread onlydm/host, and the vi hooks are indm/gfx(it readsdm/gfxanddm/gfx/nvnnow; found on Absolum). - What it found (the calls themselves are in the entries of their service below):
- Pokémon Sword (SDK 7, one boot each): the import list against the hooks and every other game's imports named all of them beforehand: 33
nn::imports no host hook names and no other game imports. - 13 Sentinels: Aegis Rim (SDK 11).
- Monster Hunter Rise (SDK 11, one boot each): the import list against the hooks and the other SDK 11 games found most of them before the first boot.
- DRAGON QUEST XI S.
- Octopath Traveler 0: the pure computations were the swkbd presets, the web argument constructors,
time::GetDayOfWeekand the audio resampler. - DRAGON QUEST VII Reimagined (SDK 19.3.1): the import list against the hooks gave the rest before they were met; the rest fill the game's own structures or sit behind a socket that fails offline.
- Pokémon Legends: Z-A (19.3.11): the import list against the hooks (the survey's
nso_syms.pytable, thenmain's undefinednn::symbols that noHLE_FORCEnames) left 86 candidates; most only fill the game's own structures (error and web argument builders,preporeport buffers,swkbdconfiguration, the audio resampler,nn::async). The ones that reach a service were hooked before they were met where the answer is clear:time::ToPosixTimewith an explicit rule,album::SaveCurrentScreenshot,err::ShowApplicationErrorand theShowShopAddOnContentList(UserHandle)overload. - STEINS;GATE RE:BOOT (SDK 20.5.17):
nn::audio::SetAudioOutVolume(AudioOut volume kept per output) was amongmain's imports that no host hook names; the others there fill the game's own structures or run insdk(the CPU audio renderer, the swkbd and hid argument builders). - Paper Mario: The Thousand-Year Door (SDK 15.3.2):
nn::settings::GetAvailableLanguageCodeswas the one import ofmainthat no host hook names and that reaches a service;fs::MountRamDiskand the swkbd and hid helpers it also imports run insdkor were never called. - Catherine: Full Body (SDK 8.2.1): besides
GetAvailableLanguageCodeCount, the other imports no hook names run insdk(theLanguageCodecomparison,ClockSnapshot's constructor and getters, fibers,NumberLineAllocator). - Animal Crossing: New Horizons (SDK 20.5.4): the clock, region and album calls under their own entries below were found in
main's imports before the first boot. - The Great Ace Attorney Chronicles (SDK 10.4.1): listed after its first boot crashed in
oe::DisableAlbumImageTakenNotification; the calls found are in the entries under## Display, window and operation mode,## File system and save dataand## Accounts, network, shop and parental controls. - Big Brain Academy: Brain vs. Brain (SDK 11.4.3).
- Pokémon Sword (SDK 7, one boot each): the import list against the hooks and every other game's imports named all of them beforehand: 33
A game update imports SDK calls the base game did not
- Symptom: a game update aborts at boot where the base game ran.
- Cause: the update imports SDK functions the base game didn't. Mario 1.2.1 added 28, among them
nn::nfp(amiibo, initialized at boot),pl::IsRunningOnOunce(is this a Switch 2),ec::ShowShopApplicationInformationForUpgrade,account::PopOpenUsersandaoc::CountAddOnContent. - Fix: diff the undefined dynamic symbols of the two
mainmodules before the first run, and read the call sites before choosing answers: Mario only reads the count fromPopOpenUsersand falls back toTryOpenPreselectedUseron 0, and only counts add-on content when running on a Switch 2. The host answers as a Switch 1 with no amiibo and no add-on content (hle_sdk16.c,hle_account.c,hle_misc.c). - Found on: Super Mario Bros. Wonder (update 1.2.1).
Game-linked HIPC clients of system services
- Symptom: abort in
sm::Initializeundersf::hipc::InitializeHipcServiceResolution, right after the first frames (frommain+0x5b8198); since that fix,[RED] sf: the game connects to service <name> itself, which the host does not serve, then an abort withResult=0xe15(caps:suin Super Smash Bros. Ultimate's single-player mode,notif:awhen Fit Boxing 3 opens its Settings). - Cause:
mainlinks its own clients ofolsc:u(cloud save data backup settings) andnpns(push notifications), which talk HIPC throughsmandsvcSendSyncRequest. For each user the game asks whether backup is on and switches it off where it is (main+0x2809c8c); a failed connect aborts as well. - Fix:
hle_sf.ctakes over the SDK's HIPC client entry points (InitializeHipcServiceResolution,ConnectToHipcService,SendSyncRequest,CloseClientSessionHandleand the control requestsQueryPointerBufferSize,ConvertSessionToDomain,DuplicateSession(Ex)): a service it serves (olsc:u, the capture services below) gets a host session, and every request on it succeeds with zeroed output, which reads as backup off for every user. Any other name is refused with a red line, assmrefuses a service nobody registered (npnswas never connected).DM_SF_TRACE=1dumps each request. A service with real answers registers itself withSF_SERVICE(hle.h) from its own file: it gets the request's raw input, the client's handles and its A / B / X buffers, writes raw output, and may copy an event's read end or move a new session (an object outside a domain) back; a session keeps its own state and ends it on close (audren:u: SDK 1: the renderer is theaudren:uservice). - Capture services: Super Smash Bros. Ultimate links clients of
caps:suandcaps:u(screenshots and clips) and aborts withResult=0xe15whensmrefuses them at the start of its single-player mode. The host has no album, socaps:su,caps:u,caps:a,caps:c,caps:scandcaps:ssget host sessions too: a list reads as empty and a save does nothing. - Reminder alarms:
nn::notification's alarm calls (ListAlarmSettings,RegisterAlarmSetting,UpdateAlarmSetting,DeleteAlarmSetting,LoadApplicationParameter), which most SDKs link, connect tonotif:aon their first call and abort on any failure: Fit Boxing 3 2.0.0 (SDK 21.4.4) lists them when its Settings open. The client sends only commands 1000 (Initialize, with the process ID), 500, 510, 520, 530 and 540 (SDK 21:sdk+0x58ac80..0x58ad10in Splatoon Raiders 1.1'ssdk); the notification event comes fromam, not from this service. The host schedules no alarms, sonotif:ais served: a list is empty and leaves the caller's array as it is, a registration succeeds with ID 0 and never fires, a parameter loads 0 bytes. - Found on: Animal Crossing: New Horizons (SDK 20.5.4); Super Smash Bros. Ultimate (capture services); Fit Boxing 3 2.0.0 (
0100AC101BFA2000, a provisional profile, no note:notif:a, PR #1974).
Mission events through mnpp:app
- Symptom:
[RED] sf: the game connects to service mnpp:app itself, which the host does not serve, then annn::diagabort with Result 0xe15 (main+0x37080) when a game is started. - Cause:
mainlinks its ownmnpp:appclient, outside the host's BCAT SDK hooks, and aborts whensmrefuses the connection (Game-linked HIPC clients of system services). The service (13.0.0+) initializes with a PID descriptor and reserved inputu64(command 0), then accepts aUidand type-0x5 input buffer (command 1). Neither command has output; the real service creates events for later upload to Nintendo (service contract). - Fix:
hle_sf.cservesmnpp:appthrough the existing success/zeroed-output response path. It is a deliberate offline stand-in: events are acknowledged and discarded, with no retained queue or upload. This fixes the missing host service at the protocol level (hostbinding), without a game or build gate. It does not implement Nintendo's event backend. - Found on: Super Nintendo Entertainment System – Nintendo Classics (
01008D300C50C000, 6.0.0, SDK 20.5.21), when starting a game from the list. PR #2164 reports the original abort and Mac gameplay with the separate friends hook and game profile. - Check:
make -C dm/host/tests GAME=<id> build/t_sf, thendm/host/tests/build/t_sf, checks initialization with the PID/reserved input, event submission with theUidand input buffer, success without output data or handles, untouched input, and refusal of the othermnppservice names. The same test retains its existing offline-service, alarm and camera checks.
SDK names that changed between versions
Older SDK names for the same calls
- Symptom: a call the host hooks under its newer name reaches the SDK's own code on an older game.
- Cause: older SDKs export other names for the same calls.
- Fix: hook both generations. SDK 12 names:
ListAudioDeviceName/GetActiveAudioDeviceName, singularhid::GetNpadState,OpenDefaultAudioOut. SDK 11 names:fs::CommitSaveData(mount)is the older name offs::Commit. - Found on: Metroid Dread (SDK 11 names).
- Note: overloads change too: SDK 18's
nn::hid::InitializeTouchScreen(int, int)(Super Mario Galaxy, SDK calls that open a system service through sm), SDK 19'sLoadModulewith one more bool (nn::roand its port), andvi::CreateLayerwith the layer's size (Absolum,vi::CreateLayerwith the layer's size). SDK 19'sfs::MountRom(const char *, int, void *, size_t)andfs::QueryMountRomCacheSize(size_t *, int)take a program index (Metroid Prime 4: Beyond's boot,[RED] sf: the game connects to service fsp-srv itself): an index mounts that program's RomFS image,romfs_programs/<index>.imgbeside the RomFS, which the NUP packer writes for the other programs of an application, and an index with none mounts this program's own (a red line for an index other than 0) (A Switch 2 Edition NUP).
SDK 4's friends::GetBlockedUserList without a Uid
- Symptom: abort in
sm::Initializeundernn::friends::GetBlockedUserListafter the opening movie. - Cause: SDK 4's overload without the
Uid(EPiPNS_7account23NetworkServiceAccountIdEii), which the host did not take over. - Fix: it reports an empty list with success: the game turns a failure into an error for the error applet (
main+0x8ff9f0). The overload with aUidkeeps reporting a failure, which DRAGON QUEST XI S takes as it is (Account, friends, play data and Nintendo Account calls). - Found on: DARK SOULS: REMASTERED (SDK 4.5.0, the oldest so far; one boot).
SDK 20's friends::GetPlayHistoryRegistrationKey without a Uid
- Symptom: an
nn::diagabort with Result 0xe15 infriends::detail::ipc::Initialize(sdk+0x3b45a8), first thing innnMain, after[RED] sf: the game connects to service friend:u itself. - Cause: the form without a
Uid(GetPlayHistoryRegistrationKey(PlayHistoryRegistrationKey*, bool)) was not taken over, and the SDK's own opens the friends service. - Fix: taken over as the
Uidform is: the key is unavailable (hle_friends.c). Both returnRES_FAILwithout writing the output; the host has no friends service. The hook is bound to the SDK symbol, with no title or build gate. - Check:
make -C dm/host/tests GAME=<id> build/t_friends, thendm/host/tests/build/t_friends, resolves both overloads by their actual registered names and checks the failure result and untouched output for both local flags, including guest bool arguments with upper bits set. - Found on: Super Nintendo Entertainment System – Nintendo Classics (
01008D300C50C000, 6.0.0, SDK 20.5.21,main+0xc608). PR #2162 reports the original abort and a Mac boot past it with separate mission-events and profile changes.
SDK 14's friends calls without a Uid, blocked-user list availability, and cut-object methods
- Symptom:
[RED] sf: the game connects to service friend:u itself, then annn::diagabort with Result 0xe15 infriends::detail::ipc::Initializeunderfriends::EnsureBlockedUserListAvailable(sdk+0x341d28) when leaving the title screen. - Cause:
hle_friends.c/hle_offline.cdid not take overEnsureBlockedUserListAvailable/CheckBlockedUserListAvailability(either form), several no-Uidoverloads (EnsureFriendListAvailable,CheckFriendListAvailability,DeclareOpenOnlinePlaySession,DeclareCloseOnlinePlaySession,GetProfileList,UpdateFriendInfo,NotificationQueue::Initialize,UserPresence::Initialize, plusFriend::Update), or methods (AsyncContext::Cancel,NotificationQueue::Clear,NotificationQueue::Finalize) that lock mutexes left uninitialized by the cut constructors. - Fix: all 16 SDK symbols are taken over in
hle_friends.cwith the same offline policy as their existingUidandnn::account::AsyncContextcounterparts:Ensure*and service queries fail at once (RES_FAIL),Check*Availabilityreports unavailable (*out = 0) withRES_OK,UserPresence::Initialize()andAsyncContext::Cancel()returnRES_OK, andNotificationQueue::Finalize()is a no-op. Bound to the SDK symbols with no title or build gate. - Open: returning
RES_FAILfromEnsureBlockedUserListAvailablematchesEnsureFriendListAvailableand works on SUPER BOMBERMAN R 2, though another title could turn it into an error applet (as DARK SOULS: REMASTERED did with SDK 4'sGetBlockedUserList). - Check:
make -C dm/host/tests GAME=<id> build/t_friends, thendm/host/tests/build/t_friends, resolves all 16 registered symbols and verifies their results, output flags, null safety and untouched buffers. - Found on: SUPER BOMBERMAN R 2 (
0100B87017D94000, 1.0.0, SDK 14.3.0; provisional profile, no note yet, issue #3177): Mac gameplay through the title screen, main menu, Story (World 1) and Battle Offline vs 3 COMs at 60 fps with no[RED]lines or aborts.
Friend-ID lists and network error Results on SDK 7
- Symptom:
friends::GetFriendListorerr::ShowNetworkServiceErrorenters the SDK's service path despite the host's offline replacements. - Cause: the account-ID list overloads (with and without
Uid) and the error overload takingnn::Resultwere not registered. The existing hooks coverFriendobjects and anErrorCodepair, which have different exported names and argument layouts. - Fix: both account-ID list overloads follow the host's offline policy. They return
RES_FAIL, set the count to zero, and leave the ID array untouched. The Result overload logs the module and description and sends the usual applet enter and leave notifications. - Found on: Super Kirby Clash 1.0.1, SDK 7.4.0, in PikaMan80's patch for issue #987.
SDK 6's account::OpenPreselectedUser returns a Result
- Symptom: the first loading screen never ends;
DM_FS=1showssave:/system"not found" and nofs mount save. - Cause: in SDK 6
account::OpenPreselectedUserreturns a Result, and the game skips its save mount when it is not 0 (main+0x53b7e0). The host's hook returned void and left the handle pointer in w0. - Fix: the hook returns 0 now; SDK 7 and later callers ignore it.
- Found on: Fire Emblem: Three Houses (SDK 6.5.0).
File system and save data
Directory handle allocation failure
- Symptom: the host crashes in
h_fs_OpenDirectorywhen its folder-backed directory handle allocation fails. - Cause:
opendirsucceeded, but the followingcallocofdirh_twas dereferenced without a null check. Returning early without cleanup would also leak the already-openDIR. - Fix: close the directory on allocation failure, preserve
errnoacross cleanup, and return the existing filesystem failure througherr_resbefore publishing a handle. The caller's output stays untouched, as on the other failed-open paths.t_fs_directory.cinjects allocation failure in the real handler, checks the descriptor is closed and the output unchanged, then exercises successful open, count, read and close. - Found on: the GCC audit in issue #313, reproduced with a synthetic directory and allocation fault injection; no game-specific failure was reported.
The SDK's own fs::IsMounted reads an empty mount table
- Symptom: IL2CPP "Could not open …/global-metadata.dat" (then a crash in its logger).
- Cause: IL2CPP checks
nn::fs::IsMounted("rom")before opening; the SDK's ownIsMountedreads a mount table the host never fills. - Fix: answer from the host's mount table (
hle_fs.c). - Note: the C library's path checks read the same empty table through
IsPathMounted(C library path checks ask the file system's limits).
A mount in the SDK's own table stays until the SDK releases it
- Symptom:
game called nn::diag abort: Result 0x7802(MountNameAlreadyExists) when a game mounts a RAM disk under a name it has just unmounted. - Cause: the host's mount table is permanent and
nn::fs::Unmountdid nothing.nn::fs::MountRamDiskhas no host version, so it runs insdkand registers in the SDK's own table, and the no-op left that entry there while the game freed the disk's buffer. - Fix:
h_fs_Unmountleaves a host mount alone and sends any other name to the SDK: itsIsMounted, then itsUnmountif it holds the name (the SDK'sUnmountaborts on a name it does not hold).guest_symgives the module's own definitions, not the host's take-overs. A name in neither table stays a no-op.t_fs.ccovers each case. - Note: the file calls on such a mount now reach the SDK too: File calls on a mount in the SDK's own table.
- Found on: Paper Mario: The Thousand-Year Door (GitHub issue #1012).
File calls on a mount in the SDK's own table
- Symptom:
game called nn::diag abort: Result 0x202(path not found) right afterfs path not found: <name>:/...lines (DM_FS=1) for a mount name nofs mountline ever named. - Cause:
nn::fs::MountRamDiskruns insdkand registers in the SDK's own mount table (A mount in the SDK's own table stays until the SDK releases it), while every file call the host takes over looked in the host's table only. Nintendo Switch Sports Resort mounts its VoiceText speech data as the RAM diskvtapi, copiesVoiceText/fromcontent:into it at boot and aborted on its firstGetEntryType(main+0x414dbc). - Fix: a path whose mount name the host does not hold but the SDK's
IsMounteddoes goes to the SDK's own call (sdk_path_callinhle_fs.c;guest_symgives the module's definition, not the host's take-over), with no host lock held. The file and directory handles that call opens are listed (sdk_handle_add, up to 256 open at once; past that the open is closed in the SDK and fails), and the calls that take a handle go to the SDK when it is listed; a close forgets the handle before the SDK frees it.IsMountedandIsPathMountedanswer from both tables. A rename between the SDK's mount and another fails without reaching either. A path on a host mount never asks the SDK.t_fs.c(⑩) covers routing, handle tracking and isolation. - Note: Paper Mario: The Thousand-Year Door's file cache (the RAM disk
cache) takes this path as well: itsCreateFileoncache:/<hash>was "path not found" and the game skipped the cache (its note); not checked on that game. - Found on: Nintendo Switch Sports Resort (
04008E001F098000).
File handles with low bits set, and backslash paths
- Symptom: a 10-byte read of the wrong RomFS file, then a null pointer at boot; files named
rom:\StartupUI.pakare not found. - Cause: on Horizon a
FileHandleis a pointer to the SDK'sFileAccessor, a heap object, so its low bits are clear, and a game's file device may mask them off (handle & ~7) beforeReadFile. The host's RomFS-image handle kept the entry index in its low bits, so entry 7 was read as entry 0. Separately, Horizon's file system accessor turns every backslash in a path into a slash before it normalizes the path (FileSystemAccessor::SetUpPath, on every mount except the PC host's); the host treated a backslash as part of a name. - Fix: the guest gets the host's handle shifted left by 4, 16-byte aligned like an AArch64 heap block (
FH_OUT/FH_IN). Each guest path resolver (img_path,host_path_ex,set_guest_name,dir_snapshot) turns backslashes into slashes first, so overlays,..and guest names see the same path (hle_fs.c;dm/host/tests/t_fs.c). - Found on: Metroid Prime 4: Beyond (SDK 19; bring-up in issue #229, from PR #513); not in the games table yet.
Saves named before backslash paths
- Symptom: after a rebuild, a game shows every file of its file select as new, while its save folder holds names that start with a backslash (
\savedata0.bin,\screenshot0.bin). - Cause: a host from before backslashes separated paths took the backslash in
save:\savedata0.binas part of the file's name. Today's host looks forsavedata0.bin, and the old file cannot be reached by any path a game can ask for. - Fix: each mount of a committed save, before its work directory is cloned, renames every entry whose name has a backslash to the name the game asks for today (
save_old_names,hle_fs.c):\dir\fbecomesdir/f, the folder made on the way, and\diranddirmerge. It goes by guest names, so\Foobesidefoostays a file of its own. Each rename is atomic and keeps the contents, and a kill partway is finished by the next mount, so it needs no transaction and no marker, and a file the game erases later stays erased. It holds the locks the cloud sender's clone takes, and comes after the cloud's save came in, so that one is renamed too. - Limits: an entry whose new name is taken stays under its old name, with a log line at each mount (
save: … stays as it is): the game wrote a new save since, and that is the one it reads. To go back to the old save, delete the new file and start again. A build from before the change can no longer read a renamed save. With cloud saves, a rename counts as a change to this device's save and goes out at the next mount or Commit; a device still on such a build then sees an empty save. - Check:
dm/host/tests/t_fs.csection 9. On Link's Awakening on the Mac, one save renamed to the old form: every file shows New Game without the fix, and File 1 with it, the file unchanged. Through a cloud folder, old names that come in are renamed, the renamed save goes out, and the next mount is in step. - Found on: The Legend of Zelda: Link's Awakening (GitHub issue #905, diagnosed in LNPANDY/NX2Apple#461).
Both saves changed is the player's choice, not the newest file's
- Symptom: after playing on two devices, a save started fresh on one of them a minute after a real save on the other replaces the real one in the cloud; it survives only in that device's
save-backups/<date> cloud. - Cause: when both saves changed since the last sync (or a device that has never synced has a save of its own), the host keeps the newer one, and "newer" is the newest file date in the save. A new game's first save written 45 s after a 54-minute save is the newer one. The host could ask instead (
ss_decidereturnsSS_ASKwhen a front end setsDM_SAVE_SYNC_CHOICE, documented in The cloud saves folder), but neither launcher set it, so the player was never asked. - Fix:
save_sync_report()(dm/host/save_sync.c) answers, before the start, one line about the two saves as the game's first mount will see them: their hashes, dates, file counts and sizes, the cloud's device, and whether both changed. It finds the cloud's file with the mount's own rules (cloud_path:DM_SAVE_SYNC,icloud, a folder named after the game) and fetches it through the same front-end call. Both launchers call it when Play is pressed (SaveSyncReport.swift, shared): on a conflict they show both saves with their dates and sizes (the size tells a new game from one with progress; no button is the default on the Mac) and passlocal:<hash>orcloud:<hash>, both with the hash of the cloud's save the player chose against (local:nonewhen the cloud has none); with nothing to choose they passask. The Mac launcher setsDM_SAVEbefore its window so the report can read the save, and checks with the window off too. - Limits: with no launcher (
DM_LAUNCHER=0, or an iPhone app withoutlauncher.json) the newer save still wins. A front end that setsaskwithout comparing keeps a save that changed on both sides on neither side's until a start that asks. - Check:
dm/host/tests/t_save_sync.csection 15: nothing anywhere, a save only here, in step, the game's own folder chosen, only in the cloud, both changed with the new save the newer and the smaller, the cloud unreadable, sync off,DM_SAVE_SYNCread when no folder is given, nothing left behind. The Mac launcher and the iPhone sources build; neither dialog has been run here. - Found on: Cadence of Hyrule (
01000B900D8B0000, 1.5.0) on an iPhone (iPhone19,4) and a Mac mini M2 Pro (PR #2180).
No save in the cloud is not an empty cloud for a device that synced one
- Symptom: a device that already synced a save to the cloud folder sees no
<title>/save.dmsyncthere (the cloud save was removed, a different folder was picked after an iPhone reinstall broke the bookmark, or iCloud has not listed the file yet), and Play sends this device's save without asking and with no backup of anything not yet listed. - Cause:
front_save_sync_fetchreturns0when neither<title>/save.dmsyncnor its.save.dmsync.icloudplaceholder is visible, andss_decidesent this device's save whenever the cloud had none, ignoring that<save>.syncholds abaseproving this device synced a save there before.save_sync_reporttherefore saidconflict=0, so the launcher asked nothing. - Fix:
ss_decidetreats no cloud save plus a sync base as both changed. With a front end that asks, it returnsSS_ASK, andsave_sync_reportsaysconflict=1withcloud=0(a damaged cloud file still reportsconflict=0and is replaced with a backup as before). The launchers show "No cloud save found" (SaveSyncReport.Step.missing) with Try Again, Play Without Sending (offline) and Send This Device's Save (local:none).send_savenever sends over a missing cloud save while a base is set. A start that chose to send (the player, or no front end) clears the base first. With no front end the start still sends, as before, with a red line. - Limits: iCloud listing the folder late after a new pick is inferred from the code, not caught in a device log (the overwrite originally reported in #3196 turned out to be the newer-file rule of a build from before the entry above). A cloud save removed on purpose now costs one question.
front_save_sync_fetchdoes not yet ask iCloud for the folder's listing itself. - Check:
dm/host/tests/t_save_sync.csection 2 (the table), section 13 (damaged cloud file stillconflict=0and replaced with a front end), and section 17 (the report, a start that asks, a game played without sending, the Mac-style send after the host, the cloud's file listed again,local:none, no front end);dm/ios/tests/launcher_storage_check.swift(SaveSyncReport.step->.missing). The iPhone compile check and the Mac launcher's Swift typecheck pass. On an iPhone 16 Pro Max (Donkey Kong Bananza,040074A01BF12000), with the IPA reinstalled (the bookmark then did not resolve), the folder chosen again and the cloud's file moved aside on the Mac: the report saidcloud=0 conflict=1, the dialog showed and nothing was sent; with the file back, Play brought the cloud's save in with no dialog and kept the phone's insave-backups/<date> local. The Mac's dialog has not been run. - Found on: an iPhone after reinstalling the IPA (issue #3196, PR #3197).
The cloud's save is listed but not downloaded
- Symptom: the first start after the other device saved plays this device's save; start it, quit, start again, and the cloud's save comes in. With no connection, the game's first save mount waits out its whole time limit.
- Cause: iCloud lists a file it has not downloaded as
.save.dmsync.icloud, and the mount gives the downloadFETCH_MS(10 s) before it plays on with this device's save; a later start finds the file there. The report says the coordinated read could also come back without the file before the download landed; that is not checked here. - Fix: the download happens in the launcher, before the game: its report waits up to a minute (
SaveSyncReport.waitMs) with "Checking the cloud save…" and Play Without It on screen.front_save_sync_fetch(dm/ios/Sources/SaveSync.m) asks for the download and waits for the file until it is there or iCloud reports a download error (NSURLUbiquitousItemDownloadingErrorKey), so with no connection it ends at once. A cloud save that did not come is said so, with this device's save, another try or Cancel; playing this device's passesoffline, so the mount does not wait again, and that save is not sent until it has been compared with the cloud's. - Limits: with no launcher the mount's 10 s apply as before. Whether iCloud sets the download error at once when offline is from Apple's documentation, not a run.
- Check: not run on an iPhone here: neither a listed file nor an offline start. The PR author's runs (its own 25 s wait): a planted
.save.dmsync.icloudin a scratch folder timed out with nothing written, and a real iCloud fetch loggeddownloaded in N s. - Found on: Cadence of Hyrule on an iPhone (iPhone19,4), after a save from a Mac mini M2 Pro, macOS 26.6 (PR #2180).
Replacing a cloud-save folder left its scope open on iOS
- Symptom: switching the launcher's cloud-save folder or turning cloud saves off left the previous folder's sandbox grant open until the app exited.
- Cause:
dm_cloud_saves_pathdiscarded the URL without stopping access and could replace it with a different URL for the same path. Clearing the bookmark left the grant held. The stale-bookmark refresh balances its own grant. - Fix:
CloudSaves.mretains the exact URL that successfully started access and stops access when the selection is replaced, cleared, or no longer resolves. The launcher disables folder changes during the prelaunch save check so it can finish using the selected folder. - Found on: code review of the shared iOS launcher. The grant lifecycle was checked with synthetic URLs and bookmarks.
A failed pull deleted this device's save
- Symptom:
[RED] save sync: bringing the cloud's save in failed (errno=…): playing on with this device's, and the game starts with the cloud's save; this device's is in neither its save folder nor<save>-backups. - Cause:
pull(dm/host/save_sync.c) unpacked the cloud's save into<save>.sync-tmp/in, swapped each folder with the live one, and then moved the swapped-out folder, this device's, from the staging folder into the backups. Between the swap and the move the staging folder held the only copy of this device's save. When the move failed,mount_oncelogged the line above and cleared<save>.sync-tmp, deleting it; an app killed between the two steps lost it the same way, since every start clears that folder. A failure at the second folder (save_device) after the first had swapped left a save that was half the cloud's. - Fix: each of the cloud's folders is moved into this device's backup folder first, and swapped from there with the live one, so one atomic step puts the cloud's folder in place and leaves this device's in the backups; a folder the cloud's save does not have is moved to the backups. The staging folder never holds this device's save.
pullrecords what it did to each folder, and on a failure puts them back in reverse order: the save is this device's again, whole, and the empty backup folder goes. If a step of putting back fails, nothing is deleted and the red line names the backup folder that holds what is not in place; since A pull cut short left a half-replaced save that save is not mounted, and the putting back is done by the journal's recovery. - Check:
dm/host/tests/t_save_sync_metadata.c, the pull cases: nothing fails, with and without the cloud's device save; the move into the backups fails; the device save's swap fails and the save is swapped back; the device save's move to the backups fails; the swap back fails too. After every rename and swap the staging folder is checked for this device's save. On the oldpull, 22 of these checks fail, among them the reported loss.t_save_sync101 checks. - Found on: no game; a report with an injected EIO on the move into the backups (a pull of the cloud's save chosen by the player).
A pull cut short left a half-replaced save
- Symptom: after the app was killed while it brought the cloud's save in, or after
[RED] save sync: bringing the cloud's save in failed (errno=…), and this device's could not all be put back, the game started on a save that was half the cloud's (itssavefolder the cloud's,save_devicethis device's, or the other way round), and the sender could send it over the cloud's. This device's folders were in<save>-backups, but nothing put them back. - Cause:
pull(dm/host/save_sync.c) undid a failed step only within the same call, from a list of what it had done; an app killed between the two folders' swaps left no record, and the next start, finding no pull in progress, compared and played on what was in place. A step of putting back that failed was logged, and the mount went on:save_sync_mountreturned nothing its callers could refuse on. The backups of this device's older saves were pruned when the new backup folder was made, before the pull was known to succeed. Reproduced against the oldpull: killed after its first folder's swap, the next start (sync off) played on the cloud'ssavewith this device'ssave_device. - Fix: a journal,
<save>.pull, is written and synced before the first of this device's folders moves, and removed once the cloud's save is wholly in place (the commit point). It names the backup folder and, for each folder, what this device had there (nothing, an empty folder or a save, with the folder's device and inode: a rename or a swap keeps a folder's inode, so it is found wherever the pull stopped). One recovery,recover, puts this device's save back from any point, removing only the cloud's folders: a failed step calls it, and so does the first save mount of every start, before the staging folder is cleared and before a sender can run, whateverDM_SAVE_SYNCsays. A journal that cannot be read, or a recovery that fails, leaves everything where it is and refuses the save mount:save_sync_mountreturns -1 (a second mount gets the first's answer) andhle_fs.cstops the game with the reason (die), and the next start tries again. The Mac launcher's send after the host (save_sync_after_exit) sends nothing while a journal is pending, and the launchers' report (save_sync_report) sayspull=1and offers no conflict, as what is in place may be half the cloud's. The older local backups are pruned only after a pull completes. An app kill is covered; a power loss is not claimed (the folder renames are not synced to the disk). - Check:
dm/host/tests/t_save_sync_metadata.c(204 checks): a kill after each rename and swap of a pull, with this device's device folder holding a save, empty or absent and the cloud's save with and without one, then the next start's mount: this device's save is back as it was, nothing of the cloud's left, the journal gone; a kill in the middle of that recovery, finished by the next start; a pull whose putting back fails keeps its journal and the next start recovers it; a recovery that fails refuses the mount, keeps the journal, and the start after it recovers; an unreadable journal refuses the mount; a second mount gets the first's answer; a pull that fails prunes nothing and one that completes leaves the newest 10; nothing is sent after the host while a journal is pending.t_save_sync(104): a journal the start cannot put back stops the game's ownMountSaveData, leaving the save and the journal as they were, and with the journal gone the mount goes on. Four deliberate breaks (no journal, a mount that ignores it, pruning at the backup's creation, a recovery that leaves the cloud's folder in the backups) each fail the test. - Found on: no game; the audit of the review's save fix (step 15), with the reproduction above.
Automated runs synced their scratch save with the player's cloud save
- Symptom: none in a log. With
DM_SAVE_SYNCexported in the shell, ascripts/regress.pyroute withsave=newstarts with the player's cloud save for that game, and the run's own progress then replaces it in the cloud. - Cause:
regress.py(run_env),bench.py(run_one) and the NSP script's host runs (tool_env: the captures, checks and the pipeline prebuild) copied the caller's environment and replaced onlyDM_SAVEwith a scratch folder. The host syncs wheneverDM_SAVE_SYNCnames a folder, and names the cloud file by title ID (dm/host/save_sync.c,cloud_path), so the scratch save was synced with the player's: with noDM_SAVE_SYNC_CHOICEthe newer save wins, a save only in the cloud is pulled in, and the first commit after it is sent over it. The cloud save it replaced was kept in<DM_SAVE>-backups, inside the run folder, which the next run deletes. - Fix: every automated run (
regress.py,bench.py, the NSP script's tool runs and prebuild) goes through one policy,dm/tools/run_saves.pycloud_off, applied after the overrides it takes:DM_SAVE_SYNC=0, and the launchers'DM_SAVE_SYNC_CHOICEremoved (the player's answer, meaningless with sync off);regress.py --envor abench.pyvariant or--envthat turns sync on is refused (CloudSync).regress.pyleavesDM_SAVE_SYNC*out of a baseline's context, since no run reads them. The command the NSP script prints for the player's own run is unchanged. Cloud saves are checked bydm/host/tests/t_save_sync.candt_save_sync_metadata.con temporary folders. - Found on: no game; a report with a temporary cloud folder holding a synthetic save.
An unhooked fs::ReadFile overload falls through to the SDK's own
- Symptom: a fault inside
sdkat boot, right after the save data is mounted:ldr w8, [x0, #0x24]withx0holding a host file handle (SD GUNDAM G GENERATION CROSS RAYS:sdk+0x62a78,x0 = 0x4000000000000390), whileGetFileSizeon the same handle answered just before. - Cause: the game imports
nn::fs::ReadFile(FileHandle, s64, void*, size_t, const ReadOption&), the overload with read options and no bytes-read output, which the host did not hook, so the call bound to the SDK's own. That one reads the handle as aFileAccessor*, and the host's handle is an image-entry id (as above). The general case: SDK calls that open a system service through sm; the import list finds such overloads beforehand (Listing a game's unhooked imports before they are met). - Fix: a hook with the contract of the overload without read options (
h_fs_ReadFileExactOptcallsh_fs_ReadFileExact): the options are ignored and a short read is a failure, as on Horizon, since the caller has no byte count to see it by (hle_fs.c;dm/host/tests/t_fs.c). - Found on: SD GUNDAM G GENERATION CROSS RAYS (
010055700CEA8000, SDK 9.4.1, from PR #947): the fault was all that stood between the boot and its frame loop; not in the games table yet.
C library path checks ask the file system's limits
- Symptom: Addressables never start (no
StreamingAssets/aa/settings.jsonin theDM_FS=1output at all), then a null asset crash (main+0x31100ec). - Cause: Unity 2022's C# file API reaches the SDK's C library, not
nn::fs:File.Exists→SystemNative_Stat→stat=open+fstat+close(sdk+0x948b0). nnmusl's path check (sdk+0x904e0, then the convertersdk+0x8ef50) asksnn::fs::IsPathMounted,GetPathLengthMax,GetUtf16PathLengthMax,GetEntryNameLengthMaxandGetUtf16EntryNameLengthMaxbefore it callsnn::fs::GetEntryType/OpenFile, and the SDK's own versions read the empty mount table (IsPathMountedfalse; the next one aborted with Result 0x35f202). - Fix: the host answers them from its mount table, with Horizon's 0x300-byte limits and no UTF-16 limit (
hle_fs.c). The path .NET builds is/rom:/…; nnmusl's converter turns it back intorom:/…. - Found on: Ace Attorney Investigations Collection (1.0.0.2, SDK 17.5.3, Unity 2022.3 IL2CPP).
- Note: armyja's fork (GitHub issue #18) patched the managed stat wrappers by address instead; these hooks need no per-build table.
Paths with . and .. components
- Symptom: an Atk task aborts in a
switchdefault (UnexpectedDefaultImpl, thenAbortImpl) while a stream sound loads. - Cause: the stream path was
rom:/system/snd/../../sounds/streams/…, and the host answered "not found" for any..component. Horizon's path normalizer resolves.and..lexically and fails only above the mount root. - Fix:
host_path_exnow does the same (norm_restinhle_fs.c). - Found on: Metroid Dread (
main+0x1225a8c).
RomFS lookups on large directories
- Symptom: a long black screen at boot with nothing in the log (Engage: about 17 s on the Mac, 32 s on an iPhone); sampling the process (
sample <pid> 3) showsgetxattrunderpath_componentat the top of stack. - Cause: the game is walking RomFS, and every path component scanned its whole parent directory. That scan maps the game's case-sensitive names onto APFS, so it calls
getxattron each entry, and Engage has directories of 38,000 files. The rest of the time was the listing itself:ReadDirectorycalledstat,getxattrand a failingfopen("<file>.holes")for every entry. - Fix: read-only mounts now use a per-directory name index built at the first lookup (
dir_index_getinhle_fs.c), which also speeds up every file Wwise opens during play. In listings, now only.dm-case-*names (the only ones that carry the xattr) read it, directories take their type fromd_type, and files usefstatat/openatrelative to the directory. - Found on: Fire Emblem Engage: with the name index the first frame came at 5.7 s on the Mac; with the listing fix too it comes at 1.8 s on the Mac (9.9 s → expected about 3 s on an iPhone), and the opening movie starts at 7 s instead of 49 s.
ReadFile into write-protected texture pool pages
- Symptom:
[RED] fs ReadFile into … failed at +0 (EFAULT): VM region … protection 1, now and then. - Cause: the destination was texture pool memory, which the dirty-page tracker write-protects after each upload (
nvn_dirty.c).ReadFilelifts the protection first (dm_guest_write_prepare), but the graphics layer can protect the pages again beforepreadwrites them, and a system call gets EFAULT where a plain write would fault into the tracker's handler; at 60 fps uploads come twice as often. - Fix: on EFAULT the host now prepares the rest of the buffer again (unprotect, mark dirty, so the texture is uploaded again) and reads on, up to eight times (
h_fs_ReadFile; the first case is logged,[fs] ReadFile … prepared again). - Found on: Monster Train 2 at 60 fps: two runs in three as the route map loads, never at 30 fps.
- Check: four runs at 60 fps: one retry, no failed read.
File-not-found noise from optional paths
- Symptom:
fs … not foundlines withDM_FS=1. - Cause: games probe many optional paths (debug parameters, other-language voice files).
- Note: only a missing file followed by a failure matters.
- Found on: every game (general).
Directory, file data cache and save-thumbnail calls
- Symptom: a missing
fs::DeleteDirectory; undefinednn::fs::/nn::account::imports with no hook, found from the import list (Listing a game's unhooked imports before they are met) before they were met. - Fix: hooked:
fs::DeleteDirectory(an empty directory),fs::CleanDirectoryRecursively,fs::RenameDirectory(done asRenameFile);fs::EnableGlobalFileDataCache,fs::DisableGlobalFileDataCache,fs::EnableIndividualFileDataCache/DisableIndividualFileDataCache;account::StoreSaveDataThumbnailImage/DeleteSaveDataThumbnailImage(nothing kept) (hle_fs.c,hle_account.c). - Found on: Metroid Dread (SDK 11:
fs::DeleteDirectorywas missing); 13 Sentinels: Aegis Rim (SDK 11:CleanDirectoryRecursively,EnableGlobalFileDataCache); DRAGON QUEST XI S (SDK 7.3.2:DisableGlobalFileDataCache); The Great Ace Attorney Chronicles (SDK 10.4.1:RenameDirectory, the thumbnail calls), Big Brain Academy: Brain vs. Brain (SDK 11.4.3: the individual file data cache).
fs::Commit with a list of mounts
- Symptom: the SDK's own code opened fsp-srv and aborted, leaving the save writes uncommitted.
- Cause:
fs::Commit(const char* const*, int), the mount-list overload, had no hook. - Fix: the host commits the list as one transaction when every name is the same host save; cache and temporary storage in the list are skipped (their writes are already on disk, as for the single-name
Commit), and a list of two separate saves is refused without committing either. - Found on: Animal Crossing: New Horizons (PR #25).
- Note: SDK 11's
fs::CommitSaveData(mount)is the older name offs::Commit(Older SDK names for the same calls);fs::Commitwith aCommitOptionis under Device save data on the account save's directory.
Save-write failures stay with their backing transaction
- Symptom: a failed write in one independent save can make another save's next
Commitfail and discard its successful changes; the damaged save may then commit its truncated working file. - Cause: the host used one process-wide failure marker, consumed by whichever save committed first.
- Fix: each canonical backing save owns its failure state. Open file handles retain that transaction identity, aliases share it, and each commit waits for in-flight writes or size changes to its backing save before consuming or restoring its failure marker (
hle_fs.c). Concurrent first writes initialize the shared failure-injection settings withpthread_once. - Check:
t_fs_commit_listinjects write failures after truncation in either of two independent saves, verifies that the other save commits its changes, and checks failure propagation through aliases, rename failure handling, and a failed recovery clone. It blocks writes and size changes through an alias while another save commits, then verifies that both Commit ABIs wait for the affected I/O and refuse its failure.make -C dm/host/tests GAME=<title ID> fs-tsanalso checks concurrent first writes and failed file I/O concurrent with mounting another alias. - Found on: the two-save host regression. Mario Kart 8 Deluxe uses independent device and account saves.
A failed save path operation still allowed the save to commit
- Symptom: after an unexpected host error while creating, opening for writing, deleting or renaming a save entry,
Commitcould publish the other changes in the working directory without the failed change. - Cause: writes and size changes through file handles marked the backing transaction failed, but path lookup and most path mutations did not. A recursive delete also continued after a child failed, letting the next directory read replace its error.
- Fix: unexpected mutation failures mark the transaction by its exact guest mount name, even when lookup failed before a physical path existed. Aliases share the backing transaction's marker; read-only and non-save mounts do not mark it. Ordinary missing, existing, type, not-empty and invalid-name results (what Horizon answers too) remain unmarked; a rename whose name metadata and rollback both fail marks it whatever the first error, since the entry stays at the new path. Recursive deletion and cleaning check the child result as well as the saved directory-read error before returning, restoring that error after closing the directory; deletion calls
rmdironly after every child succeeded. This also keeps the analyzer from treating a failed child followed by a successfulrmdiras a failure with undefinederrno. The existing commit refusal restores the committed version and notifies the front end; the next complete save can succeed. - Found on: the synthetic save-mutation regression, following the filesystem lead in issue #1692 for Ocarina of Time. The cause of that game's area-transition crash and subsequent black screen remains unconfirmed; this correction does not establish that connection or repair an already damaged save.
A save folder that cannot clone directories
- Symptom:
[RED] save transaction: cloning the work directory failed (…, errno=45)when the save folder (DM_SAVE) is on an external drive, then a read-only save mount and every save write failing (South Park:profile.sys); now the line readsthe save folder's filesystem cannot clone directories (save transactions need APFS …). - Cause: a save transaction clones the committed folder into its work folder with
clonefileand publishes a commit withrenamex_np(RENAME_SWAP). Both need APFS: on HFS+ and exFAT disk images both fail withENOTSUP(45), and neither format advertisesVOL_CAP_INT_CLONEorVOL_CAP_INT_RENAME_SWAP, so copying the files instead of cloning them would still leave no atomic commit. The host already failed safely (the committed save mounted read-only, the iOS front end told); the line did not say why. The apps' own save folders are on APFS (the Mac app's~/Library/Application Support/nxnative/<title ID>/save, the iOS app'sDocuments/save); only aDM_SAVEset by hand or a development run's work folder can be elsewhere. - Fix:
hle_fs.cnames the cause whenclonefilereturnsENOTSUP: setDM_SAVEto a folder on an APFS volume (the RomFS and shader libraries may stay on the other drive). Recursive deletes (rm_tree,CleanDirectoryRecursively) now take each entry's type fromlstat, notd_type(which a filesystem may report as unknown), unlink a symlink without entering it, and refuse a symlink given as the tree itself; a commit whose leftover.newcannot be cleared is refused with its own red line instead of failing in the clone. - Check:
dm/host/tests/t_fs.csection 8 makesclonefilefail withENOTSUP(read-only mount, one front-end notice, committed save unchanged, writable again once cloning works) and deletes save folders holding a symlink to a folder outside the save (the target keeps its files). - Found on: South Park: The Fractured But Whole 1.05 during a Mac run with its save folder on a Journaled HFS+ external drive. PR #662.
Save data size queries
- Symptom: SIGSEGV at address 0 in
nn::fs::GetSaveDataSizeMax, about 13 minutes into a new game. - Cause: Unreal's save system asks before its first save; the SDK's version reads the fsp-srv object the host never made.
- Fix: it reports 256 MB of data and journal, as
GetSaveDataSizedoes (hle_fs.c).fs::GetFreeSpaceSizegives the same answer;fs::GetCacheStorageSizereports the size the storage was created with (Cache storage limits and the cache storage list). Also hooked:fs::GetSaveDataSize/ExtendSaveDataand the one-argumentfs::MountCacheStorage. - Found on: Octopath Traveler 0 (
GetSaveDataSizeMax,GetCacheStorageSize,GetFreeSpaceSize, found by the import list); Monster Hunter Rise (SDK 11:GetSaveDataSize,ExtendSaveData,MountCacheStorage).
Cache storage and other titles' save data
- Symptom: each aborted in
sm::Initializeor read a null applet proxy, one per boot. - Cause: SDK 20 file system calls that reach a service.
- Fix: cache storage:
OpenCacheStorageList/ReadCacheStorageListlist the cache folders that exist, none on a fresh run (Cache storage limits and the cache storage list),CreateCacheStorage/MountCacheStorageuse a host folder beside the temporary storage.fs::IsSaveDataExisting(ApplicationId, Uid)for another title (it asks for Breath of the Wild's save: none) andMountSaveDataReadOnly. - Found on: The Legend of Zelda: Tears of the Kingdom (1.4.3, the same
sdkbuild as Breath of the Wild 1.9.0).
A read-only mount of the game's own save data
- Symptom:
game called nn::diag abort: Result 0, call site main+0x3917270about 48 s into every start after the game first saved, right afterfs mount save0; the first start, with no account save yet, went on. Earlier the log has[RED] fs read-only mount of another program's save data SaveReadOnly: program <the game's own ID>, the host has none. - Cause: the game mounts its own account save read-only as
SaveReadOnlyat boot (fs::MountSaveDataReadOnlywith its own application ID;fs::IsSaveDataExistinghad told it the save exists). The host answered every such mount TargetNotFound. Once an account save existed, the game read through that mount and aborted where it checks the mount's name againstSaveReadOnly(main+0x349d880 → main+0x3917260). - Fix:
hle_fs.cmounts the game's own save data read-only on its committed save directory (DM_SAVE, not the transaction's work directory), creating it empty on a first start, as the console creates the save data; another program's save data is still TargetNotFound, and so is the game's own whenDM_SAVEis unset or its folder cannot be made (a red line, no exit). - Check:
make -C dm/host/tests GAME=<id> run(t_fs_case): the own save mounts read-only, reads the committed files and not the uncommitted ones, refuses writes; another program's gets TargetNotFound; a first start mounts an empty save; noDM_SAVE, or a file in its place, gets TargetNotFound. In the game, a start with the save the abort happened on runs past it. - Found on: Nintendo Switch Sports Resort (Switch 2,
04008E001F098000, v65536).
Device save data on the account save's directory
- Symptom: the island lives in device save data, which the host did not mount.
- Cause: 3.0.3's
mainmounts no account save data; the island is in device save data (MountDeviceSaveData,GetDeviceSaveDataSize,ExtendDeviceSaveData). - Fix: the host gives device save data the account save's host directory and transaction (one player). A second mount name over a save already mounted now shares that mount's transaction (
mount_ex); it used to clone the committed directory again, over the first name's pending writes. Alsofs::Commitwith aCommitOption(its one flag clears the restore flag) andGetSaveDataRestoreFlag(never restored from a backup). - Found on: Animal Crossing: New Horizons (3.0.3, SDK 20.5.4).
- Note: a game whose
mainimportsMountSaveDatatoo gets its device save as a save of its own (Device and account save data as two saves).
Device and account save data as two saves
- Symptom: every boot asks to pick a Mii again (
DM_FS=1:UserSave:/userdata.datnot found although the host save has it). - Cause: the game mounts
CommonSavewithMountDeviceSaveDataandUserSavewithMountSaveData(uid)(main+0x8b0c84), two saves on Horizon; the host made device save data the account save (for Animal Crossing: New Horizons, which mounts only device save data), so both names shared one directory. At boot the save manager deletesCommonSave:/userdata.dat(main+0x8b1910, through its file device'sDeleteFile,main+0x633afc; a probe there with@*x1+8shows the name) and commits, and in the shared directory that was the account save's own file. - Fix: a game whose
mainimportsMountSaveDatatoo gets its device save as<DM_SAVE>_device, a transaction of its own (hle_fs.c); of the games on hand only this one imports both, so Animal Crossing's islands stay where they are. - Found on: Mario Kart 8 Deluxe (4.0.0, SDK 4.4.0; one boot).
A rename between two mounts
- Symptom:
RenameFile("save:/a", "rom:/a")succeeded and wrote into the read-only RomFS folder; a rename between two writable mounts, or between two names of one host save, moved the file. - Cause:
rename_entryinhle_fs.cchecked that the source's mount is writable and resolved the destination without looking at its mount. Horizon'sfs::RenameFileandfs::RenameDirectoryfind each path's file system by its mount name and refuse two before touching either (Atmosphère'sfs_user_filesystem.cpp: the two accessors must be one, elseResultRenameToOtherFileSystem, module 2 description 6034); only a rename between the SDK's own mount and the host's was refused, withRES_FAIL. - Fix:
rename_anycompares the two mount names (the part before:, asFindFileSystemtakes it) and answers0x2F2402for two, before the SDK or the host is asked; one mount's rename goes on as before, and a read-only source is refused by its own check. Account and device saves that share a host folder and transaction are two mounts on Horizon too, so a rename between them is refused as well.make -C dm/host/tests GAME=<id> run(t_fs, ⑦b) renames into a read-only mount, into another writable one and between two names of one save, and checks both paths afterwards. - Found on: a code audit's reproduction (2026-11-13); no game has been seen to rename between mounts.
A folder that cannot be read is listed short
- Symptom: after a read error on a folder (
EIO, an external drive going to sleep), files of a read-only mount are not found for the rest of the run;CleanDirectoryRecursivelysucceeds with files left; a listing or count is short with no error. - Cause:
readdirreturns NULL both at a folder's end and on a failure, and onlyerrnotells them apart. Every loop inhle_fs.ctook NULL for the end: the name index of a read-only folder (dir_index_get) was kept for the whole run without the names after the failure, the path walk answered "not found", and the clean, the listing (ReadDirectory), the count and the overlay snapshot went on with what they had. - Fix:
dir_nextinhle_fs.cgives the next entry without.and.., and NULL witherrno0 at the end or set on a failure; the name index, the path walk, the recursive delete and clean,ReadDirectory,GetDirectoryEntryCountand the overlay snapshot (OpenDirectory) use it and fail on a failure. A name index that could not be read is not kept, so the next lookup reads the folder again.make -C dm/host/tests GAME=<id> fs-directory(t_fs_directory) fails a folder's reading at once and after one entry in each of them. - Found on: a code audit's reproduction with an injected
EIO(2026-11-13); no game log has shown it.
Opening a large folder with an overlay set takes seconds
- Symptom: with
DM_ROMFS_OVERLAYset,OpenDirectoryon a RomFS folder of tens of thousands of entries takes seconds, during which every other path call waits for the path lock. - Cause: the overlay snapshot (
dir_snapshotinhle_fs.c) compared each name it gathered with every name gathered before it, the base folder's own too, to drop a name a layer repeats: n(n−1)/2 comparisons, 722 million for 38,000 names. - Fix: the snapshot gathers every layer's names, then
names_firstsorts (name, position) once and keeps each name's first, in the order gathered, so the listing is the same as before (the last overlay folder first, then the base, an image base in its table order). Measured on an M4 Pro, a read-only folder of 4-byte files under an empty overlay folder: 10,000 entries 0.19 s → 0.03 s, 38,000 entries 3.23 s → 0.20 s; what is left grows linearly (each name's layer is looked up for its type and size).t_fs_directorychecks a name in several layers, names differing in case and the layers' order. - Found on: a code audit's synthetic measurement (2026-11-13). No game runs with an overlay by default.
System data stand-in for the MiiModel archive
- Symptom: abort in
fs::detail::GetFileSystemProxyServiceObjectunderfs::QueryMountSystemDataCacheSize(main+0x8f23bc). - Cause: the game mounts system data 0100000000000802, MiiModel, as
MiiResource:and readsNXTexture{Low,Mid}{Linear,SRGB}.datandShape{Mid,High}.datwhole; the SDK's Mii rendering is linked intomain(main+0x8f1400–+0x8fc000). - Fix: firmware content is not the host's to ship, so the host writes a stand-in of the same layout with every part blank (
dm_mii_standininhle_mii.c, mounted byhle_fs.cMountSystemData; any other system data answers "target not found"). A player's own archive takes its place (A console's own Mii database and system data). Heads build and draw nothing; bodies and favourite colours show. - Found on: Mario Kart 8 Deluxe (4.0.0, SDK 4.4.0; one boot).
- Note: the layout as the code reads it: texture file +0xc the largest decompressed size of each of 11 part kinds, +0x38 their alignments, from +0x64 one 0x1c-byte entry per part (offset, size, stored size, 4 zlib parameters, then width, height, format, mips); shape file +0xc / +0x3c the same for 12 kinds, from +0x6c one 0x58-byte entry per part (offset, size, stored size, parameters, five vertex attribute offsets and sizes, index offset and byte size, bounding box), then hair (132 × 0x48, +0x12704) and faceline (12 × 0x24, +0x14c24) transforms. A texture of size 0 is skipped (
main+0x8faaf4), but a game may still ask for its texture, so every texture entry points at one blank 8x4 texture (A Mii part the stand-in leaves out; Mario Kart 8 Deluxe has not been run with it); shapes cannot all be absent, because the faceline is drawn without a check (a null buffer read atmain+0xa690d0undermain+0x8286c4), so every shape entry points at one shared mesh of one vertex and the triangle (0, 0, 0), 32 bytes of zeros in a stored zlib block. The largest sizes must not be 0: they size the model's memory pool (main+0x8f2e6c), whose alignment is the first one. The Mii database itself: Mii database answered by the host.
The Switch 2's Mii model archive
- Symptom: at boot
[RED] fs mount system data MiiResource: the host has no 0400000000000849; the game goes on, and minutes later, where it first builds a Mii model, a guest crash reading address 0xc ([dm] CRASH sig=11 addr=0xc). Nintendo Switch Sports Resort:pc=main+0x1cdcfb4,lr=main+0x1cd2e68, 3.7 minutes into a session, in two-player Avioneta. - Cause: the Switch 2's Mii model data is system data 0400000000000849, which the game mounts as
MiiResource:; the host served only the Switch's MiiModel, 0100000000000802. With the mount refused the game's Mii resource kept null file pointers, and the function atmain+0x1cd2e30, which sizes a model's memory withnn::mii::detail::CalculateSizeAndAlignment, read the texture file's largest part size (+0xcof the file,main+0x1cdcfb0) through the null one. - Fix: the same stand-in serves both archives from one directory (System data stand-in for the MiiModel archive) and holds the Switch 2's texture sets too (
OunceTexture{Low,Mid,High}{Linear,SRGB}.dat). The files have the Switch's layout: the game's accessors (main+0x1cdcd80–+0x1cdd0c4) read 11 texture part kinds from +0x64 in 0x1c-byte entries with the same section offsets, 12 shape kinds from +0x6c in 0x58-byte entries, the hair transforms at +0x12704 and the facelines at +0x14c24, and skip a texture entry of size 0 (main+0x1cdead0), which the stand-in no longer has (A Mii part the stand-in leaves out). Mii heads build and draw nothing, as with the Switch's stand-in. - Check:
t_mii_sysdata(host tests): both archives mount from the one stand-in directory, every file the game names reads in that layout, another archive is still "target not found". Switch Sports Resort on the Mac: the mount succeeds at boot, and the menus, table tennis and one-player Avioneta play as before. The crash itself needs two players, which a scripted run cannot be: a player's 11-minute session with the stand-in (2026-11-12), two-player Avioneta among it, did not crash. - Found on: Nintendo Switch Sports Resort.
A Mii part the stand-in leaves out
- Symptom: a crash in an NVN texture call with a null texture where the game builds or draws a Mii model:
[dm] CRASH sig=11 addr=0xc pc=h_nvnTextureGetFlags+0,x0=0. Nintendo Switch Sports Resort: two-player skate, on leaving the practice zone (a player's session, 2026-11-12, 193 s in), guest backtracemain+0x49c58 main+0x3fbc9b0 main+0x3fbbb24 main+0x3fbb474. - Cause: the Mii model stand-in left every texture part out (size 0). The Mii code skips such a part when it builds a model (
main+0x1cdead0inCharModelinitialization,main+0x1cd33e0), but its texture getter (main+0x1cd5490) answers for a part by the model's create flags alone: texture 1 (the part of kind 0 thatGetHairTypepicks, held at the model +0x150) exists whenever the normal or the hat flag was given. The firmware's files have every part, so on a console the getter's answer always holds a texture. Switch Sports Resort sets up a renderer for its Mii models there (main+0x3fbb420→main+0x3fbc8d0), which takes textures 0 and 1 and registers each in its texture pool (main+0x49b30:nvnTexturePoolRegisterTexture, thennvnTextureGetFlags); texture 1's holder was the empty one (main+0x1cdd0f0), so both calls got a null texture and the second read its flags through it. - Fix: in
hle_mii.c, for every game that uses the stand-in: every texture part is one shared blank texture, as the firmware's files have one for every part: 8x4 texels of format index 0 (nn::gfxR8_Unorm, the table atmain+0x42d2688), one level, optimal tiling, 0x20 zero bytes stored as one zlib block (the mesh's), which the reader inflates into the texture's own storage (main+0x1cdcbe8, 512 bytes on NVN). Mii heads still draw nothing. - Check:
t_mii_sysdata(host tests): every part of every texture file has a texture whose data inflates to its size, no more than its texels (one check fails without the change). The crash itself needs a second player, which a scripted run cannot be: a player's 11-minute session with the blank texture (2026-11-12), two-player skate among it (the practice zone, then leaving it), did not crash (the game note). - Found on: Nintendo Switch Sports Resort.
Save-sync metadata errors close the temporary file
- Symptom: a failed write of
<DM_SAVE>.sync.tmpleaks its stream, and the diagnostic can report a cleanup error instead of the write error. - Cause:
write_baseshort-circuitedfprintf,fcloseandrenamein one condition. A failed write skipped the close;unlinkcould then replaceerrnobefore logging. - Fix: always close an opened stream, preserve the first write/close/rename error, and rename the temporary file only after both writing and closing succeed. Cleanup leaves the previous sync metadata in place.
- Found on: static analysis reported in issue #313; reproduced without game files.
- Check:
t_save_sync_metadatainjects open, write, close and rename failures into the production writer, including simultaneous write/close failures and cleanup changingerrno. It checks descriptor closure, preservation of existing metadata, diagnostics and a successful replacement. No cloud service or gameplay validation is claimed.
Add-on content
Add-on content from DM_AOC_DIR
- Symptom: DLC the player owns is not unlocked.
- Fix: the host reports add-on content from
DM_AOC_DIR, one numbered folder per DLC index (title ID − base − 0x1000) holding that DLC's RomFS.build_ipa_from_nsp.pyextracts the DLC NSPs in the folder withnx_extract --aoc,build_ipa.shcopies them to<App>/aoc/, and the app setsDM_AOC_DIR.aoc::CountAddOnContent/ListAddOnContentreport those indices (hle_misc.c), andfs::MountAddOnContentmounts the folder read-only (hle_fs.c). D2R keeps its fixed{1}withoutDM_AOC_DIR;DM_AOC_OWNED=0reports none. - Found on: Fire Emblem Engage: its two DLC packages each hold one empty marker file (
e0,h0), and the content is already in update 2.0.0.DLCManager.RefreshHasListmarks a content owned when its mount succeeded (probemain+0x29f3c88).
Owned add-on content lists beyond 64 entries
- Symptom: some owned DLC is missing, and
aoc: reportingstops at 64 add-on contents. - Cause:
hle_misc.cstored only 64 indices and stopped readingDM_AOC_DIRwhen that array filled, before sorting. The omitted indices depended on directory order; its 256-byte log buffer also truncated longer lists. - Fix: the shared array holds 2000 indices, covering the scanner's existing accepted range (1..2000), and a static buffer holds the complete index log without increasing guest-stack use. Folder and
.imgdiscovery, sorting, deduplication, pagination andDM_AOC_OWNED=0retain their behavior. This applies to every game using the add-on content hooks. - Open: the existing 1..2000 acceptance range is retained; it is not established here as Horizon's full legal range. More than 2000 accepted folder/image entries can still fill the array before deduplication, even when their unique indices fit.
- Found on: Super Smash Bros. Ultimate (13.0.5, 99 DLC licences; PR #441).
Cache storage limits and the cache storage list
- Symptom: SIGSEGV at address 0 in
sdk+0x34fb44at start-up, innn::fs::GetCacheStorageMax(int*, long*)(SDK 14), which reads the SDK's service object and dereferences it. Separately, cache storage the game made on an earlier run (or a player copied in) is not found: the list reported none. - Cause: no host hook for
GetCacheStorageMax, whose answer is the application's own control data;OpenCacheStorageList/ReadCacheStorageListreported none on every run, a fresh console's answer. - Fix:
GetCacheStorageMaxreads the game's control data (control_readinhle_fs.c):CacheStorageDataAndJournalSizeMax(s64 at 0x3180) andCacheStorageIndexMax(u16 at 0x3188) ofcontrol.nacp, fromDM_CONTROL_NACP, else beside the RomFS: the NSP script's extraction folder (<version>/control.nacp, soregress.pyand Mac runs need nothing), the Mac app'sResources(pack_app.py --control-nacp), the iOS app'sdm/control.nacp(build_ipa.sh, whichmain.mnames). No control data is a[RED]line and an error, not a guessed limit. The list is the<DM_TEMP>_cache<N>folders that exist:OpenCacheStorageListtakes a snapshot (onereaddirof their parent),ReadCacheStorageListhands it out in index order as 0x20-byteCacheStorageInforecords (the index, the rest zero), and the handle is a list number, never a host pointer. A storage's size is the one it was created with, as on Horizon:CreateCacheStoragerecords it beside the folder (<folder>.size, which the list skips; creating it again keeps it,DeleteCacheStorageremoves it), andGetCacheStorageSizereports it. A folder with no record (made byMountCacheStorage, an older host or the player) gets the control data's default (CacheStorageSize/CacheStorageJournalSizeat 0x3170 / 0x3178), else 256 MB of each; a storage that does not exist isResultTargetNotFound. - Found on: Just Dance 25.0.3 (0100BEE017FC0000, SDK 14; no profile in this repository, issue #1049): a diagnostic host passed the crash, mounted nine cache storages and read the offline save. Tears of the Kingdom created cache storage 0 (54,198,272 bytes, journal 180,224) and mounted it as
savct, thensavc, at every boot because the list was empty; from its second run on it now finds it. - Open: the record layout was read from SDK 14's
ReadCacheStorageListonly. Tears of the Kingdom's second boot with the list is not run yet (no build of it on the test Mac); no other local game makes cache storage on its route (OCTOPATH TRAVELER 0 and II, Princess Peach: Showtime!, Yoshi and the Mysterious Book and Orbitals list it and find none).
Add-on content mount cache sized as RomFS working memory
- Symptom: SIGSEGV in
crypto::detail::CbcModeAes128Helper::DecryptBlockswith a null destination (main+0x8737e8, right afteraoc:is mounted). - Cause: the add-on content (0100152000023001:
contents.datandversion.txt, the courses are in the update) is decrypted inAocHeap, a 0x3130-byte heap that also holds the mount cache. The host answeredQueryMountAddOnContentCacheSizewith 4 KB, and the 0x1400-byte decryption buffer then did not fit. - Fix: on Horizon the cache is the RomFS's file table as
RomFsFileSystem::GetRequiredWorkingMemorySizesizes it: both hash tables (4 bytes a bucket, the builder's bucket count) and all directory and file entries (0x18 / 0x20 bytes plus the name, padded to 4), 0x88 bytes for these two files. The host computes that from the folder it mounts (romfs_work_sizeinhle_fs.c);romkeeps its minimum answer, which is too small rather than too large. - Found on: Mario Kart 8 Deluxe (4.0.0, SDK 4.4.0; one boot).
Add-on content queries on a small guest stack
- Symptom: SIGBUS in
__vfprintfunderaoc_load, fromh_aoc_Count(a store to0x…67ff0, right below a page of the guest thread's stack). - Cause: the first add-on content query lists
DM_AOC_DIRand logs, a few KB of stack, and the game asks from a thread with little left. - Fix:
aoc::CountAddOnContentandListAddOnContentrun on the big host stack (hle_misc.c; since 2026-11-13 every take-over does: Host calls on small guest stacks). - Found on: Digimon Story Cyber Sleuth: Complete Edition (SDK 6.4.0; one boot).
An add-on content mount name used again after Unmount
- Symptom: the game shows the add-on content version error (
game asks to show an error: add-on content version mismatch) after its title screen, with every add-on inDM_AOC_DIR; withDM_FS=1the first add-on's file opens and the second's is not found under the same mount name (Pokémon Friends:AVCtitle:/AocVersion/AocVersion_DLC01.jsonopens,AocVersion_DLC02.jsonisfs stat not found). - Cause: the game checks each add-on in turn under one mount name:
MountAddOnContent("AVCtitle", index), read its version file,Unmount. On Horizon Unmount releases the name. The host's mount table is permanent and its Unmount a no-op, and a mount under a name in use answers success with the old target, so the second add-on's mount still showed the first one's files. - Fix: an add-on content mount releases its name at Unmount (
hle_fs.chost_unmount): the entry is marked released, which no name lookup matches (mnt_is). The entry and its image stay, as an open image file names its entry by index, and a later mount of the same image under any name takes that entry back (mount_releasable/mount_impl), so cycling through the add-ons does not grow the table. Save, RomFS and other mounts keep the permanent table. - Found on: Pokémon Friends (
010008C01E742000, update 1.1.5, two add-ons; no profile in the repository yet). Its expected versions are one string,"3", compared for equality (AocVersionCheker.Check), which both add-ons hold.
A cache storage mount name used for the next index
- Symptom: the game lists several cache storages (
fs cache storage list: 2) but only the first one's files are ever read; the others' are not found, and withDM_FS=1the log has onefs mount <name>: → <DM_TEMP>_cache1and no mount of the second (Taiko no Tatsujin: Rhythm Festival: songs held in the second cache storage are unreadable, while on a Switch both work). - Cause: the game mounts all its cache storages under one name, one index at a time:
MountCacheStorage(name, 1), then for the next indexUnmount(name)andMountCacheStorage(name, 2). On Horizon Unmount releases the name. The host's mount table is permanent and its Unmount a no-op, so the second mount found its name in use for another folder, answeredPathAlreadyExists, and the game went on with storage 1. - Fix: a cache storage mount releases its name at Unmount, as an add-on content mount does (An add-on content mount name used again after Unmount):
hle_fs.cmount_releasable(mount_impl) publishes the entry as releasable under the same lock,host_unmountfrees the name, and a later mount of the same folder and mode takes the entry back, so cycling through the indices does not grow the table. A different index under a name still in use stays refused, as on Horizon. Checked byt_fs("cache storage mount: …"). - Found on: Taiko no Tatsujin: Rhythm Festival (
0100BCA0135A0000, update 7.0.0; no profile in the repository yet; JKSV dumps of cache storages 1 and 2, with the Music Pass songs in the second: its plugin keeps a use count per index and mounts the next index after unmounting the one held,main+0x152262c).
Input
Controller disconnect between style and player lookup
- Symptom: clang reports a negative shift in
fillorvib_targets(hle_hid.c). - Cause: a style check looked up the connected player, then input or vibration routing looked it up again. A disconnect between the reads made the second result -1, used in
1u << player. - Fix: look up the player once and derive the style from that same result before constructing the player mask.
- Found on: clang static analysis (issue #424); no gameplay failure reported.
History reads fill every requested entry
- Symptom: buttons and menus work, the sticks do nothing in play (Super Mario Odyssey: its first hint, "Look Around", waited forever); an
nn::diagabort with Result 0x2aca in the first frames ofnnMain(Hollow Knight: Silksong, Unity 6000.0.50f1:bt: sdk+0x514580 main+0x1296c64 …). - Cause: games read whole histories and ignore the returned count. Odyssey reads all 16 entries of
GetNpadStates; the host filled only the newest. It polls every controller slot each frame, which moves the shared sampling number on by about 16, so the stick samples it combined were mostly empty, while buttons and the stick's direction bits (which menus use) still came through. Silksong'smain+0x1296c60callshid::GetDebugPadStates(states, 16)every frame, and the SDK's own reads a debug pad resource nothing initialized (module 202, hid); the host had only the single-stateGetDebugPadState. - Fix: the host now fills every requested
GetNpadStatesentry with the current state under consecutive sampling numbers; theGetDebugPadStateshistory form answers every requested entry as not connected, newest first with consecutive sampling numbers (hle_hid.c).DM_KEYStakesRLeft/RUp/RRight/RDownfor the right stick. - Found on: Super Mario Odyssey; Hollow Knight: Silksong.
- Note: Odyssey's six-axis history is read the same way (Six-axis sensors).
Mac controller sticks past full tilt on a diagonal
- Symptom: with a DualSense on the Mac, both analog sticks move the character or camera erratically while the D-pad works (Persona 3 Portable 1.0.2).
- Cause: a Switch stick's calibrated value stays inside the circle of radius
DM_STICK_MAX, but a Mac or iPhone controller's axes each reach full tilt on their own through GameController, so a diagonal reads up to about 1.15 of full tilt. A game that takes the stick's magnitude as at most full tilt got more than it could. - Fix:
hle_hid.cholds each stick inside that circle, keeping its direction, for every npad state it fills (stick_circle, infillandfill_joy). A stick inside the circle is unchanged. - Found on: Persona 3 Portable (#3050).
- Check:
t_hidputs a full-tilt diagonal on both sticks and checks that each stays inside the circle and keeps its direction. On the Mac, Persona 3 Portable's sticks move normally with a DualSense after the change.
Npad style set update event
- Symptom: the game never reads the controller (the title's "Press L+R" never sees a press; no
GetNpadStatecall at all). - Cause: it waits for the event bound by
hid::BindNpadStyleSetUpdateEventbefore reading. - Fix: the host now signals it once when it is bound for a connected controller, and again when a player's controller connects or goes away.
- Found on: The Legend of Zelda: Link's Awakening (SDK 8.2.0).
No input after the console mode changes at run time
- Symptom: the game runs on but takes no input, from the touch gamepad or a controller, after the console mode is switched at run time (to handheld and back to docked), until it is restarted.
- Cause: a mode change moves player 1 between the Handheld npad and No1, as taking the Joy-Cons off the console's rails or putting them back does, and the hid service signals the style update event of every npad whose controller came or went. The host pushed notification 30 and signalled none, and it kept no event bound to Handheld (0x20) at all. A game that waits for those events stays on the npad it has: Hades II, sent to Handheld by the controller applet in handheld mode, kept reading it once docked, where it is empty.
- Fix: one function,
styles_sync(hle_hid.c), signals the bound event of each npad (No1..No8 and Handheld) whose style is no longer the one the game was last told, and everything a style depends on calls it after its change: the console mode (dm_set_opmode, before the notification), the players and their Joy-Cons, the ids and styles the game supports, its Joy-Con assignment. A split pair's second npad, which handheld mode takes back, is signalled with the rest.t_hid.c(t_opmode) andt_oe.ccover it. - Found on: Hades II (issue #2143); on the Mac,
DM_OE_SCRIPT="opmode=0@15,[email protected]"on the note's route reproduces it (the applet answers at the press between the two).
Six-axis sensors
- Symptom: motion moves never happen; shaking does nothing (Super Mario Odyssey: cap throws by shaking).
- Cause: the host handed out six-axis handles but reported no sensor.
- Fix: it now reports one per connected controller: two for handheld or dual Joy-Cons, one otherwise, with the style, npad id and device in the handle. At rest the sensor lies flat: acceleration (0, 0, −1) G, no rotation, identity direction. Samples are 5 ms apart on the guest clock and numbered by time, so a history read returns the samples at those times.
DM_BTN_SHAKE(dm_input.h: the iPhone shaken, Space on the Mac,DM_KEYSShake) plays a side-to-side shake in whole cycles. - Found on: Super Mario Odyssey: it reads all 16 history entries per sensor and ignores the count, like its npad history (History reads fill every requested entry).
- Note: find a game's swing detector by probing the accelerometer value it reads (
DM_PROBE=main:626248@x8+10in Odyssey 1.4.1).
Switch 2 controllers over Bluetooth LE
- Symptom: a Joy-Con 2 or Pro Controller 2 does not appear in the Mac's Bluetooth menu, or as a GameController or HID device; the game sees no controller.
- Cause: these controllers are Bluetooth LE devices with Nintendo's own GATT service, not HID gamepads (Apple's controller driver list on macOS 27.2 has no Switch 2 products), and a Joy-Con 2 forgets a connection the moment it drops: one that is let go stays silent until Sync is held again, unless it is bonded to the host.
- Fix:
switch2_proto.h(pure C: the advertisement and what the host does with it, command framing, bonding, the input report, stick calibration, the motion maps) andpad_switch2_apple.m(a CoreBluetooth central the Mac and iOS front ends share, behind the off-by-defaultDM_SW2). A controller held in Sync advertises no host: on the Mac the host bonds it with the console's0x15commands (this Mac's Bluetooth address, then two keys, which may be fresh random ones), and from then on a button press makes it advertise toward this Mac and the host connects. A controller advertising another host is never written to. After connecting, the host runs the handshake (identity read, stick calibration, player lights, features) and takes the 63-byte reports; a player light write once a second keeps the link up. - Report layout (a left and a right Joy-Con 2, macOS 27): the controller's own clock in milliseconds at offset 0 (four bytes; +30 a report on a Mac, +60 or +90 when one was lost), buttons at offset 4 (the same bits as the Pro Controller 2; the right Joy-Con's rail buttons are
0x10/0x20, the left's0x100000/0x200000), the left Joy-Con's stick in the first stick field and the right one's in the second, both calibrated from the first slot (0x130A8); accelerometer at0x30, gyro at0x36. A Joy-Con held upright reports raw x right, y forward, z up, and its gyro channels are right-handed rotations about the same axes, which is the Switch frame, so its map is the identity for rotation and the negated reading for gravity. The gyro scale is 0.0607 degrees per second per count, measured: 14 tilts from lying on an edge to standing against a wall (90 degrees by the accelerometer) integrated to 1.153 times as much at the Switch family's nominal 0.070, on both Joy-Cons. Each sample is timed by the controller's clock, not by when its notification arrived (they come in bursts, and a lost report leaves a gap only the clock shows). At rest the gyro reads up to about 1.5 degrees per second off, a fixed offset per controller: it is there from the first sample, the one learned for that controller before (kept under its serial number) or, for a right Joy-Con 2, its factory offset (16 bytes at0x13040: a temperature and the offset in radians per second, which matches its rest offset); about a second of nearly constant samples refines it. - Rumble: each controller lists its own vibration channel (the right Joy-Con 2's
FA19B0FB-CD1F-46A7-84A1-BBB09E00C149, the left one's289326CB-A471-485D-A8F4-240C14F18241). The report is a zero byte and a 16-byte block per actuator:0x40 | samples << 4 | sequence, then up to three five-byte samples, played in turn. A sample is two bands, low then high, each a 10-bit frequency code and a 10-bit amplitude. The frequency code is logarithmic, 96 steps an octave, with 333 at 110 Hz (about 9.9 Hz to 16 kHz); the amplitude is linear, 1023 at full; both bands together are limited to 0.98. Hertz and amplitude are rounded as the console rounds them: truncate, then the nearer of that code and the next. Checked against the Switch 2's own encoder on 200,000 random values: no byte differed. An earlier reading (hertz as the code, a single sample per block) played effects 3 to 5 times too low in pitch and dropped two samples of three. A game sets its vibration about every 5 ms, and each value plays once in its own 5 ms sample, three to a packet every 15 ms (switch2_proto.h, Rumble timing), as the console plays them: a one-step pulse stays one sample long. Before that, a value played until the next packet, so short pulses lasted two to three times as long; replayed against a recording of Nintendo Switch 2 Welcome Tour's rumble exhibits, their energy came to 1.8 to 2.2 times the console's, and now matches it. The game's two full-key motors reach the pad throughhaptics_apple.m(dm_haptics_apple_set_sink, with Rumble strength and cutoff applied): each Joy-Con of a pair plays its side, a Joy-Con alone the stronger of the two, a Pro Controller 2 one per grip (rumble checked in Echoes of Wisdom). The console also corrects the amplitude by frequency with tables of its own per controller model; that is not done here. - Bonding (a left and a right Joy-Con 2): each bonded with fresh random keys, then woke toward the Mac on a button press and reconnected with no Sync. The answer to the first key was the same bytes on both Joy-Cons and with any key; the answer to the second changes with the key.
- Permission: macOS asks once for each game app, at the first scan. A rebuilt app with the same bundle ID asked again (a fresh ad-hoc signature); a second start of the same app did not.
- Found on: a left and a right Joy-Con 2 on an M1 Pro Mac, macOS 27.2: Metroid Dread (both woke and played as one pair, pairing by Sync during the game, the Home quit prompt; a Joy-Con paired back to a Switch 2 woke for it and was left alone,
woke for another host, until Sync paired it with the Mac again) and Super Mario Odyssey (motion: the cap throw by shaking, from the pair's right Joy-Con; rumble on both Joy-Cons). - Note: protocol credit: the community's reverse engineering of these controllers (Finally the Controller Works, ndeadly/switch2_controller_research, trevlars/switch2-controllers-linux, Nadeflore/switch2-controllers); the code was written from those notes. A Pro Controller 2 (an M4 Pro Mac, Super Mario Bros. Wonder 1.2.0, issue #1267) paired by Sync on the first try and sends the Joy-Con 2's report layout (GR
0x1000000, GL0x2000000, C0x4000), with full stick travel from its factory calibration and Home's quit prompt; its rumble channel came from the notes and is now checked in Echoes of Wisdom, and its gyro scale is the Joy-Con 2's, not measured on it. Its motion map is measured: A Pro Controller 2's motion turned a quarter turn. This Mac's own address comes fromIOBluetoothHostController, read once the app may use Bluetooth. On iOS there is no API for the device's own address, so a controller in pairing mode is used there without bonding. The Joy-Con 2's mouse sensor: The Joy-Con 2 mouse sensor and pointer.
A Switch 2 controller's stick at rest reads as in use
- Symptom: a game that turns a feature off while a stick is in use keeps it off after the stick is let go, some of the time. Breath of the Wild with a Pro Controller 2: motion aiming did nothing on about half the aims, and from the first use of the right stick on.
- Cause: each stick axis had a dead zone of 40 raw counts and no scale past it. A Pro Controller 2's right stick comes to rest 0 to 60 counts off its calibrated centre, so after a release it read 0 or a constant 3 to 5 % (41 counts was already 3.4 % of a 1200-count travel). Breath of the Wild decides at the start of an aim whether the right stick is in use.
- Fix:
s2_cal_apply(switch2_proto.h) uses a round dead zone, and past it scales the deflection back to start at 0, aspad_hid_stickdoes, so there is no jump at the edge and a small diagonal movement keeps both axes. Its size is the stick's own. Each stick's factory block, which the host now reads whole (0x31 bytes at0x13080/0x130C0), holds 0x28 bytes of model constants before its calibration. These match Switch 1's "stick parameters", whose third value is the dead zone the console applies. The third value here is 160 counts on a Pro Controller 2 (10 % of its nominal travel, the last pair, 1583) and 147 on a Joy-Con 2 (12.6 % of 1167), read from dumps in ndeadly/switch2_controller_research and GP2040-CE. A value outside 3 to 25 % of the stick's travel, or a blank block, falls back to 10 %. The log names the dead zone at connect ([sw2] ... dead zone). - Open: that the third value is the dead zone is inferred from the Switch 1 layout and the two models' values, not read from the Switch 2's hid code. The right stick's user calibration is read at
0x1FC062(ndeadly's layout, past the 2-byte magic); SDL reads it at0x1FC082. This matters only after a stick calibration on a console. - Found on: The Legend of Zelda: Breath of the Wild, a Pro Controller 2 on a Mac, 1.9.0 (issue #2245).
A Pro Controller 2's motion turned a quarter turn
- Symptom: with a Pro Controller 2, tilting the controller forward turns the game's view sideways, as a roll.
- Cause: the Pro Controller 2 took the Pro Controller 1's motion map. Its raw frame is the Joy-Con 2 pair's: flat and still its accelerometer read
-164, -584, 4193(z up), and held with its top tipped up-73, 3227, 2597(+0.79 G on y, forward). The old map turned that tilt into about 50 degrees of roll. - Fix:
s2_map_prois the pair's map (switch2_proto.h). y and z are measured, which fixes x in a right-handed frame, and the gyro shares the accelerometer's axes (one ICM-42670-P chip).t_switch2checks both recorded poses. - Found on: The Legend of Zelda: Breath of the Wild, a Pro Controller 2 on a Mac, 1.9.0 (issue #2245).
Xbox One controllers from other makers over USB
- Symptom: a wired Xbox One controller that is not Microsoft's, such as a PDP Wired Controller for Xbox One (
0e6f:02a8), is listed on USB (System Information) but its light stays off, GameController does not list it and the game sees no controller. The same pad works on Linux. - Cause: macOS's Xbox driver (
XboxGamepad.dext) matches Microsoft's pads by vendor and product ID only (045e:028e,02ea,0b00,0b12), so another vendor's pad stays unconfigured. A GIP pad (the Gaming Input Protocol, USB classFF/47/D0) sends nothing until the host powers it on, and some vendors' pads want more packets first (PDP: its light and authentication). Linux's xpad sends them (xboxone_init_packets). - Fix:
pad_gip.h(pure: the init packets per vendor, the input report, the Xbox button's report and its acknowledgement) andpad_gip_mac.h(IOUSBHost from user space, no driver or entitlement): a device of GIP's class with no driver 1.5 s after it appears is configured once without interface matching (if not already configured), its interface 0 opened, the init packets sent and its interrupt IN pipe read into a reusable DMA buffer. A device with macOS's Xbox driver on it (itsXboxUSBDeviceIOUserServiceorAppleUserHIDDeviceinterface service) is left to GameController. The configuration outlives the process, so interfaces with only user clients on them count as free, or the second run would never find the pad.front_mac.mmakes it a player from its connection, as a GameController controller; its Xbox button is Home.+[IOUSBHostDevice createMatchingDictionary…]gives a driver personality's keys, whichIOServiceAddMatchingNotificationfound no device by: the host matches byIOPropertyMatch. - Limits: no rumble or player light yet. Not run: unplugging during a game, another vendor's GIP pad, an Xbox One pad of Microsoft's beside it.
- Found on: Mario Kart 8 Deluxe (v1507328), a PDP Wired Controller over USB on a MacBook Pro M1 with macOS 27.2: its light came on, every button, both sticks over their full range, both triggers and the Xbox button read, a second run found the pad still configured from the first, and the game logged
(USB) connected: player 1. - Check:
t_pad_gip(dm/host/tests): the init packets per vendor, a PDP pad's first report at rest, each button by position, the triggers' 25% threshold, the sticks' range, the Xbox button and its acknowledgement, the announce and reset.
Joy-Cons as dual or single npads
- Symptom: a pair of Joy-Cons is one Pro-style controller: the game cannot see a dual controller with two sensors, one Joy-Con cannot be a sideways player with its rail buttons, and a game's single / dual assignment calls (
SetNpadJoyAssignmentModeSingle/Dual) change nothing; a game that wants two players from one pair (its controller screen) gets one. - Cause: every controller was a full-key (or handheld) npad:
style_for_playerknew only those two styles, the styles the game supports were recorded but never consulted,fillkept the low 16 button bits (no SL / SR), the vibration handles knew types 3 and 4 only, and the assignment calls were ignored. - Fix: a front end that reads Joy-Cons one by one reports them to the npad layer (
dm_joy_attach,dm_joy_set,dm_motion_set_joyindm_input.h, no controller-specific names); nothing changes until one does. Docked, a pad that holds both Joy-Cons is one JoyDual npad (both Joy-Cons' buttons, rail buttons included, each stick on its side, a six-axis handle per Joy-Con) when the game supports JoyDual; when the game asks for single assignment, the left Joy-Con stays on the npad (JoyLeft, or the one the game named) and the other takes the lowest free supported npad (JoyRight); one Joy-Con alone is JoyLeft or JoyRight. The controller applet splits a pair when the game wants more players than there are controllers. A game that supports no Joy-Con style gets the pad's merged state as a whole controller: full-key, or JoyDual when the game supports JoyDual but not full-key (A controller in a style the game does not support). Vibration handles exist for the Joy-Con styles (type 5, 6, 7) and reach the motor of their Joy-Con, on whichever npad it is. Handheld mode: player 1's Joy-Cons count as attached to the console (the Handheld npad) and are not split; a player 2 Joy-Con pair is as docked. - Choosing on the controllers: the Switch 2 transport pairs a left and a right Joy-Con that connect; holding SL + SR on one of a pair for three seconds gives it a player of its own, and holding L on a left one alone and R on a right one alone for three seconds pairs them (
s2_gesture), as a Switch's Change Grip/Order screen does, without its screen. - Found on: a left and a right Joy-Con 2 on a Mac:
Game Before (every controller full-key) After Super Mario Odyssey 1.3.0 a pair was one Pro-style pad with one sensor; two-player mode could not take a Joy-Con each a JoyDual npad with a sensor per Joy-Con: the two-handed throws (both flicked up, both shaken sideways); two-player mode splits the pair through the controller applet (JoyLeft for Mario, JoyRight for Cappy); rumble on both, also through the full-key handles the game keeps sending to Super Mario Bros. Wonder 1.2.1 a pair was one controller: its two-player screen found one and was canceled choosing two players splits the pair (single assignment): one sideways Joy-Con each Super Smash Bros. Ultimate 13.0.5 a pair was one Pro-style pad; one Joy-Con could never be a fighter of its own holding SL + SR splits the pair into two sideways players; a 1v1 with a Joy-Con each, the rail buttons as shoulders, rumble on each
A controller in a style the game does not support
- Symptom: docked, the game ignores keyboard input that works in handheld mode, or opens the controller applet again every frame. In the applet loop, the log repeats
oe library applet: controller support,hid controller applet: 1 to 1 players wanted, 1 connectedand focus 2, then 1, thousands of times (7,162 in 3 minutes), afterhid supported controller styles 0x6. - Cause: the host showed every whole controller (the keyboard, a Pro-like pad, a Joy-Con pair the game supports no Joy-Con style for) as full-key on No1..No8, whatever styles the game supports. The hid service connects a controller only in a supported style, so a game may take any connected npad as one of its own. Nintendo Switch Sports Resort sets Handheld | JoyDual (0x6) for its Tennis lobby (
main+0xa9e940); its player check (main+0x58d0f0) found no usable player 1 on a full-key No1, so its caller (main+0x3f9d120) openedShowControllerSupportagain, and the applet's answer (one player, No1) could not change that. - Fix: on No1..No8,
pad_style(hle_hid.c) prefers FullKey, then JoyDual, then JoyRight or JoyLeft. JoyDual carries both sticks and all buttons. For one Joy-Con,single_joy_foldputs the more deflected stick on that side and maps the opposite half's buttons to the same positions on the chosen Joy-Con. The reported side has one sensor and one vibration handle. A cached FullKey vibration handle can still reach its exposed motor, as it can for a real Joy-Con. A change into or out of the single-Joy-Con mapping clears vibration on the affected pads before signalling their style events. The Handheld npad stays Handheld. If the game takes none of the four styles on No1..No8, the host keeps FullKey. - Open: the merged motion stream for a lone physical Joy-Con uses the sideways frame. An upright game can see that motion a quarter turn off. The docked keyboard test covers buttons and sticks.
- Found on: Nintendo Switch Sports Resort (
04008E001F098000, v65536), on the Mac with the keyboard andDM_KEYS: after the fix the applet is not opened once in 220 s, and Play leads to its one-controller screen ("press the button") and into a doubles Tennis match at its serve prompt. Pokémon: Let's Go, Eevee! (0100187003A36000, v131072, provisional profile) reports Handheld | JoyLeft | JoyRight | Palma (0x5a,main+0x1400bc). The PR author checked docked keyboard input on the Mac with the single-Joy-Con fallback. - Check:
t_hid(t_unsupported_style,t_single_joy_fallback,t_style_read_snapshot).
Live controller motion
- Symptom: motion controls do nothing with a controller that has a gyroscope (Breath of the Wild: aiming with its Motion Controls option on); the six-axis sensor always lies flat.
- Cause: the host's six-axis sensor had no source of motion: flat at rest, apart from the
DM_BTN_SHAKEshake (Six-axis sensors). - Fix: a controller with a gyroscope drives its player's sensor on the Mac and iOS (
GCMotion,motion_apple.h→dm_motion_set,hle_hid.c); on iOS the phone's own device motion drives player 1's while no controller supplies fresh motion (DmGamepad.m). The orientation is integrated from the gyro with tilt correction toward the measured gravity (motion_fusion.h), inSixAxisSensorState's units (G, revolutions/s, revolutions). After 300 ms without a sample the source expires; without another source the sensor lies flat again. A shake still adds on top. The switches are in development.md, How it works (Input). - Source routing (resolved, review of PR #351): sharing one integrator let phone and controller callbacks mix orientations, including with
DM_PHONE_MOTION=1; checking onlyhasRotationRatealso let zero-only controller reports suppress the phone. Each source now has its own orientation and timestamp: auto prefers fresh controller data, forced mode selects only the phone, and the Apple adapter waits for actual data before publishing. One-player games merge motion from the same controller slots as buttons. Motion settings initialize once withpthread_once; per-source locks also protect diagnostic timestamps.t_hidcovers routing, expiry and concurrent startup under ThreadSanitizer;t_motion_applecovers activation, zero-only reports and detachment. - A gyroscope advertised but not there (iOS, PR #1877): the GameSir X5 Lite has no gyroscope, but GameController advertises rotation data; a few seconds after attachment, the phone's gyro stopped driving player 1 (NX2Apple issue #971). The log contains 26 identical printed controller reports, including a nonzero rotation rate. The Apple adapter (
motion_apple.h) accepted any report that was not all zeroes, keeping the controller fresh and preferred over the phone.DM_PHONE_MOTION=1already forces the phone, including when a genuine controller gyro is attached. - Controller liveness heuristic (platform workaround): each attachment withholds controller samples until a raw rotation component differs exactly from its first report; acceleration alone does not qualify it. Once qualified, all later reports, including constant or zero values, pass until detachment. This compensates for incorrect platform/device capability reporting without a controller-model or game rule. Motion or sensor noise is expected to vary a working gyro, but constant output does not prove a sensor is missing, and varying fabricated output could pass.
t_motion_applecovers constant zero/nonzero rotation, nonzero acceleration, qualification, later zero samples and reset on reattachment. Pending: an iPhone retest in Breath of the Wild with GameSir attachment/reconnection, continued phone aiming and a genuine gyro controller's takeover. The original log rounds rotation to three decimal places in revolutions/s, so it does not establish the exact raw equality this heuristic needs. - Upright initialization (resolved, review of PR #351): the heading reference was parallel to gravity when the phone started upright, so projection produced a zero vector and silently left the orientation flat. A nonparallel reference now primes the orientation on the first sample;
t_motioncovers all six axis-aligned starting poses. - Back from the background (iOS): iOS turns a manual-activation controller's sensors (DualSense, DualShock 4) off while the app is in the background and leaves them off, so the gyro stayed dead until the controller reconnected (reported by MacNativeGames on the iPad). Becoming active again sets
sensorsActiveonce more for every attached controller (dm_motion_rearm,front_ios.m); not tested on a device here. - Found on: The Legend of Zelda: Breath of the Wild (1.9.0): motion aiming on a Mac with a DualSense. The iOS paths have not been tested on a device.
- History (resolved): history entries and Switch 2 IMU answers used to repeat the newest sample, so the SDK's sensor fusion saw a staircase instead of a 200 Hz stream. Each live stream now keeps its last 128 samples stamped on the guest clock (
live_motion.ring,hle_hid.c); every 5 ms tick takes the sample at its own time, interpolated between its neighbours (the direction as a normalized blend of the two rotations), the newest sample held past its time. The ring holds host times, turned into guest time with the clock's lag when read, so a freeze orDM_DETCLOCKkeeps them in order. An answer ends at the clock's tick and never below the last one answered for that handle (answer_tick, a high-water mark per handle), so the sampling numbers never go back and keep up with the clock: ending at the newest sample's tick (the first version) took them back when a first sample came late or a player's GameController and HID streams took turns, and stalled them for a game polling faster than its controller.t_hid.cfeeds 100, 125, 200 and 833 Hz with jittered sample times and checks consecutive ticks, the clock's tick at the end, the signal at each tick and the six-axis history, and keeps the numbers monotone through a late first sample, two streams with different latencies, fast polling, a stale source, a freeze and equal or out-of-order stamps;t_hid_tsanruns a writer against a reader. - Playout delay: a source sends a sample every 15 to 30 ms (a DualSense about 67 a second, a Joy-Con 2 33) while a Switch 2 game reads 5 ms ticks up to the present, so read at the present most ticks lie past the newest sample and can only hold it (76 to 79% of a Joy-Con 2's ticks in one session, in runs of 4 to 9). The IMU samples now play each live stream back late by about one sample interval (
DM_IMU_DELAY, defaultauto: the 90th percentile of how long after a sample the next one arrives, over the last 32, capped at 40 ms;motion_lag,motion_fusion.h), a change of delay slewed at 5% of the guest time so the data never goes back or jumps, none on a frozen orDM_DETCLOCKclock. In the host's tests at 33 Hz (a Joy-Con 2's clock, arrivals up to 4 ms late) and 67 Hz (jittered arrivals), no tick of the steady state held a sample, against 75% and 52% read at the present. The six-axis states (GetSixAxisSensorStates) keep no delay by default (DM_SIX_DELAY=0): a Switch 1 game reads the newest state each frame, aiming or steering, and a delay would only add latency. - Joy-Cons shown as a pair: a game that supports JoyDual but no single Joy-Con style is shown a single Joy-Con as a pair (A controller in a style the game does not support); both of its handles read that Joy-Con's own stream, in the upright frame a pair's sensor has, not the pad's merged stream (a sideways Joy-Con's frame, a quarter turn away). A real L + R pair gives each handle its own half, also in another player's slot of a one-player game; a pair that loses a half leaves that half's handle flat instead of switching it to the other Joy-Con mid-game, and a Joy-Con that has reported its own motion and goes quiet while attached gives its handle the flat sensor, not the merged stream.
- Joy-Con 2 sample times: the front end times a sample by the controller's clock plus an anchor, about the least latency seen (
s2_clock_sample,switch2_proto.h): the anchor rises 1 ms a second, so a controller clock running slow no longer drifts its samples toward 60 ms behind their arrival, and falls only on two reports in a row that came earlier than it predicts, to the later of the two, so one unusually quick report does not move it; a sample keeps at least half a report's step after the last where its arrival allows.DM_SW2_VERBOSEalso logs the report bytes the parser does not read (0x2A..0x2D read like a microsecond counter, maybe the sensor's own timestamp: unconfirmed). - Diagnostics:
DM_IMU_LOG=<n>logs every n-th raw sample per stream as the host receives it and every n-thGetNpadImuSamplesanswer. - Note: yaw drifts as on the console, with no recenter. The console's own sensor still reports no states (SDK 20 six-axis sensor and amiibo (
nfp) calls), so motion follows the controller in docked mode. - Open: PR #286 has iPad aiming measurements and calibration controls to compare on a device before choosing shared defaults. Related reports: #153, #389.
Non-finite motion samples
- Symptom: a non-finite accelerometer or gyro sample corrupts the six-axis fields; later valid samples do not restore the previous fusion state.
- Cause:
motion_updatepublished raw NaN/Infinity and integrated it into persistent angle/orientation. Finite but extreme rates can also overflow the float rotation norm or accumulated angle. - Fix: reject a non-finite sensor sample before priming or changing any state. A non-finite time step skips integration, and a non-finite gain disables tilt correction. Do not commit an overflowing rotation step or angle; normal finite samples keep the same arithmetic and coordinate conventions.
- Found on: synthetic
t_motionsamples, not a reproduced game or controller fault. Tests cover each sensor axis before/after priming, subsequent valid input, invalid timing/gain, finite overflow, all 48 signed frame maps and small-angle accumulation. No device or gameplay result is claimed for this change.
The phone's motion in the picture's frame
- Symptom: on iPhone Duo's inner display the phone's gyro is turned a quarter turn: tilting up and down moves the pointer left and right, and the other way round (GitHub issue #569); the outer display is right.
- Cause: Core Motion delivered the phone's samples in the hardware frame, and
DmGamepad.mturned them into the Switch frame by the interface orientation (motion_phone_to_switch,motion_fusion.h). That holds only where the hardware frame is the screen's portrait frame, as on a phone with one display. The Duo's inner display is a quarter turn from it, and it ignores the app's supported orientations. - Fix: on iOS 27 and later the pad view, full screen over the picture, is the motion manager's
deviceMotionBody: Core Motion then delivers rotation rate, gravity and user acceleration in that view's frame, for whichever display shows it and however it is turned, which is the Switch frame as it is (x to the right of the picture, y to its top, z toward the player), and the orientation map is skipped. iOS 26 keeps the map. No device model or fold state is checked. - Found on: Super Mario Galaxy: the gyro pointer on the inner display, reported by klave7. Not yet tested on a device: on the Duo's inner and outer displays and on a phone with one display running iOS 27,
DM_MOTION_LOG=1should read acc0 0 -1with the phone flat and still. - Open: while the scene is not full screen (Split View on the inner display) Core Motion falls back to the hardware frame without a flag that says so, and the samples are still taken as the view's frame.
Switch Pro Controller advertises motion but sends zeroes
- Symptom: a Pro Controller's buttons work on the Mac, but its gyro pointer never moves;
GCMotioncallbacks arrive with acceleration and rotation all zero. - Cause: the macOS driver can expose empty motion through GameController while its underlying Nintendo HID
0x30reports contain IMU data (PR #296). The OS driver lies outside this repository; the passive HID adapter is a workaround for that platform defect. - Fix:
motion_pro_mac.hlistens nonexclusively to vendor057E, product2009, without sending commands or changing the driver's configuration.motion_pro.hconverts the three signed little-endian samples to G and rad/s in the Switch frame; their nominal 5 ms spacing reaches the shared integrator throughdm_motion_set_hid. Each HID device owns its buffer and decoder. HID, GameController and phone orientations stay separate; usable GameController data wins, otherwise fresh HID data supplies that player's controller motion. Removal, focus loss or ambiguous routing clears only the HID source; 300 ms of silence expires it.DM_MOTION_HID=0disables the reader;DM_MOTION=0disables all motion. - Routing limit: GameController exposes no public per-controller HID identity. Raw motion is enabled only with one physical Pro and one GameController Pro, using that controller's existing player slot (including
DM_KBD_PLAYER=own/DM_PAD_MERGE). Multiple Pros keep their GameController paths; raw data is never assigned to the first controller by guesswork. Each model the reader knows (a table inmotion_pro_mac.h, with the DualShock 4) is paired on its own, so another model connected beside the Pro does not make it ambiguous; underDM_PAD_MERGE, where two models share player 1, the first live model in the table keeps it. Every motion report rechecks routing, so a continuously streaming pad takes over when the preferred model has been silent for one second, even without a removal callback; the preferred model takes the player back on its first report.t_motion_pro_maccovers both transitions. Synthetic GameController HID devices are excluded with Apple'sGCSyntheticDeviceproperty. - Open: passive reading cannot obtain factory calibration without issuing SPI commands alongside the OS driver (identical pads read from their reports do issue that read, and it works: Identical controllers that GameController lists as one). Nominal scales are 4096 counts/G and 70 mdps/count (protocol research); no automatic bias learning removes slow intentional turns. Sample order follows that research and Linux hid-nintendo; SDL reverses it. Confirm order, sensitivity, drift and reconnects on hardware before calling the reworked reader device-tested.
t_motion_pro,t_motion_pro_macandt_hidcover decoding, timestamps, ownership, removal, ambiguity and source fallback with synthetic inputs. - Found on: Super Mario Galaxy, docked pointer on a Pro Controller.
Switch Pro Controller stick stays zero in GameController
- Symptom: on the Mac, a third-party Switch Pro-compatible controller (
057e:2009,Switch Pro Controller) has working buttons and motion, but one or both thumbsticks stay at(0, 0)in GameController (bothGCExtendedGamepadandGCController.input.unmappedInput), so the character or camera cannot move (issue #2655, PR #382). - Cause: the physical device sends valid 12-bit stick values in its Nintendo HID input report
0x30, but Apple's GameController / Switch Pro HID driver outputs exact zero on both mapped and unmapped thumbstick interfaces (likely rejecting or misinterpreting the third-party pad's SPI calibration). The OS driver and controller firmware lie outside this repository; the passive HID stick reader is a workaround for that platform defect. - Fix:
motion_pro_mac.hdecodes both sticks from the0x30reports it already receives nonexclusively (pad_pro.h, self-measured rest and reach, no output reports) and checksGCController.input.unmappedInputalongsideGCExtendedGamepadper stick so a system-remapped stick still counts as live. If a stick has never been non-zero in GameController and its raw0x30value stays past half tilt for 150 ms while both GameController interfaces remain exact zero, that stick latches onto the passive HID decoder and logs once; buttons, haptics, Home, motion and any working stick keep their existing paths. Updates are event-driven frompro_reportonly when a latched stick's output changes (avoiding idle overwrites inDM_PAD_MERGE), with a one-shot 300 ms staleness expiry while tilted, immediate return to GameController if GameController ever becomes non-zero, and independence fromDM_MOTION/DM_MOTION_HID. Short or malformed0x30reports cannot refresh staleness.DM_PRO_STICKS=0disables the stick fallback. - Routing limit: same single-Pro pairing limit as Switch Pro Controller advertises motion but sends zeroes (one live physical Pro and one GameController Pro). Multiple Pros or twins handled by
pad_hid_mac.hunbind cleanly without guessing ownership. - Open: live verification on a physical BETOP T6 For NS, a dual-dead-stick Pro-compatible pad, and a genuine Nintendo Pro Controller (normal and system-remapped) is pending.
t_motion_pro_maccovers single-stick and dual-stick latching, brief-flick rejection, system-remappedunmappedInputprotection, event-driven deduplication, late GameController recovery, focus loss, 300 ms staleness expiry, malformed-report rejection, ambiguity, motion independence andDM_PRO_STICKS=0. - Found on: Splatoon Raiders with a USB BETOP T6 For NS on macOS 26.7.3 (left stick zero in GameController while HID
0x30spans4..4091; issue #2655); also reported on a Bluetooth Pro-compatible pad on macOS 27.0.1 in Pokémon Scarlet (both sticks zero while HID0x30spans0..4095; PR #382).
DualShock 4 over Bluetooth advertises motion but sends zeroes
- Symptom: a DualShock 4 over Bluetooth is logged
with motion (gyro)and the game reads the six-axis sensor every frame, but motion aiming does nothing; over USB it works (issue #1770). WithDM_MOTION_LOG=1no[hid] motion player 1line appears. - Cause: as with the Pro Controller, GameController's
GCMotionfor the pad sends only zeroes over Bluetooth, whichdm_motion_attachrightly ignores, while the pad's own Bluetooth input report0x11carries the sensor. Over USB the pad sends report0x01andGCMotionworks. The OS driver lies outside this repository. - Fix: the DualShock 4 is a row of the passive reader's model table (
motion_pro_mac.h): vendor054C, products05C4(v1) and09CC(v2), report0x11, paired with GameController'sDualShock 4controller.ds4_motion_decode(motion_pro.h) reads six signed little-endian words from byte 15 (USB's report0x01fields two bytes later, as Linux hid-playstation and SDL read them): rotation x, y, z, then acceleration, at the nominal 8192 counts/G and 2000 deg/s over 32767, into the Switch frame with the axis signs measured on a pad (MacNativeGames PR #1306). One sample per report, stamped on arrival; a stream that falls silent for 300 ms must show data again. A pad over USB never sends0x11, so its entry never counts and GameController's motion stays. The routing is the Pro Controller's, per model: one DualShock 4 that sends0x11and one GameController DualShock 4, whatever other models are connected. - Open: the factory calibration (a feature report the OS driver owns) is not read, and HID sources get no rest-offset learning, so a gyro bias would show as a slow drift at rest: not measured yet.
09CCis matched by the same report and not yet tested on a pad. With one pad over USB and another over Bluetooth, GameController lists two and the Bluetooth one keeps its zeroGCMotion. A controller that presents itself as a DualShock 4 (a GameSir Cyclone uses054C:05C4) and sends0x11with zeroes never becomes a source.t_motion_procovers decoding,t_motion_pro_maca DualShock 4 paired beside a Pro Controller. - Found on: The Legend of Zelda: Ocarina of Time, slingshot aiming with a DualShock 4 v1 (
05C4) on macOS 27.2 (M2 Pro); reported on Tears of the Kingdom with a v2 (09CC).
An original Joy-Con's sensors are read by the host
- Symptom: on the Mac, an original (Switch 1) Joy-Con's buttons and sticks work through GameController but its motion does not: the six-axis sensor lies flat, so a game that steers or aims with it (Nintendo Switch Sports Resort: Archery, Boxing; Splatoon Raiders: motion aiming) does not follow the controller. A lone Joy-Con does not play at all, and a pair plays as one full-key controller whatever the game asks for.
- Cause: macOS's GameController presents a paired L + R as one
GCController("Nintendo Switch Joy-Con (L/R)") with noGCMotionobject at all, a lone Joy-Con with no extended gamepad profile, and gives a controller no HID identity, so a sensor read from IOKit cannot be tied to one of its controllers (PR #2594 routed them by a button press seen on both, a heuristic). The HID report its driver keeps sending (0x30, about 60 Hz) has the IMU fields zeroed: the sensor is off until the host asks for it, and the OS driver never does. The Pro Controller's passive reader (Switch Pro Controller advertises motion but sends zeroes) does not fit: it only listens, while a Joy-Con has to be told to send its samples and to give its factory calibration over SPI. - Fix: the host reads each Joy-Con wholly from its own HID report, on the Mac only (
pad_jc1.h, pure C, andpad_jc1_mac.h, IOKit), andfront_mac.mleaves GameController's Joy-Con controllers unread (jc1_gc_unread, as identical pads'hidpad_gc_unread), keeping only Home and Capture away from macOS (pad_keep_system_buttons; Home held still opens the quit prompt, read from the report). It matches vendor 057E, products 2006 (left) and 2007 (right), opens the device nonexclusively and sends the console's handshake: device info (0x02), standard full mode (0x03 with 0x30), EnableIMU (0x40 with 0x01), the vibration on (0x48 with 0x01), SPI reads of the factory IMU calibration at 0x6020 and of the stick calibrations (factory 0x603D, user 0x8010, decoded bypad_pro.h: a left Joy-Con fills the left stick's block, a right one the right's), then the player lights (0x30), 60 ms apart as the console does, each step its own main-queue block. Output reports go out on a serial queue of their own, so a Bluetooth write never holds up the run loop. A report whose sensor block is all zero is the sensor off, never a reading (a real gyro is never 0 on all three axes three times running, even in free fall): it gives no samples, and a watchdog repeats the handshake for a Joy-Con with no sensor data since its last one, whether its reports stopped or come zeroed (a wake resets the mode), after 1 s and then twice as long each time up to 8 s. A report shorter than 0x30's 49 bytes is refused before any of it is read. - Pads and players: a Joy-Con that connects joins a pad that holds the other side alone, else it is a pad of its own (
jc1_pair_pick); holding SL + SR on one of a pair for 3 s makes it a pad of its own, holding L on a left one alone and R on a right one alone together for 3 s pairs them (jc1_gesture, the Switch 2 transport's gestures). A pad is a player from its first button press, as a raw HID pad, and its lights show the player (all four flashing while it waits). Each Joy-Con is a device of its own to the npad layer (dm_joy_attach,dm_joy_setwith its rail buttons,dm_motion_set_joy), as the Switch 2 transport's Joy-Con 2s, so the game decides whether a pair is one dual npad or two single ones (hle_hid.c), not macOS's combine setting. For a game that supports no Joy-Con style the pad is one whole controller (jc1_pad_input): a pair as a Pro Controller, a Joy-Con alone held sideways, its face buttons, stick and merged six-axis stream turned a quarter (jc1_sideways_*: the left one counterclockwise, the right one clockwise, the rail away from the player). The merged stream (dm_motion_set_hid) comes from the right Joy-Con of a pair (DM_JC1_SIDE=Lfor the left), the left one when the right one is not streaming.DM_PAD_MERGEmakes every pad player 1 and holds no Joy-Cons apart.DM_JC1=0gives them back to GameController (buttons, no motion). - Report: 49 bytes, of which three 12-byte samples sit at offset 13 (acceleration XYZ then gyro XYZ, int16 little endian, 5 ms apart, the third the newest). The chip's axes: +X runs along the controller toward its top, +Y is the short axis, and +Z leaves the face on the left Joy-Con but the back on the right one, so the map into the Switch frame is (-Y, +X, +Z) for the left and (+Y, +X, -Z) for the right, negated, because the host wants the gravity direction and not the accelerometer's specific force; the gyro takes the same rotation, in rad/s.
- Gyro scale: the calibration's coefficient is stored in either of two schemes (816 or 936 over coeff - origin), and the units in the wild use both: one of a pair here had 0x3BE7 (15335) where the other had the default 0x343B (13371), so with one constant the two integrate at rates 13% apart and the orientation drifts during a round. Each axis takes whichever constant puts it nearest the part's measured sensitivity (0.061 deg/s per count), which keeps a real per-unit calibration and drops the scheme. The gyro's origin is the still offset.
- Still offset (the cause of Boxing's phantom punches): the factory's gyro origin is close but not the unit's own: the left one here read 5/25/2 counts against a rest offset of tens of counts, and what is left over (a degree or two per second) integrates into a drift the game reads as the player's hands moving. The host learns the controller's own offset from a second of samples in which the gyro and the accelerometer hardly vary, from fresh reports with sensor data only, and takes the two together (the factory origin is kept from the calibration reply whatever the logging; a rest learned before the reply, against origin 0, starts again, and the same calibration read again after a wake keeps it), as the Switch 2 transport does for its Joy-Con 2 (
s2_rest_update,pad_jc1.h'sjc1_rest_update): measured, the left's residual was 11/-3/-7 counts and the right's 4/2/4. On a 22 minute session the learned offsets settled at -1/-2/46 counts on the left and 9/-8/-15 on the right, the left's residual at rest was 0.06 deg/s, and Boxing, which threw punches with the player still on both builds before this one, was clean. - Sample times: the newest sample is the earlier of the clock and the arrival, the clock advances 15 ms a report and slews a quarter toward the arrival, and the samples within a report are 5 ms apart; a sample at or before the last one given is skipped, so an early report brings fewer samples rather than out-of-order ones.
- Rumble: the game's vibration for a Joy-Con pad's player goes to the Joy-Cons (
dm_jc1_rumble, set as the player's haptics sink), not to GameController. Every 15 ms while it buzzes, each Joy-Con gets an output report 0x10 with one HD rumble sample (jc1_rumble_encode, dekuNukem's rumble data table as Linux hid-nintendo and SDL encode it: a high band of 81.7..1252 Hz and a low band of 40.9..626 Hz, each frequency and amplitude on its log scale; nothing at the default frequencies is the neutral 00 01 40 40): its own side's motor in a pair, the stronger of the two in each band when it is alone. A report carries one sample where a game sets values every 5 ms, so each report plays the strongest value set since the last one (jc1_rumble_hold), and a buzz ends with three reports of silence. The tick runs only while there is a Joy-Con pad. - Found on: Nintendo Switch Sports Resort (v65536), on a Mac (macOS 27.2) with a left and a right Joy-Con: both accept the handshake, the 49-byte reports arrive at about 60 Hz with three samples 5 ms apart, the factory calibration reads, and flat on the desk both halves report the same gravity (left +0.01 -0.06 -1.04, right +0.02 -0.06 -1.01). The normalized gyro scale reads 0.0611/0.0611/0.0610 deg/s per count on the left and 0.0610/0.0609/0.0610 on the right: the same 0.061 the part's sensitivity is, where the left's own coefficient with the 816 constant would give 0.0532, 13% slow. Archery starts and shoots, and the game's own orientation gate (the buttons facing inward) passes. A real punch reached 9.9 G and 18 rad/s. On Splatoon Raiders (v65536, a Switch 2 game, SDK 21.4.4) the same pair aimed cleanly and 1 to 1: the game reads the six-axis API every frame (30,400
GetSixAxisSensorStatescalls to frame 26,100 in a 7 minute session) and never the npad IMU API, and the stream carried the motion (444 deg/s peak from the left half, 484 from the right, 1.27 rev/s handed to player 1). - Open: reading a Joy-Con wholly from HID (buttons, sticks, rumble, lights, pairs, gestures, the sideways mapping) is checked by
t_jc1only and has not run on hardware; until it has, buttons, sticks and rumble that worked through GameController depend on it. To check on a Mac with Joy-Cons: a pair and a lone one join at a press and light their player; sticks centred and reaching full after the SPI calibration (DM_JC1_LOG=1logs it); a game that asks for single Joy-Cons splits the pair; the rumble strength and feel, and whether a 15 ms report rate keeps up over Bluetooth with two pads; Home held quits; whether GameController's player lights on the Joy-Con fight the host's. The sideways frame derived here (left (-y, x, z), right (y, -x, z)) is the opposite of the Switch 2 transport'ss2_map_left_alone/s2_map_right_alone; one of the two is wrong and only hardware can say which. A pair dropped out once mid-session (the right one's RSSI was -77; a battery is suspected). Whether a pair's two sensor frames should be common or per device is open: a flat pose agrees on both, and mirrored hand poses read mirrored x, which is physically expected and passed Archery. iOS is not supported (IOKit). Boxing's phantom punches were the still offset and are fixed (above); the three samples a report (200 Hz, where the Switch 2 transport sends one) are not implicated, since Splatoon Raiders aims 1 to 1 from the same stream and a round of Boxing is clean. - Check:
t_jc1(the output report's bytes, the SPI reply in both encodings, the left and right frame signs, a short report refused unread, the repeated packet counter, a zeroed stream after a live one and the watchdog's timing, the jitter monotonicity with early and late arrivals, the calibration's origin and the rest learned on it; each Joy-Con's buttons and the charging-grip bit, the stick through its SPI calibration, the sideways stick, sensor and buttons, a pad's whole-controller state, the pairing pick, the merged-stream side, each Joy-Con's motors, the gestures, the light patterns, the rumble codes against the table and the peak hold).
iOS drops a lone Joy-Con without an extended gamepad profile
- Symptom: a lone Joy-Con L connects on iOS, but the log says
no extended gamepad profile: not usedand the game gets no buttons or stick. - Cause: iOS discovers the controller but supplies no
extendedGamepad. The iOS front end had required one to assign a player and receive input. The reporter observedGCController.inputchange callbacks on the affected device. - Fix: the iOS front end reads a lone Joy-Con from
GCController.inputon element changes. It maps the sideways face buttons and rail shoulders by position and reports the direction pad as the left stick. It uses the shared iOS player, press-to-join, and controller-prompt routing. Home and Capture retain iOS system behavior on this path. - Found on: Kirby and the Forgotten Land, base version 1.0.0 on iPhone19,4 with iOS 27.3 (#2971). The reporter completed 15 time trials in about 20 minutes with a fork patch that combined callbacks and polling.
- Open: verify the callback-only path on an iPhone with a left and a right Joy-Con, each alone and alongside a second pad. Check presses and releases, stick orientation, joining, disconnect, and the system Home action.
Identical controllers that GameController lists as one
- Symptom: two Switch Pro Controllers connected over USB to a Mac play as one player: GameController lists one controller and reads one of the two pads, the other does nothing, and a two-player game refuses to start (issue #1218). Over Bluetooth both are listed.
- Cause: GameController lists one controller for both. Their USB serial numbers are the same, which may be why; over Bluetooth each has its own. IOKit has both devices, and each sends its report
0x30. GameController gives a controller no HID identity, so its one controller cannot be tied to one of the two devices. - Fix: one mechanism in
pad_hid_mac.h, on its own HID manager. It keeps the devices GameController reads (g_hidpads_gc) instead of dropping them, to count IOKit's pads of each model (vendor and product ID) against GameController's controllers of it: a Pro Controller's by their product category, another model's by name (vendorNameis the HID product string). Other Microsoft, Sony and Nintendo pads cannot be matched by name (a DualShock 4's HID product string isWireless Controller), so they are never read this way, which would read them twice. When IOKit has at least two pads of a model and more than GameController lists (only entries that send reports count: A HID entry that sends nothing counted as a second pad), after a 3 s wait for a pad that is not listed yet (pad_dupes_want), every pad of that model is read there, a player each, by USB location: a Pro Controller from its report0x30(pad_pro.h) with its gyro (motion_pro.h), any other model from its HID elements (pad_hid.h).front_mac.mleaves GameController's controllers of that model unread (hidpad_gc_unread). When GameController lists them all again, they go back to it.DM_PAD_IDENTICAL=0turns it off, as doesDM_HID_PADS=0;DM_MOTION=0andDM_MOTION_HID=0turn off only the gyro.motion_pro_mac.his not involved: it still pairs one Pro Controller's raw motion with GameController's one controller. - Sticks: a Pro Controller read this way asks for its stick calibration in SPI flash, subcommand
0x10in output report0x01: the user's at0x8010when its magicB2 A1is there, else the factory's at0x603D(spi_flash_notes.md). Alongside the macOS driver both pads answered over USB, and a pad over Bluetooth, on an M4 Pro with macOS 27. Without an answer each axis measures its own rest and reach. - Limits: such pads have no rumble or player lights, and Home does not quit from them. Another model's buttons follow 8BitDo's numbering unless
DM_HID_MAPsays otherwise; only Pro Controllers were run, before the mechanism was folded intopad_hid_mac.h(PR #1595), and the folded version awaits a run with two Pro Controllers over USB. - Found on: Mario Kart World 1.8.0, two Pro Controllers over USB, 33 minutes of two-player split-screen races.
One Pro Controller read as two players
- Symptom: with one Pro Controller over Bluetooth, the log shows
GameController lists 1 of 2 pads of this modeltwice for the same USB location, then players 1 and 2 for that pad; a one-player game opens the controller applet every few frames (hid controller applet: 1 to 1 players wanted, 2 connected, focus state 2 then 1, thousands of times). A game that suspends its music while an applet has focus plays none: sound effects and positional music still play, while area and cutscene music never start. - Cause:
IOHIDManagerhands a device over once per matching dictionary it meets, each time as a newIOHIDDeviceReffor the same I/O Registry entry. The Pro Controller meets both the GamePad usage dictionary and its own vendor / product one (added so identical pads are counted), andhidpad_foundknew devices by reference only, so one pad counted as two pads of its model against GameController's one controller (Identical controllers that GameController lists as one). - Fix:
pad_hid_mac.hknows a device by its registry entry ID (hidpad_entry): a second reference to a known entry is ignored in every list. - Found on: The Legend of Zelda: Ocarina of Time, one Pro Controller over Bluetooth on the Mac: no music in Kokiri Forest gameplay or its cutscenes, back once the pad was read once.
A HID entry that sends nothing counted as a second pad
- Symptom: one Pro Controller over Bluetooth comes back from a long disconnect (20 minutes or more) as two players:
GameController lists 1 of 2 pads of this model: read herefor two USB locations, one of them0x0, thencontroller 'Pro Controller' (HID) connectedas players 1 and 2. The location-0 entry logscannot ask its stick calibration (IOReturn 0x10000003). Theconnectedthendisconnected ... is freelines of the GameController controller just before are the host releasing it to the twin path, not a Bluetooth drop. A short drop of about 20 s reconnects as one player. - Cause: the twin path (Identical controllers that GameController lists as one) counted every IOKit entry of the model as a pad. After the long disconnect IOKit had a second entry of the one pad:
0x10000003isMACH_SEND_INVALID_DEST, so nothing receives what is sent to it, and it survived the next reconnect while the live entry was replaced. Two entries against GameController's one controller read as two identical pads that GameController merged. The raw motion pairing (Switch Pro Controller advertises motion but sends zeroes) counted the same entries, so the dead one would also have turned the gyro off. What macOS keeps the entry for is not known: the report has noioreglisting of that state. - Fix: an entry counts only while a pad is behind it (
hidpad_live,pad_hid_mac.h;pro_live,motion_pro.h). macOS keeps a Pro Controller in full mode, which sends report0x30every 15 ms whether or not anything moves, so a Pro Controller entry counts while its last0x30is less than a second old; another model's entry counts once it has sent any report (it may send only on change). Each entry's reports are listened to for this (hidpad_listen; another model's only until its first). An entry starts counting at its first report, and again at its first after a silence; one that falls silent without being removed is left out at the next change of the model's pads. Both twins and the raw motion pairing use it. When a model has two or more entries, the log names each one that starts or stops counting, with its transport and registry entry ID, and the twin line names them too, so a report shows which entries a pad has. A twin now takes its player only once it sends. - Open: not run with a controller (none here), so that the reporter's location-0 entry sends nothing is inferred from its
MACH_SEND_INVALID_DEST, not measured; if it does send report0x30, it still counts. The issue stays open for the reporter's retest. Two Pro Controllers over USB are read as twins as before, about 15 ms later (their first reports), checked with fake devices only. A silence of a second or more (a pad whose reports stop while it stays connected) leaves it out at the next change of its model's pads. - Found on: The Legend of Zelda: Ocarina of Time (v131072), one Pro Controller over Bluetooth on a MacBook Air M4 with macOS 27.2, in two runs after long disconnects (issue #2237).
- Check:
t_pad_hid_mac(dm/host/tests, fake IOKit entries and GameController controllers): one pad with a silent second entry stays with GameController, as does a reconnected pad whose old entry fell silent; two pads over USB become twins only once both send, go back when one falls silent and come back when it sends again. With every entry counted, it fails with the report's tworead herelines.t_motion_pro_mac: a silent entry does not stop the pairing, and a pad whose old entry fell silent is paired on its new one.t_motion_pro:pro_live.
An analog trigger at rest read as ZL held
- Symptom: on the Mac, with an Xbox controller, ZL stays held without the trigger being touched; in The Legend of Zelda: Ocarina of Time, Z-targeting stays on and the camera stays locked behind Link.
- Cause: the Mac front end set ZL and ZR from GameController's
isPressedonleftTriggerandrightTrigger. The reported controller's LT reads about 0.06 at rest withisPressedtrue. The report isolates the input at that API boundary; whether the resting offset originates in the controller or macOS is unknown. - Fix:
pad_read(front_mac.m) sets the digital ZL and ZR buttons from the trigger's normalizedvalueabove 0.25, for every GameController pad. This compensates for the upstream resting value; it has no controller, game or build gate. - Found on: The Legend of Zelda: Ocarina of Time (v131072), an Xbox controller on an Apple M4 Mac with macOS 27.2 (PR #2504). The author reports that Z-targeting no longer sticks and both triggers work when pulled.
- Check: a local probe on macOS 27.2 drives the extracted
pad_readwith GameController snapshots (other front-end calls stubbed): both triggers at 0, 0.06, either side of 0.25, exactly 0.25, full pull and release; shoulders, face/menu/d-pad/stick controls; and press-to-join and input gates. The new mapping passes and the same sweep fails with main'sisPressedmapping. Snapshot setters do not dispatch the profile callbacks on this OS, so event delivery was checked separately with a physical pad. - Physical control check (2026-11-18): a DualSense Wireless Controller on an Apple M6 Mac, macOS 27.2 (26B123), through the same extracted
pad_readin a temporary AppKit probe, operated by the user. Both analog triggers rested at 0 and reached 1.0. LT was off at 0.247059 and on at 0.250980; RT was off at 0.243137 and on at 0.254902. Live callbacks also released ZL / ZR below the threshold while GameController'sisPressedremained true. Both triggers pulled and released; shoulders, all four face buttons, all d-pad directions, both stick buttons and both sticks passed, with no buttons held at the end. The probe received 1,734 profile events (325 LT, 262 RT). This checks the input conversion and callbacks, not a DualSense gameplay run. - Open: the upstream source of the Xbox resting offset remains unknown. Switch Pro Controller compatibility and iOS have not been tested here; iOS keeps its existing input path. The physical DualSense check closes the second-controller threshold/control check requested before landing this Mac change.
A virtual controller is trusted but never published by GameController
- Symptom: on the Mac through Steam Link / Remote Play, a virtual
045e:028econtroller namedGamePad-Ngives a game no input and no controller-connected log line.+[GCController supportsHIDDevice:]answers YES, butGCController.controllersis empty (issue #2465). - Cause:
hidpad_foundtrusted the Microsoft, Sony and Nintendo vendor IDs without waiting for GameController to publish a controller. A virtual HID device can reuse those IDs without being published, so neither GameController nor the raw HID reader read it. The existing two-second fallback covered other vendors only. - Fix: vendor-only trust applies to physical devices: a device marked
kIOHIDVirtualHIDevicemust have a matching, usable GameController controller or take the existing two-second HID fallback, whatever its name, vendor or product. Both the name check (hidpad_gc_listed) and a late handoff (hidpad_gc_connected) requireextendedGamepad, the profilefront_mac.mreads. Apple's GameController synthetic devices remain excluded. Physical-controller vendor trust remains because their GameController names can differ from their HID product strings. - Fix, its layout: the raw HID fallback used 8BitDo's button numbering and treated Z / Rz as the right stick. Steam Link's Xbox 360 layout uses Xbox button usages, X / Y for the left stick, Rx / Ry for the right stick and Z / Rz for the triggers.
pad_hid_layout_forrequires045e:028eand those six Generic Desktop axes without dedicated Brake / Accelerator usages. Nintendo's report0x3Ftakes precedence. Discovery and the value callback use the same axis mapping. The d-pad arrives as buttons 12–15, andDM_HID_MAPstill replaces button entries. - Check:
t_pad_hid_macdrives the real discovery, value callbacks and handoff with fake IOKit devices and GameController controllers. It checks the mapped face button, triggers and right stick for the matching Xbox layout, dedicated triggers on a different layout with the same ID, and Nintendo's right-stick axes when report0x3Ftakes precedence. Unlisted virtual devices of all three trusted vendors and another vendor deliver button presses and releases through HID after the wait. Already listed and promptly published usable controllers stay with GameController. A matching controller withoutextendedGamepadcannot suppress HID or take it back, but a usable late controller does. Removal during the wait, the synthetic exclusion, physical-device trust with missing or false virtual flags, and the identical-pad and Nintendo-protocol cases are checked too. - Open: live Steam Link verification of the buttons and triggers is pending. The reporter's local Steam-specific repair restored input. The button map comes from one-at-a-time presses of a GameSir G8 through Steam Link on an iPhone, captured on the Mac, and
t_pad_hidchecks each. Both sticks worked in Donkey Kong Bananza with an earlier local version. Rumble and multiple remote players remain untested. - Found on: Cult of the Lamb 1.5.28 with four DLCs through Steam Link, built with engine
ccd834e0(NX2Apple 1.4.0), reported in issue #2465.
A HORI Taiko Drum gets 8BitDo's button map
- Symptom: on the Mac, a HORI Taiko Drum for Nintendo Switch (USB,
0f0d:00f0, "Taiko Controller") is read as a raw HID pad, and the log saysbuttons use 8BitDo's numbering. Its buttons reach the game in the wrong places: A and R do nothing, Y acts as A, L as Y, ZL / ZR as L / R, and minus / plus as ZL / ZR. - Cause: GameController does not list the drum, so it reaches the raw HID fallback after the two-second wait. The fallback uses 8BitDo's D-input numbering by default. The drum uses HID usages 1 Y, 2 B, 3 A, 4 X, 5 / 6 L / R, 7 / 8 ZL / ZR, 9 minus, 10 plus, 11 / 12 stick clicks, 13 Home and 14 Capture.
- Fix:
pad_hid_layout_forselects the Taiko Drum map for USB ID0f0d:00f0. The PS4-mode HORI Fighting Stick Alpha (0f0d:011c) also declares 14 button usages, so the count cannot identify the drum's map. Nintendo's report0x3Fand the Xbox 360 layout take precedence.DM_HID_MAPstill replaces button entries. Fighting Stick descriptor capture - Check:
t_pad_hidchecks the drum's 14 usages and the layout selection.t_pad_hid_macexercises discovery and value callbacks for the drum and a fixture based on the PS4-mode Fighting Stick descriptor. The reporter identified the drum in an IOKit probe and played Taiko no Tatsujin: Rhythm Festival (01006B0016AD6000, 6.2.0) withDM_HID_MAP=Y=1,B=2,A=3,X=4,L=5,R=6,ZL=7,ZR=8,MINUS=9,PLUS=10,LS=11,RS=12, which supplies the same map. - Open: a gameplay run with the physical drum and the revised host is pending.
- Found on: Taiko no Tatsujin: Rhythm Festival (
01006B0016AD6000, no profile in this repository) with a USB HORI Taiko Drum on an Apple M3 Pro Mac.
A keyboard receiver that declares a gamepad takes player 1
- Symptom: on the Mac, with a keyboard and mouse receiver plugged in, the log shows
controller '<receiver>' (HID) connected: player 1and the real controller as player 2; a one-player game takes no input from it and opens the controller applet again and again (hid controller applet: 1 to 1 players wanted, 2 connected). - Cause: the receiver declares a Generic Desktop GamePad or Joystick collection, so it matches the raw HID pad filter (
hidpad_start), and a raw HID pad took the lowest free player at its connection. A HID descriptor only claims a controller: nothing in it tells a receiver that never sends a report through that collection from a pad at rest.+[GCController supportsHIDDevice:]answers YES for this receiver and GameController never lists it, so since the two-second wait for such devices (463d21f7) it was read as HID; before that it was skipped. - Fix: a raw HID pad is a player from its first button press, not from its connection (
hidpad_first_press,front_mac.m), through the path of Press a button to join but with the slot a connecting controller takes (pad_slot_take): the log sayspress a button to play, thena button pressed: player N. A device that never presses takes no player. Identical pads read here (twins) are models GameController lists and stay players at their connection. - Open: not run with such a receiver (none here): the issue stays open for the reporter's retest. The applet opening in a loop when a one-player game sees two players was a cause of its own, resolved: The controller applet leaves out the players past the maximum.
- Found on: The Legend of Zelda: Ocarina of Time, a Keychron Link receiver (3434:d030) over USB and a Pro Controller over Bluetooth, macOS 27.0.1 (issue #1657).
Pro Controller clone read as raw HID
- Symptom: on the Mac, a Pro Controller clone that GameController does not list (a PowerA NANO pairs over Bluetooth as
Lic Pro Controller, HID vendor and product 0) is read as a raw HID pad with its buttons in the wrong places, a full stick push reads 61 to 74% so the character does not run, and its four lights keep running in a chase. - Cause: its report descriptor is Nintendo's, and until a console talks to it the pad stays in the Pro Controller's simple report
0x3F. That report numbers its buttons unlike the default 8BitDo map and carries the sticks uncalibrated (the NANO's rest 9 and 11% off centre, its reach about 0.78 of the axis from there), and the pad chases its lights until it is given a player. The pad speaks the lights subcommand (0x30): it answered with80 30in report0x21(PR #989); that does not establish support for full input mode or device info. - Fix: Nintendo's protocol is told by the descriptor, not the name or vendor (
pad_hid.h,pad_hid_nin_bit). A pad read as raw HID that declares buttons in input report0x3F, the reply0x21, full input0x30and subcommand output0x01is asked for device info (0x02). One that answers gets the shared handshake (jc1_handshake_report, also used by original Joy-Cons): full mode, sensor and vibration on, factory IMU calibration and factory/user stick calibration from SPI, then player lights. Its report0x30gives buttons and sticks throughpad_pro.h; the buttons pass through the sameDM_HID_MAPas0x3F, including Home/Capture overrides, without carrying old hat or trigger state across modes. The gyro usespad_jc1.h's calibrated sensor decoder (jc1_unit_cal,jc1_input, in the Pro Controller's frame): factory origins and per-axis sensitivity, the learned rest offset and monotonic sample times. The passivemotion_pro.hdecoder remains for identical genuine Pro Controllers. With output report0x10, the protocol pad gets its player's HD rumble (dm_hidpad_rumble, left and right actuators separately, every 15 ms while buzzing). Output reports go out on a serial queue (g_hidpad_out). - Fallback: report
0x3Fuses its own button numbering and raw sticks measured from their rest against the reach seen so far (pad_hid_raw_axis, starting at 0.7: a full push read 99 to 100% on the NANO). It serves until full mode, for good after three unanswered device-info asks or no0x30after the handshake, and again after a return to0x3F, which starts another handshake. Player lights are independent of full mode and device info: a descriptor with0x3Fbuttons, reply0x21and output0x01can receive the LED command (pad_hid_nin_lights,jc1_led_pattern), even without full input0x30. They flash all four before joining and show the player's number after its first button press; they are also sent when device-info retries run out. A pad declaring only0x3Fbuttons receives no output. The log names the path;DM_HID_LOG=1logs simple-report usages. - Open: the protocol path has not run on hardware: the NANO was played on the PR's
0x3Fpath only (buttons in place, full tilt runs, player 1's light). Whether it accepts full mode, answers SPI reads, has a gyro or plays rumble is unknown, as is whether its descriptor declares the necessary reports. Its log namesanswers Nintendo's subcommands,in full mode: read from its report 0x30, the calibration received, or the fallback. iOS is not covered (IOKit). - Found on: a PowerA NANO over Bluetooth on macOS 27.2; not specific to a game. Played in FINAL FANTASY RESONANCE on the PR's
0x3Fpath. - Check:
t_pad_hidcovers the simple map, raw stick scaling, descriptor capabilities and identical button mappings in both modes, including disabled buttons, Home/Capture overrides, the d-pad and stale simple state.t_jc1covers the shared handshake, calibrated motion and separate rumble actuators.t_pad_hid_macdrives fake IOKit devices through retries, handshake, full input, calibration replies (a truncated reply is rejected; factory rest emits zero gyro, and per-axis sensitivity is applied), a custom map in full mode, player lights, rumble and return to simple mode. It checks lights without full input support and without a device-info answer, no output for buttons alone, an unchanged 8BitDo path and identical genuine Pro Controllers.
A raw HID d-pad reads left as up-left
- Symptom: on the Mac, pressing left on a raw HID controller's d-pad registers up-left, and pressing up-left registers no direction.
- Cause:
b396df3aremovedDM_BTN_LEFTfrom the eight-slot hat table inpad_hid_buttons()(pad_hid.h). Value 6 then read the entry for up-left, and value 7 read the zero-initialized last slot. - Fix: restore left at index 6 and up-left at index 7 in the shared decoder. It handles 8BitDo D-input hats and Nintendo's simple report
0x3F. GameController and Nintendo's full report0x30decode the d-pad independently. - Found on: synthetic raw HID hat inputs on macOS 27.2.1. A compiled probe decoded all eight directions before
b396df3a, six after it, and all eight with the fix. PR #2933 - Check:
t_pad_hidchecks the button mask for all eight directions. Only values 6 and 7 fail with the broken table.t_pad_hid_macchecks the Mac raw HID path with virtual controllers.
SDK 20 six-axis sensor and amiibo (nfp) calls
- Symptom: SDK 20 calls that reach a service;
nfp'sAttachActivateEvent/AttachDeactivateEventcrashed in the SDK atsdk+0x3f2a78. - Fix: the console six-axis sensor (
hid::*SevenSixAxisSensor*) reports zero states; morenfpcalls are hooked:AttachActivateEvent/AttachDeactivateEvent, the two-argumentMount,Unmount,GetCommonInfo,GetRegisterInfo,GetState,Finalize. The host answers as a console with no amiibo. - Found on: The Legend of Zelda: Breath of the Wild (1.9.0, SDK 20.5.22). Super Mario Bros. Wonder 1.2.1 already initialized
nn::nfpat boot (A game update imports SDK calls the base game did not).
Switch 2 hid calls that open the hid service
- Symptom: at boot,
game called nn::diag abort: Result 0x58ccaatsdk+0x6cab6c(underhid::GetNpadJoyIconDecorationColor, once the game draws), orResult 0xe15atsdk+0x6d6948(underhid::InitializeSensorFusion, with[RED] sf: the game connects to service hid itself). Later, motion controls that go through the SDK's sensor fusion (hid::UpdateSensorFusion) do nothing: the controller's orientation stays still. - Cause: these Switch 2 SDK calls ask the hid service or read its shared memory, neither of which the host provides, and the SDK aborts on the answer. For the icon decoration colour the SDK reads the npad's internal state from hid shared memory, finds none and answers
0x58cca, which its wrapper aborts on. - Fix: the host answers them in
hle_hid.c, checking npad ids as the SDK does (No1 to No8, Other, Handheld; another id is refused with0x58acaand a red line):- Joy-Con icon decoration colour (one or both halves):
0x4b6ca, which the SDK answers for an npad whose controller is no decorated Joy-Con (sdk+0x6be204) and its wrapper hands to the game; no controller of the host is one, and the 12-byte colour is not written. - Npad IMU (
EnableNpadImu,DisableNpadImu,IsNpadImuEnabled,GetNpadImuSamples): the layer the SDK's own sensor fusion reads (Enable/UpdateSensorFusion→GetNpadImuSamples→nn::imu::FullSensorState). These four are the only users of the SDK's IMU state (sdk+0x1056c48), so the host keeps that state: on with the game's buffer, which no service writes; enabling twice answers0x2908caas the SDK does. - IMU samples:
GetNpadImuSampleswrites 0x28-byteNpadImuSamples (sdk+0x6ca8b8) from the host's six-axis state (Six-axis sensors, live motion) at each 5 ms tick on the guest clock, in the layout and units of The Npad IMU sample holds the acceleration first. The handle is the six-axis handle, which the fusion passes as the IMU handle (The SDK's IMU handles are the console's six-axis handles). Like the console's ring in shared memory, the answer keeps no state per reader: each call returns the newest ticks up to the current one, at most the count asked for and the 16 the SDK's ring holds, oldest first, numbered by absolute tick + 1, and never below the last tick answered for that handle (a high-water mark per handle, so the numbers never go back). The fusion skips a number it has already taken and bridges or resets on a gap (sdk+0x6d7198), so several readers, a fusion created again, or an IMU switched off and on each get every tick. A handle whose controller is not connected has no samples. GetSixAxisSensorIcInformation: the fusion's initialization (sdk+0x6d7db0) asks it through the hid service and, when it fails, never reads a sample (sdk+0x6d7e40). The 0xc8 bytes are, per sensor, its range, zero-offset bounds and sensitivity bounds (read at+0x00,+0x10,+0x40,+0x44,+0x64,+0x74,+0xa4,+0xa8intonn::imu::SixAxisSensorInformation,sdk+0x6fed30); a sample past twice the range resets the fusion. The host answers yuzu's values for this layout: 2000 deg/s and 8 G (the Switch six-axis IC's full scale), offsets within ±10 deg/s and ±0.0612 G, sensitivity 0.95 to 1.05 with ±0.003 cross-axis.IsSixAxisSensorDeviceNewlyAssigned(from hid shared memory,sdk+0x6c1330): no, so the fusion is not reset each update;ResetIsSixAxisSensorDeviceNewlyAssigned: nothing to clear.StoreSixAxisSensorCalibrationParameterkeeps the fusion's 0x744-byte gyro bias calibration per device for the run andLoadSixAxisSensorCalibrationParametergives it back (The SDK's sensor fusion needs sensor noise and a stored calibration for a device with nothing stored). Six-axis handles are checked as the SDK'sVerifyValidSixAxisSensorHandledoes (sdk+0x6d8440: also device index 0 to 2, else0xd6ca).
- Joy-Con icon decoration colour (one or both halves):
- Note: the Home button protection calls, which the same game asks at boot, are answered as in Home button protection on a Switch 2 controller. Unconfirmed against a console: which Joy-Con a pair's device index 0 and 1 are (the host takes 0 as the left, as for six-axis handles), the IC bounds besides the ranges (not read from a Switch 2 controller), and the Result a console gives for a device with no stored calibration (the only caller tests for 0).
- Found on: Nintendo Switch Sports Resort (
04008E001F098000, v65536).t_hid.ccovers each call, the sample window and numbering, unit conversion, sign switches and concurrent readers.
The SDK's IMU handles are the console's six-axis handles
- Symptom: a Switch 2 game's motion controls stay still and its motion calibration fails: Nintendo Switch Sports Resort's "Calibrar los sensores de movimiento de los mandos Joy-Con" ("place the Joy-Con on a flat surface") ends after 30 s with "No se ha podido completar la calibracion" every time, though
GetNpadImuSamplesis called thousands of times;StoreSixAxisSensorCalibrationParameteris never called (DM_HLECOUNT). - Cause: the sensor fusion's handle is made by the SDK itself (
GetSensorFusionHandles→GetNpadImuHandles,sdk+0x6ca570→nn::hid::utility::GetSixAxisSensorHandle,sdk+0x6d8490; the SDK's ownGetSixAxisSensorHandlescalls the same utility). That is the console'sSixAxisSensorHandle: byte 0 theNpadStyleIndex(3 full key, 4 handheld, 5 Joy-Con pair, 6 left, 7 right), byte 1 the npad id, byte 2 the device (0 left and 1 right of two sensors; SDK 22 gives full key and handheld one sensor, device 2). The host'sGetSixAxisSensorHandlesput the style's bit number in byte 0 instead, andGetNpadImuSamplesread the SDK's handle that way: a pair on No1 (0x5,0x10005) was style bit 5, never connected, so every call answered 0 samples and the fusion left atsdk+0x6d777cwithout feeding anything. - Fix: the host's six-axis handles use the console's numbering too (
six_style_index,six_style_bitinhle_hid.c; devices 0 to 2 for every style, as SDKs differ in the device they give; a style set of several styles gets the one the npad is shown in; the stored calibration of device 2 is device 0's), so the SDK's handles and the host's read the same everywhere;t_hid.cchecks both kinds, player 2's npad and a split pair's left and right Joy-Cons. - Found on: Nintendo Switch Sports Resort (
04008E001F098000, v65536).
The Npad IMU sample holds the acceleration first
- Symptom: a Switch 2 game's motion calibration never completes and, with a real controller, what it moves turns by itself in circles while the controller lies still: Nintendo Switch Sports Resort's "place the Joy-Con on a flat surface" ends after 30 s with "No se ha podido completar la calibración" every time, and its paddle spins. A probe on the fusion's output sample (
DM_PROBE=sdk:6d7118@x22+0x40:GetUnbiasedAccelerationz, thenGetUnbiasedAngularVelocityin deg/s) reads an acceleration of 0 G and an angular velocity of about +560 deg/s about z with a flat sensor and no controller. - Cause:
NpadImuSample(0x28 bytes,sdk+0x6ca8b8) is the sampling number, the ns since the previous sample, the acceleration in m/s² at +0x10 and the angular velocity in rad/s at +0x1c.UpdateSensorFusioncopies +0x10 negated (sdk+0x6d7334) to nn::imu's sample +0x24, which nerd'sFeedSixAxisSensorValues(sdk+0x6ffac0) andGyroPointing::FeedImuSampleNoUpdate(sdk+0x700e90,sdk+0x700f84) take as the acceleration, and +0x1c as it is to +0x18, the angular velocity. The host wrote the angular velocity first and both negated, so the fusion took gravity (9.8 m/s²) for a 9.8 rad/s turn about the vertical (562 deg/s), its stable orientation turned at that rate andGyroPointingCore::Recover(sdk+0x712aa0) ran about once a second. - Fix:
GetNpadImuSampleswrites the acceleration (G × 9.80665, −9.8 m/s² on z lying face up) at +0x10 and the angular velocity (revolutions/s × 2π) at +0x1c, in the six-axis state's own signs: the fusion negates the acceleration into a specific force and reports it as −m/s² / 9.80665 G (sdk+0x6d74a0), so its outputs read as the six-axis state does. The time step is the sample timestamps' ((t − t_prev) / 1e9,sdk+0x700ff0, from the samples'delta_ns).DM_IMU_ACC_SIGN/DM_IMU_GYRO_SIGN(-1) negate either andDM_IMU_AXESpermutes the axes, for a test. - Check: the same synthetic run then read an angular velocity of −0.004 deg/s (5 to 95% within ±0.17), −1.000 G on z, a stable orientation turning 0.16 deg/s, the fusion's ready flag (bit 1 of the orientation's flags word,
sdk+0x6d78f8) set, noRecover, and the game's calibration passed. With a right Joy-Con 2 and with a DualSense the calibration passes and the paddle follows the controller in matches.t_hid(t_imu_conversion: a known pose through the whole conversion to the bytes the fusion reads). - Found on: Nintendo Switch Sports Resort (
04008E001F098000, v65536).
The SDK's sensor fusion needs sensor noise and a stored calibration
- Symptom: with IMU samples flowing from the host's own flat sensor, the fusion reset itself several times a second (its initialization, which asks
GetSixAxisSensorIcInformation, ran 612 times in one Nintendo Switch Sports Resort session) and never took the controller for still;StoreSixAxisSensorCalibrationParameterwas never called. With a DualSense its orientation drifted. - Cause: samples that never change. The fusion's stillness detector (
GyroPointingStateDetector::UpdateMovingDetection,sdk+0x736260) calls the controller moving when the lag-1 autocovariance of the last 64 accelerations on x and z (m/s²) is beyond 1e-6, and its bias calibration needs the Kalman filter's bias deviation under 0.01 rad/s (GyroPointingKalmanFilter::GetCalibrationState, thresholds atsdk+0xbb85b8/+0xbb7df8), which an exactly constant input does not give it. On a console the fusion rarely has to learn the bias:LoadSixAxisSensorCalibrationParametergives it the controller's stored calibration, which it takes as its initial bias (sdk+0x6d7f7c) and counts as calibrated (+0x538); the host answered none (0xd8ca). A GameController (DualSense: 0.34, 0.20, −0.66 deg/s at rest) reports its gyro with its rest offset, which a zero bias would then leave in. - Fix:
GetNpadImuSamplesadds fixed Gaussian noise to the host's own samples (gyro 0.1 deg/s, acceleration 0.05 mG, a hash of the tick, device and axis, so a tick read again reads the same;DM_IMU_NOISE=0removes it,=<deg/s>,<mG>sets other spreads, also throughDM_CTL'senv). A live controller carries its own noise: its interpolated ticks are left as they are, and only a tick with no change of its own (a held sample, or between two that read alike) gets a tenth of the host's noise.LoadSixAxisSensorCalibrationParameteranswers a device with nothing stored this run with the ideal sensor's calibration (zeros, a zero bias) when the sensor's gyro offset is taken off (six_offset_known: the host's own sensor, a HID or Joy-Con 2 stream, the phone, a GameController once its offset is learned), else0xd8caas before. The host learns a GameController's rest offset and takes it off (motion_rest,motion_fusion.h: a first offset from two agreeing still seconds, at most 2 deg/s so a slow steady turn is not taken for one, later ones only within 1.25 deg/s of it, ramped in over 0.75 s; forgotten when the stream goes stale or another controller takes the player), and drops a stream's first all-zero sample (a Joy-Con 2's first report; later zeros can be a free fall). - Check:
t_hid(t_imu_noise: spread, whiteness and the stillness criterion;t_live_rest,t_live_still_dither,t_six_ic_info, the calibration load and store) andt_motion(rest_checks). With a DualSense, over 1,876 still answers the game got a mean gyro of 0.00, −0.04, −0.00 deg/s after its offset (0.6, 0.1, −0.7 deg/s) was learned. - Found on: Nintendo Switch Sports Resort (
04008E001F098000, v65536).
nfp's extended application area
- Symptom:
[RED] sf: the game connects to service nfp:user itself, thengame called nn::diag abort: Result 0xe15under the game's own initialization (main+0x115deb0). - Cause:
nn::nfp::InitializeWithExtendedApplicationAreais another entry to the library the host takes over, and was not hooked, nor wereGetExtendedApplicationArea,SetExtendedApplicationArea,GetExtendedApplicationAreaInfoandRestore. - Fix: hooked as the rest: the same device that never finds a tag (
hle_sdk16.c, checked int_nfc.c). - Found on: Kirby Air Riders.
NFC initialization beside the amiibo library
- Symptom: selecting amiibo initializes
nfp, then the game connects to the unservednfc:userservice and aborts innn::nfc::Initialize. - Cause: a game can call the general NFC library (
nn::nfc) itself, beside the amiibo library (nn::nfp). The host takes over the wholenfpfamily, butnfc::Initializestayed in the SDK and connected tonfc:user. - Fix:
hle_sdk16.ctakes overnn::nfc::Initialize,Finalize,GetStateandIsNfcEnabled. Initialize and Finalize only track the library's state (no service session), andIsNfcEnabledanswers false: a console with NFC switched off, so the game shows its own "NFC is disabled" message and returns to its menu. Thenfpanswers are unchanged.dm/host/tests/t_nfc.cchecks the hooks. Of the games here, only Hyrule Warriors: Definitive Edition callsnn::nfcfrom its own code; the others have it only inside thesdkmodule. - Open:
nfpanswers as a console with NFC on and no amiibo (SDK 20 six-axis sensor and amiibo (nfp) calls), so a game that asks both libraries gets two different consoles, and the game's message points to a System Settings switch the host does not have. AnsweringIsNfcEnabledtrue would matchnfp, but the game's amiibo path after it has not been run. - Found on: Hyrule Warriors: Definitive Edition 1.0.1 (SDK 3.5.1), entering amiibo from the title screen (GitHub issue #708). With the fix, the message opens, closes and opens again.
The amiibo library's state before Initialize
- Symptom:
game called nn::diag abort: Result 0, call site sdk+0x13ce58in the middle of play, fromnn::os::TryWaitSystemEventon an event that was never set up (backtracemain+0x1fb9920in Tears of the Kingdom 1.4.3). - Cause:
nn::nfp::GetStateanswered 1 (initialized) from the start. Breath of the Wild (main+0x128ec7c) and Tears of the Kingdom (main+0xca5200) callnfp::InitializeandAttachAvailabilityChangeEventonly whenGetStateis not 1, so they skipped the attach; Tears of the Kingdom's amiibo poll then waits on that event and the SDK aborts on its uninitialized state. Breath of the Wild also checks for 0 afterFinalize(main+0x128f964). - Fix:
hle_sdk16.ckeeps the library state as on Horizon: 0 untilInitialize, 1 untilFinalize, like thenfchooks beside it.dm/host/tests/t_nfc.cchecks it. - Found on: The Legend of Zelda: Tears of the Kingdom 1.4.3 (GitHub issue #613; when the poll first runs was not found; the abort came after about 15 minutes of play, and was not reproduced here).
Vibration values flushed by the SDK's vibration graph
- Symptom: abort in
nn::sm::Initializeundernn::hid::VibrationNode::Update. - Cause: the SDK's vibration graph flushes queued values with
hid::detail::SendVibrationValues, which opens the hid service. The game sets handles on itsVibrationTargets even when the host reports no vibration device. - Fix: the flush calls it through the PLT, so an
HLE_FORCEon that symbol catches it and returns success (hle_hid.c). - Found on: Metroid Dread.
Forced vibration sessions
- Symptom: at boot,
[RED] sf: the game connects to service hid itself, thenCRASH sig=11 addr=0inhid::detail::EndPermitVibrationSession(sdk+0x3526bcin SDK 9.4), underhid::EndForcedVibrationSession. - Cause: the SDK's own call opens the hid service, which sm refuses, and reads the null service object. A forced session lets an application vibrate while the system's vibration setting is off.
- Fix:
hle_hid.canswersBeginForcedVibrationSessionandEndForcedVibrationSessionwith nothing to do. The host has no system vibration setting: its own rumble switch is the player's, and a session does not override it. - Found on: Super Mario Party (
010036B0034E4000, no profile yet), #2513: the crash came before its first frame; with the fix it reaches the opening.
Whether a vibration device is mounted
- Symptom: with rumble on,
[RED] sf: the game connects to service hid itself, thenCRASH sig=11 addr=0inhid::detail::IsVibrationDeviceMounted(sdk+0x24254cin SDK 7), underhid::IsVibrationDeviceMounted. With rumble off in the host's settings the game never asks. - Cause: the SDK's own call opens the hid service, which sm refuses (0xe15), and reads the null service object. With rumble off the affected game did not ask; current channel handles do not depend on the rumble setting.
- Fix:
hle_hid.canswers it. The host reports a device as mounted when the handle names a channel of the npad's controller (vib_valid), independently of haptics output routing (A vibration device before its controller connects). - Found on: Super Mario Odyssey 1.4.1, entering a Sand Kingdom pipe (
main+0x5d3150asks for each handle of a controller whether any is mounted; GitHub issue #715). No other local game imports it. Kirby Air Riders calls the Switch 2's form,IsOunceVibrationDeviceMounted, for its handles soon after boot, answered the same way. It crashed a run with a window, and no headless run; why only that one was not checked.
Vibration handles before a controller is reported
- Symptom:
DM_RUMBLE_LOG=1shows the game's startup handle request answered with none, then every vibration value sent to handle 0 and reaching no output for the whole session, although a controller with haptics (a DualSense on the Mac) is connected. Trails into Reverie aborts at boot withPH3 FATAL ERROR: Assertion failed: noOfDevices == 2when it requests two FullKey handles for the second controller slot. - Cause: The host's
hid::GetVibrationDeviceHandlesrequired both a connected npad of the requested style and an output sink. In Nintendo SDK 14.3.0,hid::utility::GetVibrationDeviceHandleswrites the handle bytes directly from the requested ID and style, with no queries about connected hardware. Reverie caches handles at startup for Handheld and every FullKey slot, including slots that are disconnected or inactive in the current operation mode. - Fix (resolved): A supported individual style and valid npad ID determine the handles, including when the slot is empty, rumble is off or there is no sink. The host still resolves multi-style masks against the connected style. Mounting and
vib_sendresolve handles against live controller state, and sending requires permitted, routed output (hle_hid.c).DM_RUMBLE_LOG=1logs the requests and, once a second, the values sent, those with no routed output and the peak amplitude. A mutex protects the totals across game threads. - Found on: Unicorn Overlord (the Asian release,
010054B01AD92000), in the log only: the game has no rumble of its own (it sends amplitude 0 throughout), so nothing could be felt before or after. A later Echoes of Wisdom test checks startup handles and device-info answers on a game that rumbles. - Check:
t_hidcovers enumeration for disconnected slots, inactive styles and missing sinks, plus cached handles delivering a nonzero value after routing, mixed batches and concurrent sends. It checks the right Joy-Con's device index against the SDK's encoding. libnx handle generation
A vibration device before its controller connects
- Symptom: with rumble on, a game asks for vibration handles at boot and gets two, then sends one idle value and none for the rest of the session; nothing vibrates although a controller connects a few seconds later.
DM_RUMBLE_LOG=1showsGetVibrationDeviceInfoanswering mounted 0 (andIsVibrationDeviceMounted, when asked, false) before the pad connects. - Cause:
IsVibrationDeviceMounted,IsOunceVibrationDeviceMountedandGetVibrationDeviceInfoanswered fromvib_targets, which keeps only the players with a routed haptics output. A game that asks once at boot, before a Bluetooth pad has connected (the Switch 2 transport connects on a button press while the game runs), keeps "not mounted" for the session and never sends rumble. On Horizon the controller is there before the game boots. - Fix:
IsVibrationDeviceMountedandIsOunceVibrationDeviceMountedusevib_validto check the handle and npad style independently of the output route.IsVibrationPermittedfollows the app's rumble setting with an output sink installed (dm_haptics_enabled).vib_targetskeeps the routed-output mask so values sent before the pad connects are dropped. For device info, see Vibration device type and position. - Found on: The Legend of Zelda: Echoes of Wisdom; its game note records the before/after traffic and physical controller validation from PR #2859.
- Check:
t_hid(both mounted forms and actuator answers before a route and with rumble off, permission with no controller, values still dropped until permitted and routed);t_hid_tsanalso queries capabilities and permission concurrently with sends and rumble-setting changes. Diagnostic counters are atomic across game threads.
Vibration device type and position
- Symptom:
PH3 FATAL ERROR: Unknown Vibration device positionduring startup, after the game successfully gets two vibration handles for an empty FullKey slot. - Cause:
GetVibrationDeviceInforeturned zeros for a handle whose device was unmounted. The two output fields are the actuator type and position. Reverie checks that the position is Left or Right atmain+0xa24214, including for controllers it may use later. libnx HID ABI - Fix:
GetVibrationDeviceInforeports a linear resonant actuator and its position from the handle's device index.IsVibrationDeviceMountedstill checks live npad state. The same handle decoder checks the device index for both APIs. - Found on: The Legend of Heroes: Trails into Reverie 1.0.4.
- Check:
t_hidchecks both actuator positions on a disconnected npad and unknown info for an invalid handle.
Controller haptic engines without advanced players
- Symptom: a controller (an Xbox Wireless Controller, a GameSir Super Nova, a GameSir Cyclone) never vibrates in a game on the Mac or the iPhone, though iOS Settings' Identify buzzes it; the log repeats
[RED] haptics: controller left handle create player: Couldn’t communicate with a helper application. (NSCocoaErrorDomain 4097). The engine itself starts. - Cause: the engines that
GCDeviceHapticsmakes are served bygamecontrollerd, which tells CoreHaptics whether it offers advanced pattern players (HapticServerConfig.supportsAdvancedPatternPlayers; its log:Server returned: supports audio: 0 adv players: 0).-[CHHapticEngine createAdvancedPlayerWithPattern:error:]does not check that; the request reaches the server, which refuses it, and the XPC reply comes back as NSCocoaErrorDomain 4097, on every locality (All, Default, Handles, Left Handle, Right Handle). The output made only advanced players (a looping 30 s event driven by dynamic parameters), and a player failure is retried on the same handle, so the fallback to the default locality could not help either. On the Mac the refusal also leaves that engine unusable: a plain player or a restart on it fails with -4810. A plainCHHapticPatternPlayeron a new engine plays and takes dynamic intensity and sharpness controls. - Fix (resolved): when the advanced player cannot be made, the channel drops that engine, makes a new one and keeps using plain players (
haptics_apple.m, log linehas no advanced players … plain players). A plain player cannot loop, and one stopped in the middle of an event left the Xbox controller's motors running at its level after the engine and the process were gone, until the controller was switched off. So plain players play pulses of 0.5 s that end on their own: the next one is scheduled where the last ends while the effect lasts, each starts at the current level (its pattern's initial control) and takes later levels as controls, and a stop sends level 0 to the playing pulses and stops the engine only after the last one has ended. Checked on an Xbox controller through the host's ownhaptics_apple.m: low and high levels are told apart, full level feels like a plain pattern at intensity 1, and the motors stop after the effect.t_haptics_applecovers a server without advanced players: the new engine, the pulses following each other, no pulse cut by a stop. - Left and right handle engines override each other (current). Without advanced players, the engines of
LeftHandleandRightHandleplaying at once were not felt on the Xbox controller, while one engine onHandles(or onAll) at the same intensity was; a trigger engine playing beside them likewise drowned them out. So a split route whose first advanced player is refused becomes one engine onHandles(Defaultwhen the controller does not list it) that plays both motors mixed (merge, log lineplays both motors on one engine): the rumble is the same on both sides. A DualSense (GCProductCategoryDualSense) is not merged: with plain players on its left and right handle engines, each side alone, both at different levels and silence were felt as sent (PR #986: a standalone probe and Super Mario Odyssey's buried Power Moons, over Bluetooth on macOS 26.7.1, with plain players set at connection). So its handles keep their engines, each moves to plain players when its advanced player is refused (log linehas no advanced players … plain players, once per handle), and left and right keep their own levels. Why the Xbox controller's handle engines override each other is not known (its rotating motors, or its driver ingamecontrollerd), so other controllers with both handle localities stay merged until one is tried. Not run: a DualSense over USB or on iOS, a DualSense Edge, and the refusal on both handles of a real DualSense (the left handle's is what main already met).t_haptics_applecovers the merge and the DualSense's handles, with and without advanced players. - Low levels on rotating motors (open). Controller motors and the Switch's resonant actuators disagree at low amplitudes, in two directions. The Xbox controller's motors showed nothing at intensity 0.05, a faint buzz from about 0.1 and a soft one at 0.3, so Breath of the Wild's charged attack (0.07 for about 3 s,
DM_RUMBLE_LOG=1) was not felt even atDM_RUMBLE_GAIN=2.5. Mario Kart 8 Deluxe holds its low band at 0.1–0.4 all race long (about 30 changes a second, 0.84 peaks every few seconds): a texture on a Joy-Con, rumble that never lets up on a DualShock 4's motors. A floor with a square-root rise (0.15 + 0.85·√x) fixed the first and would make the second much worse, so the mapping stays linear.DM_RUMBLE_MIN=0..0.9(default 0) silences controller levels below it and stretches the rest over the full range, on every controller route; 0.45 leaves Mario Kart 8 Deluxe's crashes and drifts, as an emulator gives them on that controller.t_haptics_applecovers the cutoff. - Found on: The Legend of Zelda: Breath of the Wild (1.9.0), on macOS 27.0.1 with an Xbox Wireless Controller over Bluetooth and an Xbox 360 USB receiver; NieR:Automata The End of YoRHa Edition (the Asian release,
0100B8E016F76000) on an iPhone with a GameSir Super Nova in DualShock 4 mode, which plain players fixed; Mario Kart 8 Deluxe (4.0.1) on macOS 27.0.1 with a GameSir Cyclone; the same error in issue #219 (Sifu, provisional profile), controller unnamed.
Paired Joy-Cons rumble both halves on one channel
- Symptom: a paired Bluetooth
Joy-Con (L/R)rumbles both Joy-Cons together for every effect—including when a game splits the pair into sidewaysJoyLeftandJoyRightnpads so player 1's rumble shakes player 2's Joy-Con too—and logslocalities All, Default, JoyCon (L), JoyCon (R), 1 channels. - Cause:
GameControllerreports the per-half actuator localities of a combinedNintendo Switch Joy-Con (L/R)as"JoyCon (L)"and"JoyCon (R)"rather thanGCHapticsLocalityLeftHandleandGCHapticsLocalityRightHandle.haptics_apple.mchecked only the handle localities and fell back toDefault(one mixed channel), and on a server without advanced playersc.mergewould also collapse a two-channel route back toDefault. - Fix: when
supportedLocalitiescontains both"JoyCon (L)"and"JoyCon (R)",configurecreates motor 0 on"JoyCon (L)"and motor 1 on"JoyCon (R)". These localities keep separate engines with plain players too. A failed factory or engine start uses the channel's existing backoff and retries its own locality: neithermergenor the handle route'sDefaultfallback is installed, since mixing can cross npads. Ordinary handle localities retain their fallback. - Current reach: original Joy-Cons normally use the Mac's raw HID transport, including its per-device rumble, so they bypass this adapter's engine route. This fix serves the remaining Core Haptics route (iOS, or Mac GameController fallback /
DM_JC1=0); it does not add split Joy-Con input support to GameController front ends. - Verification:
t_haptics_applecovers each side's factory and start failures with advanced and plain players, locality-preserving recovery, and active controller-object replacement through split, rejoin, disconnect and reconnect. Old callbacks, snapshots, pulse renewals and delayed stops cannot affect the replacement route.t_hidchecks active vibration through single / dual assignment, both choices of the half kept on the original npad, and rejection of stale single handles after rejoin. These are synthetic boundary tests; post-fix physical split / join and iOS validation remain open. - Found on: Super Mario Party (
010036B0034E4000, provisional profile), paired Bluetooth Joy-Cons on an Apple M1 Pro with macOS 26 (PR #2472's original diagnosis log).
A haptic engine that stops under a call raises, and ended the app
- Symptom: the app dies with
*** Terminating app due to uncaught exception 'com.apple.CoreHaptics', reason: '-[CHHapticEngine(CHHapticEngineInternal) checkEngineRunning:]: self.running', then[dm] CRASH sig=6in__pthread_kill; no[RED] hapticsline comes first. Seen after about 85 s of a Mario Kart World race on an iPhone, a few seconds after the log'soe focus statechanged twice (2, then 1). - Cause: Core Haptics reports a player or parameter call on an engine that is not running by raising an
NSException, not by returning anNSError, and offers no running state to ask first. The engine stops on its own at any time (an audio interruption, the haptics helper's exit) while its stopped handler is only queued onto the adapter's serial queue, and the adapter's own stop is asynchronous, so any queued work that calls a player (a level change, a pulse renewal, the idle release, a stop on focus loss or reconfiguration) can reach an engine that is no longer running. Everyerror:path inhaptics_apple.mwas already covered; this one is not an error return. The log has no backtrace, so which call raised in the crash is not known; it came a few seconds after a focus loss and its return, which stop and restart the engines. - Fix (resolved): every entry into a rumble channel (
apply:,stop, the queued pulse renewal and delayed engine stop) runs its Core Haptics calls insideguarded:work:. A caught exception is handled as a failed engine (stoppedEngine:stage:) that is never called again: the channel drops its engine and players without stopping or silencing them (a stop sends a plain player zero, which raises once more; nothing plays from an engine that is not running), backs off like a failed start, clears the queued output and logs[RED] haptics: <target> <stage> on a stopped engine; the next effect builds a new engine.t_haptics_appleraises from a player'ssendParameterson the advanced-player route and on the plain-player route, from a level change and from the idle release, and checks the channel clears and recovers; without the guard the first case ends in the same uncaughtNSException, and with a recovery that stops the channel the plain-player case does. - Found on: Mario Kart World (1.8.0, a physical iPhone, run of 2026-11-07).
DualShock 4 rumble through its effects report
- Symptom: on the Mac, a DualShock 4 or a controller that presents itself as one (a GameSir Cyclone over Bluetooth: HID vendor
054C, product05C4,productCategory"DualShock 4") does not rumble; Core Haptics failed on every locality with NSCocoaErrorDomain 4097 (issue #363, also in a minimal Swift app), while the same controller rumbles in an SDL-based emulator. - Cause: the Core Haptics route was the only one. SDL's hidapi driver does not use it for a DualShock 4: it writes the controller's effects report, which needs no haptics server and keeps the strong and weak motors apart, where a server without advanced players merges them (above).
- Fix (resolved): on the Mac, a controller GameController calls a DualShock 4 is driven through that report when a free HID device of vendor
054C, product05C4/09CC/0BA0is there (asked of the registry at each connect;ds4_route, log linerumble through the DualShock 4 effects report): report0x11over Bluetooth (78 bytes, flags0xC4, rumble-only flag0x01so the light bar is left alone, CRC32 over0xA2and the first 74 bytes),0x05over USB (32 bytes), sent only when a motor byte changes. As the emulators feed SDL, the strong motor follows the low band and the weak one the high band (0.85 / 0.15 left / right), linearly, withDM_RUMBLE_GAINandDM_RUMBLE_MIN. Without the HID device the controller keeps the Core Haptics route. GameController does not name a controller's HID device, so two DualShock 4s each get one, possibly swapped.t_haptics_applecovers the CRC, the fallback without the device and the report's bytes on fake devices. iOS is unchanged. - Found on: Mario Kart 8 Deluxe (4.0.1) and The Legend of Zelda: Breath of the Wild (1.9.0) with a GameSir Cyclone over Bluetooth on an M5 Pro, macOS 27.0.1: rumble on crashes and drifts (with
DM_RUMBLE_MIN=0.45), on hits and chopping, stopping after each. Not checked: a genuine Sony DualShock 4, the USB report.
A DualShock 4 that connects after the first stays on Core Haptics
- Symptom: with two controllers that present themselves as DualShock 4s on the Mac, the one turned on first rumbles normally and the one turned on later is barely felt. The first logs
rumble through the DualShock 4 effects report; the later one logshaptics: player 2 controller …, localities …, thenhas no advanced players (NSCocoaErrorDomain 4097): plain playersandplays both motors on one engine (Handles). - Cause:
ds4_routekept oneIOHIDManagerfor the session and never scheduled it. A manager adds devices once when its matching is set; later arrivals and removals reach it only through a notification port, which needs a run loop or a dispatch queue (Apple'sIOHIDManager.cin IOKitUser). SoIOHIDManagerCopyDeviceswent on answering with the devices of the first DualShock 4's connect: a later controller found none free and fell back to Core Haptics, whose plain pulses onHandlesthe reporter barely felt. From the same code, a controller that disconnected and came back would get its dead device back and no rumble; that was not reported. - Fix (resolved):
ds4_takeasks the registry at each connect (IOServiceGetMatchingServiceson vendor054C) and each player owns the device it opens, closed when the controller goes. A device in use is told by its registry entry ID, since two handles on one device are notCFEqual. Scheduling the manager was not chosen: the lookup would then depend on the arrival callback running before GameController's connect, and a missed one would leave the controller on Core Haptics for good.t_haptics_applecovers a controller connecting later and one coming back, on fake devices; the same lookup finds the same devices as a manager on this Mac's own HID devices. How weak Core Haptics is on this controller was not measured: a controller with no effects report stays as it was. - Found on: Mario Kart World (1.0), issue #1165, two GameSir Cyclones over Bluetooth on an M5 Pro, macOS 27.2: from the reporter's log. Not yet run on two real controllers.
Pro Controller rumble through its rumble report
- Symptom: on the Mac, a Switch Pro Controller or a controller that presents itself as one (an 8BitDo pad, GameSir Nova, or Xtreme XTRE041 in Switch mode: HID vendor
057E, product2009,productCategory"Switch Pro Controller") does not rumble through Core Haptics, or on a genuine Switch Pro Controller feels thin and loses stereo and dual-band texture. The log shows no error:haptics: player 1 controller Pro Controller, localities All, Default, Handles, Left Handle, Right Handle, thenhas no advanced players (NSCocoaErrorDomain 4097): plain playersandplays both motors on one engine (Handles), and the plain players start and play. - Cause: the Core Haptics route was the only one for GameController-listed Pro Controllers. Without advanced players
haptics_apple.mmerges both handles onto one engine and collapses the game's two bands per actuator into one intensity and sharpness, so a genuine Pro Controller loses stereo and dual-band HD rumble (issue #2804). On Switch-mode clonesgamecontrollerd's Core Haptics output produced no felt vibration at all; on a GameSir Nova, Core Haptics fired only athapticSharpness = 0and stayed silent at0.5or1.0, while the host sends about0.5(PR #2607).gamecontrollerdlies outside this repository. - Fix (resolved): on the Mac, a controller GameController calls a Switch Pro Controller is driven through Nintendo's HD rumble output report
0x10when a free, non-synthetic HID device of vendor057E, product2009accepts subcommand0x48 0x01(enable vibration;pro_routeinhaptics_apple.m, log linerumble through the Pro Controller rumble report). The registry lookup (hid_take) is shared with the DualShock 4 and skips GameController's synthetic HID devices (kIOHIDGCSyntheticDeviceKey); accepting0x48 0x01also passes over the dead second entry IOKit can keep after a long Bluetooth disconnect (issue #2237). Reports are padded to 49 bytes over Bluetooth (JC1_REPORT_LEN) and 64 bytes over USB, as SDL andpad_jc1_mac.h/pad_hid_mac.hsend them. Each actuator keeps its own low and high band at the game's frequencies viapad_jc1.h's exact HD rumble encoder (jc1_rumble_encode,jc1_rumble_report), withDM_RUMBLE_GAINandDM_RUMBLE_MINapplied as on every other route. Changes are paced to 15 ms with peak-hold (jc1_rumble_hold) so 5 ms pulses are not dropped and Bluetooth is not flooded at 200 Hz, an active level refreshes every 30 ms, and stop, focus loss, sink switch or disconnect sends neutral (00 01 40 40) and cancels timers. Without a free live device, the controller stays on Core Haptics. - Check:
t_haptics_applecovers synthetic and dead-entry skipping,0x48 0x01enable, 49-byte Bluetooth and 64-byte USB report encoding, stereo L/R and exact log-table bands, 15 ms pacing with peak-hold, 30 ms refresh, idle timer stop,DM_RUMBLE_GAIN/DM_RUMBLE_MIN, focus suspend, sink handover, disconnect cleanup, failed-silence non-spinning, Core Haptics fallback, and two Pro Controllers. - Found on: The Legend of Zelda: Ocarina of Time (v131072): an 8BitDo pad over Bluetooth, USB and 2.4 GHz receiver on macOS 27.2 (PR #2607, reproduced on an M3 Pro), a GameSir Nova over Bluetooth and 2.4 GHz receiver on macOS 27.2, a genuine Nintendo Switch Pro Controller over Bluetooth on an M3 Pro with macOS 26.6.2 (issue #2804), and an Xtreme XTRE041 over Bluetooth and USB on an M1 Pro (PR #2787).
- Open: hardware retest of this unified route on a genuine Nintendo Switch Pro Controller over Bluetooth and USB, on 8BitDo / GameSir Nova with 49/64-byte padded reports, on an XTRE041 over USB without the
0x80 0x02/0x80 0x04USB handshake, and with two Pro Controllers connected at once (GameController names no HID device, so two connecting together may swap their rumble, as for the DualShock 4).
An 8BitDo Ultimate 2 Wireless with no rumble on the Mac
- Symptom: an 8BitDo Ultimate 2 Wireless (HID
2DC8:6012, firmware 1.03 or later) over Bluetooth LE plays its buttons and sticks but never rumbles. The log sayshaptics: player 1 controller 8BitDo Ultimate 2 Wireless, localities none, 0 channels, and the game is told there is no vibration device. - Cause: Apple's
GameControllerframework lists this pad with no haptics localities, so no Core Haptics route exists for it (GameControllerlies outside this repository). Its own HID output report0x05(5 bytes:{0x05, low, high, 0, 0}) drives the two rotating motors, as SDL's hidapi 8BitDo driver sends it. - Fix (resolved):
haptics_apple.madds an HID output route (abitdo_route, log linerumble through the 8BitDo output report 0x05) for a controller with no haptics localities whosevendorNamecontains8BitDo, when a free, non-synthetic2DC8:6012gamepad or joystick HID interface accepts a zero probe{0x05, 0, 0, 0, 0}viahid_take(skipping dead Bluetooth entries from #2237 and firmware without report0x05). Motor bytes use the same linear0.85 / 0.15low/high band split (erm_mix, withDM_RUMBLE_GAINandDM_RUMBLE_MIN) as the DualShock 4 route. Changes are paced to 20 ms with peak-hold across the pacing interval so 5 ms pulses are not dropped and Bluetooth LE is not flooded at 200 Hz, active levels refresh every 50 ms, a normal stop sends three zero reports 20 ms apart, and focus suspend, sink switch or disconnect sends silence once and cancels timers. iOS is unchanged. - Check:
t_haptics_applecovers missing/other-PID/non-gamepad/synthetic/dead devices, controllers with haptics or other names, zero probe on connect, linear0.85/0.15band split, 20 ms peak-hold pacing, 50 ms active refresh, three-report stop and idle stop,DM_RUMBLE_GAIN/DM_RUMBLE_MIN, focus suspend, sink handover, failed-silence non-spinning, disconnect cleanup, and two pads at once. - Found on: The Legend of Zelda: Ocarina of Time (v131072), an 8BitDo Ultimate 2 Wireless over Bluetooth LE on an M5 MacBook Air, macOS 27.2 (PR #2763; also independently confirmed accepting report
0x05in PR #1934). - Open: hardware retest of this revised linear route (without the PR's default floor/hold) on the pad over Bluetooth LE, firmware 1.02, two pads at once (GameController names no HID device, so two connecting together may swap their rumble, as for the DualShock 4), and USB / 2.4 GHz dongle (
2DC8:310B).
Scripted presses on a path of their own
- Symptom: with a controller connected (a DualShock 4 here),
DM_KEYSandDM_CTLpresses are logged (DM_KEYS: … press …) but the game does not react to them, or only now and then; without the controller the same script works. - Cause: scripted presses went through player 1's controller path (
dm_pad_set). A connected controller publishes its whole state there on every change, replacing scripted holds and sticks; the press latch preserves only the first read. Script release also cleared the physical controller's state. - Fix (resolved):
DM_KEYSandDM_CTLset buttons, a press latch and sticks of their own (script_setinhle_hid.c), ORed with the keyboard / touch path and player 1's controller when the game reads player 1; for the sticks, the one deflected more wins. Shake includes the scripted path too. - Check:
dm/host/tests/t_hid.c(t_script) runs the scripted publisher with a controller update during the hold: buttons survive repeated reads after the latch is consumed, the scripted stick wins over drift, shake continues, and release preserves physical input. Short presses are latched once, all four axes reach the handheld npad, and player 2 stays separate. - Found on: Batman: Arkham Knight (
0100ACD0163D0000), reported in PR #326 while driving the opening route withDM_KEYSand a DualShock 4. Reproduced independently in the host HID test without game files; its game profile is not in this checkout.
Touch gestures recognized from the touch points
- Symptom: taps in handheld mode do nothing, though the game reads the touch screen (the title's PRESS ANY BUTTON, the menus' cards).
- Cause: the game's touch handler (
main+0x42f1ac) usesGetTouchScreenStateonly to track the finger and takes its taps, pans and swipes fromhid::GetGestureStates(it acts on types 5–9), which the host answered with no entries. - Fix: the host now recognizes gestures from the same touch points, by yuzu's rules plus an 8 px slop before a touch counts as moving (
hle_touch.cgesture_sample, unit testt_gesture; only in handheld mode, as touches): Touch, Press after 0.5 s, Pan, Pinch / Rotate with two fingers, Cancel on a change in the finger count, then Tap (IsDoubleTap within 0.35 s), Swipe above 400 px/s or Complete, and Idle. For every game. - Check: every menu, the cards, the map's drag and flick worked by touch with it.
DM_TOUCH_LOG=1logs each gesture entry, and aDM_CTLlinedrag <x0> <y0> <x1> <y1> [seconds]moves a finger for testing pans and swipes on the Mac. - Found on: Taiko Risshiden V DX (SDK 12.3.3, Koei Tecmo's KTGL).
- Two-argument
InitializeGesture: SDK 20.5.15 has an overloadnn::hid::InitializeGesture(int, int), whose SDK body opens the hid service and aborts insm::Initialize(Result 0xe15) on the host; it is taken over as the other one is (PRAGMATA).
Touch sampling numbers across docked and handheld
- Symptom: a game started docked takes no touch after it is switched to handheld (the in-game menu on the iPad,
DM_OE_SCRIPT=opmode=0@…on the Mac), thoughDM_TOUCH_LOG=1logs its reads with the touch points. Started handheld, the same game takes taps. - Cause: docked reads of
GetTouchScreenState(s)were numbered from the npad sampling counter (from 65536) and handheld reads fromhle_touch.c's own count (from 1). Unity's touch reader takes a state only if its sampling number is above the last one it took, and it takes the docked reads' empty states too (Aokanamain+0xd2bde0; the last number is cleared at init,main+0xd2b588, and stored atmain+0xd2bdec). After the switch every handheld state fell below the docked numbers and was dropped. Started handheld and then docked and back, the same happened. - Fix:
hle_touch.cnumbers the states of both modes from its one count: every statetouch_read(hle_hid.c) returns comes from atouch_fill_nsample, made withpoints0 in console mode, which gives an empty state with the next number and leaves the fingers (their Start and End) for the next handheld sample.DM_TOUCH_LOGprints the number the game sees. For every game. - Check:
dm/host/tests/t_touch.creads in console mode between handheld reads (an empty state with the next number, the Start of a finger pressed meanwhile kept), anddm/host/tests/t_hid.c(t_touch_sampling) reads docked, handheld, docked and handheld again through bothGetTouchScreenStateandGetTouchScreenStates(points asked for in handheld mode only; since Touch samples on a 4 ms grid, with a history, a read reachestouch_fill_nat most once per 4 ms in either mode, or on a mode change). In Aokana on the Mac (the PR author's runs, headless, a tap every 1.5 s from 20 s, with the first form of the fix, which numbered both modes from the npad counter): a tap during the opening movie stops it and the title comes up, before the fix only when started handheld; with it, also started docked and switched withDM_OE_SCRIPT=opmode=0@12, and started handheld, docked at 12 s and back at 24 s. Not run on the iPad. - Found on: Aokana - Four Rhythms Across the Blue (
0100990011866000, Unity 2018.4.22f1 IL2CPP; profile in PR #1372), on the iPad: started docked, then handheld and Tap in the in-game menu, and no tap reached the game.
Touch samples on a 4 ms grid, with a history
- Symptom: a game's own on-screen keyboard highlights the tapped key but enters no character; keys that also have a button (space, delete) work.
DM_TOUCH_LOG=1shows a full Start / held / End sequence at the right place, but with consecutive sample numbers for reads in the same frame (Animal Crossing: New Horizons). Or a touch drag is dropped: the object is selected and does not follow the finger, while taps work (Pokémon Friends,010008C01E742000, update 1.1.5, Unity 2022.3; no profile in the repository yet). - Cause: two readers, one rule of the hardware that the host broke each way. On the Switch, the touch resource writes the screen's LIFO every 4 ms (yuzu:
GestureUpdatePeriod), every SDK read returns those samples, and reading uses up no edges. (1)touch_read(hle_hid.c) once calledtouch_fill_nat every read, and each call advanceshle_touch.c's finger state (the Start goes out once, then End once). Animal Crossing reads the touch screen twice per frame (its input manager atmain+0x1b65260, then its keyboard's reader), so the first reader took the Start and the End and the keyboard only saw a held point. (2) Publishing one sample per presented frame fixed that, butGetTouchScreenStatesthen returned one state. Unity 2022.3 polls on its own thread every 16.7 ms whatever the frame rate (Pokémon Friendsmain+0xb00670,GetTouchScreenStates<16>(buf, 16)), takes each returned state whose sampling number is above the last it took, and when a poll takes no new state with touch points while a finger is down it ends every live touch as cancelled (main+0x60d6a0). At 30 fps the second poll of a frame found the same number and cancelled the drag. Giving every read a new number instead makes Unity take the same Start again on every state, so taps stop working. - Fix: a read makes a sample only when 4 ms have passed since the newest one (or the mode changed) and otherwise copies the newest, with its number and edges. The last 16 samples are kept (
g_touch_hist);GetTouchScreenStates<N>(s, n)returns the newest min(n, 16) of them, newest first, each at the reader's own stride with its count clamped to N, andGetTouchScreenStatecopies the newest. An edge sits in exactly one sample. Fingers beyond a small reader's capacity go unseen there, as on hardware. Console-mode reads go through the same ring and ask for no touch points, so two within 4 ms share a number, as the console's LIFO keeps writing empty entries when docked; the ring is not cleared on a mode change. Gestures keep their own finger state. For every game. - Check:
dm/host/tests/t_hid.c(t_touch_sampling): reads within 4 ms share the sample and the sampler runs once, 4 ms later is a new sample, the history is newest first and holds 16, a small reader's stride and count (a sample it makes still holds every finger), a Start found at index 1 by a later reader, mode changes within 4 ms,n <= 0makes no sample, and a read applies theDM_KEYSframe steps due in its frame first. Pokémon Friends on the Mac (a copy of a phone save, 30 fps): taps on Start Game and the room button work and a dragged object follows the finger. Mario Kart 8 Deluxe 4.0.1 on the Mac, handheld (GetTouchScreenStates<16>, given up to 16 states now where it had one): each tap on its menus (Single Player, Grand Prix, back) moves exactly one step. Animal Crossing was not run here: an iPhone check of the name-entry keyboard is still wanted.DM_TOUCH_LOGprints one line per sample, so its 500 lines are about 8 s of touch at 60 reads a second. - Open: a reader that looks only at the newest state misses an edge made more than 4 ms before its read, as on hardware; a reader polling faster than every 4 ms sees no new sample.
- Found on: Animal Crossing: New Horizons 3.0.3, the name entry in handheld mode (issue #2567, PR #2603); Pokémon Friends 1.1.5, dragging furniture on the Mac and on an iPhone.
Mac pointer stays over the game
- Symptom: on the Mac, the mouse pointer stays over the game picture while playing with a controller or the keyboard, in a window and in fullscreen (issue #675).
- Cause: AppKit hides the pointer only for an app that asks, and
front_mac.mnever asked. - Fix: a key the game takes, a controller button or a stick past 15% (GameController and raw HID pads alike,
pad_set) calls[NSCursor setHiddenUntilMouseMoves:YES](cursor_hide_for_input), only while the game window is key, the app is active and the pointer is over the content view. AppKit shows the pointer again on the next mouse movement, andinput_releaseshows it when the window loses focus. The mouse is the touch screen, so touching shows the pointer. - Check: with the pointer over the game, a controller button or the keyboard hides it; moving the mouse shows it; over the title bar, or with another app active, it stays.
- Found on: every game on the Mac (general); PR #584.
Mac display sleep during controller play
- Symptom: the Mac dims or turns off its display and can reach the lock screen while the player is using a controller, in a window or in fullscreen.
- Cause: macOS counts keyboard and mouse input as user activity, not a controller's, so its display-idle timer keeps running. The host's
NSActivityUserInitiated | NSActivityLatencyCriticalactivity (front_run) prevents idle system sleep, not display sleep. - Fix: while the game window is key,
front_mac.mholds a second activity withNSActivityIdleDisplaySleepDisabled(display_awake;pmset -g assertionsshowsPreventUserIdleDisplaySleep"NxNative active game window").input_releaselets go of it when the window loses focus or is minimized,input_resumetakes it again, and startup takes it if the window became key before the focus observers were installed. Windowless runs never hold it. An explicit lock or sleep still works, and no input is synthesized. - Found on: Mario Kart 8 Deluxe on the Mac, controller play; every game on the Mac (general); PR #741.
Mac menu bar over the fullscreen game
- Symptom: in fullscreen, the menu bar shows at the top of the game's screen whenever the game is the active app (a click on it, a controller in use), and goes away when another app on another screen is active. The system setting is "In Full Screen Only".
- Cause: AppKit's default fullscreen presentation on the reported two-display setup showed the bar on the primary display when the game became active. AppKit's decision to reveal it on focus remains open.
- Workaround tried and reverted: PR #2850 (
18a96b32) returnedFullScreen | HideDock | HideMenuBarfromDmWinDelegate(front_mac.m) for every game window. That stopped the focus reveal on the author's two-display setup, but on a single-display setup (M5 Max, macOS 27.2, external 4K screen, default menu bar setting) it made the menu bar completely unreachable from the top edge—blocking both app menus (Cheats, Window) and system controls (volume) without leaving fullscreen or switching Spaces. The override was reverted back to AppKit's default fullscreen auto-hide. - Found on: The Legend of Zelda: Ocarina of Time (M5, macOS 27.0.1, a 27-inch main screen and the built-in one); every game on the Mac (general).
- Open: on an M4 Pro with one display (macOS 27.2.1), UnMetal logged
0x405both as AppKit's proposal and as the explicit auto-hide return value (FullScreen | AutoHideDock | AutoHideMenuBar). The two-display comparison (proposedvalue, explicit auto-hide vs stock, and Cheats menu access) still needs the affected two-display setup before choosing a replacement fix.
Mouse, keyboard and key code maps
- Symptom: the first boot aborted in
hid::GetMouseState(the SDK's mouse resource was never initialized). - Fix: hooked:
hid::GetMouseState,hid::GetKeyboardStates, andkpr::GetKeyCodeMap, which asks the settings service (settings::detail::GetKeyCodeMap) for the keyboard layout's map; the host leaves the map zero. - Found on: 13 Sentinels: Aegis Rim (SDK 11,
GetMouseState); Monster Hunter Rise (SDK 11,GetKeyboardStates); DRAGON QUEST VII Reimagined (kpr::GetKeyCodeMap: the game zeroes a 0x1000-byte map and fetches it only once a keyboard reports keys,main+0x1f0eb4).
Poké Ball Plus (Palma)
- Symptom: the first boot crashed in
hid::detail::SetPalmaBoostMode, a null read atsdk+0x238eb0(the hid service never opened). - Fix: the Poké Ball Plus calls (
hid::*Palma*, 26 functions) answer that none is connected: no npad has the Palma style, so the game never gets a connection handle, and every call on a handle fails (hle_hid.c). - Found on: Pokémon Sword (SDK 7).
IR camera reported unconnected
- Symptom: undefined
irsensorimports found from the import list (Listing a game's unhooked imports before they are met). - Cause: Bezel Engine's input layer makes one (an IR camera) per controller and asks its status (
main+0x497f84). - Fix: the IR camera (
irsensor) answers every camera unconnected, and processors cannot run. - Found on: Big Brain Academy: Brain vs. Brain (SDK 11.4.3, NintendoWare Bezel Engine).
Direct irs connection and status memory
- Symptom:
[RED] sf: the game connects to service irs itself, which the host does not serve, then a null read atmain+0xeaca34before the first scene. - Cause: the game's
nn::irsensorclient makes its own HIPC session. Withirsunregistered, the client object remains null. Letting it connect without supplying command 304's copied handle exposes a second fault: SVC0x13answered success without mapping the StatusManager, and the SDK read its applet table at +0x7fb0 (main+0xeaf7b8). - Fix:
hle_irs.cregisters the service and supplies a read-only 0x8000-byte StatusManager with all nine cameras disconnected and no samples. SVC0x13and0x14map and unmap immutable service memory on free host-page-aligned alias pages. Command 307 (RunClusteringProcessor) accepts a valid initial configuration and keeps the disconnected status. It rejects a player index outside 0–8 or a nonzero camera type with0x198cd, and gain outside 1–16 with0x19ccd. - Firmware evidence: local replay of the retail HID module's command 307 handler on Switch OS 20.5.0 (
main+0xe82a0) and 21.2.0 (main+0xf0520), with simulated IPC and idle device state, returned0after storing a valid configuration and signalling a worker. Camera startup follows asynchronously. The shared status is how the client can report disconnection (0xdccd) when reading clustering states. libnx clustering state handling - Other processor starts: replay on the same two firmware builds returned
0for Moment (306), Image Transfer (308), Tera Plugin (310, including adaptive clustering and hand analysis modes), Pointing (312), Image Transfer Ex (316), and IR LED (317). This held for player 1 and handheld slots, including another request before the worker ran. All six rejected invalid camera handles with0x198cdand a different applet resource user ID with0x60a. Moment, Pointing, and the image-transfer modes reject invalid configuration fields with0x19ccd. Tera Plugin and IR LED accepted their packed configuration before interpreting it in the worker. The host accepts valid starts and reports disconnection and zero samples through the StatusManager. A physical-console run remains open. - Processor state and control. On both firmware builds, player 1 and handheld returned
0xf0cdfrom 309 (GetImageTransferProcessorState) with the output untouched while idle, after 308 or 316 started, and after suspension. Command 313 (SuspendImageProcessor) returned success and, after either start, unmapped the buffer and closed the service's copied handle. The first 314 (CheckFirmwareVersion) returned0xdecdbecause the controller lookup found no MCU. An immediate repeat returned success while the check was pending. Command 315 (SetFunctionLevel) stored the packed level for the applet and camera and returned success. All four rejected an invalid camera handle with0x198cdand a different applet resource user ID with0x60a. A client can still report0xdccdfrom the shared disconnected camera status. Libnx image-state handling - Transfer memory. Firmware commands 308 and 316 mapped their copied transfer-memory handle before returning. Injecting a mapping failure returned
0x19acd. The host's SVC0x15creates a typed handle for the caller's backed region, size and owner permission. IRS holds an in-place service mapping for each camera until suspend, stop or applet deactivation. That mapping keeps the backing available independently of the guest handle's lifetime. With a disconnected camera, the image buffer receives no samples. - Check:
t_sfcovers valid and invalid processor starts and checks the shared status after those starts.t_svc_memorychecks mapping metadata, physical-map conflicts, unmap/reuse and transfer-buffer backing.t_system_eventchecks typed transfer-handle lookup and close. Rayman Legends's legacy audio client called SVC0x15once in each 25-second baseline and candidate boot and reached its frame loop in both on M4 Pro/macOS 27.2.1. L.A. Noire 1.2 reached the frame loop with audio in the windowed startup test. Its command 307 request (player index 0, gain 2) returned0on the Mac host and in both firmware replays. A headless boot with the other start handlers enabled also reached the frame loop. t_sfalso covers the four state and control requests, including the untouched receive buffer, per-camera pending checks and function level, and release on suspend, stop and deactivation.t_svc_memorychecks that closing the guest handle leaves the service mapping live and that releasing the mapping lets the backing be unmapped. L.A. Noire 1.2 reached the frame loop in a 25-second headless boot on M4 Pro/macOS 27.2.1 with the state and control handlers enabled. Its startup exercised commands 302, 304, 307 and 311.- Found on: L.A. Noire 1.2 (NX2Apple issue #1386).
Software keyboard and applets
System applets opened by Show… calls
- Symptom: null read in
sdkundernn::applet::CreateLibraryApplet(Engage: title menu → DLC →nn::ec::ShowShopAddOnContentList);Show…overloads found in the imports before they were met. - Cause: every
Show…call that opens a system applet (eShop, friend lists, web pages, error screens) goes through the applet proxy thatoe::Initializewould have set up, and the host has none. - Fix: hook each
Show…overload the game imports: listmain's undefined symbols containingShow/Appletand grep the host sources for each mangled name; one overload missing is enough to crash. The shop calls returnvoidand act as if the player closed the shop (hle_misc.c); the friends and web ones return failure (hle_friends.c,hle_offline.c).ShowWebPageremains cut;web::ShowOfflineHtmlPagenow uses the offline web view when its page is available.err::ShowNetworkServiceErroranderr::ShowApplicationErrorare logged. Also hooked, found in the imports before they were met: theShowShopAddOnContentList(UserHandle)overload, and theec::ShowShop…overloads without anApplicationId(they show the calling application's own pages).ec::ShowShopSubscriptionDetailsis under Shop service accessors. - Found on: Fire Emblem Engage (the shop calls); Octopath Traveler 0 (
web::ShowOfflineHtmlPage); Pokémon Sword (SDK 7,err::ShowNetworkServiceError); Pokémon Legends: Z-A (19.3.11:ShowShopAddOnContentList(UserHandle),err::ShowApplicationError); The Great Ace Attorney Chronicles (SDK 10.4.1: the overloads without anApplicationId); Fire Emblem Fortune's Weave (SDK 22.2.0:hid::ShowControllerStrapGuide(const StrapGuideArg&), met at the title about 100 s in).
Library applets take the application's focus
- Symptom: entering 2P stops the game on its 2P screen: the same frame repeats, the music plays, no controller does anything, until the window loses and regains focus (Mario Kart 8 Deluxe, every launch). With one controller, once that was fixed: the 2P character select ignores input while the log shows the controller applet opened again every few frames.
- Cause: on Horizon a library applet takes the application's focus. am sends message 15 with OutOfFocus when it opens and 15 with InFocus when it closes, and the
Show…call returns once it has closed. The host's stand-ins answered at once with no focus change. Mario Kart applies the controller applet's answer only after that InFocus notification: its notification thread (main+0x8ea560, blockingPopNotificationMessage) sets a flag on 15 with state 1, and the per-framemain+0x87b5d0takes the flag before it applies the answer (main+0x87b300). Second: with fewer controllers than the game's minimum, the host answered success with the connected count. A Switch never gives that answer (its applet waits for controllers until the player closes it), and the game, which asks for two in 2P, opened the applet again. - Fix:
hle_oe.ccounts open applets apart from the front end's focus. The game sees the front end's state, or 2 while an applet is open over a game in focus; each change of what it sees is one 15 (under focus modes 1 and 2, Focus handling mode decides whether focus changes are notified).DM_APPLET("name");(hle.h) at the top of a stand-in holds the game out of focus until the stand-in returns: the controller applet (both overloads), strap guide (both overloads: SDK 22 adds one with aStrapGuideArg) and firmware update,swkbd::ShowKeyboard, the Mii editor, the user selector and creator, the error applets and the shop pages. Stand-ins that report the applet could not start (friends, web, the license notice, the album, amiibo) open none. The inline keyboard is left as it was: its applet draws into the game's own picture and is not believed to take focus (not checked). An instant open and close merges into one pending 15 that reads 1, which is all Mario Kart needs; a game that must see the 2 would need more.ShowControllerSupportwith fewer players than the minimum (ControllerSupportArg+0) returnsResultControllerSupportCanceled(2202-3101), what the SDK'sShowControllerSupportCore(SDK 4.4.0sdk+0x24eeb0) returns when the player closes the applet; Mario Kart goes back to its engine class menu, as on a Switch.DM_OE_SCRIPTnow also starts for a game that only uses the blockingPopNotificationMessage. - Found on: Mario Kart 8 Deluxe (4.0.0 and 4.0.1; GitHub issue #550).
- Check:
t_oeandt_hid(dm/host/tests). On the Mac, from a save past the Mii pick: L+R at the title, Down, A (2P), A (Grand Prix), A (50cc). The log showsoe library applet: controller support, thenoe focus state → 2 (library applet open)and→ 1 (library applet closed), and the character select takes input. With one controller and no window (or underDM_CTL) the applet logstoo few, closed as the player would (canceled)once and the engine class menu comes back; with a window its prompt waits for a second player (The controller applet waits for players).
The controller applet waits for players
- Symptom: with Press a button to join on, a game's player screen closes when the game asks for more players than have pressed a button. The log shows
hid controller applet: 2 to 2 players wanted, 1 connected: too few, closed as the player would (canceled)(Mario Kart World 1.8.0, pull request #1596). - Cause: the controller applet's stand-in (
ctrl_support,hle_hid.c) answered at once, and below the game's minimum (ControllerSupportArg+0) it answered as the player closing the applet. A Switch's applet stays open until enough controllers are there or the player closes it. Before Press a button to join the host had nothing to wait for; with it, connected controllers that are no player yet are what the applet waits for. - Fix: with a window and no scripted input,
ctrl_supportasks the front end (front_ctrl_support,front.h). Its prompt is up over the game, holding the game's thread, while controllers join: a first button press with Press a button to join, a connection without it. The rules are inctrl_prompt.h: B or Escape closes it (canceled); with at least the minimum in, it is done when a player presses A or Return, when the game's maximum has joined, or when no connected controller is left to join; the press that makes a controller join counts for neither; no time limit and no close on a focus loss, as on a Switch. The game gets no controller or keyboard input while it is up, nor until the A or B that closed it is let go. The host counts the players again once it closes (dm_players_reported) and answers canceled below the minimum. The Mac draws it on the Home prompt's card (front_mac.m,home_quit_mac.hhq_card_view), iOS as a card of its own with Done and Cancel buttons for touch (DmGamepad.m). A front end passes the texts in the player's language asDM_CTRL_PROMPT_TEXT(Starting a game). Without a window, or withDM_KEYSorDM_CTL(nobody at the controllers), the host answers at once as before. - Found on: Mario Kart World (1.8.0, pull request #1596; GitHub issue #1640).
- Check:
t_ctrl_promptandt_hid(dm/host/tests). On the Mac with a window, two controllers and Press a button to join on, Mario Kart 8 Deluxe from a save past the Mii pick: press a button on one controller, then L+R at the title, Down, A (2P), A (Grand Prix), A (50cc). The log showsfront end: controller prompt open: 2 to 2 players wanted, 1 in, 1 controllers waiting to join; a press on the second controller closes it (controller prompt closed: 2 players (done), thenthe prompt waited, 2 now (OK)) and the character select has two players. B instead closes it as canceled and the engine class menu comes back.
The controller applet leaves out the players past the maximum
- Symptom: with more controllers than a game takes, the game gets no input and the log repeats
oe library applet: controller support,hid controller applet: 1 to 1 players wanted, 2 connectedandfocus state → 1 (library applet closed)every few frames (1,671 times in one run). A game that suspends its music while an applet has focus plays none. - Cause: above the game's maximum (
ControllerSupportArg+1) the stand-in (ctrl_support,hle_hid.c) answered with the count capped and left every npad connected. On a Switch the applet leaves no more controllers connected than the game takes, so the game saw the second npad again on its next frame and opened the applet again. Any second player caused it: a second controller, a receiver read as a pad (A keyboard receiver that declares a gamepad takes player 1), or one controller listed twice (One Pro Controller read as two players). - Fix: the players past the maximum, the highest first, are left out (
g_benched): their npads read as not connected and their style events are signalled, as for a player on an npad the game does not support. With a maximum of one their controllers feed player 1 (merged_players), so whichever controller the player holds plays, and a device that never sends input does no harm. With a higher maximum they are not used. They count again when the applet opens for more players (the lowest first), when the game sets its supported npads again (SetSupportedNpadIdType), or when their controller goes away; a controller that connects later is a player until the applet opens again. The log names each one:hid: player 2's controller feeds player 1: the controller applet left it out. No prompt asks which controllers stay, as a Switch's applet does: with a maximum above one the lowest players stay. - Open: not run on a game (no second controller here): the tests cover the host's side, and that Ocarina of Time stops asking once No2 reads as not connected follows from its request for one player, not from a run. A game that opens the applet for one player and later expects a second controller without opening it again would not see that controller until it reconnects; none is known. The second HID entry behind the report no longer counts as a pad: A HID entry that sends nothing counted as a second pad.
- Found on: The Legend of Zelda: Ocarina of Time (v131072, one Pro Controller over Bluetooth on the Mac, read as players 1 and 2 after it reconnected; GitHub issue #2237).
- Check:
t_hid(dm/host/tests): one wanted with two and three players, the lowest players kept with a maximum of two, the applet opened for more, a controller that goes and comes back, the supported npads set again.
The software keyboard blocks only its caller
- Symptom: the sound stutters and the input box lags while the player types a name (Octopath Traveler 0 on an iPhone: one 4.7 s frame, 5,035 wakeups a second instead of about 1,800, and no audio underruns).
- Cause: the host froze the guest clock while
swkbd::ShowKeyboardwas up (d2r-mobile's choice, so that monsters did not attack while the player typed). Unreal calls it off its game thread, so the game kept running, and every thread that waits on the clock spun while its audio mixing starved. On the Switch the applet blocks only the caller while the clock runs. - Fix: the host now does the same (
hle_swkbd.c). The iOS input box froze the clock a second time around its own wait (front_ios.m), so the first fix changed nothing on the phone (4,977 ms and 2,577 ms frames, 5,181 wakeups a second): look for every caller ofguest_clock_freeze_for, the front ends included. The inline keyboard keeps the freeze: its game (Monster Hunter Rise) does not block on hardware at all, and the host's input box blocks it. - Found on: Octopath Traveler 0.
- Check: on the Mac
DM_KBD=<text> DM_TEST_SWKBD_HOLD_MS=8000holds the keyboard up: frozen, 8.8 fps and 7,936 wakeups a second in that window; running, 30 fps and 1,788.
The inline keyboard as a resident library applet
- Symptom: null read in
applet::CreateLibraryAppletunderswkbd::InlineKeyboard::Initialize(3D World, entering the save select after the character select). - Cause: the inline keyboard is a resident library applet whose results arrive through
Calc. - Fix:
hle_swkbd.ctakes over every entry that touches the applet:Appeararms a request, and the nextCalcasks for the text the wayShowKeyboarddoes (DM_KBD, else the front end's input box) and hands it to the game's changed-string and enter callbacks, or calls its cancel callback;GetImagereports no picture.GetImageMemoryRequirementis not a pure computation: it asks vi, hence thevi::GetIndirectImageMemoryRequirementhook (vi layer and display calls without vi service objects). - Found on: Super Mario 3D World + Bowser's Fury.
Inline keyboard window size, setters and callbacks
- Symptom: texture creation returns null right after the inline keyboard's
Initialize, then a null read atmain+0x7713044. - Cause: the game makes three textures of
swkbd::InlineKeyboard::GetWindowSize, and the host answered 0 × 0 (its creation function returns null for a size of 0,main+0x77112b8). - Fix: it is 1280 × 720 as on hardware now. SDK 11 adds keyboard setters (window mode, key top alpha / scale / position, touch, hardware keyboard, user words, dictionaries; ignored) and two callbacks the applet makes from
Calc: finished-initialize afterInitializeand released-user-words afterUnsetUserWordInfo. The host makes them on the nextCalc. - Found on: Monster Hunter Rise.
Inline keyboard text callbacks and Calc states
- Symptom: the hunter's name box stays empty, then stays open with the name in it (Monster Hunter Rise, character creation).
- Cause: the inline keyboard used to count every
Appearas a cancel. The game also finishes the entry only whenCalcreturns 1 (ready / hidden) after a non-zero value (main+0x6fb3e6c); the hook returned nothing. - Fix: the text arrives through the enter callback, whose argument is the text inline (
char16_t[502], the length at +0x3EC; the changed-string argument adds three cursor positions at +0x3F0..+0x3F8:ikb_str_arg, read off the game's callbacks atmain+0x6fb3910/main+0x6fb3afc).Calcnow returns 0 until initialization finishes, 3 while shown and 1 otherwise.SetFinishedKeyboardCallbackis called on theCalcafterDisappear. AppearArg'stextMaxLength(+0x20) limits the text. - Found on: Monster Hunter Rise.
The Mac input box keeps the game's focus
- Symptom: the name typed in the Mac input box is dropped and the game asks again; the log has
oe focus state → 2and→ 1betweeninline keyboard Appearand→ OK(Monster Hunter Rise, character creation). - Cause: the box (
front_text_input, anNSAlert) takes the key window, and the game window resigning key was sent to the game as out of focus. On hardware the inline keyboard is drawn inside the game, which keeps its focus. - Fix:
front_mac.mdoes not report the game window resigning key while the box is up (g_text_box).ShowKeyboard's applet still sends its own out-of-focus / in-focus pair (DM_APPLET). - Found on: Monster Hunter Rise.
nn::ngc::ProfanityFilter vtable and by-name overloads
- Symptom:
CRASH sig=10at a heap address, called frommain+0x6bca160right after the name was entered (Monster Hunter Rise); crash inlmem::AllocateFromExpHeapunderngc::ProfanityFilter::MaskProfanityWordsInTextright after the character name is entered (DARK SOULS: REMASTERED); filter methods among the undefined imports with no hook, found from the import list before they were met (The Great Ace Attorney Chronicles). - Cause:
nn::ngc::ProfanityFilteris polymorphic and Monster Hunter Rise masks the name through its vtable (slot 8,MaskProfanityWordsInText(int *, char16_t *, uint32_t)). The constructor hook did nothing, so the object kept what the heap held. Other games call the methods by name: DARK SOULS: REMASTERED calls the UTF-16 overload (EPiPtj) by name, and the host had taken it over only in the filter's vtable, so the SDK's version ran on a filter whose word list the host never loaded; The Great Ace Attorney Chronicles callsngc::ProfanityFilter::MaskProfanityWordsInText(int *, char *, uint32_t),SetMaskModeandFinalizeby name rather than through the vtable. - Fix: the filter now gets a host vtable (
ngc_vtableinhle_misc.c): each slot of the SDK's_ZTVN2nn3ngc15ProfanityFilterEis matched by address with the class's methods, and slots the loader already bound to forced take-overs keep them. Theunsigned shortandchar16_toverloads are taken over by name too, as are thecharoverload,SetMaskModeandFinalize(hle_misc.c). Nothing is masked or reported. - Found on: Monster Hunter Rise (the vtable); DARK SOULS: REMASTERED (SDK 4.5.0; one boot: the UTF-16 overload by name); The Great Ace Attorney Chronicles (SDK 10.4.1: the
charoverload,SetMaskMode,Finalize).
nn::ngc China-region profanity check and mask
- Symptom:
[RED] sf: the game connects to service ngct:u itself, which the host does not serve, thenBreak#1 reason=0 Result=0xe15from the SDK when the player name is entered after a race (Cruis'n Blast). - Cause:
nn::ngc::CheckProfanityWordsInTextForPlatformRegionChinaandMaskProfanityWordsInTextForPlatformRegionChinaare free functions, notProfanityFiltermethods. They go throughnn::ngc::t::Match, which opens thengct:uservice, and the host does not serve it. - Fix: both are taken over by name in
hle_offline.c, next to the newerProfanityFilteroverloads: the check reports no profanity, and the mask leaves the text unchanged. - Found on: Cruis'n Blast (0100B41013C82000, SDK 10, version 1.0.7; no profile in this repository).
Display, window and operation mode
vi::CreateLayer with the layer's size
- Symptom: SIGSEGV in
vi::CreateLayer(Layer**, Display*, int, int)(sdk+0x3f9bc4, from SDL3's Switch video driver atmain+0x239304). - Cause: the overload with the layer's size; the host had only the two-argument one.
- Fix: it returns the static layer (
hle_vi.c). - Found on: Absolum (SDK 18.3.2, FNA on .NET NativeAOT with SDL3; one boot each).
vi::CreateLayer with LayerCreationSettings (SDK 22)
- Symptom: SIGSEGV at
sdk+0x44ea94reading address 0, invi::CreateLayer, right afteram::GetSelfController(); the caller is the game's window setup (main+0x978cb6c). - Cause: SDK 22 adds
CreateLayer(Layer**, Display*, const LayerCreationSettings*); the game builds the settings with the SDK'sLayerCreationSettings(int w, int h)({w, h, 2},sdk+0x4526a0), and the SDK'sCreateLayerasks the applet's self controller, which the host never made. - Fix: the host takes it over like the sized overload (
hle_vi.c): the static layer, and the size recorded for an EGL surface. - Found on: EA SPORTS FC 27 (SDK 22.2.0): 1920x1080.
vi layer and display calls without vi service objects
- Symptom: SIGSEGV in
vi::SetLayerCroporvi::OpenDisplaywhen opening a display by name. - Cause: the SDK's version dereferences vi service objects the host never made.
- Fix:
SetLayerCroponly records the crop for the present (The NVN present crops by the vi layer crop);DestroyLayer,CloseDisplayandvi::Finalizeare host no-ops. Also hooked:vi::GetIndirectImageMemoryRequirement(asked by the inline keyboard'sGetImageMemoryRequirement, The inline keyboard as a resident library applet);vi::ListDisplays(one display, "Default"; the game lists 10 into a stack buffer and does not read them,main+0x808f08), found from the import list before it was met.vi::OpenDisplay("Default")returns the same static display asOpenDefaultDisplay, so applications can open the name returned byListDisplayswithout entering the SDK's absent service client. - Found on: The Legend of Zelda: Link's Awakening (SDK 8.2.0); Super Mario 3D World + Bowser's Fury (SDK 10:
vi::GetIndirectImageMemoryRequirement); The Great Ace Attorney Chronicles (SDK 10.4.1:vi::ListDisplays); Alien: Isolation (SDK 8.2.0:vi::OpenDisplay).
The display's largest layer from vi::ListDisplays
- Symptom: A game draws into a 3840x2160 swapchain on a 4K display and sets
WindowCrop 0,0 1920x1080. - Cause: The game sizes its docked window from the largest layer in
ListDisplays(DisplayInfo+0x50 and +0x58), then caps it atQueryDisplayBufferMaxResolution. The host hardcoded 1920x1080 in the first call, so the 4K cap in the second call could not raise the window size. - Fix:
hle_vi.cshares the display's largest buffer between both replies for Switch 2 SDKs. Switch 1 SDKs get 1920x1080 fromListDisplays. - Found on: Star Fox (issue #2895).
vi::InitializeWithVrrLfcEnabled
- Symptom: SIGSEGV reading address 0 in
SdkMutexType::Lock(sdk+0x171ef8) right after graphics initialize, undernn::vi2::InitializeWithVrrLfcEnabled. - Cause: the Switch 2 SDKs' display initialize with low frame rate compensation for a variable refresh rate display. It does
nn::vi::Initialize's work throughvi2, whose VRR hooks lock the mutex at the start ofnn::gsv::GetUserSession()'s session, which the host never opens. - Fix: the host takes it over like
nn::vi::Initialize(hle_vi.c): it has no vi service and no VRR display (QueryDisplayVrrSupportedsays so). - Found on: Resident Evil 4 (v131072, SDK 21.4.3:
main+0xb180288→sdk+0x5d8cf0).
Layer HDR metadata
- Symptom:
CRASH sig=11 addr=0 pc=0with the link register just after a call to avi::SetLayerNextHdr…orvi::ClearLayerNextHdr…function. - Cause: the SDK forwards a layer's HDR metadata through a table its graphics system fills, which is null on the host.
- Fix: every layer HDR metadata call of SDK 22's free functions succeeds with nothing to apply (
dm/gfx/hle_vi.c): the content gamut, the HDR to SDR tone mapping, the standard and extended content luminance ranges, the adjustable Bezier tone curve, and the clears of the gamut, the tone mapping and the curve. The host presents SDR. - Found on: Donkey Kong Bananza (the set calls); the curve and the clears: Mario Kart World 1.8.0 sets the curve every frame, from pull request #1116 (that build is not run here).
Layer frame numbers
- Symptom: SIGSEGV in
android::Surface::getQueuedFrameNumberundernn::vi::GetLatestFrameNumber. - Cause: Unreal paces frames by the layer's frame number (
main+0x10140e8); the SDK reads the vi service's surface, which the host never made. - Fix:
hle_vi.canswers with the frames presented so far;ListFrameHistorylists them, as the next entry says. - Found on: Octopath Traveler 0.
Layer frame history
- Symptom: right after the opening logo movie nothing is presented again, with no red line; the watchdog reports
no progress … stage present frame. The game thread is in Unreal'sFlushRenderingCommands, waking each millisecond from a condition variable whose event is never triggered, while the render, RHI, frame-flip and interrupt threads all wait idle. - Cause: Unreal's Switch RHI learns which frames reached the screen only from
nn::vi::ListFrameHistory: its "Viewport Thread" waits for each vsync, asks for the entry count (a null buffer: the SDK answers 8, the history's size), reads the 40-byteFrameInfoentries and takes the first one shown as the latest flip. Those flips complete the frame-end fences that wait for the swap chain (r.GTSyncType2,FFrameEndSync), and the first fullFlushRenderingCommandswaits for every fence in that ring. The host returned no entries, so no flip ever came and the flush waited for ever. - Fix:
dm/gfx/hle_vi.ckeeps the last 8 presents (recorded at each NVN present, numbered asGetLatestFrameNumber, with the present queue's ticket) and answers as the SDK fillsFrameInfo(sdk+0x4510a0in SDK 20.5.15): status (2 shown with a present time, 1 queued and not shown yet), frame number, queue tick and present tick twice, newest first. A frame is shown once the present queue has handed it on (mtl_present_progress), dropped by the Mac or not (next entry). Its present time is the drawable's presented time when Metal reports one, else (headless, before the handler runs, or dropped) the time it was first seen handed on. - Found on: Minecraft Dungeons II; Octopath Traveler 0 and OCTOPATH TRAVELER II call it from the same RHI code (
main+0x1014994,main+0x32b408c) and got no entries before. Luigi's Mansion 3 paces its presents by the history and the window's interval (A game's own present pacing reads the interval the window presents at).
A frame the Mac dropped stays queued in the frame history
- Symptom: the picture stops at a load (Orbitals: right after both players ready up at the character select) with no red line; minutes later
game called nn::diag abort: Result 0, call site main+0x10a0under Unreal's low-level fatal error, whose format isGameThread timed out waiting for %s after %.02f secs(RenderingThread.cpp). Before the abort the watchdog reportsno progress … stage present frame; the game thread wakes each millisecond inFFrameEndSync, and the render, RHI, frame-flip and interrupt threads wait idle, as in Layer frame history. - Cause: Metal reported the last two drawables as never put on screen (
presentedTime0, recorded as dropped), andListFrameHistorylisted a dropped frame as queued (status 1) for ever. A Switch's compositor shows every frame it is handed, in order, so the game can wait for a frame's flip before it presents another: Unreal's Viewport Thread (main+0x1540460) took the older shown frame as its latest flip, and the frame-end sync waited for the newer one. - Fix:
dm/gfx/hle_vi.ccounts a frame the present queue handed on as shown whether or not the Mac displayed it, with the time it was first seen handed on when Metal gives no presented time.dm/host/tests/t_vi_history.ccovers it. - Found on: Orbitals (Unreal Engine 5.6.1, Switch 2), in a window on the Mac; which Mac condition dropped the drawables (the window's occlusion, the display link) is not known.
Default display panel identifier
- Symptom: SIGSEGV in
vi::GetDefaultDisplayPanelIdentifier(main+0xa9a4, before the window). - Cause: the SDK's version calls through the vi service object the host never made. The game reads a u32 kind and, from kind 2, 0x14 more bytes; anything else makes it use zeros.
- Fix: the host answers an all-zero identifier (
hle_vi.c). - Note: a passed TV latency calibration in this game is saved per TV panel identity, the host's all-zero one included (TV latency calibration's late, beat-timed listening window).
- Found on: Rhythm Heaven Groove (SDK 21.4.0, one boot).
oe calls answered without an applet proxy
- Symptom: the first boot crashed in
oe::DisableAlbumImageTakenNotification: a null read atsdk+0x338070, the first call innnMain(main+0x6b188c); enabling those notifications also gives a null read atsdk+0x33b0f0(Xenoblade Chronicles 3); otheroecalls that reach am, found in the imports before they were met. - Symptom: a null read at
sdk+0x36ec60inoe::EnableAlbumImageTakenNotification, called fromnnMain(main+0x286268). - Symptom: a null read at
sdk+0x32daa0(x0=0) inoe::SwitchLcdBacklightOn, leaving Super Smash Bros. Ultimate's Vault > Sounds or opening My Music. - Fix:
EnableAlbumImageTakenNotificationuses the same host implementation as the disable call: no system-album notifications are produced. Found on Mario + Rabbids Sparks of Hope (SDK 13.3.5); the next boot reaches the NVN frame loop. - Cause: the SDK asks am through the applet proxy the host never made.
- Album notification enable:
oe::EnableAlbumImageTakenNotificationfollows the existing disable takeover. The host produces no Horizon album captures, so enabling notifications produces no messages. Found on Xenoblade Chronicles 3 (SDK 12.3.9,main+0x127fac4). - Inactivity extension:
oe::GetUserInactivityDetectionTimeExtensionModealso reads the absent SelfController (sdk+0x3391f0, after Xenoblade Chronicles 3's opening movie). The host retains the requested mode: 0 initially or when either setter receives false, 1 forSetUserInactivityDetectionTimeExtended(true), 2 for itsUnsafeform. The boolean query is mode != 0, matching SDK 12.3.9's implementation. This state does not make the host turn the screen off.t_oechecks both setters and both queries. - Fix: hooked (
hle_oe.c):oe::DisableAlbumImageTakenNotification;oe::IsInStoreDemoModeEnabled(no);oe::GetDefaultDisplayResolutionand its change event;oe::SendServerMaintenanceOverlayNotification;oe::SetUserInactivityDetectionTimeExtendedUnsafe;oe::GetPerformanceConfiguration;oe::SetAlbumImageOrientation;oe::Begin/EndAutoSleepDisabledSectionandIsAutoSleepDisabled(counted);oe::ExecuteProgram(logged red: the host runs one program);oe::SwitchLcdBacklightOn/SwitchLcdBacklightOff(am's CommonStateGetter: no-ops, the host leaves its display on and does not reproduce a screen turned off). The ones with a symptom of their own follow: The startup logo, Copyright frame buffer overlay, Applet resource user ID, launch parameters and VR mode, oe calls through apm without an apm session, Focus handling mode decides whether focus changes are notified. - Found on: Monster Hunter Rise (SDK 11:
GetDefaultDisplayResolution,SendServerMaintenanceOverlayNotification); 13 Sentinels: Aegis Rim (SDK 11:SetUserInactivityDetectionTimeExtendedUnsafe); Super Mario 3D World + Bowser's Fury (SDK 10:GetPerformanceConfiguration,SetAlbumImageOrientation); DRAGON QUEST XI S (SDK 7.3.2: the auto-sleep calls); Octopath Traveler 0 (oe::ExecuteProgram); The Great Ace Attorney Chronicles (SDK 10.4.1, Capcom's MT Framework:DisableAlbumImageTakenNotification, thenIsInStoreDemoModeEnabledfrom the import list); Donkey Kong Country: Tropical Freeze (SDK 4.4.0:GetUserInactivityDetectionTimeExtensionMode, a null read atsdk+0x15b73cwhen the first level's cinematic camera starts,CScreenDimmingUtil::DisableScreenDimming); Super Smash Bros. Ultimate (SDK 8.2.1, 13.0.5:SwitchLcdBacklightOnfrom the Sounds menu, issue #2224). After all of its fixes The Great Ace Attorney Chronicles runs its frame loop at 30 fps; the black screen it showed was its textures, never uploaded (CPU-written textures, the profile'stex_flush_uploadandtex_dirty_upload: Mapped-range flushes taken as uploads (tex_flush_upload), CPU writes with no flush, caught by page protection (tex_dirty_upload)).
Application crash-report switches
- Symptom: a null read in the SDK's
nn::oe::DisableCrashReportduring startup. - Cause:
hle_sdkinit.cintentionally replacesoe::Initialize, so no SDK am ApplicationFunctions object exists. The unhooked wrapper dereferences it to sendEnableApplicationCrashReport(command 90, a boolean service setting). This configures Horizon's external crash-report service, not process signal handling. - Fix: implement both exported oe switches at the same HLE boundary as the other operating-environment calls. The host has no Horizon crash-report service to configure, so these calls have no effect; native crash diagnostics stay enabled. Creating SDK service objects or suppressing host crash diagnostics would not implement this service setting more faithfully. No game or build gate is needed.
- Check:
t_oecalls both hooks without an SDK proxy and verifies that they produce no applet notifications or focus changes. The matching SDK instruction trace confirms the null interface and command 90; the rebuilt game passes startup on the Mac (identities and offsets are in its note). - Found on: FIFA 23 Legacy Edition, PR #1696. The IPC contract is documented in Applet Manager services.
nn::oe::GetDisplayVersion reads the exact NACP string
- Symptom: saved games commit cleanly to disk, yet every slot in Entrance renders as an empty
STARTtile; the game's version parser extracts2instead of723and fails its>= 438(0x1b6) savedata version filter. - Cause: Horizon's
nn::oe::GetDisplayVersionreturns the raw 16-byteDisplayVersionfield fromcontrol.nacp(+0x3060), which in Fate/hollow ataraxia REMASTERED 1.0.2 is"1.0.2 b723". Both the packing script (re.search(r'display version (\S+)', ...)andnacp.version(), which strips non-numeric suffixes for Apple'sCFBundleShortVersionString) andh_oe_DispVer(which read only the profile'sDM_GAME_DISPLAY_VERSIONStable instead ofcontrol.nacp) truncated"1.0.2 b723"to"1.0.2".smash::fw::frame::MainFrame::makeVersionStringturns runs of non-digits into.("1.0.2 b723"→"1.0.2.723"), andGameDataContext/FsnThumbnail::setHollowDataparse the integer after the last.(723, vs2when truncated). - Fix:
h_oe_DispVer(dm/host/hle_sdk16.c) reads the 16-byteDisplayVersiondirectly fromcontrol.nacp(+0x3060) viadm_control_read(dm/host/hle.h, shared withhle_fs.c), falling back toDM_GAME_DISPLAY_VERSIONS/"1.0.0"only when nocontrol.nacpis present (dumps / NUPs).dm/tools/nacp.pyaddsdisplay_version()for the raw NACP string used in surveys and derivedbuildrows (scripts/build_ipa_from_nsp.py), whilenacp.version()/bundle_version()continues to format Apple's bundle version. - Check:
t_language(dm/host/tests/t_language.c, under ASan+UBSan) checksh_oe_DispVerwith"1.0.2 b723"besideDM_ROMFS, a 16-byte non-NUL field viaDM_CONTROL_NACP, and missing-NACP fallbacks;dm/tools/tests/test_nsp_alias.pychecksderive_profilevsapp_version_ofon"1.0.2 b723". Probed live on Fate/hollow ataraxia REMASTERED 1.0.2 on Mac (main+0x80ae2creturns"1.0.2 b723",main+0xd2839cstores0x2d3= 723 with zero patches). - Found on: Fate/hollow ataraxia REMASTERED, issue #2930.
The graphics scale does not follow the operation mode
- Symptom: a Switch 2 game renders smaller docked than handheld, or smaller than console footage: Star Fox's scene was 768x432 docked (DLSS network resized to it at boot, its window 1920x1080) and 960x540 handheld; Ocarina of Time drew 2048x1152 docked, its 3D at no more than 1536x864; Donkey Kong Bananza's docked frame buffer was 2304x1296 on a 2880x1620 swap chain.
- Cause: the host answered
oe::GetCurrentGraphicsScale(am's graphics scaling parameters: 10 / 20 / 30 → tier 0 / 1 / 2) by the operation mode: 0 handheld, 1 docked. Games size their picture and their GPU budget by the tier, full at 0: Star Fox keeps only "tier 0" (byte +0xa of its mode event,main+0xba69970) and renders 0.8 times smaller below it; Bananza scales its frame buffer by {1.0, 0.8, 2/3}[tier] (main+0x30f840) and adds 0, 9 or 13 to the GPU time its dynamic resolution counts; Ocarina of Time's output is 0.8 times smaller at tier 1. So the tier reads as how much of the GPU the game may use, which a system would lower while it needs the GPU itself (GameChat's video): an inference from the games' code, not a measurement. A docked picture smaller than the handheld one, on a GPU about twice as fast, is not what the console does, and Star Fox's console footage is nearer tier 0: Peppy's close-up 65 s into it has a mean gradient of 5.8 (x1000, luminance at 1080p), tier 0 here 5.3, tier 1 4.6. - Fix: tier 0 in both modes (
hle_oe.c; check:t_oe).DM_GFX_SCALE=1or2answers a reduced tier, to see what a game does with it. Open: which tier a console reports in which mode is not measured. - Found on: Star Fox (docked: scene 960x540 to its 1920x1080 window, as handheld; measured on a build of the PR author's fork, MetalFX temporal,
HOST_OPT -O3, not onmain). Donkey Kong Bananza: docked in the mining tunnel, frame buffer 2304x1296 → 2880x1620 and main passes 1676x943 → 2095x1179, GPU p50 about 7.0 → 8.6 ms, 60 fps held with both (M6, 16 GB, a host of chaincfcc3a82c78bwith only this answer changed). Ocarina of Time: output 2048x1152 → 2560x1440, 3D 1536x864 → 1920x1080, GPU p50 12.9-14.0 → 15.0 ms at about 59 fps (M4 Pro, two contributors' runs onmainwith only this answer changed).
The startup logo
- Symptom: abort in
nn::sm::Initializeundernn::oe::FinishStartupLogo, right after the first frames. - Symptom: SDK 21
oe::EnableStartupLogoDisappearedMessagereads null atsdk+0x403fe0, afteram::GetCommonStateGetterreturns null (Fit Boxing 3 2.0.0). - Cause: both reach the applet proxy:
FinishStartupLogothrougham::GetApplicationFunctions, the SDK 21 registration througham::GetCommonStateGetter. - Fix: the host has no startup logo (
hle_oe.c):FinishStartupLogois a no-op, andEnableStartupLogoDisappearedMessagequeues message 95 (startup logo disappeared) at once through the notification queue and its event, since the logo is already gone. The number comes from the PR's run (the game popped it and went on); it was not found in the SDK's code. - Found on: Metroid Dread; Fit Boxing 3 (
0100AC101BFA2000, provisional profile, no note; PR #1973).
Copyright frame buffer overlay
- Symptom: null read in
oe::InitializeCopyrightFrameBuffer, right after the window setup. - Cause: the copyright frame buffer is an overlay the system draws only into screenshots and recordings; the SDK hands it to am as transfer memory.
- Fix:
InitializeCopyrightFrameBuffer,SetCopyrightImageandSetCopyrightVisibilityare host no-ops (hle_oe.c). - Found on: Hyrule Warriors: Age of Calamity (SDK 9.6).
Applet resource user ID, launch parameters and VR mode
- Symptom: SDK 20 calls that reach a service, each one boot; SDK 20's
OpenAudioRendereraborts on an ARUID of 0. - Cause: the SDK's own
applet::GetAppletResourceUserIdreturns 0 without am, and SDK 20'sOpenAudioRendereraborts on that. - Fix:
applet::GetAppletResourceUserIdreports 0x80; the VR-mode calls (pl::IsVrMode/BeginVrMode/EndVrMode;BeginVrModereturns 0xd08e, the SDK's own refusal);pctl::CheckStereoVisionPermission(bool, not permitted: the host has no VR display);oe::TryPopLaunchParameter(none, or the profile'slaunch_param: Multi-program applications:oe::ExecuteProgram) (The Legend of Zelda: Breath of the Wild 1.9.0, SDK 20.5.22).oe::GetPreviousProgramIndexreports −1: launched from the home menu (The Legend of Zelda: Tears of the Kingdom 1.4.3). - Found on: The Legend of Zelda: Breath of the Wild, The Legend of Zelda: Tears of the Kingdom.
oe calls through apm without an apm session
- Symptom: a null read in
sdk+0x35258(apm's session) inoe::IsCpuOverclockEnabled, the first call innnMain; null read atsdk+0x362b8(apm::SetCpuOverclockEnabled) in the first calls ofnnMain(main+0x2e1e4c); a null read (pc=sdk+0x40720c lr=sdk+0x4071d4) inoe::detail::ApmSetPerformanceConfigurationunderoe::SetPerformanceConfiguration(int)as a movie or scene begins. - Cause: these
oecalls go through the apm session the host never opened:oe::IsCpuOverclockEnabled,oe::SetCpuOverclockEnabled(bool), andoe::SetPerformanceConfiguration(int), the one-argument overload, which the host did not hook while it hookedSetPerformanceConfiguration(PerformanceMode, int). The one-argument overload sets the configuration of both modes: in SDK 14.3 (TUNIC'ssdk+0x3a5630) it looks the value up in a table and callsapm::SetPerformanceConfigurationfor Normal, then for Boost; SDK 21.4.7 goes throughoe::detail::ApmSetPerformanceConfiguration. - Fix:
hle_oe.chooks them; it does not scale clocks.oe::IsCpuOverclockEnabledreports whatSetCpuOverclockEnabledset; bothSetPerformanceConfigurationoverloads log the value and ignore it. The import list names such calls before they are met (Listing a game's unhooked imports before they are met): of the builds extracted on the game drive (2026-11-15), TUNIC, FINAL FANTASY V, FINAL FANTASY VI and Overcooked import the one-argument overload as well, and no route played on them met it. - Found on: Monster Hunter Rise (SDK 11:
IsCpuOverclockEnabled); Taiko Risshiden V DX (SDK 12.3.3:SetCpuOverclockEnabled); Warhammer Survivors (SDK 21.4.7:SetPerformanceConfiguration(int), from PR #2318).
Focus handling mode decides whether focus changes are notified
- Symptom: the game freezes after switching apps and back, picture still, sound on; the main loop waits in its pause handshake (
main+0x5d10d4/main+0x5cea68). Mac reproDM_OE_SCRIPT=bg=1@20,bg=0@25. - Cause: the game's own pause deadlocks. The game set focus handling mode 3. The SDK (
oe::SetFocusHandlingMode, SDK 18sdk+0x3c5770) turns modes 0 and 3 into "no focus notifications, the system suspends the game out of focus"; only 1 and 2 notify. The host sent message 15 anyway, and Galaxy 2's Wii layer ran a pause the console never triggers. - Fix:
hle_oe.cnow queues 15 only under modes 1 and 2 (or when no mode was set). - Found on: Super Mario Galaxy 2 (one of two causes of the freeze; the other is Guest clock reads wait while the app is in the background).
- Note: modes seen: 1 Monster Hunter Rise; 2 Wonder, Breath of the Wild, Tears of the Kingdom, Link's Awakening, Cuphead; 3 Galaxy, Galaxy 2, 3D World, Odyssey.
Album calls fail with no album
- Symptom: abort in
sm::Initializeundercapsrv::InitializeForApplication(album::Initialize); calls that reach the album service, found in the imports before they were met. - Fix:
hle_album.cinterceptsnn::album::Initialize/Finalizeand implements the raw-bufferSaveScreenshotoverloads locally (Local album screenshot saving). Features without a local equivalent still fail:SaveAndShareScreenshot(both overloads) andGetSharePostedLastUrl(online social sharing),ShowAlbumFiles(system album applet UI), andSaveCurrentScreenshot(compositor frame capture). - Found on: Monster Hunter Rise (SDK 11:
album::Initialize); DRAGON QUEST XI S (SDK 7.3.2:album::SaveScreenshot); Animal Crossing: New Horizons (SDK 20.5.4: the sharing calls); Pokémon Legends: Z-A (19.3.11:SaveCurrentScreenshot).
Local album screenshot saving
- Symptom: exporting a photo taken with an in-game camera to the "Console Album" fails with "Unable to save" (GitHub issue #3211).
- Cause:
hle_offline.cexplicitly stubbed thenn::album::SaveScreenshotoverloads to returnRES_FAIL. In Pokémon Pokopia (main+0x10fedc0→main+0x112fe94), the game decodes its internal gallery JPEG withnn::image::JpegDecoder's defaultPixelFormat_Rgba32(0xe, verified atsdk+0x4d984andsdk+0x4da04) into a0x7e9000-byte (1920×1080×4) linear RGBA8888 buffer and calls the 4-argumentnn::album::SaveScreenshotwithImageSize = 1(1920×1080). Switch 1 callers (Pikmin 4,main+0x1e1b2bc..0x1e1b354) passImageSize = 0(1280×720) RGBA8888 buffers; Switch 2 SDKs accept both0and1(sdk+0x1a0ab0,sdk+0x1a0ae0,sdk+0x1a2160). - Fix:
hle_album.cimplements the 4-argument, 5-argument (withImageOrientation0..3), and 7-argument (withUidlist)nn::album::SaveScreenshotoverloads. It validates the pointer,ImageSize(0= 1280×720,1= 1920×1080), buffer length (>= w * h * 4), and orientation, rotates the pixels whenorient != 0, encodes the opaque RGB image to PNG via CoreGraphics + ImageIO, and publishes it atomically (mkstemps+link/unlink) underDM_ALBUM_DIR(Mac apps default to~/Pictures/nxnative/<title ID>indm/mac/launcher.c, iOS apps toDocuments/albumindm/ios/Sources/main.m, host fallback<DM_ROOT>/albumthen<dirname(DM_SAVE)>/album, created lazily on first save). Write/space failures map tonn::albumresult codes (0xced6full,0xcad6error,0xccd6invalid). - Found on: Pokémon Pokopia (v655360, SDK 20.5.25, GitHub issue #3211). Also serves Pikmin 4, DRAGON QUEST XI S, Monster Hunter Rise, Resident Evil 4, and PRAGMATA.
Accounts, network, shop and parental controls
Account, friends, play data and Nintendo Account calls
- Symptom: a null read at
sdk+0x336cccinpdm::QueryApplicationPlayStatistics(Pokémon Sword, the second boot); undefinednn::account::/nn::friends::imports with no hook, found from the import list (Listing a game's unhooked imports before they are met) before they were met. - Fix: hooked (
hle_account.c,hle_friends.c,hle_offline.c):account::ListAllUsers;account::PushOpenUsers(nothing to hand over);account::LoadCachedNintendoAccountInfo(fails: no Nintendo Account; Big Brain Academy then skips the birthday and country getters);friends::GetBlockedUserList,DeclareOpen/DeclareCloseOnlinePlaySession(unavailable);friends::StartFacedFriendRequest/StartSendingFriendRequest(fail); the Nintendo Account request'sGetAuthorizationCodeandGetState(both fail, asGetIdToken);pdm::QueryApplicationPlayStatistics, which asks how often this user launched two other games and reads only the launch count, so each is never played. - Found on: Super Mario 3D World + Bowser's Fury (SDK 10,
ListAllUsers); Octopath Traveler 0 (PushOpenUsers); DRAGON QUEST XI S (the friends calls); DRAGON QUEST VII Reimagined (the Nintendo Account request); Pokémon Sword (SDK 7,pdm); The Great Ace Attorney Chronicles (SDK 10.4.1: the friend requests); Big Brain Academy: Brain vs. Brain (SDK 11.4.3:LoadCachedNintendoAccountInfo). - Note: Super Mario Odyssey's
account::OpenPreselectedUserandaccount::GetLastOpenedUserare in SDK calls that open a system service through sm; SDK 6'sOpenPreselectedUserin SDK 6'saccount::OpenPreselectedUserreturns a Result; SDK 4'sGetBlockedUserListwithout aUidin SDK 4'sfriends::GetBlockedUserListwithout aUid; the save thumbnail calls in Directory, file data cache and save-thumbnail calls.
Play statistics without a user ID
- Symptom: a null read at
sdk+0x2a4fc0during startup in thepdm::QueryApplicationPlayStatisticsoverload without aUid. - Cause: the SDK dereferences the applet proxy from
nn::am::GetApplicationFunctionsto query the system play log. The proxy is null on the host. The SDK returns the number of output records, andmain+0x10e78cchecks that there is at least one before reading the array. - Fix:
hle_offline.cserves that overload by returning zero records for the empty system play log. - Found on: Persona 5 Strikers (1.0.0, SDK 8.3.2).
account::GetUserId copies the Uid of any handle
- Symptom: a second controller ends the game with
FATAL account::GetUserId: the handle was not issued by the host (0x2), at boot with both connected or when the second joins during play (EA SPORTS FC 27 1.8d.6523; the FC 26 patch reports(0x8)). - Cause: the host checked the handle's third word against the marker its own open calls write. The SDK's accessor never reads that word: FC 27's
nn::account::GetUserId(sdk+0x1c0040) callsdetail::GetUserId(sdk+0x1bede0,ldp x8, x1, [x0]; mov x0, x8; ret), stores the 16 bytes and returns 0. For a second controller's player FC 27 passes a handle it built and never filled (main+0x1f638b0; words0x7012222b20 0x400000001 0x2), so on a console the call succeeds and returns those bytes. - Fix:
GetUserIdcopies the Uid and returns 0 for any handle, as the SDK does (hle_account.c); the open calls issue session tokens for closing their own sessions, but the accessor still does not inspect that word.t_accountcovers the host's handle and built handles with third words 2, 8, 0 and all ones. - Found on: EA SPORTS FC 27 (PR #1129; two DualSense controllers on a Mac and an iPad Air M4, reported in its review thread); first found on EA SPORTS FC 26 by the FC 26 120 fps patch (MIT).
Local account selection, sessions and separate saves
- Symptom: Minecraft Dungeons II's second local player repeatedly receives player 1's user, cannot join, and opens the user-selector/error applets on every attempt (PR #2846).
- Cause: the host always returned its one fixed UID. The game leaves
invalidUidListempty and expects the person at the selector to choose another account. The PR's carried implementation demonstrated about 40 seconds of two-player play, but guessed selection intent from controller counts, listed closed users as open, and forgot registered users at the next boot. - Fix:
hle_account.cpresents the eligible users and an explicit Add user action throughfront_user_select(native Mac/iOS dialogs). It checks exclusions for existing and new identities, supports cancellation and the optional Skip action, and only bypasses the UI for the single registered user when the game'sisSkipEnabledpermits it, with neither exclusions noradditionalSelect. It never reads a controller count. Network-required selections fail when unqualified users are forbidden; the host has no linked Nintendo Accounts. The settings layout and the distinction between skipping the UI and showing a Skip button follow libnx's selector. - Identity and sessions: user 1 retains its original UID; users 2–8 use PR #2846's deterministic slots and
Player Nnicknames.hle_account_users.catomically records registration in<DM_SAVE>.usersbefore returning a new UID. An unreadable/corrupt registry fails closed without overwriting it. Selection does not open a user: each open owns a unique session token,ListOpenUserslists only users with live sessions,ListAllUsersincludes closed profiles, andGetLastOpenedUserfollows opens. Closing a copied/stale token cannot close another session. A fresh process has registered profiles but no live sessions; the launch user remains user 1. - Saves:
hle_fs.cretains<DM_SAVE>for user 1 and uses<DM_SAVE>_userNfor each additional user, including read-only mounts. Unknown UIDs fail instead of falling back to user 1. Reusing an occupied mount name for a different backing directory fails. The existing transaction engine handles each directory independently; no transaction rewrite. Additional users and the registry are local to the app's save store and outside the current primary-account/device cloud-sync format. See the front-end contract for backup/move requirements. - Checked:
t_accountcovers choices, exclusions (including uncreated UIDs), skip/cancel, registration failure, two sessions for one UID, stale closes, concurrent opens/closes, and fresh-process registry loading.t_account_savechooses and opens two users, mounts distinct saves with identical filenames, commits independently (including an alias and read-only views), injects a failure in each direction, and starts two fresh processes to verify registered identities and committed bytes survive while pending writes do not. Native Mac picker selection and Mac/iOS source builds were checked; actual Minecraft co-op/progress across boots and iOS device interaction remain untested on this implementation. - Found on: Minecraft Dungeons II, reported by papertradooor in PR #2846; save/session contracts reproduced with synthetic inputs. Borderlands: Game of the Year Edition also needs an empty open-user list at first gamepad mapping to take its synchronous preselected-user fallback.
An account AsyncContext needs its SDK constructor
- Symptom:
CRASH sig=11atmain+0x5b64f8,lr=main+0x3f1b8cc(nn.account.AsyncContext$$Finalize), on an IL2CPP thread-pool worker a few seconds after the player confirms a name and birthday (Pokémon Friends 1.1.5). The object's first word, its vtable, holds stray bytes (0xffffd256in one run,0x15600000128in another). The game had startedaccount::EnsureNetworkServiceAccountIdTokenCacheAsync. - Cause:
nn::account::AsyncContextis polymorphic. The SDK's constructor (SDK 19.3.11:sdk+0x1ad6c8) writes the class's vtable and nulls the three words after it, the IPC object pointer at +0x18 among them, and sends nothing. The host took the constructor over with one that wrote no memory, so the vtable word kept what the allocator left there. The game's C# binding deletes the native context from the managed finalizer through the virtual deleting destructor, inlined in main (main+0x5b64f0:if (p) p->vtable[1](p)), which the host'sAsyncContextD1Evtakeover never sees, and jumped through those bytes. - Fix: the constructor is no longer taken over (
hle_account.c): the SDK's own runs. No host interface sets the IPC pointer, so the SDK's destructor, reached through the vtable, finds no session to close and frees the object.friends::AsyncContextandaccount::NintendoAccountAuthorizationRequestContexthave no vtable (their SDK constructors write none), so their takeovers stay. - Found on: Pokémon Friends (
010008C01E742000, update 1.1.5, SDK 19.3.11; no profile in the repository yet). The managed names come from Il2CppDumper's table (IL2CPP method lookup).
Friends presence is accepted offline
- Symptom: the loading screen stays at 22% for ever while the music plays (Twelve Minutes). No red line, no crash.
DM_FS=1showslevel0and the FMOD master bank read, then no other scene and no save mount;DM_HLECOUNTshowsaccount::TryOpenPreselectedUser,GetUserId,GetNicknameandfriends::UserPresence::Initializeonce each, andfs::MountSaveDatanever. - Cause: the host's
UserPresence::InitializereturnedRES_FAILlike the other friends calls. The game's start-up takes the failure as fatal and stops before it mounts its save, so the loading screen waits for a scene that is never asked for. A presence is the game's own object until the friends service publishes it, so failing to set one up is not what an offline console reports. - Fix:
UserPresence::Initialize,SetDescriptionandCommitsucceed and publish nothing (hle_friends.c). The calls that need the service (friend lists, online play sessions, invitations) still fail; the notification queue opens since The friends notification queue opens offline. - Check:
make -C dm/host/tests GAME=<id> runrunst_friends. - Found on: Twelve Minutes (
0100CD701434C000, Unity 2019.4.31f1 IL2CPP, SDK 12.3.7; seedds/nxnative#217).
The friends notification queue opens offline
- Symptom: the game quits by itself right after its first textures, with no
[RED]line and no crash: the last lines arengc: ProfanityFilter host vtable of 9 slots (3 matched to the class's methods), thenSVC 0x7 … (placeholder returns success)and an abort undernn::os::detail::ThreadManagerImplByHorizon::ExitProcessImplon the Mac (__nnmusl_ProcessExit→nnosExitProcess),svcExitProcess/graceful exiton an iPhone (Beach Buggy Racing 2). - Cause: the svcExitProcess is the game's own
exit(-1)(main+0x40a9c8), which its logger calls for the fatal level (6, "Fatal",main+0x35e370) after nnMain loggedUnable to init game.(main+0x26b8). One start-up step,VuGameServices(initmain+0x4c0), returned false: it opens the preselected user, reads its Uid and nickname, then takes a failednn::friends::NotificationQueue::Initialize(const Uid&)(main+0x584) as fatal; the host cut that call toRES_FAIL. On the console the queue is a local object of the friends service (its notification service, opened for a user), which a console without a connection opens too; it only stays empty. The ProfanityFilter line is the last before the exit, not the cause (the filter'sInitializecomes after the queue in the same step). Found withDM_PROBEon the logger's entry (the message in x2), on the init's failure exit (lrnames the step) and in the step. - Fix:
NotificationQueue::Initialize, with and without aUid, andClearsucceed (hle_friends.c);Popstill finds nothing,GetSystemEventnever fires andFinalizehas nothing to close. Friend lists, online play sessions and invitations still fail. No title or build gate. - Check:
make -C dm/host/tests GAME=<id> runrunst_friends. - Found on: Beach Buggy Racing 2: Island Adventure (
0100C43012344000, base v0, Vector Unit's engine, SDK 10.8.2, NVN; provisional profile, no note yet: its shaders are in an.apfarchive the shader split does not read). With the fix the Mac host runs its frame loop at 60 fps for a minute, mounts and commits its save; nothing is drawn without shaders.
The network account check is cancelled offline
- Symptom: a "Transmitting" loading screen with a hint stays for ever before the main menu while the game keeps drawing at 60 fps and its music plays (Taiko no Tatsujin: Rhythm Festival). No red line, no crash;
DM_SF_TRACE=1shows nothing afternsd:u.DM_HLECOUNTshowsaccount::EnsureNetworkServiceAccountAvailablecalled thousands of times (4,647 in under three minutes, about once per frame). - Cause: the host's
EnsureNetworkServiceAccountAvailablereturnedRES_FAIL. The SDK opens the account applet for account errors that require user interaction. Cancelling it returnsResultCancelledByUser(2124-0001,0x27c), as confirmed by replaying the SDK 13.3.0 path with a cancelled applet exit. Taiko takes that result as "continue offline" (main+0x16ee0f4:and x8, x0, #0x3fffff; cmp x8, #0x27c) and retries on anything else. - Fix: the call returns
RES_ACC_CANCELED, the result the user selector already gives on cancel (hle_account.c). The other network-account calls (GetNetworkServiceAccountId,LoadNetworkServiceAccountIdTokenCache) still fail. - Check:
make -C dm/host/tests GAME=<id> runrunst_account. - Found on: Taiko no Tatsujin: Rhythm Festival (
01006B0016AD6000, update 6.2.0, Unity 2020.3.26f1 IL2CPP, SDK 13.3.2; no profile in the repository yet). Before the fix, a cheat that rewrote main's import stub for the call (main+0x1845440, build7150D78C454E7C55) to return0x27cgot it to the main hub.
Creating an ssl context needs no network
- Symptom: the game ends right after
nnMain, with a crash in its own cleanup on an object it had not created yet (DRAGON QUEST BUILDERS 2:CRASH sig=11 addr=0x60db0atmain+0x2676c8, x0 = 0, the callersmain+0x85210andmain+0x7fabf8). No red line. - Cause:
ssl::Context::Createfailed in the host's offline stubs. A context is a session of the console's own ssl service, so it succeeds on Horizon with no network; only a connection needs one. The game's online library treats the failure as fatal, and its startup (main+0x84a60) returns false. - Fix:
Context::CreateandContext::Destroysucceed and connect to nothing (hle_net.c).Connection::Createand the rest still fail, as they do with no network. - Found on: DRAGON QUEST BUILDERS 2 (SDK 5.4.0). 53 of 82 games surveyed import the call.
EventFd needs no network
- Symptom:
abortundergrpc_initat startup, with no red line:game called nn::diag abort: Result 0, call site sdk+0xb8fe8, backtracesdk+0xba138 sdk+0x7bd670 sdk+0x777f30 main+0x21f0c80, just afterfs mount _npln:(Ocarina of Time). - Cause: gRPC, which
nn::nplnlinks, wakes its pollers withnn::socket::EventFd. The host failed that with ENETDOWN, so gRPC found no wakeup descriptor, its poll engine's factory (main+0x21f1280) returned null and the engine selection calledabort(main+0x21f0c7c). An event descriptor is local to the bsd service, so on Horizon it works with no network; only a connection needs one. - Fix:
EventFd,EventFdReadandEventFdWriteare host counters,Pollwaits on them with a condition variable andClosefrees them (hle_net.c). They share the BSD descriptor table with local UDP sockets. An endless wait comes back with 0 after 100 ms, as it does with nothing to wait on. - Check:
make -C dm/host/tests GAME=<id> runrunst_net_eventfd. - Found on: The Legend of Zelda: Ocarina of Time (SDK 22.2.8).
Event descriptors in an fd_set
- Symptom:
CRASH sig=10(SIGBUS) in a network thread right after start (Minecraft'sNetherNet Network,main+0x18b2ae8,x0=0x4000), at a load from its own stack. - Cause: the host numbered its event descriptors from
0x4000. The bsd service gives out the lowest free number from 0, and games size their tables for such small numbers: NetherNet puts its event descriptor in a 1024-bitfd_seton the stack forSelect, andFD_SET(0x4000)reads and writes 2 KB past the set.Selectalso failed whenever a descriptor was set, so it could never wait on one. - Fix: the event descriptors are numbered as the service numbers them, the lowest free one from 0 (
hle_net.c).Select(dm_sk_select, both overloads) isPollover the descriptors in its sets: it waits on the host's event descriptors, a descriptor the host never made has nothing to say, the sets come back with the ready ones, and a descriptor closed during the wait fails with EBADF. As a game's own stale or never-valid descriptors now fall in the same range,Pollreports a closed descriptor (POLLNVAL) only for one that was open when the wait began. - Check:
t_net_eventfd(make -C dm/host/tests GAME=<id> run). - Found on: Minecraft (Bedrock Edition, 1.21.120).
UDP loopback works offline
- Symptom: New Game stays on the loading artwork with an empty progress bar while rendering and loading tips continue (Divinity: Original Sin 2). Both
nn::socket::Socket(AF_INET, SOCK_DGRAM, 0)calls fail, so RakNet never completes initialization. - Cause: the host treated every socket as remote networking and returned ENETDOWN. RakNet's startup tests a local UDP endpoint by sending a four-byte datagram to itself at
127.0.0.1; this works on an offline console. The missing test leaves the game's single-player client and server waiting. The same cause was independently documented in DroidPlay Core's Divinity note. - Fix:
hle_net.cserves IPv4 UDP endpoints inside the process, with BSD sockaddr/flags/errors, local binding and ephemeral ports, datagram queues, connected send/receive, nonblocking calls andPoll/Select. The enum, plain-argument and C entry points share this service with EventFd. Queues are bounded; close wakes blocked readers and pollers, and descriptor generations prevent waits from attaching to a reused slot. Remote traffic and name resolution remain unavailable. No game key or fixed address is involved: this is host binding, its loosest correct binding. - Check:
t_net_loopbackexercises the four-byte startup test, two-endpoint exchange, connected filtering, peek/truncation, nonblocking and timed receive, remote rejection, mixed EventFd readiness, and close/reuse during waits;t_net_eventfdretains the existing event-descriptor checks. - Found on: Divinity: Original Sin 2 - Definitive Edition (update 1.0.12, SDK 9.3.0).
The local user's profile image
- Symptom:
Break#1 reason=0 Result=0right after the first save is created, then exit 42; the stack hasnn::diag::detail::OnAssertionFailureundernn::image::JpegDecoder::Decode(sdk+0x394e4), called from the game (Burnout Paradise Remastered, SDK 9.3). - Cause:
account::LoadProfileImagefailed with 0 bytes ("the host has none"). Every user on a console has a profile image, a 256x256 JPEG, and the game hands the buffer toJpegDecoderwithout checking the Result. - Fix:
hle_account.canswers with the local user's image, a plain 256x256 baseline JPEG of 670 bytes built into the host: the size is the image's, the copy what the buffer holds. - Found on: Burnout Paradise Remastered (
0100DBF01000A000, no profile; issue #1118), from the reporter's symbolized stack; not run here.
Mii database answered by the host
- Symptom:
[RED] sf: the game connects to service mii:e … mii:u itself, then an abort. - Cause:
nn::mii::Databasekeeps anIDatabaseServiceof the mii service at +0 (Database::Initialize,sdk+0x1c5664), andAppendMii/ShowMiiEditstart the MiiEdit applet. - Fix:
hle_mii.ctakes over the public methods: a console with no Mii of its own (an empty database: no index, nothing to update) that still has the six default Miis every console has. A CharInfo the host builds is the default Mii's parameters with Switch common colours, a create ID with version 4 and variant bits (fixed per default Mii, so a saved choice finds the same Mii; fresh forBuildRandom, which the title's demo race calls for 12 racers) and the nickname "no name"; every field is withinCharInfoRaw::Verify's ranges (sdk+0x1b68c8).ShowMiiEditis answered as the editor closed with no change;AppendMiimakes a Mii (A Mii made in the editor's place). - Found on: Mario Kart 8 Deluxe (4.0.0, SDK 4.4.0; one boot). The game asks for the default Miis with
Get(…, 6, SourceFlag 2)and never reads the count (main+0x81e954): its boot-time list of Mii icons (main+0x419dc8) builds a head model for each of the six, and zeroed entries failed the model'sCharInfoAccessor::IsValid(CharModel::Initializereturned 0xd67e,main+0x8f15b0) and crashed atmain+0x8f152c. - Note: the heads' model data is a stand-in with every part empty (System data stand-in for the MiiModel archive).
A Mii made in the editor's place
- Symptom:
mii: AppendMii (the host has no Mii editor: cancelled)at each press, and the game goes back to where it asked for a Mii (Mario Golf: Super Rush's Golf Adventure: its save slots). - Cause:
nn::mii::AppendMiistarts the MiiEdit library applet to make a new Mii, and a game that needs one (Golf Adventure is played as a Mii) asks for it when the database holds none. The host has no editor, and answered "cancelled". - Fix: the host answers as a player who saves the editor's starting Mii: the system's default Mii (male, "no name") with a create ID of its own, added to the database after the console's Miis, and
*indexis its place there (hle_mii.ch_mii_Append).IsUpdatedis true once after it for a question that includes the database. Such Miis are kept for every game in<DM_SYSTEM_DIR>/host/MiiDatabase.dat, a file of the host's own format ("DMMI", version 1, the count, then the CharInfos), read at the next start beside the console's database, which is never written. A full database (100) cancels, as the editor cannot add one then. - Found on: Mario Golf: Super Rush (4.0.0): Golf Adventure shows its own "Select a Mii" with the new Mii, starts, and plays its opening in the village (Mac, M6). A Mii shows without a head unless the player supplies the head data (A console's own Mii database and system data). Issue #2361 found that the game needs the call to succeed. Also called by Super Smash Bros. Ultimate and Nintendo Switch Sports Resort's
main(not run). - Check:
make -C dm/host/tests GAME=<id> build/t_mii && (cd dm/host/tests && build/t_mii): the Mii is added after the console's, listed, found by its create ID, kept in the host's file and read back at the next start; the console's file is not written; a damaged host file is refused; a full database cancels.
A console's own Mii database and system data
- Symptom: the game shows only the six default Miis, and a Switch 2 game logs
[RED] fs mount system data MiiResource: the host has no 0400000000000849(Nintendo Switch Sports Resort: Mii heads cannot be drawn). - Cause: both live on the console: the Miis in the mii service's system save, the head textures and shapes in a system data archive. The host ships neither.
- Fix: a player can supply their own, under
DM_SYSTEM_DIR(the Mac launcher sets~/Library/Application Support/nxnative/system, the iOS appDocuments/system; elsewhere$DM_ROOT/run/platform/system):sysdata/<system data ID, 16 hex digits>/: an archive's RomFS files.MountSystemDatamounts it read-only (hle_fs.csysdata_own), ahead of the host's Mii model stand-in (MiiModel, and the Switch 2's MiiResource: The Switch 2's Mii model archive).save/8000000000000030/MiiDatabase.dat: the mii service's database. The Switch 2's service (program0400000000000039) mounts system save8000000000000030asmiiand readsmii:/MiiDatabase.dat, as the Switch does. The file is 0x1a98 bytes:NFDB, 100 StoreData of 0x44 bytes, the version (1) at +0x1a94, the count at +0x1a95, and a CRC-16/CCITT (polynomial 0x1021, initial 0) of the bytes before it at +0x1a96, big-endian.hle_mii.creads it once atDatabase::Initialize. Each StoreData's seven words of bit fields, nickname and create ID become a CharInfo (mii_from_store; the stored eyebrow y is 3 below the CharInfo's).Getlists them before the six default Miis (source 0, then 1),GetIndexandUpdateLatestfind them by create ID, andIsFullDatabaseis true at 100. A file of another size, magic, version or CRC is logged and leaves the database empty. The file is never written: Miis a game adds go to a file of the host's own (A Mii made in the editor's place).
- Found on: Nintendo Switch Sports Resort (v65536). The save's ID, mount name and file checks were read from the Switch 2's system program
0400000000000039.- The archive it needs: the game mounts system data
0400000000000849asMiiResource:and readsShapeMid.dat/ShapeHigh.datandOunceTexture{Low,Mid,High}{Linear,SRGB}.dat. Its code also names the fourNXTexture*files of the Switch's MiiModel (0100000000000802), but it picks the texture file from a table by a flag (main+0x1cdeb50) that its Mii setup (main+0x320040) only ever clears, so it always reads theOunceTexture*files: the Switch's archive, or the host's stand-in of it, cannot take its place. Without the archive the setup function's size query fails and it mounts nothing, and the game shows no Mii heads; the host now mounts its stand-in there, whoseOunceTexture*files are blank, so the heads still draw nothing (The Switch 2's Mii model archive). - Run: with a console's
0400000000000849(its eight files) and a database of one Mii in place, the game mounts the archive, lists the Mii first on Select User, and draws Mii heads there, on its Customize screen and in play (M4 Pro, macOS 27.2).
- The archive it needs: the game mounts system data
- Check:
make -C dm/host/tests GAME=<id> build/t_mii && dm/host/tests/build/t_mii: a database with known fields unpacks into them; a wrong CRC, size or version is refused;Get,GetCount,GetIndexandUpdateLatestanswer from it.
Shop service accessors
- Symptom: the abort with no message (
SVC 0x15/0x1f/0x21placeholders, thenBreakwithsm::FinalizeunderShopServiceAccessServer::Proxy::Initialize) fromec::InitializeForShopServiceAccessors, called from Unreal'sFOnlineSubsystemSwitch::Initat the start ofnnMain. - Cause: the shop service accessor library reaches the shop service.
- Fix: the library init succeeds with nothing to set up, an accessor never initializes, and its async response is complete at once with no data (
hle_misc.c); the accessor and response are stubbed whole because the SDK's destructor aborts unlessFinalizesucceeds. Also hooked:ec::FinalizeForShopServiceAccessors, the shop response'sCancelandGetErrorCode, andec::ShowShopSubscriptionDetails. - Found on: DRAGON QUEST XI S (SDK 7.3.2: the game then runs its opening movie at 30 fps); DRAGON QUEST VII Reimagined (SDK 19.3.1:
FinalizeForShopServiceAccessors,Cancel,GetErrorCode,ShowShopSubscriptionDetails, found by the import list). - Note: the shop's
Show…pages are under System applets opened byShow…calls.
Offline purchased-item notifications
- Symptom: a purchase watcher crashes in
nn::ec::InitializePurchasedEventafter account selection, before it can wait for a notification. - Cause: the guest SDK initializer uses an add-on-content service object that the offline host never opened.
- Fix: the purchased-item queue is empty offline. Its notification is a persistent, unsignalled system event that guest threads can wait on. Popping either form of purchased-item info returns false without writing a record.
- Found on: Super Kirby Clash 1.0.1 (#987), SDK 7.4.0.
Parental controls and free communication
- Symptom: abort in
nn::sm::Initializeundernn::pctl::IsFreeCommunicationAvailable(Engage, entering its first battle map). - Cause: the SDK connects to the parental-control service through
sm. - Fix: the host answers it like the other free-communication calls: not available (
hle_misc.c).pctl::CheckFreeCommunicationPermission: never. - Found on: Fire Emblem Engage; DRAGON QUEST XI S (
CheckFreeCommunicationPermission). - Note:
pctl::CheckStereoVisionPermissionis under Applet resource user ID, launch parameters and VR mode.
Network interface, LDN, socket and play report calls
- Symptom: play report calls met entering the save select (3D World); undefined
nn::ldn::/nn::socket::imports with no hook, found from the import list before they were met (Big Brain Academy). - Fix: hooked (
hle_net.c,hle_offline.c): thenifmIP queries with SDK 10'ssocket::InAddr/in_addrmangling;prepo::AddSessionId/AddInternetConnectionStatus;ldn::GetNetworkConfig; SDK 11's socket overloads with plainsockaddr/intarguments (Connect,Accept,GetSockName,Get/SetSockOpt,Fcntl,Recv,Send). - Found on: Super Mario 3D World + Bowser's Fury (SDK 10:
nifm,prepo); Big Brain Academy: Brain vs. Brain (SDK 11.4.3: LDN, sockets).
Play report upload status
- Symptom: a won Chambara match ends in
nn::diagabort Result0xe15, after[RED] sf: the game connects to service prepo:u itself. - Cause: the SDK's
nn::prepo::GetTransmissionStatusopensprepo:uthroughsm. The host has no play report service process, andsmreturns ResultNotRegistered. - Fix:
hle_offline.canswers success with status 0 (idle). The offline host discards reports, so the upload queue is always empty. - Found on: Nintendo Switch Sports 1.5.0 (SDK 13.3.4), with a won match replayed after the fix in PR #2908.
SDK 21 socket initialization and overloads
- Symptom:
[RED] sf: the game connects to service bsd:u itself, which the host does not serve(and bsd:s, bsd:a) at the game's first socket call, then the game's own abort: Star Fox'svsocket.nintendo.cpp:148logssocket: 4and stops. With only the connection cut, the game's HTTP thread aborted a few seconds in: its event loop'spollreturned -1 with errno 14 (EFAULT), and the loop tolerates only EINTR (main+0xbe2efc4). - Cause: SDK 21 inlines
nn::socket::Initialize(const Config &)into the game and connects to the bsd services fromnn::socket::internal::Initialize(int), past the host's cut. nnmusl'spollthen has no socket state and fails. Its socket functions also come in overloads with plainsockaddr,ShutdownMethod,Read/Write, aGetHostEntByName(const char *)without options andSetAllocator(MemoryResource *), andnifm::GetCurrentIpConfigtakes IPv4 and IPv6 configurations with their counts. - Fix:
internal::Initializeis cut as the plainInitializeis, the C library'spollgoes to the host'sPoll, the overloads use the shared offline BSD service (hle_net.c), andGetCurrentIpConfigreports no configuration (hle_offline.c).Pollno longer fails on a descriptor the host never made, which only a garbage value can be: it reports nothing ready at the timeout, as a console's does for a socket with nothing to say. The game logssocket: No error informationand goes on offline. Local descriptors work through EventFd and UDP loopback. - Found on: Star Fox.
Server environment queries without nsd
- Symptom:
[RED] sf: the game connects to service nsd:a itself, which the host does not serve(alsonsd:u), thengame called nn::diag abort: Result 0xe8dand exit 134 during startup. - Cause:
nn::nsd::GetApplicationServerEnvironmentTypeasks the nsd services for the console's server environment (nsd::detail::ipc::GetApplicationServerEnvironmentType) and aborts when the request fails; the host serves no nsd service.nn::oe::GetServerEnvironmentTypeis a single branch through thesdkmodule's PLT to it, in all 18sdkmodules on hand (Switch 1 and Switch 2 titles, Mario Golf: Super Rush and EA SPORTS FC 27 among them), so a game reaches it either way. The query asks for a fixed property of the console, not for a network connection. - Fix:
hle_offline.ctakes overnsd::GetApplicationServerEnvironmentTypeand returnsoe::ServerEnvironmentType1, retaillp1, as the existingnsd::GetEnvironmentIdentifieranswer does (the game's table maps0 dd1,1 lp1,2 sd1,3 sp1,4 dp1). The forced takeover binds thesdkmodule's own PLT entry too, sooe::GetServerEnvironmentTypeneeds no takeover of its own. Other nsd operations are not implemented.t_server_environmentlooks up the real registrations by name and checks the answer against the identifier. - Found on: Hogwarts Legacy (
0100F7E00C70E000, SDK 17, no profile), in a contributor's bring-up (PR #1199; also NX2Apple issue #475): with the takeover the game passed the call and went on rendering. No local game references either function. Hogwarts on the current host and PATAPON 1+2 REPLAY (NX2Apple issue #426) are not checked (open).
Bluetooth LE at boot
- Symptom:
[RED] sf: the game connects to service bt itself, which the host does not serve, thengame called nn::diag abortatsdk+0x16ba48and exit 134, a second after the audio renderer starts. Withbtandbtm:userved as zeroed host sessions the abort moves tonn::btm::user::InitializeBtmUserInterface(sdk+0xb8eb4), before either session gets a request. - Cause:
maincallsnn::bluetooth::InitializeBleat boot (main+0xa0b030; the Pokémon GO Plus + support of the 3.0.1 update), which runsbluetooth::hal::user::InitializeBluetoothUserInterfaceandbtm::user::InitializeBtmUserInterfaceand aborts when they fail. Zeroed answers are not enough: the BTM setup expects real objects or handles back. - Fix:
hle_offline.ctakes over the BLE calls the game reaches without a device:InitializeBleconnects to nothing, the fiveAcquireBle…Eventcalls bind an event that never fires, scan parameter, scan start andConnectToGattServerfail, scan stop succeeds, and the scan result and connection lists are empty. The GATT calls after a connect are never reached. - Found on: Pokémon Violet 3.0.1 (
v720896, a derived profile), on an M3, macOS 27.2: the opening plays through. Not checked: 1.0.0 (the registered build), Pokémon Scarlet 3.0.1.
Network requests stay on hold before they settle
- Symptom: the boot sits at a black loading screen for good, CPU nearly idle, every thread waiting, about 1 boot in 6 (3 in 4 with four Mac hosts at once); the title movie is never opened, and the save files are never probed.
- Cause: a race the host's instant offline answers lost. The game's boot state machine (
main+0x1f2f0e0, state atthis+0xd4, found by probing the save probe's call stack and dumping the state each tick) stayed in state 7, which polls the status word (+0x14) of the game's BCAT news runnable ("OlimarMemo") for 0, 4, 5, 6 or 7; it read 1. The runnable's constructor (main+0x203f3b0) clears the status, startsFBCATThreadand only then stores 1; the thread'sRun(main+0x203f510) stores 2, callsnn::nifm::SubmitNetworkRequest, sleeps whileIsNetworkRequestOnHold, and stores 6 whenIsNetworkAvailableis false. On a Switch the request stays on hold while the nifm service evaluates it, so the constructor's 1 always comes first; the host answered "not on hold" at once, and a thread that ran before the constructor's store finished at 6, which the 1 then overwrote. - Fix: a submitted request is on hold for the first
IsNetworkRequestOnHoldafter the submission and settled as unavailable at the next (hle_net.c). On Horizon each query is an IPC to the nifm service, which evaluates the request as it serves them, offline a rejection; Pikmin 4 sleeps 10 ms between its queries, so the constructor's store always comes first. - Note: the first fix held the request for 50 ms of host time. A game that bounds its wait by the number of queries never saw that end: Hades'
NetworkPollThread(main+0x27aaa0) yields between queries and cancels after 2,000 (2,000 IPCs on a Switch, 0.1 ms here), then submits again at once, which kept a host core busy (1.17 billion queries a minute; with A wait at two yields is not progress, 216,000 yields and half the CPU). Its stamp,now_ns() | 1, also read as settled whenever the next query came within the same 42 ns tick of the Mac's clock: 30% of Hades' submissions, and 42% back to back. - Found on: Pikmin 4 (Unreal Engine 4.26.2); Hades (the 50 ms hold).
- Check: 12 of 12 boots with four hosts at once reached the title, with both fixes; a host that answers at once hung 1 of 4 in the same test.
- Note: how it was found: the hung boots' logs diverged from good ones at the save probe (
DM_FS=1), the thread dumps showed nothing but idle waits, andDM_PROBEon the state machine, thenpeeklines in a hung run'sDM_CTLfile, followed the pointers to the status word (a probe on the hot path slowed the boot enough to hide the race: 8 of 8 good).
Socket Poll and Select with nothing to wait on
- Symptom: one thread at 100% CPU from boot, with one SVC in 99 s (
NexusRevolution Socket,main+0x92c7c4, the game's network thread). - Cause: it calls
nn::socket::Poll(fds, 0, 33): no descriptors and a 33 ms timeout, which on hardware is a 33 ms sleep. The host failed every socket call at once, so the thread spun 11,000 times a second (88,000 hits of a probe in 8 s). - Fix:
PollandSelectwith nothing to wait on (no descriptors, or only negative ones, which POSIX ignores) now wait out their timeout and return 0, in every mangling the host takes over, including SDK 4'sSelect(int, fd_set*, …, timeval*); an endless timeout returns 0 after 100 ms, since a thread inside a host hook pauses for IL2CPP's collector only once the hook returns (hle_net.c,dm_guest_sleep_nsinhle_thread.c). - Found on: DARK SOULS: REMASTERED (SDK 4.5.0; one boot). Guest CPU fell from 1,030 to 60 ms per second.
Settings, languages and fonts
Language codes
- Symptom: the first comparison in
nnMainaborted insm. - Fix: hooked:
settings::LanguageCode::Makeand the reversedoperator==(LanguageCode, Language). - Found on: Super Mario 3D World + Bowser's Fury (SDK 10).
Chinese language aliases in settings comparisons
- Symptom:
DM_LANG=zh-Hansorzh-Hantreaches the game unchanged, but its startup menu falls back to Japanese; the olderzh-CNorzh-TWspelling selects Chinese. - Cause: Odyssey 1.4.1's language selectors (
main+0x977b30,main+0x977d30) compare the desired code throughsettings::operator==(LanguageCode, Language)with only the deprecatedLanguage::Chinese(6) andTaiwanese(11) entries, neverSimplifiedChinese(15) orTraditionalChinese(16); its control data lists Simplified and Traditional Chinese, which the NSP script spellszh-Hansandzh-Hant(it turnszh-CNandzh-TWinto those too). The real operator compares bytes withMakeLanguageCode, so on the console the system must hand this gamezh-CN/zh-TW; the host compared bytes the same way withDM_LANG's spelling, sozh-Hansdid not matchzh-CNandzh-Hantdid not matchzh-TW. - Fix: both settings equality hooks share an alias-aware comparison (
hle_sdk16.c): Simplified Chinese's two spellings match each other, as do Traditional Chinese's. The scripts stay distinct;GetDesiredLanguage,LanguageCode::Makeand the available language list keep their original codes and indices. No title-specific override. This stands in for the system's choice of spelling, whose rule per title is not known (open): a game that compares the code with its own strings, or looks upzh-CN's index in the available list, still needs the exact spelling. A synthetic full matrix tests both operand orders, malformed codes and the unchanged list. - Found on: Super Mario Odyssey (1.4.1, SDK 7.3.2; fresh-save Mac startup menus in Simplified and Traditional Chinese after the comparison fix).
Available language codes and their count
- Symptom: abort in
sm::Initializeundernn::settings::GetAvailableLanguageCodes(early innnMain,main+0x327888); abort insm::Initializeundernn::settings::GetAvailableLanguageCodeCount()(main+0x117590). - Cause: Paper Mario asks for up to 32 codes and takes the index of
oe::GetDesiredLanguage's code in the list as its language. Catherine comparesLanguageCode::Make(0 … count − 1)withGetDesiredLanguage's code. - Fix: the host lists the system's codes in
nn::settings::Languageorder, the tableLanguageCode::Makeuses, and reports the count of that table (hle_sdk16.c). The self-contained SDK functions can supply their own list and count. - Found on: Paper Mario: The Thousand-Year Door (SDK 15.3.2, the codes), Catherine: Full Body (SDK 8.2.1, the count; one boot).
Polish and Thai, and a Switch 2 SDK's own language list
- Symptom: a game that ships Polish or Thai text could not be given either language: the NSP script stopped at
unknown game language 'pl', and the Game language row did not offer them. - Cause:
nacp.LANGUAGEScovered only the first 16 bits ofSupportedLanguageFlag. The controls for Wonder Switch 2 Edition 1.2.1 use bits 16 and 17 for Polish and Thai. Breath of the Wild 1.9.0 sets bit 17 in its Switch control data. Innn::settings::Languageorder the two codes areplat 18 andthat 19. A Switch 2 SDK can provide a separate list with no settings service call. Its list omitszh-CNandzh-TW, so Simplified Chinese is at index 13 instead of 15. Where the SDK lists Polish and Thai they are at indices 16 and 17. - Fix: the tools read the two control bits and offer the codes in the packer and launcher.
LanguageCode::Makeand both comparisons know the two enum ordinals. The loader lets the SDK answerGetAvailableLanguageCodesandGetAvailableLanguageCodeCountwhen the loadedsdkhas both exports and itsFS_ACCESSstamp identifies a reviewed Ounce revision. The remaining SDKs use the host's 18-entry settings-service fallback.oe::GetDesiredLanguagealready passes through theDM_LANGcode. - Found on: Super Mario Bros. Wonder (1.2.1, SDK 16.2.12, Polish and Thai title-screen boots on the Mac with
DM_LANG). The list and count exports read a local table of 16 codes in Donkey Kong Bananza (20.5.19) and Pokémon Pokopia (20.5.25), and 18 in Mario Kart World (21.4.0), Wonder Switch 2 Edition (21.4.1), The Legend of Zelda: Ocarina of Time (22.2.8), and Nintendo Switch Sports Resort (22.2.10). A Mac loader test called the two exports from the rewritten Pokopia and Sports Resort SDKs and checked the count, full list order, and truncated list. Open: the correctoe::GetRegionCodefor Thai is unknown. The fallback currently returns Europe.
Region code from the language
- Fix:
oe::GetRegionCodeanswers from the language: Japan, the Americas, Europe or Hong Kong / Taiwan / Korea. - Found on: Animal Crossing: New Horizons (SDK 20.5.4; found in
main's imports before the first boot).
Default language from control data
- Symptom: running the Mac host directly without
DM_LANG(e.g. viascripts/bench.pyorscripts/regress.py) crashes a game that does not ship American English (en-US), such as Xenoblade Chronicles 3 crashing 2.5 s into boot atmain+0x10141ac. - Cause:
nn::oe::GetDesiredLanguageandnn::oe::GetRegionCode(hle_oe.c) fell back toen-USwheneverDM_LANGwas unset, ignoring the title'scontrol.nacpSupportedLanguageFlag(+0x302C). On Horizon,GetDesiredLanguagealways returns a language declared in the title's control data. - Fix: when
DM_LANGis unset or empty,oe_lang(hle_oe.c) readsSupportedLanguageFlagat+0x302Cviadm_control_readand picks the first set language in NACP bit order (en-US, thenen-GB, thenjathroughth), falling back toen-USwhencontrol.nacpis absent, too short or sets no known language bit. Bothoe::GetDesiredLanguageandoe::GetRegionCodeuse it; an explicitDM_LANGstill passes through unchanged. Checked with synthetic NACP cases indm/host/tests/t_oe.c. - Found on: Xenoblade Chronicles 3 (lists
en-GBand noen-US; reported in PR #3147).
Shared font address: BFTTF header or bare TTF
- Symptom: the font engine runs on garbage; crash after the shared fonts load, looking up the "?" glyph (
main+0x6c73c0, a font cache lookup returning null), with SDK 10'sScalableFontEngine::LoadFontfailing with error 403 andSetFontwith 301 on both stand-in fonts; or Japanese, Korean or Chinese text draws nothing in a Unity game while Latin text is fine (Patrick's Parabox's language menu showed three blank lines). - Cause: consumers read the shared font differently.
- The SDK's font engine calls
ScalableFontEngineHelper::Decode(ptr, size), which XOR-decodes in place unless the first word is the "already decoded" marker (LE0x18029a7f). So for a game that decodes it the system shared font must look like BFTTF: servemarker + bswap(size ^ 0x49621806) + TTF(hle_sdk16.c). Mario decodes the pointer and needs the 8-byte BFTTF header in front. - 3D World records shared fonts as type 0 (
main+0x975658), calls noScalableFontEngineHelper::Decodeand hands theGetSharedFontAddresspointer straight toLoadFont, so the pointer must be the plain TTF. SDK 10 and older games all take the plain TTF. - Unity's Switch player hands the shared fonts straight to FreeType. In Patrick's Parabox (SDK 13) the game's one font (Jost, a Unity dynamic font) falls back to the OS fonts for those glyphs, and the player loads them from the shared fonts:
main+0x2390b0maps the namesSwitch_Font_STD,Switch_Font_CN_Simplified,Switch_Font_CN_Extended,Switch_Font_CN_Traditional,Switch_Font_KRandSwitch_Font_NIN_Extendedto types 0–5 and handsGetSharedFontAddress/GetSharedFontSizestraight to FreeType'sFT_New_Memory_Face(main+0x23b2e0), as libnx homebrew does with the same pl offsets. The host gave every SDK 11+ game the 8-byte BFTTF header in front, so every face failed to open. - The SDK's
GetSharedFontAddressis the shared memory base plus the pl service's offset, with no adjustment, and that offset points past the header (yuzu's pl service: "font offset and size do not account for the header"); Captain Toad (SDK 8) records its shared fonts as plain TTFs and callsDecodeonly for its BFTTF formats. - A game on a newer SDK can import
Decode(and so get the header) yet hand the address straight toLoadFontthe same way (The Legend of Zelda: Echoes of Wisdom 1.1.0, SDK 20.5.1:main+0x8b37ccrashed at address 0x38).
- The SDK's font engine calls
- Fix: the host first decided by the SDK version alone (SDK 10 and older the TTF, SDK 11+ the header). Now the address is the header (marker form above) only for a game on SDK 11 or later whose
mainimportsnn::fontll::ScalableFontEngineHelper::Decode(Wonder, Breath of the Wild, Tears of the Kingdom, Pokémon Legends: Z-A); every other game gets the TTF itself (font_skipinhle_sdk16.c,dm_game_importsinloader.c; the profile keyshared_fontoverrides). The host'sLoadFonttakeover passes the TTF past the header whenever it is given the host's own BFTTF base, so the address formfont_skippicks only matters toDecodeand other readers (hle_sdk16.ch_font_LoadFont). - Check: 3D World's case was found by probing the engine's error code after each call (
DM_PROBEon the instruction afterGetError). - Note: of the games on hand, the ones that call
GetSharedFontAddresswithout importingDecodeare all Unity players (Engage, Ace Attorney Investigations Collection, Brain Memory Training Academy, Patrick's Parabox). To see which fonts a Unity game asks for, probe its name mapper's entry (DM_PROBE=main:2390b0on Patrick's Parabox 1.0.1; the function is the onemaincaller ofGetSharedFontLoadState). - Found on: Super Mario 3D World + Bowser's Fury (SDK 10, the plain TTF); Super Mario Bros. Wonder, The Legend of Zelda: Breath of the Wild, The Legend of Zelda: Tears of the Kingdom, Pokémon Legends: Z-A (the
Decodeimporters); Patrick's Parabox (the blank CJK text, 1.0.1); Captain Toad: Treasure Tracker (SDK 8, plain TTFs); Fire Emblem Engage, Ace Attorney Investigations Collection, Brain Memory Training Academy (the other Unity players); The Legend of Zelda: Echoes of Wisdom 1.1.0 (no profile).
Shared fonts requested all at once
- Symptom: abort in
nn::sm::Initializeundernn::pl::sharedresource::GetPlatformSharedResourceManager(first thing innnMain). - Cause: the game asks for every shared font at once with
pl::GetSharedFont(int *, SharedFontData *, int, LanguageCode)(sdk+0x40f270), not by type.SharedFontDatais 0x18 bytes {u32 type, address, size}; the SDK adds the pl service's offsets, which point past each font's 8-byte BFTTF header, to the shared memory base, and the game hands each address straight toScalableFontEngine::LoadFont(main+0x501ff0). - Fix: the hook returns the six types in order with the stand-in TTFs past the header, whatever the profile's
shared_font(hle_sdk16.c). - Found on: Rhythm Heaven Groove (SDK 21.4.0, one boot).
Shared font load request
- Fix:
pl::RequestSharedFontLoadis hooked (an SDK 20 call that reaches a service). - Found on: The Legend of Zelda: Breath of the Wild (1.9.0, SDK 20.5.22).
Multi-program applications: oe::ExecuteProgram
- Symptom:
[RED] oe::ExecuteProgram(<n>, <k> bytes of parameters: …); before this entry, a crash right after that line (sig=4on a trap, or the next function running). A program started on its own quits at boot: it expects the launch parameter its launcher passes. - Cause: a multi-program application has one Program and one Control NCA per program index, title IDs base + index. One program starts another with
oe::ExecuteProgram(index, param, size): on Horizon the process ends and the named program starts, and pops the parameters withoe::TryPopLaunchParameter. The call never returns, and what follows it in the game's code is not code to run: a trap (Super Mario 3D All-Stars' launcher,main+0x10a58) or the next function (ROMANCE OF THE THREE KINGDOMS 8 REMAKE,main+0xa31914). - Fix: one package over all the programs. The first program's profile lists the others (
programs); the host is built over a table of their profiles (game.pyheader_multi,DM_GAME_*read the entryDM_PROGRAMpicks), each program extracted withnx_extract --program=<title ID>into its own build folder, andbuild_ipa_from_nsp.pypacks them as one (--program Npacks one alone, for bring-up).ExecuteProgramends the program as Horizon does (hle_oe.c):- The Mac, a run command or an app:
DM_PROGRAMSnames a table with one row per program: its host, rewritten modules, run folder and environment. The parameters go to<run folder>/launch_param.bin, and after the graceful exit (dm_host_shutdown_then, which writes the pipeline archive first: A run that ends in its prewarm loses what it compiled) the hostexecves itself with this environment less every key a row sets, then the row's keys,DM_LAUNCH_PARAMandDM_PREV_PROGRAM(oe::GetPreviousProgramIndex). The NSP script writesprograms.tsvin program 0's build folder; a Mac app'sdm/mac/launcher.cfills in its own paths. - The iPhone: iOS cannot start a process.
DM_EXEC_OUT(main.m:Documents/program.bin) gets the index and the parameters; the front end names the program for 1.5 s and schedules a local notification that opens the app (front_program_handoff; a player who refused notifications is asked on screen to open the app again), and the app ends. The next start reads the record, deletes it and runs that program without the settings screen, so opening the app later starts at the first program. Each program's modules are in sections of their own (gen_embed.py --tag,DM_EMBED_TAG) and its files indm/p<N>/,p<N>/andmsl/p<N>/, packed so into the IPA or copied so by the Xcode build phase (build_ipa.shPROGRAMS_TSV,stage_resources.sh). - A program not packed (Super Mario 3D All-Stars' Galaxy, 32-bit ARM): a red line, and the application's first program starts instead, as after a restart from HOME. No table (a program run by itself):
ExecuteProgramof its own index starts its host again with its own arguments; another program cannot start, and the program ends.
- The Mac, a run command or an app:
- Launch parameters:
TryPopLaunchParameterreturns the bytes ofDM_LAUNCH_PARAM's file, once; a program run alone gets what its profile'slaunch_paramdescribes. - Found on: Super Mario 3D All-Stars: the launcher starts Super Mario 64 and Super Mario Sunshine with 16 bytes (language code and two volume floats), and each game's Return to title selection calls
ExecuteProgram(0). ROMANCE OF THE THREE KINGDOMS 8 REMAKE and Octopath Traveler 0 import it; neither was seen to call it. - Note:
DM_CTLprogram <n>calls it with no parameters (05, Scripted input). The iPhone path compiles and packs; it has not run on a device.
oe::RequestToRelaunchApplication: the application starts again
- Symptom:
CRASH sig=11 addr=0in the SDK'sapplet::RequestToLaunchApplication(Super Smash Bros. Ultimate 13.0.5:pc=sdk+0x804c8) right after a game asks to restart itself, for example after a language change. - Cause:
oe::RequestToRelaunchApplicationwas not hooked. The SDK's version reads through the am application proxy, which the host never opens. - Fix: hooked (
hle_oe.ch_oe_Relaunch): the start ofoe::ExecuteProgram(oe_start) for program 0, with no launch parameter and no previous program, as from HOME; it never returns. On the Mac the plan is made first and the graceful exit (dm_host_shutdown_then) then runs onlyexecve: a multi-program application's program 0 row, or a program run by itself its own host with the same arguments. Either gets this environment lessDM_LAUNCH_PARAMandDM_PREV_PROGRAM, plusDM_RELAUNCH=1, which makesDM_CTLresume at the end of its file. On the iPhone an app holding several programs records program 0 (DM_EXEC_OUT); an app of one program cannot start itself again, so the front end asks the player on screen for 3 s to open it again (front_program_handoff), and the app ends. - Note: tested on the Mac with a program run by itself; the multi-program and iPhone paths have not run.
t_oechecks the Mac's plans. - Found on: Super Smash Bros. Ultimate (13.0.5: Options > Language > Yes).
Offline HTML startup overflows a small guest stack
- Symptom: opening Mario Kart 8 Deluxe's info screen crashes in
__chkstk_darwin, called byweb_findthroughweb_startandh_web_Offline(issue #2541). - Cause: the offline-page hooks ran on the calling game thread's stack.
web_startkeeps about 5 KB of path buffers andweb_findneeds another 5 KB, before the file-system and front-end calls. A small thread stack sized for Horizon's applet request cannot hold this host implementation. - Fix: both
ShowOfflineHtmlPageandOfflineWebSession::Startwere registered withHLE_FORCE_BIG, the guarded host-stack entry, which every take-over takes since 2026-11-13 (Host calls on small guest stacks). Arguments and results keep their ABI, and the original guest stack is restored when the call returns. Calls already on a host stack use the direct path. - Test:
t_web_stackcalls both registered entries on an 8 KB guarded guest stack with a fake viewer (session exit, the synchronous callback result, a missing page); before the fix it stops with SIGBUS. Mario Kart 8 Deluxe 4.0.0 on the Mac shows its Info page, closes it with B and opens it again. - Found on: Mario Kart 8 Deluxe, 4.0.1 with DLC on the Mac.
Offline pages moved by the Switch browser's focus navigation
- Symptom: an offline page shows and B closes it, but the D-pad and A do nothing: its entries never take the focus or open. A page error at load,
TypeError: window.nx.playReport.setCounterSetIdentifier is not a function. Button icons in the page's text draw as empty boxes. After the page went to another of its pages and back, B no longer closes it. - Cause: the Switch browser (NetFront Browser NX, WebKit-based) moves the focus itself: the D-pad and the stick move it to the nearest focusable element in their direction (spatial navigation), as the default action of the arrow key, and A presses what has the focus; a page loads with its first element focused. Pages are written for that: Mario Kart 8 Deluxe's Info pages have only
tabindexentries, act on theirfocusandclickevents, wrap from the last entry to the first in their ownkeydownhandlers and cancel Left / Right withreturn false, which only make sense if the browser's move is a default action that a moved focus or a prevented key stops. The host sent synthetic key events, which have no default action in WebKit, so nothing moved the focus. Itswindow.nxstand-in answered an unknown name with a no-op function, so a namespace (nx.playReport.incrementCounter) was undefined and the click handlers threw before they navigated;nx.playSystemSe(the browser's system sounds) was a generic no-op. On the Switch a character no font in the page's list has comes from the system's fonts, the extension font among them, so pages name families that do not exist (the footer:none,NintendoExt0003) or their own fonts without the icons; WebKit falls back to macOS's fonts. B went back whilehistory.length > 1, which also counts the pages ahead after a back. - Fix:
web_apple.m's injected script does the browser's part. An arrow key that the page neither prevents nor answers by moving the focus moves the focus to the nearest focusable element (links, form controls,tabindex≥ 0, visible) whose far edge and centre lie past the focus's in that direction, scored as in the CSS spatial navigation draft (the gap ahead, plus the gap to the side 30 times going left or right and twice going up or down); with none there, the nearest scrollable box (or the page) scrolls 64 px. At load the first element in tab order takes the focus when the page focused none. Unknownwindow.nxnames are logged no-ops at any depth;playReport's counters are dropped (telemetry) andplaySystemSeis silent, logged once per sound (the sounds are the web applet's own data, which the host does not have). Each family a page's styles name that is its own (@font-face) or not installed gets the host's extension font for U+E000–E1FF as an extra face, ahead of the page's own faces so a page font with the glyph still draws it. B asks the web view: back when it can go back (WKWebView.canGoBack), the end with exit reason 1 otherwise. - Found on: Mario Kart 8 Deluxe 4.0.0, the Info screen (issue #2541): on the Mac the D-pad moves through Driving Techniques, Items and Battle and the pages' wraps, A opens each, the Items grid moves in both directions, B goes back and closes the page from the index, and the menu takes input after.
- Note: what NetFront does is read from the pages, not from a console: whether its own move would also run after a handler moved the focus, which element it focuses at load, and whether A clicks a focused element that is not a link or button (the host keeps A to links and buttons, as before) are unconfirmed. The pages' sounds and their
nx-se-disabledattribute (the browser's default sounds off) have no effect here. Super Mario 3D All-Stars' pause pages, which move the focus in their own handlers, were not on hand to run again.
Offline HTML pages in a web view
-
Symptom: a null read in
applet::StartLibraryAppletImmediatelyunderweb::OfflineWebSession::Startat boot; a game's pause menu, an offline page, never shows, or the game waits for a message from it. -
Cause: the web applet shows the pages a game ships in its HtmlDocument NCA over the game, with the Switch browser's JavaScript extension (
window.nx: content messages both ways, the footer's buttons). A game may start its page hidden at boot, wait for the page's first message beforeAppear, and read where the page ended (its last URL) when it closes. -
Fix:
hle_web.creadsShowOfflineHtmlPageArgas the SDK writes it (u16 count at +0, entries from +8 of{u16 type, u16 size, u32 0}and their data: DocumentPath 0x6, CallbackUrl 0x3, KeyRepeatFrame 0x1c / 0x1d, BootMode 0x41) and shows the page in a web view of the front end over the game picture (web_apple.m, WKWebView on the Mac and the iPhone), hidden untilAppear. The page is served from its folder through a scheme of its own (dmweb://doc/, so its XMLHttpRequests for its sounds work), with awindow.nxstand-in,navigator.getGamepadsin the standard mapping and key events from the controller (D-pad and left stick as arrows with key repeat and the browser's spatial navigation as their default action, Offline pages moved by the Switch browser's focus navigation; A as keyCode 32), its 1280x720 fitted to the 16:9 picture, transparent, with the host's extension font for the button icons. Messages are queued both ways. The page ends at its callback URL (http://localhost/by default: exit reason 3, the URL as the last URL), on B from its first page (1),nx.endApplet(0) orRequestExit/Finalize(2). While it shows, the game reads no input (dm_input_holdinhle_hid.c; buttons held as it appears count once released). Pages come fromDM_HTML, by default the folderhtmlbeside the RomFS folder (html-document/orhtml<n>/html-document/, asnx_extract --htmlwrites them; the NSP script extracts them for every program, and the iOS app carries them ashtml/besideromfs/). On the iPhone the page sits over the game view and under the gamepad, and a touch no control takes goes to the page (DmGamepad.m). Without the page or a window, a stand-in answers: the page loads at once, sends one empty content message and closes when it appears (exit reason 0, no last URL);ShowOfflineHtmlPagethen fails. -
Found on: Super Mario 3D All-Stars: Super Mario Sunshine (its pause menu,
launcher_pause_menu.htdocs, started hidden at boot) and Super Mario 64 of the same collection. -
Note: WebKit matches
:focusonly in the key window, so the page's:focusrules are copied for the focused element (with another app in front the highlight stayed on the first item). A relative URL that climbs out of the document's folder is looked up inside it.DM_WEB_LOG=1logs each key and the focus after it.DM_CTLwebshot <path>saves the page as a PNG. The iPhone path compiles; it has not run on a device. -
Fix:
applet::GetAppletResourceUserIdreports 0x80; the VR-mode calls (pl::IsVrMode/BeginVrMode/EndVrMode);pctl::CheckStereoVisionPermission(bool, permitted);oe::TryPopLaunchParameter(none, unless another program of the application started this one: Multi-program applications:oe::ExecuteProgram) (The Legend of Zelda: Breath of the Wild 1.9.0, SDK 20.5.22).oe::GetPreviousProgramIndexreports −1: launched from the home menu (The Legend of Zelda: Tears of the Kingdom 1.4.3).
Every undrawn extension code point is a ring
-
Symptom: a crash in the font engine at boot with the null glyph, from a code point no message uses (
main+0x62d20on 1.0.0,main+0x63780on 1.1.4);?in text for an icon the stand-in does not draw. -
Cause: the stand-in extension font drew only the icons games were seen to use, so a lookup of any other code point found no glyph.
-
Fix: every code point of U+E000–E1FF the stand-in does not draw maps to a plain ring (
make_ext_font.py), so a lookup always finds a glyph. -
Found on: Super Mario 3D All-Stars (the launcher looks up U+E06B at boot).
- Super Mario 3D All-Stars: Super Mario Sunshine: its recompiled PowerPC code is Hagi's
.nrolz(data/gekko/<game>/nx/<game>.nrolz: the NRO's size big-endian, then one LZ4 block), whichnro_collect.pydecodes; the 25.3 MB NRO matches the hash.nrr/Hagi.nrrregisters. Super Mario 64 of the same collection loads its recompiled N64 code (05_UNSMJ3.002.nro) and unloads it before it returns to the launcher.
- Super Mario 3D All-Stars: Super Mario Sunshine: its recompiled PowerPC code is Hagi's
nn::jit taken over by the host
- Symptom:
nn::jit::Initializecrashes reaching for the jit service (sdk+0x2e5414). - Cause: on Horizon the jit service loads the game's JIT plugin, an NRO the game reads from its own files, into a process of its own, maps the game's code memory read-write there and read + execute in the game, and runs the plugin's
nnjitpluginGenerateCode/nnjitpluginControlfor each request (yuzu'sservice/jithas the calling conventions). The host has no service process. - Fix:
hle_jit.ctakes over the API (Initialize,CreateJitEnvironment,GenerateCode,Control,GetJitEnvironmentInfo,DestroyJitEnvironment,Finalize).CreateJitEnvironmentfinds the plugin among the game's buffers by SHA-256 among the rewritten NROs (nro_collect.pycollects it through the game's NRR), loads it alone (loader.cnro_load_alone: relocated against itself and left out of the game's symbol lookups), runs it as the service does (_init,GetVersion,ResolveBasicSymbolswith the host'smemcpy/memmove/memsetand panic handlers,SetupDiagnosticsoff,Configure,OnPrepared) and gives it its configuration: the code memory (aMAP_JITmapping on the Mac, one address for the plugin's writes and the game's calls), the data memory, and the work buffer's last part as its transfer memory, where it keeps its state.GenerateCodeandControlrun on the calling thread under one lock, with the data zero-padded to 32 bytes as the SDK sends it;GenerateCodeopens the thread's JIT write window (pthread_jit_write_protect_np) and invalidates the instruction cache over the range returned. Layouts from SDK 9.5.1'snn::jit(sdk+0x2e6610ff.): code ranges are offsets in the code / data memory, the handle is the environment,GetJitEnvironmentInforeturns {code address, size, data address, size}.DM_JIT_LOG=1logs every request ( - Found on: Super Mario 3D All-Stars: Super Mario 64 : command 3 at boot turns 4,235 precompiled MIPS blocks into 14.2 MB of code in 27 ms; command 4 compiles a handful of blocks in play. Its code needs nothing from the rewriter (no x18, SVC, system register or PC-relative literal in 3.55 million instructions).
A JIT plugin loaded a second time crashed
- Symptom: a second
nn::jit::CreateJitEnvironmentfor the same plugin, afterDestroyJitEnvironment, crashes with SIGSEGV innro_load_alone(amemcpyfrom address 0) right afterNRO <name> loaded alone (load 2, …). - Cause: NRO data snapshots are lazy:
preload_nrosrecords only the length of an NRO's initialized data, and the first load copies it.nro_loaddid that copy, butnro_load_alone(the JIT plugin's load) did not, so its reload restored the data from a null pointer. Its reload also left the bss as the previous environment had left it, while the jit service loads the plugin fresh for each environment. - Fix: both loads start with
nro_reset_data(loader.c): the first load snapshots the initialized data, and a reload restores it and zeroes the bss. Each load keeps its own symbol binding (linked into the game's lookups, or alone). - Found on: no game: a synthetic test found it, and no game has been seen to create a second environment. Super Mario 3D All-Stars: Super Mario 64 is the one game that takes this path.
- Check:
t_nroloads a module alone, dirties its data, bss and relocation slots, and loads it alone again: the data and bss are as rewritten and the slots relocated against the module itself. Without the fix it fails at the first load (no snapshot).
A JIT plugin loaded alone took bindings from the game's NROs
- Symptom: none seen on a game. A JIT plugin's undefined weak import could end up pointing into a game NRO, though the plugin runs, on Horizon, in the jit service's own process and links with nothing of the game's; a second
CreateJitEnvironmentbefore the first was destroyed reset the live plugin's data under it; a plugin's deactivation skipped the loader's locks and its check of stacks borrowing NRO data. - Cause:
nro_load_alonerelocated the plugin against itself only, but left it marked loaded like any module, so the rebind loops ofnro_loadandnro_unload(a linked NRO coming or going: every loaded module's imports it defines or that point into it bound again) took it in.h_jit_Destroycleared the plugin'sloadedflag itself, outsideg_modules_mu, withoutsvc_nro_deactivate's check. Nothing refused loading a module that was loaded. - Fix: a module loaded alone is marked so (
module_t.alone), and both rebind loops leave it out. Its end is the loader's,nro_unload_alone(underg_modules_mu, throughsvc_nro_deactivate, asnro_unload), whichh_jit_Destroycalls after the plugin's fini.nro_reset_datarefuses a module already loaded (die): the host has one image of the plugin, where the jit service would load a copy per environment;ro::LoadModulealready answered such a load with an error. - Found on: no game; the audit of the review's JIT fix (step 15). Super Mario 3D All-Stars: Super Mario 64 is the one game that loads a plugin.
- Check:
t_nro: with the plugin loaded alone, a linked NRO that defines the plugin's undefined weak import is loaded (the main module's import is bound to it, the plugin's stays 0) and unloaded; a second load alone while it is loaded is refused in a child process and leaves its data as it was;nro_unload_aloneends it, and the reload is as rewritten; a module with no initialized data reloads with a zero bss. Without the rebind change the isolation check fails.
nn::jit served from an image on iOS
- Symptom:
[RED] jit::GenerateCode command <n>: request <key> … is not in the image …: capture it on the Mac (DM_JIT_CAPTURE) and rebuild the image, then the game crashes there (the iPhone, or the Mac withDM_JIT_SERVE). - Cause: iOS runs no code made at run time, so the plugin's output must come from the Mac. That output depends on where the code memory and the modules are (the plugin builds every host address as
movz+ threemovk), and two things only the game's code tells: which bytes of a request's data make the request, and where its output lists the code's entry points, which the game computes from the address it asked for. - Fix: the Mac host captures each request once with the layout it was made in (
DM_JIT_CAPTURE=<dir>,<key>.jit; the key is the command, the data size, the data and the input's SHA-256, an input over 1 MB by size only).dm/tools/jit_capture.pybuilds the image (jit.img,jit.tsv,jit.out): each address sequence into the code memory or a module becomesadrp+add+ twonops to a canonical layout (the code memory at 0, the modules after it, 16 KB aligned); requests the captures placed differently go after the others, with their branches out of the block moved; output words that are host addresses become relocations, found as the words that differ between two captures in different layouts (a request captured once must hold none). The profile keysjit_key_dataandjit_out_codesay the rest (dm/games/README.md, Keys). Serving (iOS; the Mac withDM_JIT_SERVE=<dir>): the plugin is never loaded; the image is mapped at the layout's base (iOS: the executable's__TEXT,__dm<tag>_jitsection,gen_embed.py --jit), and every module it names at its offset in one reservation (loader.cjit_layout_init; the image's layout must match each module's size, else the host stops);Controldoes nothing, andGenerateCodefinds the request by its key and returns the image's code range, the data bytes and the output with its relocations applied. The NSP script's iPhone build of a program whosemainimportsnn::jit::CreateJitEnvironmentboots it twice headless withDM_JIT_CAPTURE(capture_jit) and adds every other folder injit_capture/; a Mac build's run command captures play intojit_capture/play. A request already in the folder is not captured again, so a session whose code memory lies elsewhere than every earlier one's (one that started after an in-process program switch) may hold only its later requests, whose code calls boot code it did not capture: the builder leaves such a session out with a red line (capture session <base> left out …, with how many of its requests no other session has) and builds from the rest.DM_JIT_MISS_DUMP=<dir>writes a missing request's input. - Found on: Super Mario 3D All-Stars: Super Mario 64: command 4's request struct leaves 4 padding bytes uninitialised, which differed once the plugin no longer ran; the image is about 14 MB, and the JIT layout a second reservation of 0.96 GB on the iPhone.
- Check:
test_jit_capture.py(dm/tools/tests). - Note: a request the image lacks stops the app there: play that part on the Mac and pack again. Not run on a device yet.
Nintendo-extension glyphs for button icons
- Symptom: controller-button icons in text show as
?. - Cause: those glyphs come from the system shared font's Nintendo-extension set (private-use code points; Mario's
GameMsg/Key.msbtuses U+E0E0–E0F0 for A/B/X/Y/L/R/ZL/ZR/SL/SR/D-pad/+/−, U+E0AB–E0AE for D-pad directions, U+E090–E097 for stick arrows, U+E100/E101 for sticks). - Fix:
dm/tools/make_ext_font.pygenerates a stand-innintendo_ext.ttfwith those icons (make_shared_fonts.pymakes it with the other stand-ins); the host serves it for shared-font type 5 (DM_FONT_DIRorDM_SHARED_FONT_EXT). - Note: to find which code points a title uses, scan the
TXT2sections of its MSBT files for U+E000–F8FF. - Found on: Super Mario Bros. Wonder.
Shared fonts on iOS
- Symptom: on a phone,
GetSharedFontLoadStatewould report "not loaded". - Cause: the macOS stand-in path (
/System/Library/Fonts/Supplemental/Arial Unicode.ttf) does not exist on a phone. - Fix: the iOS app ships the stand-ins in
dm/font/(build_ipa.shmakes them withmake_shared_fonts.py) and setsDM_FONT_DIR. - Found on: every game on iOS (general).
Shared font stand-ins sized for the game's font engines
- Symptom: a crash after the shared fonts load, looking up the "?" glyph (
nro0+0xaef8a8, a null pointer from nn::font's texture cache), withScalableFontEngine::LoadFontreturning 201 on one engine and 0 on another, andSetFont301. - Cause: a game sizes each
nn::fontllengine's work memory for Nintendo's font of the type it loads there, and the host served macOS's Arial Unicode as it is for types 0-4. Mario Tennis Fever gives its first engine 512 KB and its second, the one its glyph thread uses, 50 KB (0xc800), andFSS_load_fontneeds 56-60 KB for Arial Unicode there: 201, ignored by the game, so the name stays unknown to that engine,SetFontfails and every lookup misses. What it needs grows with the font's hinting program (Arial Unicode: a 4,139-element interpreter stack, a 9 KBprep) and its outlines and layout tables, hardly with its glyph count. Measured on that engine (its buffer shrunk by a test take-over, a boot each): Arial Unicode as it is 56-60 KB, unhinted 44-48 KB, a hinted 7,430-glyph Japanese cut 44-48 KB, the same cut unhinted at most 32 KB. - Fix:
dm/tools/make_shared_fonts.pymakes one stand-in per type, unhinted, with the layout tables but kerning dropped, holding its type's characters (standard: Latin, Greek, Cyrillic and cp932's Japanese; GB 2312; the other GBK hanzi; Big5; every modern Hangul syllable with KS X 1001) and a name of its own, as a game can load several types into one engine; the host serves each type its own file fromDM_FONT_DIR(hle_sdk16.c,font_file), a type without one the standard font. The NSP script makes them into<id>_build/fontandbuild_ipa.shinto the app. On that 50 KB engine standard, both Simplified Chinese fonts and Traditional Chinese need 24-32 KB, Korean 32-40 KB; every engine runs on the game's own buffer, as on the console. Before this the host gave every engine under 512 KB that much host memory in a take-over ofScalableFontEngine::Initialize,FinalizeandGetPointerToWorkBuffer(PR #2707's registry of them), removed with the cause. - Checked: Super Mario Party (
010036B0034E4000, SDK 5) loads all six types into each of its four shared-font engines (512 KB and 768 KB): every load returns 0, each under its own name. The old stand-in gave all five of types 0-4 the one nameArial Unicode MS. - Open: engine sizes are measured on one game. A game that loads several types into a small engine needs their sum there, and one whose engines are smaller than a font needs fails with 201 as above. Type 0 now holds no Chinese or Korean, as on the console, so a game that draws those from type 0 alone shows
?. The fonts are drawn unhinted. - Found on: Mario Tennis Fever (SDK 20.5.17). Kirby's Dream Buffet, issue #1569, logged the old take-over's
[RED] more than 16 font engines with a small work buffer; its later crash is not shown to follow from it.
C library, time and random numbers
Time zone rules, calendar conversion and the network clock
- Symptom: saves dated 18:00:02 31/12/1969 (
ToCalendarTime: first conversion 2 → 1969-12-31 18:00), and Continue, which takes the newest save, loads an older one. - Cause: the host failed
time::StandardNetworkSystemClock::GetCurrentTime, and the game kept the PosixTime it had (2). A Switch keeps its network clock from its last time sync, so one that has ever been online reads it offline too. The SDK'sStandardNetworkSystemClock::now()never callsGetCurrentTime: it reads the time service once its own initialized flag is set, which the host'sInitializetake-over never sets, and returns 0 (1970) otherwise (Ocarina of Time'ssdk+0x5d8490). - Fix: the network clock is the host's clock, as the user clock (
DM_FIXED_TIMEincluded), since the host's clock is set from the network:GetCurrentTime,now(), and the network fields of the host's clock snapshots (below).t_timechecks all three. Also hooked:time::ToPosixTime(hostmktime), andtime::ToPosixTimewith an explicit rule (the host's zone, as forToCalendarTime);time::LoadTimeZoneRuleand theToCalendarTimeoverload with a rule (the host's zone is used);time::StandardNetworkSystemClock::IsAccuracySufficient(no: the host does not know when its clock last synced). The network clock's context and the adjustable clocks follow the same rule (below).time::GetDayOfWeekis a pure computation and needs nothing. - Reach:
maincalls the network clock in Breath of the Wild, Tears of the Kingdom, Mario Kart World, Minecraft Dungeons II, PRAGMATA, Super Mario Party and Ocarina of Time (now()too); Pokémon Sword and Shield, Brilliant Diamond and Animal Crossing: New Horizons import it. - Found on: Divinity: Original Sin 2 (SDK 8.2.0; first brought up in DroidPlay Core, an Android fork that shares this host, from PR #2359: the network clock); 13 Sentinels: Aegis Rim (SDK 11,
ToPosixTime); Monster Hunter Rise (SDK 11, the rest); Octopath Traveler 0 (GetDayOfWeek); Pokémon Legends: Z-A (19.3.11,ToPosixTimewith an explicit rule, found in the imports before it was met).
The C library's local time is UTC, as on a Switch
- Symptom: times a game shows through the C library are off by the host's UTC offset: Hades II's load screen dated a save made at 01:44 KST (UTC+9) 16:44 the day before, its UTC time. The save file itself holds the right time.
- Cause: the host took over
localtime,localtime_randmktimewith its own local-time functions, on the belief that the SDK converts by the system time zone. It does not: the SDK's musl time zone helper (__secs_to_zone) is a fixed stub (offset 0, no daylight saving, name"UTC") in everysdkchecked, SDK 3.5.0 to 22.2.10 (Xenoblade Chronicles 2 to EA SPORTS FC 27, the Switch 2 builds included). Local time on a Switch comes only fromnn::time. Hades II turns its save header's time into a UTCstruct tmwithgmtime_r, back into seconds withmktime, then into a calendar withtime::ToCalendarTime. The host'smktimeread the UTCtmas local time, 32,400 s early in KST, andToCalendarTimeadded the offset back once. The take-over came from the D2R port, whose chronicle times (localtime+strftime) differed from the wall clock by the zone's offset. They do on a Switch too. - Fix: the take-overs are gone, so the SDK's own functions run. The pass-through table (
hle_table.c), used only when no module defines them, mapsmktimeto the host'stimegmandlocaltime_rtogmtime_r.nn::timekeeps converting in the host's zone (above).t_timechecks both withTZ=Asia/Seoul. - Found on: Hades II 1.0.141667 (SDK 20.5.15; issue #2784:
gmtime_rfrommain+0x4301bc,mktimefrommain+0x430a4c,ToCalendarTimefrommain+0x430d18).
Steady clock, clock snapshots and user clocks
- Symptom: SDK calls that reach the time service, each aborting in
sm::Initialize(or found in the imports before they were met). - Fix:
time::StandardSteadyClock::GetCurrentTimePoint: host monotonic seconds, fixed source ID;GetSpanBetweenruns insdk(The Legend of Zelda: Breath of the Wild 1.9.0, SDK 20.5.22).time::ClockSnapshot::CreateWithStandardSystemClockandCreateWithAdjustableSystemClock: 0xD0 bytes, filled on the host from the steady clock, the user clock and the calendar; the network fields are the user clock's, as the network clock is (Time zone rules, calendar conversion and the network clock), so two host snapshots take their span from their steady time points and one made on a Switch from the network times. The type byte at+0xcdis 1 for standard and 2 for adjustable snapshots (0 means uninitialized), as verified in Tears of the Kingdom's SDK. The adjustable entry also dereferences the absent time-service session without a host take-over.t_timechecks both registrations, guarded buffers, the adjustable calendar and location, and snapshot arithmetic. The adjustable crash and boot fix were reported for Tomodachi Life: Living the Dream in PR #385; that gameplay report has not been repeated here.- The adjustable user clock (
time::AdjustableUserSystemClock::GetCurrentTime, which the game's days follow) reads the time service's shared memory in the SDK (MonotonicSystemClock::GetCurrentTime,sdk+0x4421cc), which the host never maps, so it is the host's clock, as the user clock;time::GetStandardSteadyClockCurrentTimePoint, the free-function form of the steady clock (Animal Crossing: New Horizons SDK 20.5.4, found inmain's imports before the first boot). time::StandardSteadyClock::now(), the C++ clock form: a time point of seconds inx0. The SDK asks the steady-clock sessiontime::Initializeopens and returns 0 without one (SDK 3.7.0,sdk+0x16edf4in Mega Man Legacy Collection, which calls it from six sites inmain); the host takes overInitializeand opens none, so the clock never moved. It is the host's monotonic seconds, asGetCurrentTimePoint. Reported in PR #2729.
- Found on: The Legend of Zelda: Breath of the Wild, The Legend of Zelda: Tears of the Kingdom, Animal Crossing: New Horizons, Mega Man Legacy Collection.
A game restart reports a user clock change
- Symptom: after a normal game restart on the same Mac, Pokémon Brilliant Diamond can record a new time penalty and skip daily or weekly events.
- Cause: the first user clock context in each process subtracts the whole-second steady time from the whole-second wall time. The result depends on the sampling phase and can vary by one second without a wall-clock adjustment. The context refresh also compared the wall time to guest ticks, which can stop while the steady clock keeps running.
- Fix: bracket the wall-time read with steady-clock reads, subtract at nanosecond precision, and round the resulting offset to whole seconds. Use that clock pair for the snapshot and retain the existing in-process refresh threshold of more than one whole second.
t_timeruns the first sample at two phases in fresh processes and checks the threshold, forward and backward adjustments, and elapsed time while guest ticks are suspended. - Found on: Pokémon Brilliant Diamond 1.3.0 on macOS. The change covers game restarts on the same host boot.
The adjustable network clock aborts in Adjust
- Symptom:
game called nn::diag abort: Result 0x74, call site sdk+…within the first frames, the backtrace's firstsdkframe right pasttime::AdjustableNetworkSystemClock::Adjust(its last instruction is the call ofdiag::detail::AbortImpl, so the return address names the next function,GetSystemClockContextof the same class). Any other reader of an adjustable network clock, or the adjustable user clock'snow(), aborts indiag::detail::AbortImplundertime::detail::MonotonicSystemClock. - Cause:
AdjustcopiesStandardNetworkSystemClock::GetSystemClockContextinto the SDK'sdetail::MonotonicSystemClockand aborts on its failure; the SDK asks the time service, which the host never opens, and gets 0x74. Past that, every adjustable reader goes throughMonotonicSystemClock::IsAdjusted,GetCurrentTimeorGetCurrentTimespec, which turn the stored context into a time through the time service's shared memory, which the host never maps, and abort without it (Nintendo Switch Sports Resort'ssdk+0x5d96e0..+0x5d985c). The adjustable network clock'sGetCurrentTime,now()andGetSystemClockContexteach callIsAdjustedfirst; the adjustable user clock'snow()callsGetCurrentTime.GetStandardNetworkSystemClockCurrentTimespec(SDK 17) reads the shared memory too and returns 0x74. - Fix: on the host the network clock is the user clock (Time zone rules, calendar conversion and the network clock) and each adjustable clock is its standard clock, in every reader.
hle_time.canswersStandardNetworkSystemClock::GetSystemClockContext,AdjustableUserSystemClock::GetSystemClockContextandAdjustableNetworkSystemClock::GetSystemClockContextwith the user clock's context (the one the host's snapshots carry at+0x00and+0x20),AdjustableNetworkSystemClock::GetCurrentTimeand thenow()of both adjustable clocks with the host's clock, and both network…CurrentTimespecgetters with the host's real time (DM_FIXED_TIMEincluded).Adjustruns as is and only sets the SDK's copy.t_timechecks each of them against a snapshot, the contexts within their 0x20 bytes. - Found on: METAL GEAR SOLID: Peace Walker - Master Collection Version (
0100C6F01C4F8000, 1.3.1, SDK 19, not in the games table), program 1, which its launcher starts: it aborted inAdjust(sdk+0x42c514on that build) right after its first frames. Found and diagnosed by varyform in PR #1875, whose first fix (a zero network context) ran it on for 90 seconds (2100 frames) with sound on an M3 Max; the fix as landed has not been run on that game here (no game files).
A periodic benefit claim without the time service session
- Symptom:
Break#1 reason=0 Result=0 svc at sdk+0x370f24right after the first save at the title, withbt: sdk+0x175f00 sdk+0x175fc4 sdk+0x176060 sdk+0x375b88 main+0x6ea74 …(diag::detail::OnAssertionFailurecalled fromtime::ClaimPeriodicBenefitWithUserSystemClock). - Cause: the public
time::ClaimPeriodicBenefitWithUserSystemClock(a once-a-day reward) asserts thattime::g_pStaticService, the time service sessiontime::Initializeopens, is set; the host takes overInitializeand opens none. The work is intime::detail::ClaimPeriodicBenefitWithUserSystemClock, which only compares the snapshots' fields throughCalculateSpanBetweenandCalculateStandardUserSystemClockDifferenceByUser(both host take-overs) and asks the service two things: when automatic correction was last switched, if the context's snapshot and this one differ in it (+0xcc), and the device's location and when it was set, if they differ in location name. Host snapshots never have automatic correction and always carry the host's zone name, but a claim context saved on a Switch (a location such asAsia/Tokyo) or a Mac whose zone changed reaches both, again with no session. - Fix: an
HLE_FORCEon the public entry calls the SDK'sdetail::implementation directly (hle_time.c), and logstime: periodic benefit claim → <result>; past its session check the public entry does only that (SDK 6.5 and 20.5). The two service questions are taken over too:detail::GetDeviceLocationNameAndUpdatedTimeanswers the host's zone name, as its snapshots carry, and both it anddetail::GetStandardUserSystemClockAutomaticCorrectionUpdatedTimeanswer a cleared time point. The host does not know either moment, and the claim uses such a time point only when its source ID is the current snapshot's steady clock's, which a cleared one never is. - Found on: Tetris 99 (010040600C5CE000) 2.5.0, SDK 6.4 (the same
sdkmodule as ASTRAL CHAIN), from a provisional profile: the claim returned 0, then 1 on the next check, and the title screen kept running for three minutes at about 56 fps.
Hooks whose return type did not match the SDK
- Symptom: a call the host answers reads as failed when it succeeded, or reads leftover register bits. Super Smash Bros. Ultimate refills the Spirit Board at every visit, since the elapsed time between two snapshots never reads as known.
- Cause: four take-overs declared another return type than the SDK's own function:
time::CalculateSpanBetweenreturns bool (true when the span is stored), and the host returned a Result 0;nifm::HandleNetworkRequestErrorResultreturns bool, and the host returned a Result whose low bit happened to be 0;audio::AcquireAudioDeviceNotificationForOutputandpl::BeginVrModereturn a Result, and the host's werevoid. Checked in thesdkof SDK 12 to 20 (Metroid Dreadsdk+0x3ab540,+0x336210,+0x534a0; Breath of the Wildsdk+0x412970). - Fix: each returns what the SDK does: the span call 1 or 0; the network call 0 (not resolved, offline); the notification 0 the first time and 0x499 (already acquired) after;
BeginVrMode0xd08e, the SDK's own answer whenpctl::CheckStereoVisionPermissionrefuses, which the host now does too, having no VR display (Breath of the Wild's options then stay 2D, as MacNativeGames found).t_timechecks the span call's values. - Found on: reported by MacNativeGames on Super Smash Bros. Ultimate (the Spirit Board) and Breath of the Wild 1.6.0 / 1.9.0 (the VR option); the Spirit Board was not replayed here.
clock_gettime(CLOCK_REALTIME) through the time source pointer
- Symptom:
std::terminate(Breakfromsdk+0x5bfa48) at the first real-time read (right after the first-boot dialog,main+0x3f3f68→system_clock::now()). - Cause:
clock_gettime(CLOCK_REALTIME)calls through a source pointer (sdk+0xb05010) thatnntimeStartupsets oncetime::Initializesucceeds: 1 =nn::time::GetStandardUserSystemClockCurrentTimespec, 2 = the adjustable clock's (sdk+0x8e414). Both asked the time service. - Fix: they are host take-overs now (
hle_time.c), andsystem_clock::now()works on any build. - Found on: Ace Attorney Investigations Collection (1.0.0.2, SDK 17.5.3).
Guest clock reads wait while the app is in the background
- Symptom: after switching apps and back, one guest thread at 100% in a tight loop (
main+0x9abd0,x10 = 0); the game freezes, picture still, sound on. Mac reproDM_OE_SCRIPT=bg=1@20,bg=0@25. - Cause: the frame pacing measured a frame period of 0 (
main+0x5926a8: the clock difference between two frames). The host freezes the guest clock in the background but its threads went on, so two frames read the same time. - Fix: guest reads of the system counter (the
cntpctgate,svc GetSystemTick) now wait while the app is in the background (hle_os.cguest_clock_read_wait); host work and the keyboard freeze (The software keyboard blocks only its caller) keep the frozen clock. - Found on: Super Mario Galaxy 2 (one of two causes; the other is Focus handling mode decides whether focus changes are notified).
Cryptographically random bytes
- Symptom: abort in
sm::Initializeundernn::crypto::GenerateCryptographicallyRandomBytes(Unicorn Overlord:std::random_device→ thesdk's owngetentropy→InitializeCsrng; Z-A: the first call innnMain,main+0x1734b4). - Cause: the bytes come from the csrng service. The
sdkdefinesgetentropy, so the host'sgetentropyhook never sees the call, but the call intonn::cryptogoes through thesdk's PLT. - Fix: an
HLE_FORCEon it fills from the host's entropy stream, the same stream asgetentropy(hle_os.c). - Found on: Unicorn Overlord (SDK 16.2.4; one boot), Pokémon Legends: Z-A (19.3.11; one boot).
clock_gettime is nn::time's steady clock (SDK 22)
- Symptom:
libc++abi: terminating due to uncaught exception of type std::__1::system_error(the arguments came out as rubbish, the format named the failure) once the game's own code ran, withsdk+0x5f2e60(std::terminate) andsdk+0x66ad2c/sdk+0x66acc8(get_terminate/terminate) in the backtrace. - Cause: SDK 22's exported
clock_gettime(sdk+0xa1430) acceptsCLOCK_REALTIMEandCLOCK_MONOTONICand returnsENOTSUPfor ids 2–11; both accepted ids jump through musl ifunc slots in the SDK's data (sdk+0xba5018,sdk+0xba5020) whoseR_AARCH64_GLOB_DATrelocations bindnn::time::GetAdjustableUserSystemClockCurrentTimespec,_ZN2nn4time41GetStandardUserSystemClockCurrentTimespecEP8timespecand_ZN2nn4time37GetStandardSteadyClockCurrentTimespecEP8timespec(sdk+0xb92298). The first two were answered from the CLOCK_REALTIME entry; the steady one was not, so the SDK's shared-memory client ran, could not read the time service's page, and returned an error, whichstd::chrono::steady_clock::now()(sdk+0x5f2e10:mov w0,#1; bl clock_gettime; cbnz w0→std::__1::__throw_system_error) turned into the exception. - Fix:
hle_time.canswersGetStandardSteadyClockCurrentTimespecwith the host's monotonic clock (struct timespecfromclock_gettime(CLOCK_MONOTONIC)). The network-clock variants answer the host's real time, as the network clock is the user clock (The adjustable network clock aborts inAdjust). To name such a failure,hle_sdk16.ctakesnn::diag::detail::VAbortImpl(an assert, an uncaught C++ exception or an SDK check with a message): it logs[diag] abort at <function>: <expression> (<file>:<line>) message format <format>and then aborts asAbortImpldoes. Only the format is printed: the host cannot expand ava_listthe guest built. - Check: with
DM_AUDIO=1, a run to the first room has no[diag]line and the frame counter keeps advancing. - Found on: Well Dweller (SDK 22.2.0), in
std::chrono::steady_clock::now()called from GameMaker's frame-timing helper.
Modules and symbols
Host symbol indexes avoid repeated name scans
- Symptom: relocation repeatedly scans all HLE and forced-takeover entries, and named-stub reuse becomes quadratic as more imports are missing.
- Cause: module exports already had a name index, but
resolve_import,hle_implements,force_lookupand stub reuse still searched their tables linearly. - Fix: open-addressed name indexes store entry numbers. HLE duplicates retain the first entry; forced-takeover duplicates still abort. Stub insertion grows its index above half capacity and retains existing stub numbers. Resolution is serialized at startup and by the module write lock during runtime NRO loading; module string tables stay mapped across unload.
- Found on: The Legend of Zelda: Breath of the Wild, reported in PR #261.
- Check:
make -C dm/host/tests GAME=010015100B514000 symbols nrocovers collisions that wrap around the table, duplicate precedence/rejection, absent sections and names, counting-wrapper selection, all 4,096 stubs through growth and reuse at capacity, and NRO relocation/lifecycle. The symbol test also passes AddressSanitizer and UBSan. A local arm64 Mac synthetic 270-entry HLE table with 25% misses, Apple clang 21 at-O1, took 375–442 ns per linear lookup versus 15 ns indexed (25–29x; three runs of 360,000 lookups). This measures lookup cost, not overall game loading time; no new gameplay run here.
Global symbol resolution in load order
- Symptom: a library's
freerejects a pointer (CentralHeap::Free→NotNMallocPtrError). - Cause: the game's
maindefines its ownoperator new/delete(Unity's memory manager) andsdkhas a copy forwarding tomalloc/free. - Fix: symbols are resolved globally in load order (the first module's definition wins, also for a module's references to its own exports); only local / non-default-visibility symbols bind to the module itself (
loader.c). The loader logs how many references bind to an earlier module.
Module initializers run dependencies first
- Symptom: a crash during
main's static initializers, beforennMain:CRASH sig=11 addr=0xffffffffffffffe8 pc=sdk+0x46d880 lr=main+0x164410— a null-vptr read inside the sdk module'sstd::ostream::write, called from a game log helper thatstd::cout.writes its first line. - Cause:
run_module_initscalled each module's DT_INIT in forward order of the load list (main, subsdk0, sdk). The list puts dependents first and dependencies last:main's initializers already write tostd::cout, which the sdk module's DT_INIT (libc++'sios_base::Init) constructs, so the game wrote to a not-yet-constructedcout. - Fix: the DT_INITs run in reverse load order (
loader.c), so a module's dependencies initialize before it; the timing is unchanged (afternninitStartupand_init_libc2, beforennMain). - Found on: Little Busters! Converted Edition (
0100943010310000, 1.0.0, SDK 8.3.2), a provisional profile, no note (not in the games table). With the fix the game passes all module inits and boots; If My Heart Had Wings (01001AC00ED72000) boots unchanged with the same host.
Undefined weak imports bind to 0
- Symptom: a weakly imported function the game calls although nothing defines it: an
UNIMPLline, then an abort. - Cause: the loader bound every undefined import to a named stub, so the address test the compiler emits for a weak symbol saw a function.
- Fix: an undefined weak symbol that no module defines and the host does not implement is now 0, as Horizon's rtld binds it (
loader.c, logged asundefined weak … bound to 0). - Found on: Octopath Traveler 0 (the
thread_localinit function_ZTHN13LowLevelTasks5FTask10ActiveTaskE).
nn::ro and its port
- Symptom: crash in
nn::ro::InitializeWithPortName. - Cause:
nn::roconnects toldr:ro. - Fix: take over
Initializeand answerLookupSymbolfrom the loaded modules (hle_ro.c). Check the mangled names against the new title's imports: SDK 19'sLoadModuletakes one more bool (_ZN2nn2ro10LoadModuleEPNS0_6ModuleEPKvPvmib), so the hook for the older form did not catch it and the SDK's own code would have run. - Found on: Hades II (SDK 19's
LoadModule).
ro::ProtectRelro runs natively
nn::ro::ProtectRelro(called frommain's DSO init), a new import of SDK 20, needs nothing: it runs natively on the host's no-opSetMemoryPermission/SetMemoryAttribute. Found on The Legend of Zelda: Breath of the Wild (1.9.0, SDK 20.5.22).
The SDK rejects a module that svcQueryMemory finds
- Symptom:
Failed to get our const data section!beforennMain. The SDK'sGetRequiredBufferSizeForGetAllModuleInfofinds the game's code mapping but returns zero. - Cause:
nn::ro::GetModuleAddressRangeandLookupModuleSymbolby base consult the guest rtld lists. The host runs its own loader, so the SDK's automatic-load list is empty. The native range lookup rejects the game's code address, and the native symbol lookup returns0xa16for its ownnndetailRoGetRoDataStartexport. - Fix: answer both
nn::rolookups from the host's loaded modules. The module size ends at the 4 KiB-aligned MOD0 bss end, as rtld computes it. The symbol lookup takes the exact module base and searches that module. The SDK keeps its own module list and calls the game's exports for the exact read-only data range. See also whole-process memory walks. - Found on: Hitman Absolution, PR #3023 (v131072, SDK 22.2.0). The native walk lists all four modules and both boundary exports resolve before
nnMainon the Mac.
Loading NROs with ro::LoadModule
-
Symptom: the frame loop runs, but the game waits for code it loads itself (
ro::RegisterModuleInfo/ro::GetBufferSizered lines;mainimports 1,045lua2cpp::create_agent_*functions, global, that no ExeFS module defines, bound to stubs at start). -
Cause: the fighters' code is 98 NROs inside
data.arc, registered by.nrr/cross2_*.nrr. The SDK's ownLoadModule(SDK 8.2.1LoadModuleInternal,sdk+0x347460) uses the service only to map the image, then zeroes bss, relocates through rtld's module lists, calls the module's init and binds the variables of the modules loaded before; the host replaces rtld, so it takes over the whole call. -
Fix: the NROs are collected at pack time by the SHA-256s the NRRs list (
dm/tools/nro_collect.py: loose files, the current files of an indexed archive, or a scan for stored and zstd-framed NROs; Smash's NRRs of older releases also register 666 superseded copies, whichdata.arcstill holds and which are left out), rewritten like any module (patch_nso.pyreads NROs: the flat image, segments at +0x20, build ID at +0x40) and listed in<patched dir>/nro.tsv. The host maps them all at start and keeps them out of symbol lookups;LoadModulefinds one by the image's SHA-256, restores its data and bss (after the first load), relocates it against the modules loaded then in load order, binds the earlier modules' symbol relocations it defines (main'slua2cppstubs), fillsnn::ro::Moduleas the SDK does (+0 module, +8 state 1, +0x10 image, +0x18 buffer) and calls itsDT_INIT;UnloadModulecallsDT_FINIand binds every relocation that pointed into it again (loader.c"NRO modules",hle_ro.c).GetBufferSizereturns the bss size from header +0x38 as the SDK does. The startup init pass must skip NROs (their init ran unrelocated and crashed). Only data is written at a load, so it works with code embedded in the iOS executable:gen_embed.pypacks the NROs into three sections (__dm_nro_x0,__DM_NRO_W,__dm_nro_x1) and a table of their pieces (__dm_nro_tab), since a Mach-O file has at most 255 sections and three per NRO would pass it, andmap_imagemaps an NRO from there (loader.cnro_pieces). -
Found on: Super Smash Bros. Ultimate (13.0.5): it loads six NROs in its first 30 s and calls none of the stubs. Played on an iPhone.
-
.nrolz: NERD's Hagi keeps a recompiled game as an NRO packed as a big-endian u32 size, then one LZ4 block (Super Mario Sunshine (Super Mario 3D All-Stars):data/gekko/MarioSunshine/nx/MarioSunshine.nrolz), which it unpacks and hands toro::LoadModule, so its SHA-256 is the unpacked image's.dm/tools/nro_collect.pyunpacks such files too and matches them against the NRRs.
NRO tables sized from the manifest and snapshots taken on demand
- Symptom:
FATAL .../nro.tsv: more NROs than module slots (MAX_MOD 128)beforennMain(GitHub issue #372); after increasing the capacity, startup eagerly copies several GB of inactive NRO data and bss. - Cause: the host used fixed 128-entry module and activation tables. It also allocated and copied every NRO's full writable image at startup so reload could restore it, including initially zero bss.
- Fix: count the manifest once before loading and allocate both tables at their final size, preserving every
module_taddress. Keep each NRO's initialized data only when it is first loaded, before relocation and initialization. Reload restores that data and zeroes bss; unused NROs need no snapshot. The original NRO header supplies the initialized data size. - Found on: FINAL FANTASY X/X-2 HD Remaster, 1,432 NROs plus three initial modules; 5,836 MB of writable data and bss versus 767 MB of initialized data across all NROs. Most effect modules stay inactive on a short route.
- Check:
make -C dm/host/tests GAME=01007BB017812000 nroexercises manifest sizing, the last slot of a 1,435-slot table, load order, initialized-data restoration and zeroed bss after reload.
Online SDKs in NROs are never loaded
- Symptom:
[EOS] Failed to create platform;refused …: an online SDK (Epic Online Services), not loaded;refused an NRR that registers only online SDKs (1 hashes). Shredder's Revenge crashed on a null platform during startup. - Cause:
ro::LoadModulerefuses the EOS SDK, so unresolvedEOS_*imports used generic stubs returning zero. Zero signals failure in the platform pointer returned byEOS_Platform_Createand success in the status returned byEOS_Initialize. Shredder's Revenge checked the initialization result and then dereferenced the null platform wrapper. - Fix:
hle_ro.csuppliesEOS_Initializeas an import fallback returningEOS_NotImplemented, so the game takes its own initialization failure path. The loader still refuses EOS NROs by the packer'srefusedrow (dm/tools/nro_collect.py) or by theEOS_Platform_Createexport in older manifests. An NRR that names only refused modules fails registration. EOS initialization contract - Found on: Absolum (SDK 18.3.2, one boot each); Hades: it never asks for the module (checked on 1.0.38233:
refused an NRR that registers only online SDKs (1 hashes), noLoadModule, its frames as before). Hades'mainimports only EOS Auth, Connect and PlayerDataStorage, Epic-account cross-save the host cannot serve; the real SDK would at best fail its login and at worst wait on time-outs or contact Epic's servers, with an unknown risk to the player's account. Teenage Mutant Ninja Turtles: Shredder's Revenge continued to initialize EOS after both registration and loading failed. The game also has two character-select lobby calls that require a separate fix in its own code. - Note: open question for the maintainer: always load, refuse online SDKs (as now), or decide per profile.
GPU driver modules that are never loaded
- Symptom:
mainimports EGL (SDL3's GL support) andvkGetInstanceProcAddr(its Vulkan support), but the game renders with NVN (FNA3D_Driver_NVN.cpp). - Cause: NVIDIA's OpenGL and Vulkan drivers (
subsdk1,subsdk0) program the GPU through NvRm, which the host does not have. - Fix: they are never loaded (
profile_guess.pyGPU_DRIVERS); the EGL imports stay unbound stubs that nothing calls. - Found on: Absolum (FNA3D).
Modules only the NROs import from
- Symptom:
UNIMPL _ZN5movie12SetAllocatorEPFPvmmS0_EPFvS0_S0_EPFS0_S0_mS0_ES0_,UNIMPL glslcInitialize, thenUNIMPL _ZN5movie9ExtractorC1ENS_13ContainerTypeEand a crash reading address 0x18 in an NRO (pc=nro18+0x97f4) as the first movie starts. - Cause: the provisional profile loads a subsdk only when
mainimports something from it that the host does not supply. The survey extracts only the code modules, so the NROs in the RomFS were not looked at. Portal'smainis a launcher with SDL; its Source engine NROs play the movies through NintendoSDK_movie (subsdk2, imported byvideo_nx.nro) and initialize and call GLSLC (subsdk0, imported bymaterialsystem.nroandvideo_nx.nro). Left out, their imports were bound to stubs, and the stub constructor ofmovie::Extractorleft the object empty. - Fix: once the rewrite stage has collected the NROs, the NSP script adds to a provisional profile every subsdk whose exports an NRO imports and that no loaded module, other NRO or host hook supplies (
profile_guess.pynro_modules, written under a sectionAfter the NRO collection). NVIDIA's GPU drivers stay out, as above. - Found on: Portal (
modules main subsdk0 subsdk2 sdk;subsdk1, NVIDIA's OpenGL driver, stays out).
A module the NROs import from, missing from the build row
- Symptom: a game with a provisional profile stays black where its opening movie plays; the log has
modules of main's build …: main sdk (the profile lists 3), andmovie::Extractor's constructor is unimplemented. - Cause: since the host loads the modules of the
buildrow for main's build (A derived profile leaves out a module that moved to another slot), a module inmodulesalone is not loaded. The NRO step above added its subsdks tomodulesonly, and the provisional profile's row, written by the survey, named the modulesmainimports from. - Fix: after the NRO collection,
provisional_modules(scripts/build_ipa_from_nsp.py) writesmodulesand completes the row of this ExeFS's main build in one write: every module ofmodulesthe ExeFS has, with its build ID. It runs on every build of a provisional profile, so a profile written before is repaired; the rows of other versions packed from the same folder are left as they are. A changed row rebuilds the Mac host, which has the rows compiled in. - Found on: Mario Golf: Super Rush (4.0.0, issue #814), from the PR author's run (PR #2215):
subsdk0(NintendoSDK_movie) inmodulesand not in the row; with it in the row the opening movie plays (4,921 frames decoded) and the title follows; on the Mac here too (M6, 2026-11-13).
ro::LookupModuleSymbol for a name the module does not define
- Symptom:
[RED] ro::LookupModuleSymbol BuiltDebug: not defined in that moduleonce at boot; nothing goes wrong after it. - Cause: the Source engine asks each module it loads for
BuiltDebug, which only its debug builds define.ldr:rofails such a lookup on Horizon too, and the game takes the failure as "release build". - Fix: the host's answer was already Horizon's (a failure result). The line is no longer red when the module is a loaded one; a lookup in a module the host does not know stays red (
hle_ro.c). - Found on: Portal.
IL2CPP common string table intact
- Not needed in the end: the tolerant common string table of pull request #15. Ace Attorney Investigations Collection 1.0.0.2's
mainhas the table intact atmain+0x46169ac, 109 entries ending atHash128.
Code inherited from another title at fixed addresses
- Symptom: harmless on the build it was written for, silent memory corruption on any other.
- Cause: code that calls fixed module addresses. d2r-mobile's 3D render scale read a renderer pointer at
main+0x31e0848and calledmain+0x8582f0; in Mario v0 that is the middle of a static initializer and only did nothing because the pointer happened to read 0. - Fix: such code checks
module_t.build_idnow (written intofixups.tsvby the rewriter) and stays off on other builds. - Found on: Super Mario Bros. Wonder (v0, code inherited from d2r-mobile).
Built-in fonts and the audio device notification of SDK 21
- Symptom: an abort connecting to
pl:uat boot; a failednn::audiocall at boot. - Cause: SDK 21 has new names:
nn::pl::GetBuiltInFontData(a Switch 1 and a Switch 2 overload, each filling type, address and size, and returning whether the font is loaded),nn::pl::GetBuiltInFontDataSet(the same for a list of types, a Switch 2 and a Switch 1 overload: at most 6 and 7 types, one byte each,*countentries of 0x18 bytes in order, returning whether the fonts are loaded; the Switch 1 overload sets*countonly when they are) andnn::audio::AcquireAudioOutputDeviceNotification. Unhooked, they reach the services the host does not have. - Fix: all hooked (
hle_sdk16.c,hle_audren.c), with the same stand-in fonts and the same never-signaled event as their older names. Both font-set overloads fill each type asGetBuiltInFontDatadoes, in the order asked, and leave out a type with no stand-in font (t_shared_font). - Found on: Splatoon Raiders;
GetBuiltInFontDataSeton Kirby and the Forgotten Land's Nintendo Switch 2 Edition (program04004D300C5AE001, at boot).
The Joy-Con mouse pointer
- Symptom: an abort in
nn::hidat boot, in a Switch 2 game that sets up the Joy-Con's mouse mode. - Cause:
InitializeNmouseopens the hid service, and the host has neither the service nor the sensor. - Fix:
InitializeNmouse,GetNmouseHandles(none), the button configuration calls and the merged pointer's calls (a handle with no states) are hooked (hle_hid.c). SDK 21's forms too:InitializeNmousewith a pointer type, the pointer range, movement area and restriction (kept or dropped), the USB mouse's button configuration and handle (none), and the calls on a handle, which return the SDK's bool (SDK 22.2.0sdk+0x6d5510: its result is success): the merged handle 0 takes the pointer settings and has no state and no controller; any other handle is unknown. - Found on: Fire Emblem Fortune's Weave, Pokémon Pokopia. SDK 21's forms: Mario Kart World 1.8.0 at boot, from pull request #1116 (that build is not run here).
The Joy-Con 2 mouse sensor and pointer
- Symptom: a Switch 2 game's mouse mode does nothing with Joy-Con 2s: its pointer stays still, or a game that offers its mouse modes only to Joy-Con 2 controllers finds none.
- Cause: the host answered the sensor's calls as having no sensor (
GetJcmsStatesnone,GetJcmsStatea cleared state,GetNmouseHandlesnone), and a Joy-Con 2 pad had only the plain Joy-Con styles. A Switch 2 game can also support only the Joy-Con 2 forms of the Joy-Con styles: style bits 12, 13 and 14 for JoyDual, JoyLeft and JoyRight. Those bits are inferred: Nintendo Switch 2 Welcome Tour's mouse exhibits support only0x1000and test a pair with0x1004, a left Joy-Con with0x2008and a right one with0x4000beside JoyRight. - Fix:
- A front end reports each Joy-Con's sensor with
dm_joy_mouse(dm_input.h): the movement since its last report and whether it is connected and on a surface. A Joy-Con 2 pad says it is one (dm_joy_attachwithDM_JOY_2), and its npad then shows the Joy-Con 2 style beside the plain one to a game that supports it (hle_hid.c). GetJcmsStates/GetJcmsStateread a ring of 16 states per player and Joy-Con. A JcmsState is 32 bytes: 8 bytes the game does not read, the sampling number at 8 (newest first), the movement at 0x10 and 0x14, the attributes at 0x18 (bit 0 connected, bit 1 on a surface). A JcmsType is 0 for the left Joy-Con and 1 for the right.- The pointer (Nmouse):
GetNmouseHandlesgives a handle per Joy-Con whose sensor reports, the one last used on a surface first (it stays first while lifted, to press a button), since Welcome Tour moves its pointer by the first handle only.GetNmouseStatefills a 48-byte NmouseState: 8 bytes, then the Switch's MouseState fields (sampling number, position on the game's pointer range, movement, wheel), the buttons at 0x28 (left 1: R or ZR on a right Joy-Con, L or ZL on a left one; right 2) and the attributes at 0x2c (bit 1 connected, which the game requires).SetNmousePointerPositionmoves it. The movement is a quarter of the sensor's counts. - The Switch 2 transport turns the sensor on with its own feature bit,
0x10(S2_FEATURE_MOUSE,switch2_proto.h), only once the game has set up the sensors or the pointer (InitializeJcms/InitializeNmouse,dm_joy_mouse_wanted), as the console does for a game that uses them; a controller that connected before is sent the two feature commands again with the bit (not yet checked on hardware), and keeps it on while connected. Measured on a right Joy-Con 2 slid on a desk: report bytes 0x10 and 0x12 are 16-bit position counters that wrap (x right, y toward the player). 0x14 and 0x16 jump from about 1,600 and 150 on a surface to about 4,600 and 3,200 when lifted, and 0x16 under 1,000 counts as on a surface. While lifted, no movement is reported. The Pro Controller 2 has no sensor. DM_JCMS_LOG=1logs the game's sensor and pointer calls, at most once a second each kind.
- A front end reports each Joy-Con's sensor with
- Found on: Nintendo Switch 2 Welcome Tour: its cursor and its mouse exhibits, with a left and a right Joy-Con 2.
t_hidchecks the states, the handles and their order, and the styles.
A private application's HID scene
- Symptom: a null read at
sdk+0x65c75cduring startup, after[RED] sf: the game connects to service hid itself, which the host does not serve. - Cause: SDK 20.5.29's
nn::hid::SetSceneIdForPrivateApp(int)calls the HID service's scene setter through its absent session. Welcome Tour's flow NRO calls it before its first frame. - Fix:
hle_hid.cowns the scene setting across modules. The setter records the integer andGetSceneIdForPrivateApp()returns it; neither opens Horizon IPC. The controller transport does not use this scene label. - Found on: Nintendo Switch 2 Welcome Tour, update v262144 (
sdk+0x65d3b0, fromnro12+0x3e38).
Home button protection on a Switch 2 controller
- Symptom: a Switch 2 game crashes as a Joy-Con 2 joins:
[RED] sf: the game connects to service hid itself, which the host does not serve, thenCRASH sig=11 addr=0atsdk+0x63ce10, called fromnn::hid::EnableUnintendedHomeButtonInputProtection. - Cause:
nn::hid::EnableUnintendedHomeButtonInputProtection(const NpadIdType&, bool)turns on a guard against a Home press made by accident on that controller. It returns nothing; the SDK's own sets the flag through the hid service, which the host does not serve, and calls through the null session. - Fix: the host answers it (
hle_hid.c), records the setting per npad (No 1-8, Other, Handheld) and logs it (hid: EnableUnintendedHomeButtonInputProtection npad 0 on). The question,IsUnintendedHomeButtonInputProtectionEnabled(const NpadIdType&), whose SDK function asks the service too, answers what the game set, off by default. The host handles the Home button itself (home_quit.h), so nothing else changes. - Found on: Drag x Drive (040041601D83A000, v196608, SDK 20; no profile in the repository yet): 43 s in, as player 1's Joy-Con 2 pair joined (
main+0x2c80c4). Nintendo Switch Sports Resort (04008E001F098000, v65536) asks the question at boot: the SDK's own aborted on its error (Result 0x58ccaatsdk+0x6ca40c). - Check:
make -C dm/host/tests GAME=<id> run(t_hid).
GameShare HID feature query opens the service
- Symptom:
[RED] sf: the game connects to service stpl:u itself, which the host does not serve, followed byResult 0xe15in a guest input loop, despite the streamplay initialization takeovers. - Cause:
nn::streamplay::GetSupportedHidFeatureSet()was missing from the host. Unlike the hooked initialization functions, this public getter still ran in the SDK and lazily opened the service throughdetail::GetUserService()anddetail::CreateUserServiceByHipc(). It returns a 32-bit configured feature mask; the game tests its bits before reading guest inputs. This is neither a different Initialize overload nor an internal call bypassing its hook. - Fix: take over the getter by symbol and retain the mask in the existing setter (
hle_misc.c), as for the guest style and hold configuration. The default mask is zero. No IPC commands, aborts or executable addresses are changed. - Found on: Star Fox, base v0, main build ID
898024ffa42c059518eb38196f1ee0f635ecdf89, SDK build ID41d4de4a3b78214ad20c896960df0e5ea0ed595f. On these builds only, the observed path ismain+0xad98620(PLT call) →sdk+0x770db0(getter) →sdk+0x77a280(lazy service) →sdk+0x777770(connect / abort). These are diagnostic offsets, not patch addresses. - Check:
t_pctlresolves both takeover registrations and checks default, replacement, clearing and high-bit masks without a guest service. The PR #3162 author verified startup and played from an existing save through to Andross once on an M4 Max, macOS 27.2.1 (2026-11-21); other titles remain unchecked.
GameShare guest displays
- Symptom: a crash at boot in
nn::viundernn::streamplay::CreateIndividualDisplays. - Cause: a game can create its guest displays at boot, before any session, and the call starts a second display service the host does not have.
- Fix:
CreateIndividualDisplays,DestroyIndividualDisplaysandGetNativeWindowHandleanswer that there is no guest (hle_misc.c). - Found on: Pokémon Pokopia.
GameChat at boot
- Symptom:
[RED] sf: the game connects to service chat:u itself, which the host does not serve, thengame called nn::diag abort: Result 0xe15undernn::chat::Initialize. - Cause: a Switch 2 game can initialize GameChat at boot. The SDK's
Initializeopenschat:u, and its other calls go through the service object thatInitializemakes. - Fix:
nn::chat::Initialize(ready, no chat),IsChatting(no) andSetScreenSharingMode(nobody to share with) are hooked (hle_misc.c). Another GameChat call a game imports needs a hook of its own: each of the SDK's calls checks a count only its ownInitializeraises, and aborts otherwise. Also hooked:AttachToRoomInfoChangedEvent(bound, never signaled), and the camera video storage, local and remote. SDK 22.2.0 (sdk+0x6b43c0) checks 32 to 1920 by 32 to 1080 pixels, 1 to 4 images and a page-aligned buffer, and zeroes the 0xe0-byte storage type. With no camera each image is a blank native image of that size, zeroed memory with room for 16 bytes a pixel (hle_codec_video.cdm_native_image_blank), so the game's NVN textures on them (nvnTextureInitializeFromNativeImage) are made as on a decoded picture (AV1 movies through SDK 22's decoder). The storage type keeps their handles, and the game's buffer is one page that stays unused. - Found on: Hyrule Warriors: Age of Imprisonment. The room event and the camera storage: Mario Kart World 1.8.0 (three local images of 384x216 at boot), from pull request #1116 (that build is not run here).
GameChat queries from the title screen (SDK 21)
- Symptom:
CRASH sig=11 addr=0 pc=sdk+0x6be4d4innn::chat::GetChattingUid(), from the game's title screen code. - Cause: SDK 21 games ask the chat library who is chatting, for the room, the sharing key, the virtual camera, the members' audio levels and the camera streams; the SDK's versions read the service object
Initializewould have made. - Fix: hooked as "no chat" (
hle_misc.c): a zero Uid,GetRoomInfofails (withRES_FAIL, the chat library's real result not being known), the sharing and virtual camera calls succeed and keep nothing, the camera streaming calls succeed and stream nothing, the next-image requests fail, no audio levels. - Found on: Star Fox: 33
nn::chatimports.
The camera through the graphics system
- Symptom:
nn::diag abortings::sdk::CheckGraphicsSystemInitialized, or a failedcamera::sdk::CreateCameraContext(0x3af3), at boot. - Cause: the Switch 2's camera (a USB camera, for GameChat) is a session the SDK asks the graphics system's user session (
gsv) for. The host never opens that session, and the SDK's check that its graphics system is booted reads a flag only the SDK's own graphics boot sets. - Fix:
CheckGraphicsSystemInitializedpasses (hle_nv.c): the host's graphics layer is up from the start.CreateCameraContextgives a host session (hle_sf.c), a 32-bit handle (SDK 22.2.0sdk+0x2c42c0writes it), that answers as a console with no camera. Every command fails with 0xdc4, except command 21, the camera's event, which copies the read end of a kernel event that never fires (hle_thread.chle_new_event) in the response's special header. The game is said to take 0xdc4 from command 3, opening the camera, as "no camera"; any other error aborts. - Found on: Mario Kart World 1.8.0, from pull request #1116, not checked here (that build is not on this Mac): the meaning of 0xdc4 and the commands are inferred there from the game's code.
t_sfchecks the session's answers.
The camera commands of SDK 21's own camera module
- Symptom: with the camera session answering 0xdc4 to every command, Star Fox logs
This platform does not support the camera function.(itsvwebcam.switch2.cpp:997) and dereferences a null on the way out (main+0xba54e4c); with 0x7c4 to every command its module aborts inInitialize(subsdk3+0x1ef4) orFinalize(subsdk3+0x200c). - Cause: the game ships its own camera module (
subsdk3,nn::camera) and sorts the results itself.Initializesends command 3 with the device nameDefaultand takes success or 0xdc4, the latter passed to the game as "no camera support", a path a console with a camera port never takes;QueryDeviceConnection(command 29, a DeviceRequest) reads 0x7c4 asNo camera device detected.;Finalizesends command 4 and aborts on any failure; the connection event is command 21. - Fix:
camera_answer(hle_sf.c) answers commands 3 and 4 with success, 21 with an event that never fires, and the others, 29 among them, with 0x7c4, so the game sees a console whose camera port has nothing plugged in.nn::applet::BeginUsingCameraResource/EndUsingCameraResource(the module takes the applet's camera resource) andnn::camera::sdk::DestroyCameraContextsucceed too; the SDK's versions read service objects the host never made. The client also ends the session with an HIPC Close (message type 2), answered with the closed-session result 0xf601 (hle_sf.c); before that it logged[RED] sf: camera: HIPC message type 2 not served. Mario Kart World 1.8.0, whose reading of 0xdc4 the old answer followed, is not re-tested here. - Found on: Star Fox.
Whether the language selection is limited
- Symptom: a null read at boot in
nn::oe::IsLanguageSelectionLimited, right after the game asks for its language. - Cause: the SDK asks the
amsession at vtable +0x238, and the host never opens that session (oe::Initializeis taken over). - Fix: hooked: no limit; the host's language is
DM_LANGalone (hle_oe.c). - Found on: Hyrule Warriors: Age of Imprisonment.
Application GPU scheduling time
- Symptom: a null read in
nn::os::SdkMutexType::Lock, atsdk+0x151fb0, called fromnn::gs::sdk::QueryApplicationGpuTimeSpanafter the first rendered frame. - Cause: the query asks the graphics server's session (command 27), which the host never opens, how much of an interval the GPU was given to the application rather than to another of the console GPU's clients (the system's own rendering). Its two times are nanoseconds on the system tick clock; callers pass intervals bracketed by their own GPU counter timestamps.
- Fix:
hle_nv.canswers the whole interval (end - begin, 0 ifendis not later) with success. The host's counter timestamps are its model of the console GPU's timeline (GPU timestamps per submission segment), on which the application is the only client. It is not the GPU's busy time: Welcome Tour's Bezel profiler queries each render pass's GPU region (main+0x30a8f4) and the whole frame's (main+0x30a808), and the frame load its dynamic resolution reads is the frame's scheduled time, plus the time the application was not scheduled since the previous frame, plus 0.36 ms. With busy time the GPU's idle time between frames would count as taken, and every frame would read as full. The earlier stub returned0xaf3(not even the SDK's own unavailable-session result,0x30af3atsdk+0x41200c); Bezel then took each region's length and left out the 0.36 ms margin. - Found on: Nintendo Switch 2 Welcome Tour, update v262144 (
sdk+0x411dc0, called frommain+0x30a840).
The target frame rate (graphics frame length)
- Symptom: a null read at boot in
nn::os::SdkMutexTypeundernn::gs::sdk::SetGraphicsFrameLengthMode, called fromnn::oe::SetGraphicsTargetFrameRate. - Cause:
SetGraphicsTargetFrameRatemaps up to 59 fps to mode 1, up to 119 to mode 2 and above to mode 3 (SetGraphicsTargetFrameRateAutoto mode 0) and callsSetGraphicsFrameLengthMode, which locks the gs graphics server's context and sends it the mode. The host has no graphics server, so the context is null. - Fix:
SetGraphicsFrameLengthModeis hooked and logs the mode once per change; bothoepaths reach it. The host paces by the window's present interval (hle_oe.c). - Found on: Hyrule Warriors: Age of Imprisonment: 60 / its present interval at boot.
The display's largest buffer
- Symptom: a Switch 2 game presents at 720p, with its upscaler at the matching low size.
- Cause: the game chooses its output from
nn::vi::QueryDisplayBufferMaxResolution(its tables: 0 is 720p, 1 is 1080p, 2 is 1440p, 3 is 4K), and what the game got before the hook gave it 720p. - Fix:
hle_vi.canswers as a Switch 2 does: in handheld mode its own 1080p screen; in console mode the largest of the four that the display the game is shown on holds, as a docked Switch 2 does with its TV. The display's size comes from the front end (front_display_pixels: on the Mac the window's screen in its current mode, an iPhone's or iPad's screen), 1080p when it is not known. The host logs the answer once. - Found on: Fire Emblem Fortune's Weave: its DLSS output is 2048x1152 for 1440p and for 4K, from 1024x576; for 1080p it renders 960x540 into 1920x1080, a fifth fewer pixels at each stage, and the output matches the screen.
A game that decodes its code at run time
- Symptom:
registered NROs not foundfromnro_collect.pyin a game whose RomFS has an NRR, or[RED] ro::LoadModule: no rewritten NRO with SHA-256 ….mainis small (about 600 KB of code) beside a data segment of random-looking bytes. - Cause:
mainis a boot stub. Mario Tennis Fever's (nxboot) starts six threads, one per stream, which unscramble and unpack the game's code out ofmain's data segment into one buffer; it then registers the RomFS's NRR and callsnn::ro::LoadModuleon that buffer. No file holds the NRO, so nothing can rewrite it offline, while iOS runs no code loaded at run time and the host only loads rewritten copies. - Fix: the host's run of the stub is the decoder.
DM_NRO_CAPTURE=<folder>writes the image of aLoadModuleit has no rewritten copy of to<folder>/<SHA-256>.nroand ends the run (hle_ro.c). The NSP script (capture_nro) boots the rewrittenmainandsdkso whennro_collect.py --missing-oklists a registered hash no file holds, about 2 s on the Mac, checks the image against the hash the NRR registers, adds it to the collected NROs and rewrites. A build then runs like any game with NROs, and the shader split takes the folder (DM_NRO_DIR) as well asmain. Decisions that follow what the game imports count the NROs too (dm_game_imports): thismainimports noScalableFontEngineHelper::Decode, its NRO does. - Check:
scripts/build_ipa_from_nsp.py <folder> --platform macafter removingpatched_*andnro_*from the build folder: rewrite, capture, rewrite, split. - Found on: Mario Tennis Fever.
NRR version 1
- Symptom: a crash in
ro::RegisterModuleInfo, or an NRR that seems to register millions of hashes: the words at +0x340 and +0x344 are random. - Cause: an NRR with 1 in the byte at +5 (the Switch 2's) has a header 0x180 bytes longer. The same fields follow it: program ID +0x4b0, size +0x4b8, hash table +0x4c0, its count +0x4c4.
- Fix:
hle_ro.candnro_collect.pyread the table by that byte. - Found on: Mario Tennis Fever.
Legacy settings language lists before SDK 4
- Symptom: Xenoblade Chronicles 2's Japanese release 2.0.2 (
0100F3400332C000, maine3938fa78579c1cab27fb0ecef1314e8) hits its bounds assertion atmain+0x6979dc, called frommain+0x6ae53c, just after the first frames. - Cause: SDK 3.5.0's settings wrappers use the legacy list/count service commands 1/3. The game reserves 15 language slots, asks the count, and then copies that many codes. The host returned 18 and the game added past its 15-entry container. The legacy interface has the original 15 languages; the extensible commands 5/6 arrived in firmware 4.0.0 (libnx settings implementation).
- Fix: both language-list fallbacks use 15 entries for known SDK majors 1-3. SDK 4 and later, and an unknown SDK, retain the existing extended fallback. The original code order, Chinese comparison aliases and LanguageCode::Make are unchanged.
- Found on: Xenoblade Chronicles 2, Japanese release 2.0.2, during bring-up with a provisional profile. A diagnostic boot with the correction reached the language-selection screen and 900 frames in 40 seconds; gameplay remains unverified.
- Check:
t_language.ctests old SDKs, modern and unknown SDKs, code order, short and empty buffers and untouched buffer tails under AddressSanitizer and UndefinedBehaviorSanitizer (1,086 checks).