Files
seedds f4f0a85d6e patch_nso.py split into the general rewriter and per-build patch files (GitHub issue #63): every game's bring-up edited the one file, so PRs for unrelated games conflicted. dm/tools/patch_nso.py (1,711 → about 1,100 lines) keeps the general passes and the driver; the instruction encoders move unchanged to dm/tools/nso_asm.py; a game's own patches (CUTS, OBS and the frame-step stubs, now FRAME_STEP = {build ID: stub(ctx)}) move verbatim with their comments to dm/games/<id>/patches.py (16 profiles: Tears of the Kingdom, Breath of the Wild, Age of Calamity and Paper Mario: The Thousand-Year Door with their stubs), and the cuts of Nintendo's sdk module builds, 6 of the 15 shipped by 2 to 4 games, to dm/tools/sdk_patches.py. The rewriter loads every patch file, whatever the game, and applies those of a module's build ID at the points it did before (cuts before the scan, gates after the rewrite, stubs after the gates); a build ID claimed twice stops it, and its command line needs no DM_GAME. build_src.sha256 lists the rewriter's files and every patch file (the same for every module). NSP script: the rewrite step's reuse key counts nso_asm.py and only the patch files that name one of the game's builds (patch_files), profile_files leaves patches.py out (only the rewrite step reads it), and a derived profile gets none. dm/tools/tests/test_patches.py: no build claimed twice, the entries' forms, a game's file names only its own profile's non-sdk builds, sdk_patches.py only sdk builds some profile ships, and the reuse key's patch files. Checked byte-identical: every extracted module on the game drive (131 builds) rewritten with the previous and the new rewriter gives the same outputs but build_src.sha256, 28 of the 30 patched builds among them (all four frame-step mains), and 7 fail alike (rtld, and New Super Mario Bros. U Deluxe's, which no profile rewrites); the other two (Super Mario Bros. Wonder's mains and Absolum's, no game files here) by their CUTS / OBS data, equal to the previous tables. AGENTS.md, docs, dm/games/README.md, the profiles' comments and the host comments that named a game's cut in patch_nso.py now name its patches.py or sdk_patches.py
2026-10-23 23:36:21 +08:00

2.8 KiB

1# Super Mario Galaxy 2 (Switch, 2025; base game v0 + update 1.4.0 = v393216), SDK 18.3.5.
2# hardware (GX → Vulkan with SPIR-V generated at run time, the DSP, DVD reads from the RomFS). main's bss is about 2.6 GB (the emulated memory).
3# Renders with Vulkan: main imports 99 vk* functions, which subsdk4 (NVIDIA's Vulkan driver, on GLSLC in subsdk1) supplies; subsdk3 is NVIDIA's OpenGL driver, subsdk2 nn::pcm.
4# The host implements the vk* functions on Metal itself (dm/gfx/vk/hle_vk.m), so only main, subsdk0 (NintendoSDK_movie) and sdk are loaded; subsdk0 and sdk are Galaxy's builds.
5# ---- Identity ----
6title_id0100FD8022DAA000
7program_id0100FD8022DAA000
8# ---- App ----
9nameSuper Mario Galaxy 2
10ipaSuperMarioGalaxy2.ipa
11app_categorypublic.app-category.action-games
12pad_layoutfull
13# handheld: the pointer (star bits, menus, the file select) is the touch screen; docked it is the Joy-Con gyro, which the host does not have
14op_modehandheld
15# ---- Versions ----
16buildv3932161.4.0main=4c4513d976582b4a7a766401a8ea6dbfsubsdk0=8a72a4dcbfd375d2952288284259da94sdk=6075151627016eef437c1312f2e3ed56
17packagev393216
18shader_versionsv393216
19# ---- Graphics ----
20# main imports Vulkan, not NVN: the host's Vulkan layer (dm/gfx/vk/hle_vk.m). Hagi generates its GX shaders as SPIR-V at run time, and the RomFS has no SPIR-V file,
21# so the NSP script captures them by booting the game on the Mac (vk_capture.tsv lists the keys); vk_shaders.py translates the capture
22# ---- Files ----
23# load order as on Horizon: main, subsdk*, sdk; subsdk1–4 (GLSLC, nn::pcm, NVIDIA's OpenGL and Vulkan drivers) are replaced by the host's Vulkan layer and not loaded
24modulesmain subsdk0 sdk
25romfs_markerhagi.config
26zip_store.arc:.ast:.bmp:.cache:.har:.png:.szs:.zst:.metallib
27# ---- Memory ----
28# NPDM system resource 8 MB. As in Galaxy: no SetHeapSize, the game's memory is main's 2.6 GB bss. Unlike Galaxy, the movie player's StandardAllocator takes 384 MB of
29# virtual address memory (main+0x62c280: Initialize(nullptr, 0x18000000)), which the alias region holds after the SDK's node area (cut to 62 MB in dm/tools/sdk_patches.py for this sdk build).
30# So the block is 1.25 GB = 256 MB in front + 512 MB alias region + 256 MB stack region + 256 MB heap region; with main's 2.7 GB image about 4 GB of address space, as Galaxy's.
31# Footprint on the Mac (M4 Pro, the opening's first stage): 1.93 GB, flat from 2 to 5 minutes (Metal 1.0 GB)
32mem_reserve0x50000000
33mem_alias0x20000000
34mem_stack0x10000000
35app_pool0xCD500000
36# ---- Shader split ----
37shader_noteSuper Mario Galaxy 2 has no NVN shaders (its SPIR-V shaders go through the Vulkan layer)