Repository navigation
Conversation
stan69b
force-pushed
the
game-3d-all-stars
branch
from
October 25, 2026 16:17
5fd4cea to
632923e
Compare
… boots on the Mac to the file select Super Mario 3D All-Stars (010049900F546000, SDK 9.5.1) is a multi-program application: the launcher (program 0, NVN) starts Super Mario 64 (1), Super Mario Sunshine (2) and Super Mario Galaxy (3) with oe::ExecuteProgram. Galaxy's program is 32-bit ARM (its NPDM's 64-bit flag is clear, Elf32 dynamic sections), which Apple silicon cannot run. SM64 uses the nn::jit service. Sunshine is NERD's Hagi with the PowerPC code statically recompiled into an NRO. - nx_extract: --program <index> extracts another program of a multi-program application (the Program NCA of the base title ID + index); --list lists an NSP's NCAs; --html <dir> writes a program's HtmlDocument (Manual) NCAs, the offline HTML pages it shows through the web applet. - build_ipa_from_nsp.py: PROGRAM / --program N packs program N under the title ID base + N (its own profile, survey and work folders); DLC indices still count from the application's title ID. - nro_collect.py: Hagi's .nrolz (data/gekko/<game>/nx/<game>.nrolz): the NRO's size big-endian, then one LZ4 block. Sunshine's 25.3 MB NRO matches the hash its .nrr/Hagi.nrr registers. - hle_offline.c: nn::web::OfflineWebSession stand-in. Sunshine starts its launcher pause menu (launcher_pause_menu.htdocs) hidden at boot; the SDK's Start created a library applet and crashed (null read in applet::StartLibraryAppletImmediately). The host renders no HTML: the page loads at once, sends one empty content message (the game waits for any message before Appear; the page sends end_sound_load), and closes when it appears (exit reason 0, no last URL), so the game resumes. "Return to title selection" (last URL http://localhost/return_to_launcher) needs a real page. - hle_oe.c: TryPopLaunchParameter hands over the bytes of DM_LAUNCH_PARAM's file, once. The launcher passes each game 16 bytes (LanguageCode, two volume floats, main+0x10824 in the launcher). - sdk_patches.py, SDK 9.5.1 sdk cdb385c299fd (SM64 and Sunshine): the AddressRegionManager node area cut (orr immediates at +0xd2df0 / +0xd2e8c) and 32 MB alignment of regions of 1 GB and more (+0xd2fec). Hagi maps the GameCube's 32-bit address space 1:1 (Mmu false) in a 4 GB + 2 MB address region (main+0x125960), then its coroutine stacks in a 1 GB region (main+0x14b038); without the cuts the first failed and Hagi logged "Initialization of subsystem MEMORY failed". - hle_ro.c: LookupModuleSymbol logs its first 40 lookups, as LookupSymbol does. Checked on the Mac (provisional profile outside the repository, mem_reserve 0x1D0000000, mem_alias 0x160000000, app_pool 0x50000000, DM_LAUNCH_PARAM set): Sunshine plays its opening (HD replacement movies), skips it with Plus and shows the file select, input works; 1,152 run-time SPIR-V shaders captured and translated. Not working yet: pressing A on a file makes Mario hit the block, then the menu ignores input and no file is read. Not run: the test suites, iOS (the layout is 7.25 GB, over iOS's 6 GB single reservation).
… plays on the Mac to Delfino Airstrip; its profile fits iOS's 6 GB reservation; yield runs survive zero-timeout polls The file select was never stuck: Mario starts between blocks A and B, and A made him jump into the gap. Moved under a block, A opens START / COPY / ERASE, START plays the opening and gives control at Delfino Airstrip (30 fps on the Mac). The disc image holds the DOL's link map (marioEU.MAP), which names every PowerPC function; Hagi's statifier table (GetStatifierInfo GET_FUNCTION_INFO: 12,781 records of PowerPC address and NRO offset) maps the recompiled code back to them. - hle_thread.c: a WaitSynchronization with timeout 0 that finds nothing, right after a yield, no longer ends the run of yields (thr_yield), so the back-off begins as for a loop of yields alone. Sunshine's Hagi main thread polls a system event (TryWaitSystemEvent, main+0x82c4) and yields in turn, about 2.5 million times a second: each poll broke the run, the back-off never began, and the thread took 88% of a core. Now the process uses about 50% of a core instead of 110% at the Airstrip (main thread 870 → 290 ms/s), 30 fps held, which also left more room when the Mac was loaded (load average 15-23 there stretched frames to 100-400 ms and starved the audio: crackling). - hle_vk.m: the Vulkan layer logs a timing line every 300 frames as the NVN layer does (present interval p50 / p95 / max, fps, process CPU, top yielders, guest thread CPU) and each present interval over 100 ms with its time on DM_FSLOG's clock. Vulkan games logged draw counts only. - dm/games/010049900F546002: Sunshine's profile, moved from the provisional one. patches.py cuts Hagi's coroutine stack region from 1 GB to 64 MB (main+0x14b034, build ed0d7ace84ee): measured through boot, the opening and the Airstrip, its bump allocator handed out twelve 64 KB stacks and nineteen 64 KB blocks at its start. The block is then 6 GB, the most iOS gives one reservation: 256 MB + alias 4.25 GB (the 4 GB + 2 MB GameCube region and the 64 MB pool end at +4.16 GB) + stack 256 MB + heap region 1.25 GB (the game's heap of pool - 64 MB; 450 MB of it touched). Booted on the Mac with it to the Airstrip at 30 fps. - nx_extract: prints numbers with the invariant culture; under a French locale its summary lines read "32,9 MB" and build_ipa_from_nsp.py's extracted() reported 0 files. Known: Hagi crashed once in about 12 runs as the plane movie started (a trap at main+0xe00d4 in its texture copy): its VideoReplaceThread stops the playing video replacement (main+0xc00e4) while the GPU thread may still be uploading that video's frame, whose pixels the upload's own path frees (main+0xc169c). A race inside Hagi; not cut. Checked: the host thread tests (t_condvar, t_condvar_old, t_thread_leak), t_vk_desc, test_patches.py and test_nsp_alias.py pass; nx_extract --list under fr_FR prints "1190.8 MB". Not run: the iPhone, the other test suites.
…n the Mac and hands over to Sunshine; Super Mario 64 reaches nn::jit - make_ext_font.py: every code point of U+E000-U+E1FF the stand-in does not draw maps to a plain ring. The 3D All-Stars launcher (program 0) looks up U+E06B at boot and used the null glyph (crash at main+0x62d20); other games drew "?" for a missing icon. - hle_oe.c: oe::ExecuteProgram with DM_EXEC_OUT=<file> writes the program index (4 bytes LE) and the parameters there and ends the process (dm_host_shutdown), as Horizon ends it; whoever started the host starts that program with the parameters as DM_LAUNCH_PARAM. Without it, logged with the parameter bytes, and the game carries on as before. The launcher hands Sunshine 16 bytes: "en-US", volumes 0.5 and 1.0. t_oe stubs dm_host_shutdown. - hle_vk.m: VK_EXT_debug_report's three functions (the callback is kept as a handle and never called). Super Mario 64 (program 1) enables the extension and called vkCreateDebugReportCallbackEXT through a null pointer (main+0x7494). Checked on the Mac (provisional profiles outside the repository; the launcher's has render_cond on, without which every frame is black): the launcher shows its title and the game menu, and choosing Sunshine started it with the launcher's parameters through a chaining script (010049900F546000-work/allstars.sh in the NSP folder). Super Mario 64 now stops at nn::jit::Initialize (sdk+0x2e5414). Galaxy (program 3) is 32-bit ARM. Not done: the menu's missing images (flat purple), Sunshine's pause menu, nn::jit. t_oe and t_vk_desc pass.
…the host, its code in MAP_JIT memory
Super Mario 64 (Super Mario 3D All-Stars program 1, SDK 9.5.1) crashed in nn::jit::Initialize (sdk+0x2e5414: the SDK reaches for the jit service). It now boots past nn::jit and stops next in the Vulkan layer (specialization constants).
- hle_jit.c (new, any game that uses nn::jit): takes over the whole API (Initialize, CreateJitEnvironment, GenerateCode, Control, GetJitEnvironmentInfo, DestroyJitEnvironment, Finalize). CreateJitEnvironment finds the plugin NRO among the game's two buffers (SM64 passes rom:/.nrr/EmuAppNX64.nrr and rom:/nro/EmuSystemJITPlugin.nro) by SHA-256 among the rewritten NROs (nro_collect.py already collects it through that NRR), loads it alone, runs it as the jit service does (yuzu's LoadPlugin: _init, GetVersion = 1, ResolveBasicSymbols with memcpy / memmove / memset / PanicForPlugin / AbortImpl / UnexpectedDefaultImpl, SetupDiagnostics off, Configure, OnPrepared), and gives it the configuration the plugin reads: code memory (MAP_JIT, one mapping for the plugin's writes and the game's calls), data memory, and the work buffer's last part as its transfer memory, where it keeps its state. GenerateCode and Control call nnjitpluginGenerateCode / nnjitpluginControl on the calling thread under one lock, with the data zero-padded to 32 bytes as the SDK sends it; GenerateCode opens the thread's JIT write window around the plugin (pthread_jit_write_protect_np) and invalidates the instruction cache over the code range returned. Layouts read off SDK 9.5.1's nn::jit (sdk+0x2e6610 ff.): code ranges are offsets in the code / data memory, the handle is the environment (GetImpl is the identity), GetJitEnvironmentInfo returns {code address, size, data address, size}. Every GenerateCode is logged for the first 16 calls of each command and then at powers of two (DM_JIT_LOG=1: all), with input, ranges, output and time; DM_JIT_DUMP=<dir> writes each call's code to a file.
- loader.c: nro_load_alone, relocating an NRO against itself only and leaving it out of the game's symbol lookups (on Horizon the plugin lives in the jit service's process). dm.h declares it (one line in a shared header).
What SM64 does at boot (Mac): Control(0) with its 0xeb0-byte VM state, GenerateCode commands 1 and 2 (44 and 56 bytes of entry stubs), then command 3 with the 140 MB input and 0x108b (4,235) blocks: the RomFS's precompiled block list (03_UNSMJ3.002.pcb) becomes 14.2 MB of code in 27 ms. A capstone census of that code (3.55 million instructions): no x18, no SVC, no system register, no adr / adrp or literal load, every direct branch inside the code memory, so nothing in it needs the rewriter; it does hold absolute addresses built with movz / movk (693,098 into main's data, 8,431 into the precompiled NRO, 39 into sdk), so the code depends on where the modules are mapped.
Tests: new t_jit (a synthetic plugin whose GenerateCode writes "mov w0, #n; ret" through its own mapping; the test runs it from the reported address) passes; t_nro passes.
…y wrote it The 3D All-Stars launcher's game menu showed flat lavender where each game's artwork belongs. The artwork is a movie (MovieData/BgMovie64.mp4, BgMovieSunshine.mp4, BgMovieGalaxy.mp4; LauncherOpening.mp4 before the title). Decoding worked: the Y and UV planes reached their textures (texraw). agl converts each frame into an RGBA texture with its YUV program (agl_common bf1135fd591c81ef). Then, in the same render pass and with no barrier between, a second draw corrects the gamma in place (021631192bc452b6, exponent 2.2), sampling the texture it renders into. On Metal the attachment stays in tile memory until the pass ends, so that sample read the memory from before the pass: the zeros the gamma draw had stored the frame before. Every movie stayed transparent (alpha 0) over the layout target's clear colour 0.3, 0.3, 1 (lavender after the sRGB view). The draws themselves were fine: DM_NVN_HILITE on the YUV program and texdump both showed nothing landing, because the gamma draw overwrote it. - nvn_mtl.m: the open render pass keeps a mask of the colour attachments written in it (g_fb_wrote): cleared by its load action or by a clear drawn in it, or drawn into by a draw whose write mask and fragment outputs cover the slot (fb_note_draw). fb_prepare now takes its snapshot for any draw that samples one of those, not only for the shaders a profile's feedback_snap lists. The rule is NVN's semantics and holds for every game: the Switch reads what the earlier draw wrote, and Metal reads stale memory whatever the GPU. It fires only where the picture was already wrong, so it can cost time there but cannot make a correct picture worse. feedback_snap stays for the draws that read an attachment their pass has not written, such as 3D World's and Captain Toad's iPhone magenta blocks. DM_NVN_FB_SNAP=0 now turns both off. The snapshot log line counts the snapshots this rule took. - t_fb_stale (new, in make run): one draw writes red, then a draw in the same pass samples that attachment into itself: one snapshot, the result is red. With DM_NVN_FB_SNAP=0 there is no snapshot. When the sampling draw opens its own pass, there is no snapshot and the result is red. With the rule disabled, the first case read 0, as the launcher did. Measured on the Mac (launcher, provisional profile): the opening movie, the title and all three game movies show. One snapshot a frame (the gamma draw, 1440x1080 RGBA8), and no other draw took one. Menu frames hold 16.66 ms p50, 59.2 fps. Checked: dm/gfx/tests make run (GAME=010015100B514000) passes, 929 checks, 0 failed. Two reflection checks were skipped: no Wonder shader cache on this Mac. Not measured: Breath of the Wild / Tears of the Kingdom, Wonder and the iPhone. If one of them has many draws sampling an attachment their pass already wrote, the new snapshot count in the log shows it.
…se menu)
nn::web's offline pages (OfflineWebSession, ShowOfflineHtmlPage) are shown in a WKWebView over the game picture instead of the stand-in that closed them at once.
Super Mario 3D All-Stars' Sunshine starts its launcher pause menu (launcher_pause_menu.htdocs, BootMode 1: hidden) at boot, waits in a TryReceiveContentMessage loop for
the page's end_sound_load, Appears it on Minus, sends "appear", and on WaitForExit compares the last URL with http://localhost/return_to_launcher (exit reason 2 is
handled apart: RequestExit); main+0x84f0 / +0x86b0, build ed0d7ace84ee.
- hle_web.c (new; the session moves here from hle_offline.c): ShowOfflineHtmlPageArg is read as the SDK writes it (u16 count at +0, entries from +8 of
{u16 type, u16 size, u32 0} + data; DocumentPath 0x6, CallbackUrl 0x3, KeyRepeatFrame 0x1c / 0x1d, BootMode 0x41, from sdk+0x2f70f0 / +0x2f95a0). The page is
looked up in DM_HTML, by default the folder "html" beside the RomFS folder, in html-document/ or html<n>/html-document/ (as nx_extract --html writes them; no
path outside the document). Messages from the page are queued oldest first (size without the terminating zero), the game's go to the page; 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) or RequestExit /
Finalize (2). WaitForExit blocks until then. Without the page or without a web view (windowless) the stand-in of before answers (the empty ready message,
closed on Appear, reason 0); ShowOfflineHtmlPage then fails as the cut did.
- web_apple.m (new, Mac and iOS): the page served from its folder through a scheme of its own (dmweb://doc/, so its XMLHttpRequests for its sounds work), loaded
hidden (alpha 0, no hit testing, still running) until Appear; a document-start script gives it the Switch browser's window.nx (message events, sendMessage,
endApplet, footer.setAssign / unsetAssign, anything else a logged no-op), navigator.getGamepads in the standard mapping (0 B, 8 −, 9 +, as the menu reads
them) and key events (D-pad and left stick = arrows with key repeat, A = keyCode 32 as the menu reads it). Its 1280x720 is fitted to the 16:9 picture
(pageZoom), transparent over the game (which darkens its own frame). Its :focus rules are copied for the focused element, because WebKit matches :focus only
in the key window (with another app in front the highlight stayed on the first item moved to). A relative URL that climbs out of the document's folder is
looked up inside it: the menu's stylesheet names ../../img/ for launcher_pause_menu.htdocs/img (the guides' pictures). A sans-serif default, with the host's
Nintendo extension font for the button icons (U+E000-E1FF). Sounds follow DM_AUDIO (muted on the Mac by default). Console output and errors go to the
log; DM_WEB_LOG=1 logs each key and the focus after it.
- hle_hid.c / dm_input.h (no owner in this batch; the smallest change): dm_input_hold, while a page is shown the game reads nothing and presses made
meanwhile are dropped at the end (the A that picked Continue did not reach Mario); dm_input_peek, what the page reads (every path, DM_CTL included, plus taps
between two reads). Buttons held as the page appears count once released (the Minus that opened the menu closed it at once).
- front_mac.m: front_web_attach / detach (the page's view over the game view, first responder while shown). Makefile: web_apple.m, -framework WebKit.
Checked on the Mac (Sunshine, DM_CTL): Minus shows the menu over the darkened game; Down / Up move through Continue, Controls, Actions (each guide with its
picture) and Return to title selection; A on Continue, B, + and − resume the game, which reads the controller again; the menu opens again each time (the
game starts a new page after each end); A on Return to title selection, then OK: exit reason 3, last URL http://localhost/return_to_launcher, then
oe::ExecuteProgram(0) and the host ends (DM_EXEC_OUT). Windowless: the stand-in answers as before. Tests: t_web (new, 31 checks) and t_hid (t_applet added)
pass. Not checked: mouse clicks on the page, the real keyboard (it reaches the page through the same dm_input_peek), sounds (DM_AUDIO=1 not used). The iOS
front end's front_web_attach / detach come with B-2.
…e view, under the gamepad web_apple.m (B-1) is the iOS front end's too: the page's 1280x720 is laid out at that size and scaled to the 16:9 picture (a transform, so its viewport is the Switch's), transparent, scrolling off; the controller and the virtual gamepad reach it through hle_hid.c's state (dm_input_peek), as on the Mac. - front_ios.m: front_web_attach puts the page's view over the game view and under the gamepad (the controls stay visible and usable); detach has nothing to hand back (the web view never takes the keyboard; its :focus rules are copied for the focused element, B-1). - DmGamepad.m (no owner in this batch; the smallest change): while a page is shown (front_web_touch), hitTest lets through a touch no control would take (controlAt: the same order as touchesBegan), so it reaches the page instead of the game's touch screen; the page takes it as a click on what it lands on, which focuses it and presses A there (Continue, Return to title selection, OK / Cancel). With a controller connected every touch goes to the page. Checked: dm/ios/tools/compile_check.py compiles front_ios.m, DmGamepad.m and web_apple.m for the iPhone SDK (its one failure, hle_jit.c, is C-1's). Not checked: the iPhone itself (no device run in this session), the page's sounds alongside the app's audio session.
- B-1 done (3DAS B-1): Sunshine's pause menu shows in a web view on the Mac and every item works (Continue, Controls, Actions, Return to title selection with OK / Cancel; B, + and − resume); the stand-in stays for a windowless run or a missing page. - B-2 partial (3DAS B-2): the iPhone front end (web view under the gamepad, touches on no control go to the page) compiles for the iPhone SDK; not run on a device in this session. - B-3 done, no commit of its own (B-1 covers it): on the Mac, Return to title selection → OK ends the page with exit reason 3 and http://localhost/return_to_launcher, Sunshine calls oe::ExecuteProgram(0), the host ends with DM_EXEC_OUT, and a chaining run (allstars.sh's loop, started at program 2) brought the launcher back to its title screen. - B-4 done on the host side (in B-1), packaging left to A: the host finds the pages in DM_HTML, by default the folder "html" beside the RomFS folder, in html-document/ or html<n>/html-document/. The packaging must run `nx_extract <keys> <nsp> --program <N> --html <build>/extract/v0/html` for the program it packs (it writes html0/html-document/launcher_pause_menu.htdocs/..., 26 files, 0.8 MB for Sunshine; nothing when the program has no HtmlDocument NCA), which a Mac run then finds beside <build>/extract/v0/RomFS with no setting; the iOS app must carry that folder as <App>/html beside <App>/romfs (stage_resources.sh), which the host finds the same way from main.m's DM_ROMFS.
Super Mario 3D All-Stars' program 0, the launcher, gets a profile in the repository. It was a provisional one in the NSP folder (010049900F546000_build/profile). - game.tsv: identity, the v0 build row (main ff44f582…, subsdk0 7a5e537a…, sdk f93ce788…) and render_cond on. The menu wraps its clears in conditional rendering, and every frame is black without evaluating it. Memory: the 4 GB partition of the other sead games without virtual address memory (the NPDM declares no system resource; main sets a 2.93 GB heap in the 3.25 GB heap region). Measured on the Mac at the menu: 550 MB resident, 362 MB of it GPU allocations. The header describes the multi-program application (the launcher starts programs 1-3 with oe::ExecuteProgram and a 16-byte launch parameter) and how its movies reach the screen. - Shader tables from the provisional profile's shader split: 3,899 shaders (agl and gsys sharcb in Lib, BNSH in ShaderData and the layouts, 40 in main). Only the note changed, from "(provisional profile)" to the launcher's; a full dmsh_build.py run restamps the libraries for it. - pso_manifest.tsv: recorded on the Mac with DM_PSO_MANIFEST=off DM_PSO_RECORD from a fresh save: the opening movie, the title, every menu tile, a soundtrack's track list, the language list and the start of Sunshine. That is 22 shaders and 16 pipelines. With it a fresh run built no pipeline on demand on that route (prewarm 307 ms in the background). Checked: the host builds from this profile (GAME=010049900F546000, no DM_GAMES_DIR) and runs the launcher through that route. dm/tools/tests/test_patches.py passes. Not run: the iPhone (A-5).
Super Mario Galaxy is program 3 of the multi-program application and 32-bit ARM, which Apple silicon cannot run. Pressing A on its tile called oe::ExecuteProgram(3), and the host then stopped presenting frames.
- dm/games/010049900F546000/patches.py (new): one cut of main build ff44f58218c6a6b22b24c3e1af680a7f. The menu's contents are 0-2 the games (program = content + 1, main+0xe710) and 3-5 their soundtracks. Each frame its select state (main+0xf090) asks main+0xc040: "the selected tile can be decided (main+0xadc0) and A was just pressed (main+0x151e0)". If so, it runs the decide action (main+0xaf90) and the next state starts the game or opens the soundtrack's player. The function is rewritten in its own 24 words (two of them padding) to read the selected content as main+0xacf0 does and answer false for content 2. Found with DM_PROBE on setNerve (main+0x421c40): A on Galaxy set nerve main+0x752130 from that state, then main+0x752128, which ends in ExecuteProgram. A first try on main+0xacf0 ("the selected content is a game") changed nothing: the A press does not ask it.
- Galaxy's tile, artwork, description, language list and its soundtrack (content 5, played in the launcher) stay. Hiding the tile would mean rewriting the six-tile carousel and its layout animations.
- dm/gfx/tests/.gitignore: t_fb_stale's binary (A-1's test), as the other tests'.
Checked on the Mac (main rewritten with the cut): A on Galaxy does nothing and the menu keeps running. Super Mario 64's soundtrack opens its track list, and A on Sunshine still calls ExecuteProgram(2) with its parameters. dm/tools/tests/test_patches.py passes (the build is in the profile's build row since A-3).
Super Mario 3D All-Stars ran on the Mac only through a chaining script outside the repository (allstars.sh in the NSP folder), after packing each program by hand with --program N. - build_ipa_from_nsp.py: a Mac build from program 0 (no PROGRAM / --program) packs every program of the application that has a game profile (title ID base + index in dm/games), each into its own work folder from its own profile. That is 0 and 2 today (the launcher and Sunshine), 1 once Super Mario 64 has a profile; Galaxy, 32-bit ARM, has none. PROGRAMS / --programs lists them instead (0,2). Between programs the environment is restored, so one program's provisional or derived profile (DM_GAMES_DIR) does not reach the next. The script then writes programs.tsv in program 0's work folder (per program: its host, rewritten modules, run folder and environment) and prints one run command: program 0's, with DM_PROGRAMS pointing at it. mac_run returns the command's parts besides the command. The iPhone build is unchanged here (A-5). - The packing now extracts each program's offline HTML pages (nx_extract --html, B-4) into extract/<version>/html beside the RomFS, where the host finds them (hle_offline.c). A program without any gets an html.none marker. The launcher has two, Sunshine has its pause menu. - hle_oe.c: with DM_PROGRAMS, oe::ExecuteProgram(N) ends the program as Horizon does and starts program N's host in its place. That is an execve after the graceful exit, in its run folder, with this environment less every key a program's row sets, then the row's keys and DM_LAUNCH_PARAM=<run folder>/launch_param.bin holding the parameters. A program with no row is logged and the game carries on, as before. DM_EXEC_OUT stays for whoever runs the programs itself (the iOS app, A-5). - hle_lifecycle.c: dm_host_shutdown_then runs a last step in place of _exit, also from the 1.5 s fallback. dm_host_shutdown is that with none. - Tests: t_oe checks the plan for a packed program (host, modules, run folder, launch parameter file, the environment kept, dropped and taken) and that none exists for a program without a row. It checks ExecuteProgram writing the 16 bytes and handing prog_exec to the graceful exit, and carrying on for a program without a row. test_nsp_programs.py (new) checks the program list (profiles, PROGRAMS, a single --program), and that the Mac run over programs 0 and 2 writes programs.tsv rows and one command starting program 0 with DM_PROGRAMS. DM_WINDOW / DM_AUDIO are left to the command, and one program's DM_GAMES_DIR does not reach the next. These tests were written with the code, not before it. Checked on the Mac: build_ipa_from_nsp.py --platform mac on the NSP folder packed programs 0 and 2 (the launcher's shaders rebuilt in 51 s for its profile's new note). The printed command, run headless and silent, showed the launcher; A on Sunshine logged ExecuteProgram(2), the graceful exit and Sunshine's host in the same process; Sunshine popped the launcher's 16-byte launch parameter and showed its opening. Not run: the way back (Sunshine's pause menu, Return to title selection → ExecuteProgram(0)), which needs B's web view in a window; it takes the same path. allstars.sh in the NSP folder is no longer needed and was left in place. dm/host/tests make run, test_nsp_programs, test_nsp_mac, test_nsp_progress, test_nsp_chain, test_nsp_alias and test_nsp_nsz pass.
…lared on the Mac path only) Found by session B's dm/ios/tools/compile_check.py (GAME=010049900F546002): "use of undeclared identifier 'rx'". Checked: hle_jit.c, loader.c and hle_vk.m compile with the iPhone SDK.
…cil, specialization constants and R4G4 images in the Vulkan layer; its profile in dm/games/010049900F546001
With C-1's nn::jit stand-in, Super Mario 64 (Super Mario 3D All-Stars program 1) stopped in the Vulkan layer in turn. All fixes are general (any Vulkan game):
- Specialization constants: spirv-cross makes each a Metal function constant at its SpecId, and Metal refused the pipeline ("cannot be used to build a pipeline state", an abort under the validation layer). A stage with specialization data now gets its function specialized with those values (spec_fn: typed from the function's own constants, kept per module, variant and data). SM64 specializes one int of shader_vulkan_frag.spv.
- Packed 16-bit formats with a Metal twin: A1R5G5B5 (BGR5A1Unorm), R5G5B5A1 (A1BGR5Unorm), R4G4B4A4 (ABGR4Unorm), Metal naming its components from the low bit as the existing R5G6B5 row does. SM64's first A1R5G5B5 image failed and the game crashed on the null handle (vkGetImageMemoryRequirements).
- R4G4_UNORM_PACK8, which Metal has no format for: a linear image of it is an RG8 texture of its own, converted from the image's memory at each submit when its bytes changed (conv_refresh; the CPU's writes are final when it submits). SM64 writes the N64's IA4 textures so (crash in vkGetImageSubresourceLayout on the null image).
- vkCmdClearColorImage and vkCmdClearDepthStencilImage were stubs: they clear through an empty render pass per level and layer (an aspect left out is loaded and kept), and images with transfer-destination usage get render-target usage for it. SM64 clears its colour and depth-stencil targets this way each frame: with the stubs its depth buffer kept old values, so the title's Mario head, the logo and the file select's frame and buttons failed their depth test, and choosing a file showed nothing (the owner's report).
- Dynamic stencil compare mask, write mask and reference (vkCmdSetStencil*, stubs too): the reference is set at the draw, the masks pick a depth-stencil state made once per combination (dss_of). Dynamic line width is accepted (Metal draws lines one pixel wide), with a no-op vkCmdSetLineWidth.
dm/games/010049900F546001: SM64's profile, moved from the provisional one. Memory measured on the Mac: nnMain (main+0x2984) cuts the heap (pool - 64 MB - its 520 MB bss: 2.64 GB) into expanded heaps of 390 (the JIT work buffer), 128, 416, 128 and 400 MB and one of heap - 2,378 MB, memsetting each, so the whole heap is touched (footprint 3.2 GB); with a 1 GB heap the last size went negative and the boot crashed (main+0x2aac). The pool stays the hardware's; the guest block is 3.5 GB.
Checked on the Mac: the Nintendo logo, the title's Mario head with PRESS +, the file select, a new file through Peach's letter and Lakitu's introduction to the castle grounds and the castle lobby, 30 fps; the owner played into a course on this build. GenerateCode command 4 ran 5 times in all that (20 KB). New t_vk_clear (clears with a depth-only clear keeping the stencil, mask states, specialization, R4G4 conversion; under the Metal validation layer) and t_vk_desc pass; test_nsp_programs, test_nsp_alias, test_patches pass. Not done: my own screenshot inside Bob-omb Battlefield (steering by screenshot did not reach it; the owner reached a course).
…m application
An iPhone build from program 0 (no PROGRAM / --program) packs one IPA with every program that has a game profile: today the launcher (0) and Sunshine (2), and Super Mario 64 (1) once it has one. The app starts the program the last oe::ExecuteProgram named, else program 0. On ExecuteProgram the host records {index, parameters} in Documents/program.bin and the app ends: iOS cannot start an app's process again, and I found no clean way to restart in the same process (every module, the guest address space and Metal state would have to be torn down and rebuilt), so the player opens the app again. The next start runs that program with those parameters as its launch parameter, until a program starts another: Sunshine's pause menu, Return to title selection, starts program 0.
- One host over several profiles: game.py header-multi writes game_profile.h as a table of the programs' profiles (dm_games, from each program's own header). Its DM_GAME_* macros read the running program's entry; main.c dm_game_cur picks it by DM_PROGRAM, which main.m sets. Single-game builds keep their constant macros. Sites that needed a constant now take an expression: the shader map's default path and the stamp check (nvn_mtl.m), the module list (main.c DM_GAME_MODULES_ARR), the display versions (hle_sdk16.c, a non-static NULL-padded array; that file has no owner), the RomFS marker (main.m) and the window title and Quit item (front_mac.m: B's file, B is done, two expressions, needed only to build a Mac host over the table for testing). shared_font and device_api (#ifdef keys) are refused in such an app for now; none of these programs sets them.
- Modules: gen_embed.py --tag puts each program's modules in sections of its own (__dmp2mainx0, __DMp2mainW, __dmp2_nro_tab, …), and loader.c reads the tag from DM_EMBED_TAG. This is a five-line change to C's file: the section names, no logic.
- build_ipa.sh PROGRAMS_TSV (one row per program: profile, rewritten modules, RomFS, iOS shaders, graphics API): every program passes the single-game checks (check_program). Each program's rewriter and shader tables and launcher settings go to dm/p<N>/, its RomFS and offline HTML pages to p<N>/, its shader libraries to msl/p<N>/. dm/programs.txt lists the programs. IPA only, not --prepare-xcode.
- main.m: with dm/programs.txt it reads Documents/program.bin, takes program 0 when the program is not in the app, and sets DM_PROGRAM, DM_EMBED_TAG, DM_LAUNCH_PARAM (Documents/launch_param.bin) and DM_EXEC_OUT (back to program.bin). The program's folders become DM_ROMFS, DM_MSL_DIR and DM_NVN_SHMAP, and DM_APP_DM points Launcher.swift at the program's launcher.json. Saves stay in one Documents/save, shared as an application's save data is on Horizon.
- build_ipa_from_nsp.py: pack_one returns a program's parts on the iPhone too, and ios_programs runs build_ipa.sh once over them, with program 0's name, version, icon and bundle ID.
- Offline HTML pages (B-4) in single-game apps: <App>/html beside <App>/romfs, from the IPA packer and from stage_resources.sh.
- Memory: each process runs one program, so each program's own layout must fit one 6 GB iOS reservation. The launcher's is 4 GB and Sunshine's 6 GB (44905cb). Super Mario 64's is session C's.
- Tests: test_nsp_programs.py adds the iPhone path (one build_ipa.sh run with PROGRAMS_TSV and program 0's app) and HeaderMulti: a C program over header-multi's header gets program 0's or 2's values (address space, render_cond, modules, display versions) by DM_PROGRAM.
Built: SuperMario3DAllStars.ipa in the NSP folder (2.5 GB, unsigned): programs 0 and 2. The executable has the tagged sections of both, and the app holds dm/p0, dm/p2, p0/romfs, p0/html (html0, html1), p2/romfs, p2/html (Sunshine's pause menu), msl/p0/b-dec5ee141a9f and msl/p2/vk. Checked on the Mac with a host built over the two-program table: DM_PROGRAM=2 ran Sunshine (6 GB layout, the opening plane), and DM_PROGRAM=0 ran the launcher (4 GB, the menu with its movie). The iOS sources compile with that header (compile_check over it: only hle_jit.c failed, since fixed by C). Not run: the IPA on a device; main.m's program choice, which runs only on iOS; the way back from Sunshine. dm/host/tests make run, test_nsp_programs, test_nro_pack, test_nsp_mac, test_nsp_progress and test_nsp_chain pass.
- A-1 done (3DAS A-1): the launcher's purple backgrounds were its movies, made transparent by agl's in-place gamma draw sampling its own attachment. The NVN layer now snapshots any attachment a draw samples after its open pass already wrote it, for every game (nvn_mtl.m fb_prepare, g_fb_wrote; test t_fb_stale). - A-2 done (3DAS A-2): Galaxy's tile stays in the menu but A does nothing on it (a cut of main+0xc040 in dm/games/010049900F546000/patches.py); the soundtracks and the other games start as before. - A-3 done (3DAS A-3): dm/games/010049900F546000 with measured memory, the build row, render_cond, the shader tables and a recorded prewarm list (38 lines). - A-4 done (3DAS A-4): a Mac build from program 0 packs every program with a profile (0, 1, 2 now) and prints one command. oe::ExecuteProgram starts the named program in the host's place (DM_PROGRAMS, programs.tsv). Each program's offline HTML pages are extracted beside its RomFS. Checked launcher → Sunshine and launcher → Super Mario 64; the way back needs B's web view in a window and was not run. - A-5 done, not run on a device (3DAS A-5): one IPA (SuperMario3DAllStars.ipa, 2.6 GB, programs 0, 1, 2) over a table of the programs' profiles (game.py header-multi). It starts the program the last ExecuteProgram recorded in Documents/program.bin and quits on ExecuteProgram; the player reopens it. Super Mario 64 on the iPhone depends on nn::jit there (session C). For session C's docs: the run command, PROGRAMS / --programs, DM_PROGRAMS / programs.tsv, the iPhone app's program switching (quit and reopen) and the general same-pass snapshot rule (dm/games/README.md feedback_snap, which still describes only the listed shaders). allstars.sh in the NSP folder is no longer needed.
…ens it again
On oe::ExecuteProgram the iPhone app of a multi-program application (Super Mario 3D All-Stars) recorded the program in Documents/program.bin and vanished to the home screen with no word, and the player had to guess that reopening it starts the chosen game.
- hle_oe.c: on the DM_EXEC_OUT path, after the record is written and before the graceful exit, the host calls front_program_handoff(index, name), name being the program's profile name in an app of several programs (dm_games, game.py header-multi), NULL otherwise. The default (hle_lifecycle.c, weak) returns at once, so the Mac and single-program apps are unchanged. The record, the save handling and the graceful exit are as before.
- front_ios.m: in an app of several programs (DM_EXEC_OUT set, main.m) the app asks for notification permission (alert and sound) when its root view first appears; iOS shows the prompt only while the choice is not made, so at the first start. At each start it sets a notification delegate and removes pending and delivered notifications from an earlier hand-off. front_program_handoff, when notifications are allowed: audio suspended, "Starting <name>…" over the whole window for 1.5 s, then a local notification 1 s ahead ("Tap to start <name>"), and it returns once iOS has accepted it (at most 2 s). Then the graceful exit ends the app. Tapping the notification opens the app, which starts the recorded program as before. The delegate shows the notification even while the app is still in the foreground, in case the exit takes longer than 1 s. A player who refused notifications gets the plain quit, as before.
- The name is the profile's: "Starting Super Mario 3D All-Stars: Sunshine…", "Starting Super Mario 3D All-Stars: Super Mario 64…", "Starting Super Mario 3D All-Stars…" on the way back.
- Tests: t_oe checks the DM_EXEC_OUT path: program 2's index and 16 bytes of parameters recorded, the front end told program 2 before the graceful exit, no name in an app of one program, and no hand-off and no exit when the record cannot be written. These checks were written with the code. prog_name was checked over a header-multi header of programs 0, 1 and 2: the three profile names, NULL for program 3.
Checked: dm/host/tests make run (GAME=010049900F546000) passes, oe 47 checks. test_nsp_programs passes. The iOS compile check (GAME=010049900F546000) has 136 files, 0 failed. Not run: the overlay, the permission prompt and the notification on a device; they run only on iOS.
…ut captured on the Mac, made position-independent, served from an image Measured with C-1's log over boot, the title, the file select, a new file's introduction, the castle grounds and the lobby, and the owner's run into a course: after boot, GenerateCode command 4 ran 5 times in the owner's session and 3 to 8 times in mine, 20-28 KB; command 3 (once at boot) turns the RomFS's precompiled block list into 14.2 MB, the same in every run. The set is small and repeats, but not fixed: 0x802727f4, 0x80272954 and 0x80272ab0 are compiled in some boots only (timing), the file select's two overlay blocks (0x80172de0, 0x80173cd0) when it opens, and the Lua patch sites (0x802bbb5c / 70 / 80) at every boot. So the image is built from captures and grows with them, as the run-time SPIR-V captures do. - hle_jit.c, capture (Mac, DM_JIT_CAPTURE=<dir>): each request once, as <key>.jit: the request (data as it was and with host words masked), the layout it was made in (every module with its front patch area, the code, data and transfer memory), the code, the data memory bytes, the output and an input of up to 1 MB. The key: command, data size, data and the input's SHA-256 (an input over 1 MB, command 3's 140 MB of N64 state, only by size: it holds a table of 4,235 pointers into the precompiled NRO, and masking host words by value is not stable, about 92,000 words fall in the module range by chance). - dm/tools/jit_capture.py (new): the image (jit.img), its index (jit.tsv) and the outputs (jit.out). The plugin builds every host address as movz #, lsl seedds#48 + three movk, and nothing else in its code depends on where it runs (C-1's census): each such sequence into the code memory or a module becomes adrp + add + two nops to a canonical layout (the code memory at 0, the modules after it, 16 KB aligned; adrp reaches 4 GB); requests every capture placed alike keep their offset, the others go after them 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). On SM64's captures: 11 requests from 4 runs, 392,280 address sequences, 20,581 output relocations (command 3's pointers to its blocks), the requests seen in several runs identical after relocation. - The profile says what the host cannot know: jit_key_data, the data bytes that make a request (command 4's struct leaves 4 padding bytes uninitialised, main+0x52470, which differed once the plugin no longer ran, and the count with 1 above it was then masked as a host address), and jit_out_code, where command 4's output lists the code's entry points: the game takes the code to be where it asked (entry = its own pointer + offset, main+0x5256c; it advances the pointer by the size, main+0x52640), so a request served elsewhere gets its entry offsets moved by the difference and a size of 0, and the game then asks at one offset below every such request. - hle_jit.c, serving (iOS; the Mac with DM_JIT_SERVE=<dir>): the plugin is never loaded; CreateJitEnvironment maps the image at the layout's base (Mac: copied into pages sealed read + execute; iOS: the executable's __TEXT,__dm_jit section remapped, as the modules are), Control does nothing, GenerateCode finds the request by its key and returns the image's code range, the data bytes and the output with its relocations applied. A request not in the image is a [RED] line naming it, then -1 (the game crashes there: capture that part on the Mac and rebuild); DM_JIT_MISS_DUMP=<dir> writes its input. - loader.c: with a served image, one reservation for the layout, and every module the image names is mapped at its offset in it (Mac and iOS, front patch areas included); the image's layout must match each module's size, else the host stops. Checked on the Mac: served from an image of 2 boot captures, 4 more boots and one play capture, SM64 runs from the title through the file select and a new file's introduction to the castle grounds with every request served (7 command 4 blocks at other offsets than asked) and no plugin. New test_jit_capture.py (two synthetic runs: adrp targets, a moved request's branches, an output relocation, a request captured once refused, keys from the request bytes) passes; t_jit and t_nro pass; hle_jit.c and loader.c compile for iOS. Not done here: embedding the image in the iOS app and staging jit.tsv / jit.out (C-4).
…ts JIT code on the Mac and the app serves it from the executable Built: SuperMario3DAllStars.ipa (2.6 GB, unsigned) in the NSP folder: programs 0, 1 and 2 in one app, Super Mario 64's image in its executable (__TEXT,__dmp1_jit, 14.2 MB) and its index and outputs in p1/jit. Not run on a device (the owner sideloads and tests it). - build_ipa_from_nsp.py (A's file, A is done): an iPhone build of a program whose main imports nn::jit::CreateJitEnvironment (uses_jit) runs capture_jit after the shader steps: two headless boots in the Mac host with DM_JIT_CAPTURE into <version dir>/jit_capture/boot1 and boot2 (each until the boot code is in and nothing new comes for 10 s, at most 90 s; 20 s each here), then dm/tools/jit_capture.py --profile over every folder in jit_capture/ into <version dir>/jit beside the RomFS. Folders made with other rewritten modules or request keys are cleared (stamp.json: the modules' sizes, jit_key_data, jit_out_code). A Mac build's run command gets DM_JIT_CAPTURE=<version dir>/jit_capture/play, so what the game compiles in play on the Mac goes into the next IPA's image. - gen_embed.py: --jit <jit.img> puts the image in __TEXT,__dm<tag>_jit, 16 KB aligned, as the modules' code is. build_ipa.sh (A's file): passes it when <RomFS>/../jit/jit.img exists, and maps that folder to p<N>/jit in an app of several programs (jit/ in a single-program app), where the host finds jit.tsv and jit.out beside romfs (loader.c dm_jit_serve_dir). An empty option array is written so that bash 3.2's set -u accepts it. - hle_jit.c: the section name takes DM_EMBED_TAG (main.m sets p<N>). Memory on the iPhone: one process runs one program. Super Mario 64's guest block is 3.5 GB (within iOS's 6 GB reservation, C-2), and the JIT layout is a second reservation of 0.96 GB holding the code memory (384 MB, 13.6 MB of it the image) and the modules, which are mapped there instead of on their own. The game touches its whole 2.64 GB heap at boot (the memset expanded heaps); the app has the increased memory limit. Checked: the pack ran end to end (program 1: JIT capture 2:01 with two boots and the play capture from C-3, 11 requests); the IPA holds __dmp1_jit and p1/jit; main.m sets DM_ROMFS before the host loads. test_nsp_programs, test_nro_pack, test_nsp_mac, test_nsp_progress, test_nsp_chain and test_jit_capture pass; hle_jit.c compiles for iOS.
… Mac (launcher, Super Mario 64, back, Sunshine); stale descriptor-set frees ignored A and B were done when this started (3DAS B: done 71d4a69, 3DAS A: done 0f1fb6f). Super Mario 64 joined A's multi-program packaging with no change of its own: a build from program 0 packs every program with a profile, now 0, 1 and 2 (the IPA of C-4; on the Mac one run command over programs.tsv). Checked on the Mac from that run command (headless input through DM_CTL, a window, no sound): the launcher's title and menu, A on Super Mario 64 (ExecuteProgram(1) with the 16-byte parameters, its host in place, nn::jit, Mario's head), Minus for its pause menu (the offline page, game=64), Down x3 to "Return to title selection", A, A on Yes: the page ended with http://localhost/return_to_launcher, the game saved, unloaded its NRO, tore its Vulkan state down and called ExecuteProgram(0); the launcher's title again, A, Right to Sunshine, A: ExecuteProgram(2) and Sunshine's opening in the plane. - hle_vk.m: on that way back Super Mario 64 frees descriptor sets whose pool it had already reset or destroyed (NVIDIA's driver tolerates it), and the second free read freed memory (crash in set_free from vkFreeDescriptorSets). The layer keeps a table of the sets that exist (set_live) and ignores a free of one that does not, with a [RED] line once. t_vk_clear checks it (a set freed after its pool, with the freed memory reused). - README.md: a "Not yet tested on an iPhone" part under the games, with Super Mario 3D All-Stars (2.6 GB; Super Mario 64 and Sunshine, no Galaxy; how choosing a game closes and reopens the app; why Super Mario 64's run-time code is captured on the Mac and that a part never played there may stop the iPhone app) and its gallery image (the castle grounds). - AGENTS.md: the games paragraph gains the collection and what each program needed. - docs/development.md: the multi-program packing example, the JIT capture in the script's step list, a game note (programs, the launcher, Super Mario 64, Sunshine, Mac input) and jit_capture.py in the tools table. - docs/agents/03-bringup.md: catalogue entries for the extension font's stand-in glyphs, the multi-program hand-off (ExecuteProgram), nn::jit (and the iPhone's served image), and yield runs with zero-timeout polls. 04-graphics.md: the 3D All-Stars section (render_cond, the same-pass snapshot rule, VK_EXT_debug_report, specialization constants, packed and R4G4 formats, image clears and dynamic stencil, the stale set frees). - dm/games/README.md: feedback_snap describes A-1's general rule (as A asked), and the rows of jit_key_data and jit_out_code. Tests, once, for the code this batch changed (not the full gate, by the owner's standing rule for this repository): dm/host/tests t_jit and t_nro, dm/gfx/tests t_vk_clear and t_vk_desc (Metal validation layer), dm/tools/tests test_jit_capture, test_nsp_programs, test_nro_pack, test_nsp_mac, test_nsp_progress, test_nsp_chain, test_patches and test_nsp_alias pass; hle_jit.c, loader.c and hle_vk.m compile for iOS. Not run: the IPA on a device.
…teProgram ends the run and boots the next program in the same process Without it, oe::ExecuteProgram on the Mac execs the next program's host and on the iPhone ends the app (D-1 names the program and a notification opens it again). With DM_PROGRAM_SWITCH=inproc (environment, or dm/env.txt in the app through DM_ENV_FILE) and a host built over the programs' profiles, the running program ends and the named one boots on the same host thread, in about 0.1 s. Off by default: the Mac keeps execve and the iPhone app its quit, until the switch is seen working on an iPhone. How the run is taken down (dm/host/progswitch.c): - Statics: every host file's statics live in the sections __DATA,__dmrun_data / __dmrun_bss (dm/host/dm_run.h: a #pragma clang section that dm.h includes, and nvn_mtl.m first). Their bytes are saved at process start (main.m on iOS, main.c's main on the Mac) and put back between two runs (dm_runstate_restore): counters, tables, locks a thread left held, once flags and cached pointers all go back at once, with no per-static reset to maintain. Whole zero-fill pages are replaced by a fixed anonymous mapping, so 20 MB of tables a game never touched stay out of memory. Files that live for the process opt out after their includes (the front end, web_apple.m, crash.c, memstat.m, hle_count.c, probe.c, progswitch.c); a static that must outlive a run takes DM_PROCESS (the pthread keys, created once instead of once per run, the SIGTERM source, DM_CTL's read offset, the Mac plan of the next program). Checked with a linker map: no per-run file keeps a static in __data / __bss / __common. - Guest threads (hle_thread.c): once the run ends, every guest thread leaves at its next point that holds no host lock: SVC entry or exit, a kernel wait (after G is released), a sleep (now in steps of at most 20 ms), the start of a thread never started, or guest code when the SIGUSR2 handler finds it there. It siglongjmps to the host frame it started from (thread_main, or main.c's guest_entry for the main thread) and is counted as exited. A thread that keeps to host code (an HLE function between short stretches of guest code) is seldom in guest code when the signal comes: after 20 ms the modules' code loses execute permission (loader.c dm_modules_fence) and it leaves from the fault as it returns. Host waits that a guest thread can sit in for good leave too (dm_thread_term_check, woken by the coordinator): PopNotificationMessage, the background clock freeze, the web page wait and the movie player's deferred-event thread. - A coordinator thread of the host's own: suspends audio, ends the guest threads (5 rounds, then the fallback below), waits for the main guest thread at its exit point, then each subsystem's end of the run: scripted input threads (DM_KEYS, DM_CTL), the web page, the vsync threads and shared fonts (hle_sdk16.c), the nn::jit environment the game did not destroy (hle_jit.c: Super Mario 64 keeps its code and data memory until it ends; a served image's code memory goes with the modules' layout, C-3), movie decoders (a new list of live ones), audio outputs and the watchdog (hle_audio.c), graphics, the game's open files (hle_fs.c), the guest address space (hle_svc.c), the module images and the jit layout's reservation they sit in with DM_JIT_SERVE (loader.c), the thread and event objects. Then the statics are restored (on the main thread when the front end owns it, so its input calls never see half-reset state) and the next program's environment is set: on the Mac from its DM_PROGRAMS row (every variable the row set for another program dropped, DM_PROGRAM set, its run folder entered; the row's host is not used), on the iPhone by main.m again (front_program_env, the same function its launch uses). The main guest thread wakes, pops the run's autorelease pool (objects autoreleased on it outside a pool used to wait for a thread exit that never comes), resets its own thread-local state (nvn_mtl.m's pool lookup cache, dm_host_work) and runs the boot path again: modules, SDK start, nnMain. - Graphics: dm_gfx_end_run drains as the suspend does, then the Vulkan layer destroys every handle the game left (a new registry of the handles that hold Metal objects: memory, images, views, buffer views, samplers, descriptor pools, shader modules, pipelines, swap chains), the sparse virtual pools are unmapped and the borrowed command memory freed, and the Metal layer stops its present, display-link, encode and uniform-copy threads (new quit flags), the pipeline prewarm and predicted compiles, flushes its feedback and archive queues, closes its files, empties the residency set and releases its tables and every strong static: file-scope ones in mtl_release_statics, function statics through RUN_KEEP (each registers its slots the first time a run reaches it). dm/tools/tests/test_runstate_release.py checks both lists against the sources, so a new strong static without a release fails it. - Found on the way: the MTL4 command queue releases its feedback dispatch queue when it is deallocated without having retained it (macOS 26.5). The feedback queue now lives for the process and each MTL4 queue gets the reference it will release. - If a guest thread does not leave within about 5 s, or the main guest thread does not come back, the switch logs the threads and falls back to what ExecuteProgram does without it (Mac: the graceful exit and execve; iPhone: D-1's hand-off and exit). Also: - dm/host/Makefile PROGRAMS="0=<id> 1=<id> …" builds the Mac host over several programs' profiles (game.py header-multi, now written only when it changes); DM_PROGRAM picks the running one. - DM_CTL "program <n>": oe::ExecuteProgram(n) with no parameters from the control thread (the games' way back to the menu is a web page, which headless runs do not show). After an in-process switch DM_CTL goes on from where it stopped. - crash.c: a fault or pre-write hook registered again is kept once (nvn_dirty.c registers its hooks in every run). Measured on the Mac (headless and silent, one host over programs 0, 1 and 2, the packed builds in the NSP folder): 10 cycles of launcher → Sunshine → launcher → Super Mario 64 → launcher in one process, 40 switches, no crash. The launcher → game legs are the launcher's own ExecuteProgram (A, Right, A / A, A in DM_CTL); the way back is DM_CTL "program 0". Every run booted and drew (screenshots of each program in every cycle). Ending a run: guest threads gone in 7 ms on average (at most 21), the end of the run 128 ms (at most 230), the statics under 4 ms. Footprint at the launcher's title, 12 s after nnMain: 544 MB at the first start, then 602, 671, 607, 611, 537, 610, 642, 664, 667, 674 MB after each cycle; threads 30 to 33 (31 at the start). Sunshine ran at 908-1147 MB and Super Mario 64 at 3188-3330 MB in every cycle. Of the launcher's footprint after cycle 10: graphics 201 + 46 MB (201 + 25 at the start), untagged VM 251 MB (as at the start), malloc small 89 MB (12) and large 76 MB (27). Before the graphics releases the launcher grew by about 330 MB per Sunshine run and 150 MB per Super Mario 64 run (Metal objects held by zeroed statics, Vulkan memory and images the game never destroyed), and before the nn::jit registry by about 14 MB of untagged VM per Super Mario 64 run. After rebasing onto C-3 to C-5 (the jit environment and the served image): 3 more cycles, 12 switches, no crash, the launcher at 519, 611, 623, 677 MB, threads 30-31. Built: SuperMario3DAllStars-inproc.ipa in the NSP folder (2.6 GB, unsigned): programs 0, 1 and 2, with dm/env.txt setting DM_PROGRAM_SWITCH=inproc (build_ipa_from_nsp.py --env-file), for the owner to sideload. Without that line the app behaves as D-1 left it. Tests: t_thread_term (new): with real hle_thread.c, guest threads in an event wait, a lock wait, a guest-code spin, a 10 s sleep, never started, in a host-call loop, and the main thread in a condition wait all leave within a second without running past their wait, the process is back to its thread count, and (second run) a thread held in host code is reported after the timeout and leaves as soon as its call returns into the fenced code. t_runstate (new): restore puts a per-run file's statics back, frees a lock left held, runs a once flag again, gives a filled 64 MB zero-fill table's pages back, and leaves process statics and DM_PROCESS ones alone. test_runstate_release.py (new): the release lists of the Metal and Vulkan layers are complete and every host source places its statics in the run sections or is a declared process file (and it flags a removed RUN_KEEP or release, checked by hand). The tests were written with the code, not before it. t_oe, t_condvar, t_hid and t_web got stubs for the new calls. dm/host/tests make run passes; dm/gfx/tests: all pass except t_nvn's "counter timestamp written", which fails the same way on the base commit; test_nsp_programs passes; the iOS compile check (GAME=010049900F546000) has 137 files, 0 failed, and main.m, hle_oe.c, progswitch.c and main.c also compile for iOS over the three-program header. Not done or not checked: - Not run on an iPhone: the IPA is built for the owner to sideload. What differs there: the restore runs on the UIKit main thread, modules are vm_deallocated remaps of the executable's sections, and the fence makes remapped __TEXT pages read-only. - The GL layer (hle_gl.m) has no end of the run: the GL games are single-program applications. Its arenas and name tables would leak if one were switched. - Unreal's malloc zone (hle_uemalloc.c) is not released at the end of a run (no program of a multi-program application here uses it). - Small allocations still grow by about 7 MB per cycle (malloc small 12 → 89 MB over 10 cycles), and leaks finds about 0.7 MB unreachable after a Super Mario 64 round trip (dirty-range tables, host guest-thread stacks, path components); the rest is reachable, probably allocator caches. - The fallback after a guest thread that does not leave was not exercised in a game run (t_thread_term checks the timeout and the report).
Session D's D-2 (3b66893) landed after the C-5 docs; it asked C to document it. - AGENTS.md: the per-run host statics rule (dm_run.h's run sections, process files opting out, DM_PROCESS, releasing new strong Metal / Vulkan statics, test_runstate_release.py; host waits that must leave at the end of a run), and DM_PROGRAM_SWITCH=inproc in the 3D All-Stars sentence. - docs/development.md: the collection's note gains the in-process switch (what it does, the 5 s fallback, the Mac host over several profiles with make PROGRAMS=…, the 10-cycle measurement, SuperMario3DAllStars-inproc.ipa, DM_CTL program <n>) and D-1's notification wording. - docs/agents/03-bringup.md: the ExecuteProgram entry points at progswitch.c and what a failing switch looks like. - docs/agents/05-debugging.md: DM_CTL program <n>; after an exec switch the next host reads the control file from its start (its read offset begins at 0 in each process), after an in-process one it goes on; raise the window by pgrep -x dmhost before a shot. No code changed; no tests run.
…ENT_SNAP) Upstream's frame buffering (a188613) added strong statics to nvn_mtl.m: g_snap_alloc, g_snap_cb, g_snap_res, g_snap_ev and the ring's textures (g_snap[].tex). After rebasing the 3D All-Stars branch onto upstream ec4ea16, test_runstate_release.py failed on the four file-scope ones, as it is meant to: an in-process program switch (DM_PROGRAM_SWITCH=inproc) would have zeroed them without releasing them. mtl_release_statics now sets them to nil, the ring's textures too (a struct array, which the test does not see). Checked after the rebase: test_runstate_release and test_nsp_programs pass; dm/host/tests make run passes (with upstream's new t_svc_memory); dm/gfx/tests as before (only t_nvn's counter timestamp check fails, as on upstream); the iOS compile check has 137 files, 0 failed. Two cycles launcher → Sunshine → launcher → Super Mario 64 → launcher in one process on the Mac: 8 switches, no crash, the launcher at 521, 604, 610 MB, threads 30-32. Frame buffering itself was not turned on in those runs.
Upstream (ec4ea16) moved per-game material into dm/games/<id>/README.md and general mechanisms into docs/reference/<subsystem>.md with a line in docs/agents/symptoms.md. Rebasing the 3D All-Stars branch onto it took upstream's versions of AGENTS.md, docs/agents/03-bringup.md and 04-graphics.md, so session C's entries there are written again in the new layout: - Game notes for the three programs: dm/games/010049900F546000 (the launcher), 010049900F546001 (Super Mario 64), 010049900F546002 (Sunshine), and their rows in dm/games/README.md. - docs/reference: threads.md (zero-timeout polls between yields keep a yield run), services.md (undrawn extension code points as a ring, multi-program applications and oe::ExecuteProgram, the in-process program switch, nn::jit taken over by the host and served from an image on iOS, offline HTML pages in a web view), rendering.md (an attachment sampled after its pass wrote it gets a snapshot; the Vulkan layer's debug report, specialization constants, packed and R4G4 formats, image clears and dynamic stencil, frees of descriptor sets whose pool is gone), memory.md (Sunshine under the node area and 1 GB alignment entries). Two sentences the batch made stale are corrected (ShowOfflineHtmlPage, TryPopLaunchParameter). - docs/agents/symptoms.md regenerated with dm/tools/docs_symptoms.py. docs/development.md keeps its own 3D All-Stars block. dm/tools/tests/test_docs.py passes.
…after Super Mario 64 → launcher with DM_PROGRAM_SWITCH=inproc)
With the in-process switch on, going back to the launcher through Super Mario 64's pause menu ("Return to title selection", Yes) crashed the launcher seconds after it started: CRASH sig=5 in _xzm_xzone_malloc_freelist_outlined (xzone malloc found its free list corrupted), from unrelated callers (a CFString in nvn_mtl.m prog_get, an NSXPC dictionary). Seen twice before this session (the owner by hand, once scripted) and in every scripted run of that path here; another form of it was a crash in objc_release from dm_vk_end_run at the end of Super Mario 64's run.
Cause: as it leaves through the menu, the game tears its renderer down (main+0x9500) and calls vkDestroyImage on each image it got from vkGetSwapchainImagesKHR, then keeps the swap chain. Vulkan does not allow that (VUID-vkDestroyImage-image-04882); NVIDIA's driver evidently tolerates it. The layer freed the images while the swap chain still pointed at them, and at the end of the run vkDestroySwapchainKHR stored nil into the freed memory (malloc's encoded free-list link sits at offset 0, where VkImage_T keeps tex) and freed it again. Found by allocating the swap chain's images with mmap for one run: free() then aborted with "pointer being freed was not allocated" from main+0x9640 (SM64's vkDestroyImage loop). D-2's 40 clean switches never ran that code: there Super Mario 64 was ended from DM_CTL ("program 0") while it played.
Fix (general, any Vulkan game): a swap chain's images are marked (VkImage_T.swap) and vkDestroyImage of one is ignored with a line once; the swap chain frees them when it is destroyed.
Ruled out on the way: the jit memory (DestroyJitEnvironment unmapped the data and code memory while the game still ran; reserved without access for one run, nothing touched it) and the audio render thread that needed the fence (it crashed without any fence too). That thread gets its own exit in E-2.
Test written first: t_vk_clear destroys a swap chain's 3 images with vkDestroyImage, reuses the memory, checks the swap chain's images are intact, then destroys the swap chain. On the old layer the check fails and the process dies in vkDestroySwapchainKHR; now 20 checks, 0 failed.
Checked: 3 scripted runs launcher → Super Mario 64 → menu → Yes → launcher (window and sound, DM_CTL following the page's focus through DM_WEB_LOG): the ignored line once each, the launcher alive 25 s after the switch back, no crash. Before: 3 of 3 such runs crashed.
Docs: docs/reference/rendering.md "Swap chain images destroyed by the game", its line in docs/agents/symptoms.md (docs_symptoms.py), Super Mario 64's note (Vulkan, Found on this game). test_docs.py passes.
…wn; the fence names the threads it catches In both crashing runs of the SM64 → launcher switch, the end of Super Mario 64's run logged "1 guest thread(s) left after 20 ms; guest code fenced". The thread was the audio renderer's render thread (hle_audren.c render_main, a guest thread the host starts): it runs host code that calls the SDK's renderer every 5 ms and is seldom in an SVC or caught in guest code by the signal, so it left only from the fault of the fenced SDK code (pc sdk+0x1545c0, lr render_main+0x190), its siglongjmp skipping render_main. It was not the crash (E-1; a run crashed without any fence too), but the fence is meant as the last resort. - hle_audren.c: render_main's loops end when the run ends (dm_terminating) and the thread leaves through dm_thread_term_check between two renders, holding no lock. It leaves its output to dm_audio_end_run: closing it on the thread (CoreAudio's teardown) took longer than the 20 ms before the fence, which then fired on every switch. - hle_audio.c dm_audio_end_run frees a host output's key (dm_pcmout_open's 64 bytes), as dm_pcmout_close does; it leaked once per run that ended with the renderer open. - hle_thread.c: when the fence is reached the log names the threads still there (handle, name, host-created, last SVC, in an SVC), and for each that then leaves from the fault, where it was: pc, lr and the frame-pointer chain, host functions among the frames being what the siglongjmp skipped (end of the run: thread … left from fenced guest code at pc=…, lr=…, frames …). Recorded in term_fault, printed by the coordinator. - docs/reference/services.md: the render thread among the host waits that leave; the fence report; a switch is checked both ways (a game leaving through its own menu tears down more than one ended from DM_CTL). Checked: 3 scripted runs launcher → Super Mario 64 → menu → launcher in a window with sound: guest threads gone in 0-11 ms, no fence. 10 headless cycles launcher → Sunshine → launcher → Super Mario 64 → launcher in one process (DM_CTL "program 0" back): 40 switches, no crash; guest threads gone in 7 ms on average (at most 25), the end of the run 116 ms (at most 162); one fence, for a thread in SleepThread that left at its next 20 ms step (24 ms), not through the fault. Launcher footprint 12 s after nnMain: 578 MB at the start, then 601, 608, 662, 677, 562, 649, 569, 597, 698, 672 MB after each cycle; threads 30-33 (31 at the start). Sunshine 1038-1152 MB, Super Mario 64 3178-3357 MB. (D-2: 544, then 602-674 MB.) Tests: dm/host/tests make run passes (t_thread_term's held thread now prints the report); test_runstate_release.py and test_nsp_programs.py pass; the iOS compile check (GAME=010049900F546000) has 137 files, 0 failed. No new test for the render thread's exit: t_thread_term covers the leaving mechanism, the game runs above this path.
…ts own boot requests Preparing the collection again (build_ipa_from_nsp.py) stopped at Super Mario 64's JIT capture step: jit_capture.py "code offset 0x48 of session 0x148e04000 lies in no captured request". The Mac host captures a request only when its key is not yet in the folder (hle_jit.c jit_capture), and the image builder resolves a session's references into the code memory through that session's own records (a session is told by its code memory's base). A session that started after an in-process program switch (DM_PROGRAM_SWITCH=inproc, Super Mario 64 played from the launcher in the multi-program Mac host, which captures into jit_capture/play) has its code memory somewhere no earlier session had it: commands 1-3 (the boot) were already in the folder and skipped, and its command 4 blocks call into boot code it did not capture. Fix (dm/tools/jit_capture.py): a session the builder cannot place whole is left out with a red line saying how many of its requests no other session has, and the image is built from the rest. Borrowing the boot code by offset from the other sessions was tried and dropped: the captures' command 4 blocks sit at other offsets in each session, so an offset alone could pick another request's code. Test written first: test_jit_capture.py test_session_without_its_boot, a third session with only a play request calling into boot code it lacks; it fails on the old builder (the assertion above) and passes now, with an image identical to the two whole sessions'. On the real captures: the session 0x148e04000 is left out (3 requests, all also captured elsewhere); the image is as before, 11 requests from 3 captures, 13.6 MB, 392,280 address sequences, 20,581 output relocations. Docs: docs/reference/services.md, nn::jit served from an image on iOS.
…ogram of a multi-program application
The owner installs games on their devices from a prepared Xcode project (build_ipa_from_nsp.py --prepare-xcode, then Xcode or xcodebuild signs with their team). For a multi-program application the NSP script packed one IPA only (A-5): --prepare-xcode went straight to one program, so 3D All-Stars got a project with the launcher alone, which cannot start the games.
- build_ipa_from_nsp.py: --prepare-xcode packs every program as the IPA path does (program_list, pack_one(multi=True)), then xcode_programs prepares one project over them (build_ipa.sh --prepare-xcode with PROGRAMS_TSV) and registers it in the workspace: program 0's project, app name and identity, as ios_programs takes program 0's for the IPA. Programs 1 and up skip the Xcode bookkeeping (saved signing, the bundle ID check). --programs' help and the PROGRAMS setting say so.
- build_ipa.sh: PROGRAMS_TSV is accepted with --prepare-xcode; the programs' table of files (Gen/resources_programs.tsv: index, RomFS, marker, iOS shaders, shader folder) goes to gen_resources.py, which names it in Gen/resources.env (DM_RESOURCE_PROGRAMS).
- stage_resources.sh (the project's build phase): with the table, every program is checked before anything is copied (its files, its shader chain version), then its RomFS, offline pages and nn::jit image go to p<index>/ and its shader libraries to msl/p<index>/, as the IPA lays them out (main.m); a program no longer listed is removed, and a project prepared for one program again takes the p<index> folders away. The one-program path now copies the nn::jit image beside the RomFS too (jit/, as the IPA has it; it copied html/ only).
Tests: test_xcode_workflow.py test_several_programs (three programs, NVN and Vulkan shader folders, offline pages and a jit folder; a program dropped; a missing RomFS stops before copying; back to one program). test_prepare_preserves_upstream_options_and_graphics_paths is updated on purpose, in two ways: it had failed (6 subtests) since C-4, whose uses_jit reads ExeFS/main, which the fixture does not have (mocked now); and its by_title mock answered for every title ID, which the multi-program routing would take as 16 programs (it now answers for the fixture's title only). All 4 tests pass; test_nsp_programs.py and test_docs.py pass.
Checked for real: build_ipa_from_nsp.py "<NSP folder>" --prepare-xcode --keep-extracted --team-id YDQNQGK5W5 --bundle-id com.stan69b.nxnative.010049900f546000 prepared one project over programs 0, 1 and 2; xcodebuild -allowProvisioningUpdates (Release, the iPad Pro 11" 3rd gen) built and signed it ("iOS Team Provisioning Profile: com.stan69b.nxnative.010049900f546000", the increased memory limit entitlement), the app 2.8 GB with p0, p1 (with jit), p2, msl/p0-p2 and dm/p0-p2; xcrun devicectl installed it on the iPad. Not yet played on it.
Docs: docs/development.md (the multi-program example), docs/reference/services.md (multi-program applications).
… played on an iPad - The launcher's note opens with "The collection": four programs, each its own Program NCA, title ID, engine and graphics API (the launcher on NVN; Super Mario 64, an N64 emulator on Vulkan whose JIT plugin the host takes over, its output served from an image on iOS; Sunshine, NERD's Hagi with recompiled PowerPC on Vulkan; Galaxy, a 32-bit ARM program that Apple silicon cannot run, so it is not packed and its tile cannot be started), one save, oe::ExecuteProgram between them, and the pause menus' offline pages as the way back. - The owner played the collection's app on an iPad Pro 11-inch (3rd generation, iPadOS 26.2), installed from the project --prepare-xcode now prepares over the three programs (E-4): Super Mario 64 and Sunshine from the menu and back, first with the app quitting at each switch (D-1's notification), then built with DM_PROGRAM_SWITCH=inproc, switching in place. No device log was taken. The three game notes, docs/development.md, docs/reference/services.md and README.md say so instead of "not run on a device"; README says how to build the app that switches in place. The switch stays off by default until it has run longer on devices. - The in-process measurements after E-1 (through the games' own menus too) in the launcher's note. Rebased onto upstream main c3a0880 first (5 commits: verified game patches across updates, Metal image atomics and the shader chain moving to a new version); no conflicts. After the rebase: the multi-program Mac host builds, dm/host/tests make run passes, t_vk_clear 20 checks 0 failed, the iOS compile check 137 files 0 failed, test_docs, test_nsp_chain, test_runstate_release, test_nsp_programs and test_jit_capture pass; docs/agents/symptoms.md regenerated (377 symptoms).
stan69b
force-pushed
the
game-3d-all-stars
branch
from
October 25, 2026 16:47
632923e to
2c85925
Compare
This was referenced Oct 26, 2026
3 tasks done
This was referenced Oct 31, 2026
2 tasks done
|
Should this PR be closed ? you seem to have merged an other one on the same game, cherrypicking some fixes from this one, so it may be closed now i suppose :) |
Contributor
Author
|
Closing: Super Mario 3D All-Stars is supported on main through other PRs (#562, #1441, #2156, #2673), and it is in the games table with its Super Mario 64 and Super Mario Sunshine notes. Answering @TheSTouch: yes, nothing in this branch still needs to land. Thanks for the question. |
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.
Summary
Super Mario 3D All-Stars is not one program but four, each its own Program NCA, title ID (base + index), engine and graphics API: a menu (program 0, sead / agl on NVN) that starts Super Mario 64 (1, an N64 emulator on Vulkan with a JIT plugin), Super Mario Sunshine (2, NERD's Hagi with recompiled PowerPC on Vulkan) and Super Mario Galaxy (3) with
oe::ExecuteProgram, and each game's pause menu, an offline web page, goes back. This branch makes the collection play on the Mac and on iPhone / iPad as one app holding programs 0, 1 and 2. Galaxy's program is 32-bit ARM, which Apple silicon cannot run, so it is not packed and its tile cannot be started (a cut in the launcher).The launcher's note,
dm/games/010049900F546000/README.md, has the overview ("The collection"); the three game notes have the details.What it took, all general (any game can use it):
nx_extract --program, the NSP script packing every program with a profile (--programs),DM_PROGRAMSon the Mac, one iPhone app over several profiles (each program's modules in tagged sections, its files underp<N>/), the launch parameter, and the D-1 hand-off notification.--prepare-xcodenow prepares one Xcode project over all of them (E-4), which is how the iPad build was installed.DM_PROGRAM_SWITCH=inproc, opt-in, off by default):ExecuteProgramends the run and boots the next program in the same process in about 0.1 s. Every host file's statics live in run sections (dm_run.h), saved at process start and put back between runs; guest threads leave at their next safe point (hle_thread.c); each subsystem has an end of the run (graphics, Vulkan handle registry, audio, movies, web page,nn::jit, files, address space, modules).test_runstate_release.pyfails on a new strong Metal / Vulkan static without a release.nn::jit: the host takes the API over. On the Mac the game's JIT plugin runs in the host intoMAP_JITmemory; iOS runs no code made at run time, so the NSP script captures the plugin's output on the Mac,jit_capture.pymakes it position-independent, and the app serves it from an image in its executable (DM_JIT_SERVE).VK_EXT_debug_report, specialization constants as Metal function constants, packed 16-bit and R4G4 formats, image clears, dynamic stencil state, frees of descriptor sets whose pool is gone, andvkDestroyImageof a swap chain image ignored (E-1, below).Evidence
CRASH sig=5in_xzm_xzone_malloc_freelist_outlinedseconds after the launcher started, orobjc_releaseindm_vk_end_run. Super Mario 64 destroys its swap chain's images withvkDestroyImageas it leaves (main+0x9500); the layer freed them, and the end of the run then wrote into the freed memory and freed it again. Found by mmap-allocating the swap chain images for one run, which made the game'sfreeabort atmain+0x9640.After: 3 of 3 runs pass in a window with sound, the launcher alive 25 s after the switch back. 10 headless cycles launcher → Sunshine → launcher → Super Mario 64 → launcher in one process: 40 switches, no crash; guest threads gone in 7 ms on average (at most 25), the end of the run 116 ms on average; launcher footprint 578 MB at the start, then 562–698 MB after each cycle, threads 30–33.
--prepare-xcodeproject. Super Mario 64 and Sunshine from the menu and back, first quitting at each switch, then withDM_PROGRAM_SWITCH=inprocswitching in place. No device log was taken.dm/host/testsmake run(newt_thread_term,t_runstate),t_vk_clear(new; 20 checks),test_runstate_release.py,test_nsp_programs.py,test_jit_capture.py,test_xcode_workflow.py(a new several-programs staging test; its prepare test had failed since C-4 and is fixed),test_docs.py, andtest_nsp_chain.pypass after rebasing ontobe5b197. The iOS compile check (GAME=010049900F546000): 137 files, 0 failed.dm/gfx/tests: every test passes exceptt_nvn's "counter timestamp written" (128 checks, 1 failed), which fails the same way on the base commit. After the rebase, the collection rebuilt for the Mac with the new shader chain and the windowed menu round trip launcher → Super Mario 64 → launcher passed again.Merge Danger
Door: two-way
Opt-in where it is risky. The in-process switch is off unless
DM_PROGRAM_SWITCH=inprocis set. Multi-program packing only happens for a title whose later program indices have profiles. No game binaries, keys, saves or game logs are committed; the one image is the README gallery screenshot.Blast Radius: host-wide (statics placement), Vulkan layer, NVN pass snapshots, NSP script and iOS packaging
__DATA,__dmrun_data/__dmrun_bss(a#pragmaindm_run.h, included bydm.h). It changes nothing in a single run, but a new host file or a new strong Objective-C static has rules to follow (AGENTS.md), whichtest_runstate_release.pychecks.--prepare-xcodepath now goes through the program list like the IPA path; a single-program game prepares as before (covered bytest_xcode_workflow.py).