Repository navigation
Conversation
…ghter code is 98 NROs inside data.arc, whose exports main imports (1,045 lua2cpp::create_agent_* functions, global, bound to stubs at start), and the host loaded none. The SDK's own LoadModule (SDK 8.2.1 LoadModuleInternal, sdk+0x347460) uses ldr:ro only to map the image and then relocates through rtld's module lists, which the host replaces, so the host takes over the whole call. Pack time: dm/tools/nro_collect.py collects the NROs a game's NRR files register by SHA-256 (loose files; the current files of an indexed archive, Smash's data.arc through the new dm/gfx/tools/smash_arc.py, which reads its file-system table: 98 NROs in 7 s, while the older releases' NRRs also register 666 superseded copies the archive still holds, left out; else a scan for stored and zstd-framed NROs, all 764 in 7 min); patch_nso.py now reads NROs (the flat image, segments at +0x20, build ID at +0x40); the NSP script's rewrite step collects them (its own reuse key) and rewrites them with the profile's modules, as many at once as the Mac has cores, with nro.tsv beside them (Smash: 101 modules in 1:45, reused on the second run). Host: MAX_MOD 128; the NROs of nro.tsv are mapped at start (code read-only + execute) and stay out of symbol lookups and the startup init pass; LoadModule finds 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 (bind_sym, the binding step of relocate factored out), fills nn::ro::Module as the SDK does and calls its DT_INIT; UnloadModule calls DT_FINI and binds every relocation that pointed into it again; GetBufferSize returns the header's bss size as the SDK does; RegisterModuleInfo accepts the NRR; LookupModuleSymbol searches the one module; an NRO does not count as used memory. Only data is written at a load, so the same works once the NROs are embedded in the iOS executable (gen_embed.py takes only the profile's modules so far). DM_NRO=0 turns loading off: Hades and Hades II load their EOS SDK NRO, which the host refused so far (they play offline); a repack that finds it through NRRs now runs it, not checked without their files. Smash 13.0.5 on the Mac: the game registers its NRR (98 hashes) and loads six NROs in its first 30 s, each relocated, bound into the modules loaded before it (2, 1, then 11 imports each) and initialised, with no stub called and the frame loop at 60 fps. docs/agents/03-bringup.md has the NRO case. dm/tools/tests pass
… Services, known by its export EOS_Platform_Create. Hades and Hades II load rom:/nro/EOSSDK-Switch-Shipping.nro; Hades' main imports only EOS Auth, Connect and PlayerDataStorage (Epic-account cross-save), which the host cannot serve, and the real SDK would at best fail its login and at worst wait on time-outs or contact Epic's servers with a console identity the host makes up (whether that could get an account banned is unknown). Before the host loaded NROs both games played offline with local saves, and they do again. dm/tools/nro_collect.py (ONLINE_SDKS) does not write such an NRO and lists it in nro.tsv as a "refused" row, so the pack carries no code for it; the NSP script rewrites only the other rows; the host reads the refused hashes (nro_refused) and ro::LoadModule refuses them with one log line ("refused …: an online SDK (Epic Online Services), not loaded; the game plays offline"), and refuses by the export too when an older nro.tsv lists the module. DM_NRO=0 still turns all NRO loading off. Checked on Smash's NROs: none is refused, and a module with a listed export is. Not checked on Hades or Hades II (no game files here). docs/agents/03-bringup.md notes it; the PR asks the maintainer: always load, refuse online SDKs (as now) or decide per profile
…fails RegisterModuleInfo, as every registration did before the host loaded NROs, so the game takes the path it took then. Hades 1.0.38233 (game.nrr with the one EOS SDK hash; the NSP script's rewrite step now collects it as a refused row): the registration is refused with one log line, the game never asks for the module, and it renders on past frame 1,500 as before, one red line fewer (the old RegisterModuleInfo one). Checked with a test rewrite, host and empty save in a folder of its build folder, removed afterwards; its patched modules, IPA, saves and shader caches untouched
…gisters (Super Smash Bros. Ultimate 13.0.5 main+0x2b74458: ldrb w18,[x14]; sub w18,w18,#1; cmp w18,seedds#6; b.hi; ldrsw x18,[x7,x18,lsl #2]; add x18,x18,x7; br x18). x7 is built by adrp + add 688 instructions before and parked in x30 around a loop (mov x30,x7 ... mov x7,x30), so the far chain (table_base far) met a mov and patch_nso.py asserted "jump table 2b74458"; the function-wide search jump_adr_offsets uses finds a second adrp x7 + add pair there (another table further on) whose seven targets also lie in the function. jump_offsets' last attempt (far_base) now follows register copies back to the adrp + add (copied_base: address order to the function's start, through no call while the register followed is caller-saved; every target an instruction of the function). It was that main's only unhandled site, and it runs only where the rewriter asserted before: Mario Kart 8 Deluxe's main, subsdk0 and sdk and Smash's sdk and movie module come out byte-identical with the previous rewriter (build_src.sha256 aside); dm/tools/tests pass. Survey: a game that imports nn::ro and ships NRRs but no loose NRO keeps its NROs inside an archive (Smash: 14 NRRs, 98 NROs in data.arc whose exports main imports), so the note no longer says the host's empty nn::ro "is enough" there. docs/agents/03-bringup.md has the rewriter case
…re, for every game. Super Smash Bros. Ultimate 13.0.5 presents its window texture in its first frames before drawing into it; the texture was made on that first resolution in the present path and joined the residency set (res_add), which only a submission commits, so the display command buffer sampled it outside the committed set: kIOGPUCommandBufferCallbackErrorPageFault at the first presents, after which macOS ignored every command buffer of the process (194 command buffer and 174 upload errors in the user's run) and the window stayed pink. Headless runs never present, which is why they looked right. res_commit is free when nothing changed. Smash windowed now: the opening movie, the DLC first-boot screens, the title, the main menu and a first match render right, no GPU error. Breath of the Wild windowed with only this change on the sync-lag branch its libraries match: its title, 60 fps, no GPU error. docs/agents/04-graphics.md says so
…1): game profile, data.arc shaders and NROs embedded on iOS Bandai Namco and Sora's engine (the nu library) on SDK 8.2.1, NVN. Builds on NRO loading (PR seedds#91), the rewriter's far jump-table base (PR seedds#90) and the present residency fix (PR seedds#89). - Memory: main's virtual allocator reserves 62 GB of address space in its static initialisers (AllocateAddressRegion at main+0x37c9a5c) and aborts when that fails; the profile's patches.py cuts it to 3 GB (11 instructions that follow from the size), and sdk_patches.py cuts the address-region node area to 62 MB and the 1 GB region alignment to 32 MB on this sdk build (Catherine: Full Body's, which never allocates a region), for a 5 GB guest layout. A match peaks at about 2.2 GB resident and 1.4 GB of GPU memory on the Mac. - NVN: nvnSetExternalDebuggerEnabledNVX, which the game looks up and calls without a check, is a no-op for every game. - Shaders: shader_split.py reads data.arc (smash_arc_jobs: the current file of each path through smash_arc.py's file-system table; GLSLC outputs in .nushdb, BNSH in effects and layout SARCs): 34,884 shaders, the profile's tables. - iOS: the NROs a game loads at run time are embedded in the executable (gen_embed.py, build_ipa.sh; all NROs share two sections with an index, since 98 modules of three sections each passed the 255-section limit and crashed the linker) and the loader maps them from there; an embedded module with an empty patch area (87 of Smash's 98 NROs need no rewriting) is mapped without one, as vm_remap refuses a size of 0 and the app stopped at launch. Checked: on the Mac the opening movie, the DLC first-boot screens, the title, the menus and matches render correctly with sound; fullscreen at 120 Hz, frame time p50 16.7 / p95 about 17.2 ms. On an iPhone 17 Pro Max (built and signed through --prepare-xcode): character select and matches with sound at 60 fps (GPU about 5 ms a frame), 98 NROs mapped and loaded per match; long frames remain, about half from pipelines built the first time. The rewriter's and the tool tests pass; dmhost builds for this game and for Breath of the Wild. README.md, AGENTS.md, docs/development.md and docs/agents/03-bringup.md say so
Owner
|
Thanks — this is superseded by what is now on main: #89, #90 and #91 were integrated in d979c34 (with the online-SDK refusal), and the Smash port itself (profile, the address-region cuts, the nvnSetExternalDebuggerEnabledNVX no-op, the data.arc shader split and the packed iOS NRO sections) landed in ff64352. One piece of this PR was not on main: an embedded module with an empty patch area (87 of the 98 NROs) still went to vm_remap with 0 bytes on iOS, which stops the app at launch as you found. That guard (skip the patch area's remap when it is empty) is taken from this PR and goes into main next, credited to you. |
seedds
added a commit
that referenced
this pull request
Oct 24, 2026
… (from PR #94). 87 of Super Smash Bros. Ultimate's 98 NROs have nothing to rewrite (no x18, SVC or TLS register use), so patch_nso.py writes no patch area and gen_embed.py packs a 0-byte x1 piece for them; map_image still remapped it, and vm_remap refuses 0 bytes (KERN_INVALID_ARGUMENT), which stopped the app at launch at the first such NRO, as the PR's author found on an iPhone (FATAL nro1 vm_remap ... (0 bytes) failed: 4). ff64352's iPhone run used a build from before d979c34's loader, so the merged build had not met it. Checked: loader.c compiles for iOS and the Mac with Smash's profile, and the host unit tests pass (the NRO loader test among them); not run on an iPhone (no Smash files here) Co-authored-by: v0lumehi <[email protected]>
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
… (from PR seedds#94). 87 of Super Smash Bros. Ultimate's 98 NROs have nothing to rewrite (no x18, SVC or TLS register use), so patch_nso.py writes no patch area and gen_embed.py packs a 0-byte x1 piece for them; map_image still remapped it, and vm_remap refuses 0 bytes (KERN_INVALID_ARGUMENT), which stopped the app at launch at the first such NRO, as the PR's author found on an iPhone (FATAL nro1 vm_remap ... (0 bytes) failed: 4). 5b691ed's iPhone run used a build from before 32b81f7's loader, so the merged build had not met it. Checked: loader.c compiles for iOS and the Mac with Smash's profile, and the host unit tests pass (the NRO loader test among them); not run on an iPhone (no Smash files here) Co-authored-by: v0lumehi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Super Smash Bros. Ultimate (
01006A800016E000, update 13.0.5, SDK 8.2.1). Closes #65 for Smash; Balatro, the other game that issue asks for, is already in main.Depends on #89, #90 and #91: this branch contains their commits. Only the last commit is new; please look at those three first.
What the game needed
mainbut in 98 NROs inside the 17.6 GBdata.arc.mainimports 1,045lua2cpp::create_agent_*functions from them. Loading them is NRO loading (nn::ro) for every game, refusing online SDKs such as Epic Online Services #91.gen_embed.pyandbuild_ipa.sh.vm_remaprefuses a size of 0, so the app stopped at launch.mainreserves 62 GB of address space during its static initialisers and aborts when that fails.patches.pycuts the region to 3 GB.sdk_patches.pycuts the SDK's address-region node area and the 1 GB region alignment on thissdkbuild, which is Catherine: Full Body's; Catherine never allocates a region, so it is unaffected.shader_split.pyreadsdata.arc, taking the current file of each path throughsmash_arc.py, and finds 34,884 shaders.nvnSetExternalDebuggerEnabledNVXis now a no-op for every game. Smash looks it up and calls it without a check.Tested
--prepare-xcodewith the increased-memory-limit entitlement:dmhostbuilds for this game and for Breath of the Wild, anddm/tools/testspass.README.md (with an in-game picture), AGENTS.md, docs/development.md and docs/agents/03-bringup.md are updated.
🤖 Generated with Claude Code