Skip to content

Merge upstream main (seedds/nxnative b149a1e4): 37 upstream commits, the fork's picks kept or superseded - #3

Merged
khalilgharbaoui merged 38 commits into
mainfrom
sync-upstream
Nov 12, 2026
Merged

khalilgharbaoui merged 38 commits into
mainfrom
sync-upstream

Conversation

@khalilgharbaoui

Copy link
Copy Markdown
Owner

Brings this fork up to date with upstream main in one merge commit: seedds/nxnative b149a1e4, 37 commits past the merge base 0cad9500. A real merge (parents 31f97960 and b149a1e4), no rebase, no force push. Nothing here touches seedds/nxnative.

The rule: where upstream now does one of this fork's picks itself, upstream's version wins and the fork's copy goes, with its switches, docs rows and tests. Every other pick stays and still builds and passes on the new base. The fork's own three commits stay.

What Ocarina of Time gains from the 37 upstream commits

  • Full docked picture by default (084f5aa5): the graphics scale is tier 0 in both modes, so the game draws 2560x1440 (3D up to 1920x1080) instead of 2048x1152 (1536x864). Upstream's runs: GPU p50 12.9-14.0 to 15.0 ms, about 59 fps on an M4 Pro. DM_GFX_SCALE=1 or 2 asks for a reduced tier. This replaces this fork's DM_GRAPHICS_SCALE.
  • About 0.3 ms less GPU a frame (511a0a2c): unused border-colour corrections are compiled out of pipelines (forest deck on an M6: GPU p50 11.01-11.26 to 10.66-10.88 ms).
  • Controllers (68dde14b, 47343a42, f20f6507): one Pro Controller with a stale second IOKit entry after a long Bluetooth disconnect stays one player (the controller applet no longer opens in a loop, the music no longer stays suspended, and the silent entry no longer turns the Pro Controller's gyro off); a keyboard receiver that declares a gamepad no longer takes player 1.
  • Uniform reads (1d090a66): the maintainer's own answer to the horse, slingshot and ReDead streaks (issue #2218): a slot is bounded at its size rounded up to 256 bytes, the size the console's driver gives the GPU. See the risk below.
  • Shader build (8b55ebb3, f75ac06e, 3553400d): a cold build finishes shaders in worker processes (the PR author's Ocarina map on an M3 Max: 3,506 to 1,826 s); Mac shaders are compiled for the host's minimum macOS; an Ampere jump-table fix in the translator.
  • Already here, now upstream's own (1e69c180, 6a6a018d, d2556cff): the shared-pool-page race, the Castle Town prediction hitch and the partial texture re-uploads, the same code this fork carried.
  • General host fixes the game benefits from: log lines on the host stack, cloud-save safety (the launcher asks which save to keep when both changed), recycled heaps for textures that dynamic resolution resizes.

The fork's picks and what happened to each

# Pick Source Commit Fate
1 Uniform reads unbounded on Switch 2 #2219 98f61af Dropped, upstream does it: 1d090a66 (the slot bounded at its size rounded up to 256 bytes, for the same issue and PR). ub_unbounded and its note line are gone
2 Indirect dispatch off a busy copy encoder #2226 5c89588 Kept as is
3 Hash shared pool pages before CPU writes #2136 e1ad1ae Dropped, upstream does it: 1e69c180, the same code (upstream's comments and docs)
4 Profile key gpu_ts_hz #1714 0371576 Kept as is
5 Grace after a one-off slow frame #2091 4cdbe2e Kept as is
6 Frame step: half rate counted once #2071 7f6b3b7 Kept as is
7 fps_hold off for Ocarina #1927 82ed8f1 Kept as is
8 dispatch_overlap #1901 7cec492 Kept as is
9 Texture view cache by Metal texture, enc_thread on #2260 46c35fd Kept, adapted: its comment named rh_take, which 707cac95 split up; it now names rh_wait, where a recycled heap waits for its texture to be freed. The code needed no change (vb_drop still runs in defer_obj_at)
10 t_feedback with the encode thread off #1928 7b65b7c Kept as is
11 Partial texture re-uploads #2263 35f4494 Dropped, upstream does it: d2556cff, the same code
12 No stand-ins for predicted keys with a made base #2262 98f8e54 Dropped, upstream does it: 6a6a018d, the same code
13 fb_prepare early out #1469 f233449 Kept as is
14 Wakes after the thread lock is let go #1466 c81c0ff Kept as is
15 DM_GRAPHICS_SCALE (opt-in) #1838 64871cd Dropped, upstream does it: 084f5aa5 answers tier 0 in both modes and says it supersedes #1838; its DM_GFX_SCALE replaces DM_GRAPHICS_SCALE. The switch, its env_switches.tsv row, its services.md section and its t_oe cases are gone
16 HDR output for Switch 2 (opt-in here) #1176 80a2593 Kept as is
17 MetalFX for the game's own upscaler #1459 765aa2f Kept as is
18 Covered window keeps its frame rate #1302 7754991 Kept as is
19 Frame-rate counter in the Mac window kid-with-sword 72275f7 cbdce4b Kept as is
20 Shader split zstd in-process #1463 0fcdada Kept as is (merged beside 430ace12's shader_split.py change without a conflict)
21 Kakariko prewarm rows betogzo 449eebb, 78e241c 490dcf1 Kept as is
22 Microphone ocarina #1908 59527c0 Kept as is
23 Pro Controller gyro zero swordboiMacNative 82ab1be 813b194 Kept as is: 68dde14b is a different problem (a silent second HID entry); both sit in motion_pro.h and merged without a conflict
24 Pro Controller 2 motion #2258 20a692c Kept in part. Its press-to-join part (a Switch 2 pad waiting for its first press stays connected) is dropped, upstream does it: 7ef83394 (attach returns 1 or 0, playerSync, the Joy-Con split) wins in front_mac.m, pad_switch2_apple.h and .m; the pick's before / s2_sync_sides lines went, and its reference entry's Fix line now describes 7ef8339's code. The 200 Hz motion stream, the scaled stick dead zone, the Pro Controller 2's axes and sw2_gyro stay
25 Ocarina cheats #1718 e2ba44a Kept as is
26 Free camera cheat #1949 ba73639 Kept as is
27 God mode cheat #1955 974b2c3 Kept as is
28 Map select cheat #1963 ffd2747 Kept as is
29 Cheat sections fold in the Mac panel #2014 4ab6bed Kept as is
30 Test saves #2002 fb219b9 Kept as is
31 Shader build in worker processes #2035 77d5833 Dropped, upstream does it: 8b55ebb3 finishes shaders in DMSH_PROCS forked workers and says #2035 is not taken. The fork's dmsh_build.py change, its test change and its docs are gone
32 Shader loop guard #2254 b47b102 Kept as is
33 Texel fetch clamp #1824 d75c295 Kept as is (fetch_clamp runs inside finish, which upstream's workers run)

The fork's own commits, all kept:

  • 351a992 (DM_NVN_IND_SPLIT row): kept; #2226 stays.
  • dd8dbf1 (HDR launcher row off by default): kept; settings.tsv and test_settings.py unchanged from main.
  • 0e6c55f (Mac Controls panel, keymap_mac.h, controls_mac.h, ⌘K, DM_SHOW_CONTROLS): kept. Upstream changed front_mac.m only in its controller paths (f20f6507, 7ef83394) and added no key, so the table needs no new row; t_controls_mac passes (461 checks).

Conflicts and how each was resolved

A trial merge of main and upstream had 18 files in conflict. Most of them were the dropped picks meeting upstream's own copies, so the merged tree was worked out on a scratch branch: the six dropped picks reverted (in reverse order) on top of main, upstream merged into that, the rest resolved, and the resulting tree committed as the merge of main and b149a1e4. The scratch branch was never pushed.

File Resolution
nvn_dirty.c, t_pso_depth_stencil.m, hle_oe.c, dmsh_build.py, test_shader_toolchain_cache.py, docs/reference/nvn-objects.md, frame-rate.md, shaders.md, docs/agents/symptoms.md, most of nvn_mtl.m Upstream's side: these were #2136, #2262, #2263, #2219, #1838 and #2035 against upstream's own versions
dm/games/0400486024DEC000/README.md Both sides kept line by line: upstream's new lines (tier 0 sizes, the border corrections, the uniform bound, the controllers) and the fork's (half rate, gyro zero, timestamp rate); the dropped picks' lines went with them, upstream's copies stay
dm/games/040074A01BF12000/README.md Both: upstream's border-corrections line and the HDR line from #1176
dm/gfx/tests/Makefile Both rules (t_view_cache from #2260, t_partial_upload now upstream's)
dm/gfx/nvn/dmsh_chain.h Regenerated (below)
dm/host/front_mac.m s2pad_attach: upstream's (7ef8339; the same code as #2258's, upstream's comment). The Controls panel and keymap needed nothing
dm/host/pad_switch2_apple.h, pad_switch2_apple.m Upstream's (7ef8339), see pick 24
dm/host/tests/t_hid.c Both tests: #2258's t_motion_history and upstream's t_touch_sampling

Shader chain

dm/gfx/nvn/dmsh_chain.h is b7dc2ede7e42, written by dmsh_chain.py --header on the merged tree (this fork had 6496351be585, upstream 2afd39090b76; upstream's own tree gives 2afd39090b76 on this Mac, so the tool agrees with upstream). It is upstream's translator and tools plus this fork's loop guard (#2254) and texel fetch clamp (#1824). test_nsp_chain.py passes. Every game's shaders need a rebuild for this chain.

Risk to check in the game

  • Pick 1's streaks. This fork's #2219 removed the uniform bound for Switch 2 games, which its author found fixed both the stretching and the flicker. Upstream's 1d090a6 keeps a bound, rounded up to 256 bytes, and says the streaks did not appear on its Mac either way, so whether it clears them awaits a retest. Worth looking at the horses at Lon Lon Ranch, the slingshot aimed and the ReDeads in adult Castle Town. If they still streak, #2219 can be taken back on top of this.
  • The full docked picture costs GPU time: tier 0 is about 1-2 ms more GPU a frame on an M4 Pro. DM_GFX_SCALE=1 gives the old 2048x1152 picture back.

Tests

Run on an Apple M5 Pro (48 GB, macOS 27.2, Xcode 27.2, Homebrew Python 3.15 with the clone's .venv), all with nice -n 10, on the merge commit unless said. Python files run one at a time as CI does (python -m unittest <file>, DM_GAME=010015100B514000, DMSH_TEST_XLATE set to the committed translator, unicorn on PYTHONPATH for test_oot_frame_step).

Command Exit Notes
dmsh_chain.py --header 0 b7dc2ede7e42; on upstream's tree the tool prints 2afd39090b76, its committed value
make -C dm/host GAME=0400486024DEC000 dmhost 0
make -C dm/host/tests GAME=0400486024DEC000 -j4 run 0 first run (t_controls_mac 461 checks, t_hid 263, t_oe 70, t_switch2 121, t_pad_hid_mac, t_motion_pro, t_motion_pro_mac, t_input_stream, t_bigstack)
the same, again later 2 t_audio's device stall case (an AudioUnit restart on the real output device) failed, and failed the same way on upstream b149a1e4 at that moment: the Mac's audio device, not the code (hle_audio.c and t_audio.c are the same as on main). Every one of the 82 test commands of run, run one by one: 81 exit 0, t_audio 1
Targeted Metal tests (make -C dm/gfx/tests GAME=0400486024DEC000 check_<t>): t_nvn, t_dirty_race, t_dirty_slots, t_timestamp, t_fstep, t_dispatch_overlap, t_view_cache, t_partial_upload, t_pso_depth_stencil, t_direct_upload, t_feedback, t_present_hdr, t_upscaler_mfx, t_present_rescue, t_fetch_clamp, t_border, t_rt_recycle, t_image_alias, t_alias_takeover, t_pool_notes, t_vconv_keep, t_pso_archive, t_pso_skey, t_pso_warm, t_pso_bundle, t_missing_src1, t_omap_mask, t_tex_layout, t_srgb_alias, t_upgrade_alias 0 each
The whole gfx run list, each check_<t> on its own (141 tests plus test_dmsh_pull and test_tbdr_budget) 142 of 143 exit 0 t_dlss_scaler fails one check (and nothing else keeps them alive), the same on upstream b149a1e4 here
dm/ios/tools/compile_check.py (GAME=0400486024DEC000) 0 262 files
scripts/regress.py impact main..HEAD 0 4 games with a usage manifest affected (Hades, Breath of the Wild, Pokémon Scarlet, Tears of the Kingdom), 155 without one, Ocarina among them; the merge reaches every NVN game (chain, nvn_mtl.m)
Fast Python checks: test_docs, test_game_profile, test_settings, test_launcher_settings, test_patches, test_nsp_chain, test_shader_toolchain_cache, test_cheat_anchor, test_ocarina_test_save, test_oot_frame_step (5 run with unicorn), test_shader_cache, test_shader_pch, test_native_tools, test_dmsh_pool_arrays, test_pso_offline, test_gfx_tests_makefile, test_nsp_mac_app, test_split_zstd, test_snvn_records, test_dmsh_fetch_clamp, test_dmsh_loop_guard, test_dmsh_border, test_dmsh_control_flow, test_dmsh_blend_zero 0 each
test_env_switches 1 upstream's own: DM_NVN_VCONV_KEEP (81b21cb8) has no row; fails the same on b149a1e4
Full suite: every dm/tools/tests, dm/ios/tests and dm/gfx/tests test_*.py 176 of 183 files exit 0 (1,986 tests) the seven below

The seven files that do not pass, none from the merge:

  • test_env_switches: above.
  • test_pr_areas, test_dmsh_gather_offsets, test_dmsh_raw_last, test_dmsh_wrapv: upstream's f75ac06e made dmsh_chain.py read dm/mac/min_os.mk and dmsh_build.py's MAC_METAL name dmsh_chain.MAC_MIN_FLAG; these tests copy or literal_eval those files without it (FileNotFoundError, NameError, malformed node). All four fail the same way on upstream b149a1e4.
  • test_triage_report, test_usage: they make commits in scratch repositories, and this Mac's global git config signs every commit through 1Password, which could not sign in this session. With commit.gpgsign=false for the test process both pass (exit 0) on the merge.

test_dmsh_pool_arrays, the one failure before the merge, passes now (upstream's c823c3c0).

Not verified

  • The game itself, the benchmark and a shader build: there is no built game data on this machine. The chain changed, so every shader needs rebuilding before playing.
  • lint_python.py, lint_c.py, the sanitizer targets (tsan, memory-tsan, asan), regress.py check, the iPhone.
  • A real Switch 2 controller with Press a button to join, a Pro Controller with the gyro zero, and anything else that needs hardware.
  • The merge commit is not signed: 1Password's SSH signing could not run in this session.

seedds and others added 30 commits November 11, 2026 07:28
…the npads it moves: player 1 goes between Handheld and No1, as taking the Joy-Cons off the console's rails or putting them back does, and the host pushed notification 30 but signalled no event, and kept no event bound to Handheld at all. Hades II, sent to Handheld by the controller applet in handheld mode, kept reading that npad once docked and took no input until a restart. One function, styles_sync (hle_hid.c), now signals the bound event of each npad (No1..No8 and Handheld) whose style is no longer the one the game was last told, and everything a style depends on calls it: the console mode (before the notification), the players and their Joy-Cons, the supported ids and styles (the styles signalled nothing before), the Joy-Con assignment; a split pair's second npad, which handheld mode takes back, is signalled with the rest, and an npad whose style did not change is no longer signalled. On the Mac (Hades II v655360, DM_OE_SCRIPT="opmode=0@15,opmode=1@21.5" on the note's route) the old host stayed on the save-slot screen with six A presses unanswered; with the events the applet opens again after docking and the route reaches Erebus. t_hid (t_opmode) and t_oe cover it; iPhone retest of this form open (issue seedds#2143)

Co-authored-by: TheLowbar <333664989+TheLowbar@users.noreply.github.com>
…orded as an open risk; not reproduced on an M4 Pro with 85 GB punched while Ocarina of Time rendered

S2Arm (jhaizhou-ops/S2Arm seedds#258, seedds#305) saw kIOGPUCommandBufferCallbackErrorHang in 6 of 6
Ocarina of Time runs on an M1 Pro (macOS 27.0.1) when it punched its guest files during
play, and now never punches. Here (M4 Pro, macOS 27.2, the Kokiri Forest deck save, 8
minutes a run) a probe wrote, fsynced and punched unmapped alias-region pages of the
guest files the game uses: 36.5 GB in 2.39 million 16 KB punches and 49 GB in 140,000
whole-run punches, no command buffer error; four runs with the sweep itself had none
either. Frames over 1 s came with and without punching. The entry names what may
differ (machine and OS; S2Arm punched ranges the moment they were unmapped, the sweep
only pages given back a whole interval earlier) and the iPad run still to do.
…lice imported pipe2 weakly (minimum macOS 12.0, pipe2 declared from the macOS 27 SDK on) and the .NET runtime's SystemNative_Pipe called it unchecked at start, so the import bound to 0 there and dmsh_xlate faulted at address 0 before any build ([RED] the shader translator does not run (exit code -11)). The slice had been linked with a libSystem.Native.a configured against the 27.2 SDK; which .NET gave it is open (Microsoft's NativeAOT pack 10.0.14 has no such call, and the x86_64 slice and nx_extract had none). The translator is rebuilt with Microsoft's .NET SDK (chain 7c609af36b0f), native_tools.sh refuses a slice with a weak import before it joins the slices, and test_native_tools.py (test_no_weak_imports) reads the symbol tables of both committed tools. Over a full Cuphead Mac shader build (3,131 shaders) the old and the new arm64 slice wrote the same 6,262 files, byte for byte; not run on macOS 26 here, so the issues stay open for a reporter's retest (issues seedds#2190, seedds#2239, seedds#2227)
…45694b made reflect() read res['cbufs'] for each game uniform slot, which the translator's report always carries, and the suite's three calls still passed only sbufs, so test_pools_and_attributes raised KeyError: 'cbufs' on main (8 tests, 1 error). The calls now pass cbufs, and the first gives slot 5 a fixed extent of 64 bytes and checks that fp_c5 reflects as KIND_CBUF, reg 2, fixed 64, which no test covered. Tests only: no chain tool changes. 8 of 8 pass (PR seedds#2248, PR seedds#2256)

Co-authored-by: Pedro Nascimento <91118+lunks@users.noreply.github.com>
Co-authored-by: akratch <70729875+akratch@users.noreply.github.com>
…oard receiver that declares a gamepad no longer takes player 1: a Keychron Link receiver (3434:d030) declares a Generic Desktop GamePad or Joystick collection, +[GCController supportsHIDDevice:] answers YES for it and GameController never lists it, so since 463d21f it was read as HID after the two-second wait and took the lowest free player at once; the Pro Controller became player 2 and a one-player game (Ocarina of Time) took no input from it. A HID descriptor only claims a controller, and nothing in it tells a receiver that never sends a report through that collection from a pad at rest, so every raw HID pad (hinted by GameController or not) now takes its player at its first button press (hidpad_first_press, front_mac.m), through the path of Press a button to join but with the slot a connecting controller takes (pad_slot_take); the joining press reaches the game. Identical pads read from IOKit (twins) stay players at their connection, and DM_PAD_MERGE is unchanged. The host builds and the host tests and test_docs pass; not run with such a receiver or any raw HID pad, so the issue stays open for the reporter's retest. The controller applet opening in a loop when a one-player game sees two players is a cause of its own (issue seedds#2237). The first-press approach is PR seedds#1685's, rebuilt on the existing join path for every raw HID pad (issue seedds#1657, PR seedds#1685)

Co-authored-by: Antoine Bartoli <59134956+AntoineBRTL@users.noreply.github.com>
…the size the console's driver gives the GPU, not at the exact size: nvnCommandBufferBindUniformBuffer writes (size + 0xff) & ~0xff in NVN1's driver (method 0x8e0; Sonic Superstars' sdk, 0x467170) and ((size + 0xff) >> 8) << 20 in NVN2's (method 0xe02; Ocarina of Time's sdk, 0x67bc80), so a read between the bound size and the next multiple of 256 gives the memory there, where the host gave 0. ub_bound (nvn_mtl.m) rounds the size for both parts of the bound: the padded copy of a binding shorter than its fixed-offset reads carries the memory's own bytes up to the rounded size (the exact size where the pool ends before it) and zeros after, and the size table for reads at computed offsets holds the rounded size. Ocarina of Time binds 16, 64, 144, 192, 464, 976, 16,960 and 41,600 bytes; Paper Mario's 16-byte binding read at 0x900 still gives 0. On the Mac, Ocarina of Time with the slingshot aimed at Link's house draws as before with no new red line, and logs slot 3 bound with 192 bytes, 256 readable, read up to byte 684. Open: the streaks and flicker of issue seedds#2218 did not appear here with the exact size either (that scene, the ReDeads of adult Castle Town), so whether this clears them awaits the reporters' retest; what an Ampere GPU returns past the rounded size is not measured; no test covers the padded copy or the size table; no Switch 1 game and no regress run (issue seedds#2218, PR seedds#2219)
…whose base is made: after a submission's first pipeline miss, pso_predict_rest_ proposes each remaining draw's key and that key without its depth / stencil attachment, and with hybrid pipelines it made the pulling stand-in of every proposed key to learn whether its draw would wait, an archive lookup of the pulling base on the submit thread each, outside its budget of 2 builds. A Metal 4 base does not depend on the depth and stencil formats (pbase_key, pso_desc4), and a draw asks for its own pipeline without compiling before any stand-in (pso_build_ex(..., 0)), so a key whose base is made is one specialization away and its stand-in was never used; the attachment-free keys are rarely drawn, never enter the pipeline cache or a prewarm list, and were proposed again in every run. The prediction now asks first whether the key's base is made (pso_base_made): such a key gets no stand-in and no background build and is left out of later predictions' candidates (g_pp_easy). Without Metal 4 bases nothing changes; with DM_PSO_HYBRID=0 such a key is specialized by its draw instead of in the background. The author's measurement, Ocarina of Time v131072 entering Hyrule Castle Town on an M4 Pro, one run a side on a host from 8db5dd4: the three predictions 30.8 / 104.4 / 54.5 ms -> 0.5 / 2.0 / 1.4 ms on the submit thread, pulling pipelines made 244 -> 1. On main: t_pso_depth_stencil (new case prediction_made_base; 293 / 296 / 293 / 296 checks), t_pso_pending, t_pso_archive, t_pull, t_pso_warm, t_pso_stall, t_pso_bundle, t_pull_inv and test_docs pass and the host builds; no game run and no regress run on main. Open: a proposed key with no base made still gets its stand-in lookup on the submit thread (PR seedds#2262)

Co-authored-by: Roan de Graaf <36153028+roandegraaf@users.noreply.github.com>
… keeps a conversion while its source is unchanged: a stream of more than 262,144 elements was left unconverted (vconv_bind refused a range above its 4 MiB staging, red line 90), so a stadium of EA SPORTS FC 27 (the Estadio da Luz at 1.8d.6523: 915,138 UI16 x2 vertices into a float input) drew its stands and roof as streaks; and every conversion was made again in every submission, which for that stadium is 7.65 million vertices, 122 MB written a frame, 26.8 ms of the submitting thread on an M4 (the PR author's measurements). The staging limit is 64 MiB (PR seedds#1726). A conversion is now made once into a buffer of its own and bound again in later submissions (vk_get, nvn_mtl.m): a key (range, format, layout) is noted at its first submission with 64 samples of its source and kept from the next one that finds them unchanged; the pages wholly inside the source are write-protected (nvn_dirty_protect, as a kept index range) and the bytes in pages it shares with other data are compared with a copy, so a neighbour written every frame neither drops it nor takes a fault; a GPU write queued on the source (copy, update, fill, transform feedback, writable storage binding: vk_gpu_write from pend_add and sbw_note) drops it, and none may be queued or in flight when it is made. A changed source releases its buffer after the submissions that read it and is tried again after 32 submissions, doubling. Not kept: ranges below 4,096 vertices, sources outside tracked pools, anything while the game has sparse mappings, more than 256 MB in all; DM_NVN_VCONV_KEEP=0 turns it off, and the vertex conversion line reports the kept, made and dropped conversions by cause. PR seedds#1727's conversion on every core (26.8 to 10.6-12.7 ms there) is not taken: it still writes the 122 MB every frame. Checked: t_vconv_keep (new, 123 checks: the content against vconv_elem, each way a conversion is dropped or left), t_vin, t_float_pad, t_pull, test_docs. Fire Emblem: Three Houses on the Mac (M4 Pro, DM_NVN_VCONV_CPU=1, new game into the prologue battle), before the samples were added: 1.8 of the battle's 2.0 million vertices a submission bound from 144 kept conversions (18 MB), frame time p50 16.68 ms with and without, the same picture. Not run: the form with the samples in a game, EA SPORTS FC 27 (no files of that update here, so the stadium's frame time is open), a float input fed integers, regress.py, iOS (PR seedds#1726, PR seedds#1727)

Co-authored-by: Moustache <49116367+MoustacheOff@users.noreply.github.com>
… is the provisional one plus dual_want.tsv, with no host change and no rewriter patch; boot, the opening movie, the title, the menus, a new game's real-time opening and the first area of Tanamaar at 60 fps (frame time p50 16.67 ms, GPU about 5 ms at 1600x900, about 4.0 GB resident, Apple M6). The shader split read none of its shaders: Retro's packs have 60-byte ADIR entries here, and the program records and the packs' MTRL forms are zstd streams where Tropical Freeze's and Metroid Prime Remastered's are zlib; rfrm_shaders and snvn_records read both, and the packs (up to 3.9 GB) are mapped instead of read. 259,989 shaders, all built. The reader had also passed over, without a word, every program record whose control length is not a multiple of 0x40 (a stage's 12-byte entries after its section, the next section starting on 16 bytes): Metroid Prime Remastered's map lacked 28,479 of its 68,962 shaders since its bring-up. Its tables are regenerated (every old key kept); all 68,962 build on the current chain and the game boots and runs its menus at 60 fps on them, not played further. test_snvn_records covers zlib and zstd records with such lengths on synthetic chunks. Open: the iPhone, play past the first minute, runs of 32 ms frames after a long frame, Tropical Freeze's files not on hand to split again
…ecycled heaps instead of new Metal memory each time: every GPU-only texture the churn makes (render targets, with or without COMPRESSIBLE, the heaps of resolution families, feedback snapshots) comes from one free list whose heaps stay in the residency set. A heap is made an eighth larger than its texture and a waiting heap serves textures up to a third smaller (smallest fit first), so a target that grows by one of Metal's size steps (about 10% near 2 MB) fits the heap it freed; family heaps go back to the list after their last texture instead of being freed; block-compressed formats keep exact allocations. Since its timestamps became real (ea0c98d, 3304d6a), Mario Kart World resizes its targets nearly every frame under GPU load, and before this each new size made a new heap or texture: per 300 frames of a race about 1,200 new family heaps, 1,000 unrecycled render targets, 500 list misses and 250 snapshots. In one run alternating the two every 600 frames (two outside GPU loads so the resolution moves, Apple M6): residency commits 970 -> 272 (137 -> 26 ms), texture memory added 1.8 -> 0.34 GB, replay CPU 6.94 -> 6.36 ms a frame, frame time p50 / p95 16.7 / 24 ms and GPU time unchanged. t_rt_recycle checks growth by one size step, the eighth of headroom, block-compressed assets and snapshots; t_image_alias the family heap's capacity and its wait in the list; both pass with DM_NVN_RT_RECYCLE on and 0 (the old behaviour). Open: the M4 where the 30 fps was reported was not measured, the 256 MB cap still drops 120-380 heaps per 300 frames, and the rest of a resize's cost (new texture objects, fills, takeovers) (issue seedds#1823)
…sampler with a twin: every pixel shader with border-colour corrections declares the function constant dm_border_off (DMSH_BORDER_FC, 216) and tests it before the mask bit in dm_bs, and the host specializes each function with it true when no sampler bound to the draw's stages has a border twin (border_need, pso_key.border), so the branch and the registers it kept live across every sample are gone from the pipeline instead of skipped per pixel. The mask branch made Apple's compiler keep the sample's operands for the correction that never ran, which spilled registers in shaders with many samples. A pipeline builder takes an explicit off flag from the draw's key (pso_build, pso_build_ex, pso_build_dev, pso_desc4, pbase_key, cps_new_b, the mesh and capture pipelines, the prewarm and pso_offline.py's archives), and the specialized function is found there (fn_off, fn4_of_b, fn_dev_b); descriptors hold only real Metal functions. A draw compares its stages' need with the bound pipeline's (prog_border), so a sampler with a twin bound after the pipeline was picked gets the correcting pipeline. DM_NVN_BORDER_KEEP=1 keeps the corrections in every pipeline and =ab alternates by DM_AB phases. Ocarina of Time standing on the forest deck, in-process A/B on an Apple M6: GPU p50 10.66-10.88 ms without the corrections, 11.01-11.26 ms with them, frame time 16.67 ms both. Compiled for the M1's GPU (applegpu_g13g, 300 of its pixel shaders): mean code 16,232 -> 14,531 bytes, per-thread scratch lower in 77 shaders, higher in 11, the worst 240-352 bytes -> 0. AdyaGMD's measurement of the side-library form on an M1, Splatoon Raiders: 31.6 -> 19.8 ms a frame; not reproduced here. t_border (113 checks), the 136 gfx suites, test_dmsh_border, test_pso_offline, test_docs pass; regress.py check on Bastion and NieR:Automata: 60 fps, every shader builds, no new red line. The side library of PR seedds#1203 is not taken: it compiles every pixel shader with corrections twice. Not run: Tears of the Kingdom (the one known game that binds a twin; its build is not on hand), the iPhone, an M1. The function constant is FeReuss's design and code (PR seedds#1929); the diagnosis of the spill and the M1 numbers are AdyaGMD's (PRs seedds#1203, seedds#1032); the need for a per-draw choice is givethesourceplox's finding (PR seedds#1073)

Front-ends: the shader chain version changes; shaders are rebuilt.

Co-authored-by: FeReuss <102842515+FeReuss@users.noreply.github.com>
…d mode, so a game started docked takes touches after leaving the dock: GetTouchScreenState(s) numbered a docked read's empty state from the npad sampling counter (from 65536, touch_read in hle_hid.c) and a handheld read's state from hle_touch.c's own count (from 1). Unity's touch reader takes a state only if its sampling number is above the last one it took, empty states included (the PR author's reading of Aokana - Four Rhythms Across the Blue, Unity 2018.4.22f1: the compare at main+0xd2bde0), so after one docked read every handheld state was below it and was dropped: started docked and switched to handheld in the in-game menu on the iPad, no tap reached the game, and the same after handheld, docked and handheld again. hle_touch.c now numbers both: touch_read always calls touch_fill_n, with points 0 in console mode, which gives an empty state with the next number and leaves the fingers, their Start and End, for the next handheld read; DM_TOUCH_LOG prints the number the game sees. PR seedds#2244 numbered both modes from the npad counter by writing over hle_touch.c's number; its diagnosis, its t_hid test and its reference entry are kept, the count moved to the one place. Checked: t_touch (2 new checks: a console-mode read between handheld reads is empty, takes the next number and keeps a pressed finger's Start), t_hid (t_touch_sampling: every read reaches touch_fill_n, points asked for in handheld mode only; with the PR's test alone on main 2 checks failed), t_gesture, test_docs. The author's Aokana runs on the Mac (M4 Pro, headless, a tap every 1.5 s) were with the PR's form: started docked and switched at 12 s, 270 reads with touch points and the opening movie played on before, the first tap stops it after. Not run: Aokana or any game with this form, the iPad, regress.py (the reach is the touch read path only) (issue seedds#2243, PR seedds#2244)

Co-authored-by: Lennart Kotzur <74553440+mmkzer0@users.noreply.github.com>
…onnects waits for its first button press instead of being let go: with DM_PAD_PRESS_TO_JOIN=1 the front end gives a new pad no player until its first button (s2pad_attach, then s2pad_read through pad_join), and the transport took no player after attach for no free player and dropped the controller (attachPad, pad_switch2_apple.m), so no Joy-Con 2 or Pro Controller 2 could be used with the setting on; a press only woke it to be dropped again. The front end's attach now returns whether it keeps the pad (pad_switch2_apple.h): 1 with a player or waiting for its first press, 0 with no free player, and only 0 lets the controller go; a Joy-Con split off a pair (SL + SR held) is kept the same way, and goes back into the pair only with no free player. A pad that gets its player later gets its Joy-Con styles (dm_joy_attach through s2_sync_sides) and its player lights then: playerSync, after each read() of the front end, in report: and in leavePair, where the held SL + SR are that press and read() makes the Joy-Con a player at once. PR seedds#1907 made that check in report: only, after leavePair had already noted the new player, so a split-off Joy-Con never got its single Joy-Con style with the setting on. The log says a player once a button is pressed for a pad that waits. Checked here: the Mac host builds and the host tests pass (t_switch2 among them; none covers the Objective-C transport). The author's runs, with the PR's form: on the Mac (M1 Pro) Nintendo Switch 2 Welcome Tour with a left and a right Joy-Con 2, both stayed connected and joined as player 1 at the first press, with rumble and the mouse; on an iPhone 17 with PR seedds#1900's wiring, Super Mario Galaxy, the same, and a split made player 2 at once. Not run: any Switch 2 controller with this form, so the split-off Joy-Con's style is unchecked; the Pro Controller 2; more than two controllers waiting; lint_c.py; regress.py (the reach is the Switch 2 transport, off by default). Open: a waiting pad's lights show player 1's pattern (PR seedds#1907)

Co-authored-by: JakePre <130175182+JakePre@users.noreply.github.com>
…s split later: Block.Split gave the right half the left half's successors but left their predecessor lists naming the left half. Both decoders walk those lists back from a BRX to the load of its jump table (FindBrxTableAmpere, the Maxwell decoder's FindBrxTargetRange), so when the block holding the LDC was split after its successors were linked (a later branch lands inside it), the walk started in the left half, before the load, and met another write of the register or the program's start: "BRX with no target found in the c1 jump table" on 16 pixel shaders of Pokémon Pokopia (an LDC c[0x1][R20+0x790], then a conditional BRA to the BRX). Split now points each moved successor's predecessor entry at the right half, for both decoders; nothing else reads the decoder's lists except for their count (the IR's BasicBlock lists are another graph). PR seedds#2010 mended the lists after the Ampere decoder's split only and shipped the .NET DLL main no longer uses; its diagnosis, its test and its reference entry are kept, the repair moved into Split, and the native translator is rebuilt (dmsh_chain.lock, DMSH_CHAIN 3ae08e02ec6a: every game's shader libraries rebuild). Checked: test_dmsh_control_flow's new test_table_loaded_in_a_block_split_later fails on the old translator with that error and passes on this one; the 26 dm/gfx/tests/test_dmsh_*.py give the same results with both otherwise (test_dmsh_pairs has one error with both: it needs DM_GAME); test_docs, test_nsp_chain, tool_lock.py --check-tools pass. Old and new translator on every shader of three games, SPIR-V and reflection files compared byte for byte: Splatoon Raiders (Ampere, 27,192 shaders, 54,384 files), Octopath Traveler II (Maxwell, 13,980, 27,960) and Fire Emblem Three Houses (Maxwell, 1,372, 2,744), no file differs and no shader fails with either. The author's run with the PR's form: Pokopia's 16 shaders translate and compile for macOS, 4,001 others byte-identical. Not run: Pokopia's shaders with this form (its files are not on hand), any game, regress.py (no shader of the three games changes), the iPhone. Open: no Maxwell shader that the repair changes is known, so that side is checked by reading only (PR seedds#2010)

Co-authored-by: Valtterios <34726970+Valtterios@users.noreply.github.com>
…ICON, used only when --icon / ICON is not given and the game has no icon of its own (a dump, a NUP without one), so a game that carries an icon keeps it and a front end can pass a stand-in without knowing what the game holds, where --icon always replaces the game's. It goes to the Mac app and the IPA alike, down the path --icon takes (pack_app.py --icon, DM_ICON), its path is checked before anything is extracted, the build says when it is used, and the game event's icon reports it. The choice is one function (app_icon), tested for its order: --icon, the packed version's icon, the base game's, the fallback. No app was packed with it (PR seedds#2099)

Front-ends: new: --fallback-icon IMAGE (FALLBACK_ICON) gives an app an icon only when the game has none of its own; the game event's icon reports it

Co-authored-by: v0lumehi <34629096+v0lumehi@users.noreply.github.com>
…ffers no advanced players, instead of one engine for both: a controller with both handle localities whose first advanced player is refused (gamecontrollerd, NSCocoaErrorDomain 4097) is moved to one engine on Handles or Default, because plain players on the Xbox Wireless Controller's two handle engines override each other, so a DualSense rumbled the same on both sides. A DualSense (GCProductCategoryDualSense) now gets no merge (configure, haptics_apple.m): each handle still asks for an advanced player and, when refused, moves to plain players on a new engine of its own locality, the path a one-engine controller already takes, so left and right keep their own levels. PR seedds#986 set plain players at connection for every DualSense, which would also give up advanced players wherever a server offers them; its diagnosis, hardware test and the test's shape are kept. Why the Xbox controller's handle engines override each other is not known (its motors or its driver), so other controllers with both handles stay merged, and the reference entry says so. Checked here: the host tests pass, t_haptics_apple with two new cases (a DualSense without advanced players keeps two channels on LeftHandle and RightHandle at 0.3 and 0.4 and plays one side alone; with advanced players it makes no plain players), and test_docs. The author's runs were with the PR's form (MacBook Air M1, macOS 26.7.1, DualSense over Bluetooth): a five-step probe (left only, right only, 0.2 / 0.8, silence) and Super Mario Odyssey's buried Power Moons, each side felt apart. Not run: any DualSense with this form, so the right handle's refusal and new engine are unchecked on hardware (the left handle's is what main already met); USB, iOS, a DualSense Edge; lint_c.py; regress.py (the reach is one controller model's haptics route) (PR seedds#986)

Co-authored-by: minhthongdoan <28199243+minhthongdoan@users.noreply.github.com>
…ol buffer is made: nvn_dirty_open hashed one pool's protected pages and made them writable before it hashed the next pool's, and adjacent pools (4 KB aligned) share their first / last 16 KB host page, so a guest write to that page between the two went into the second pool's first hash, the close found that pool's page unchanged, and its texture stayed clean with stale content. Every range's protected pages are now hashed and taken (BUSY) before any page is opened, so each hash is of a read-only page; the pages are then opened in runs. A fault or host write on a taken page waits for the open as before, and neither holds a page of its own while it waits. The race reaches only pages two pools share: a write that also touches a texture's unshared pages faults there, so only a texture, or a write, that lies wholly in a shared page was missed. t_dirty_race (open_shared_page: two pools in one host page, a store to the second right after the first opens) fails on the old order (expected 1, got 0) and passes; t_dirty_slots and test_docs pass. regress.py check on OCTOPATH TRAVELER II: PASS (13,980 shaders, 59.3 fps, no new red line, a busy Mac), but that run opened no page for a pool buffer, so the new order is covered by the unit test only. Not run: Ocarina of Time or any game that opens pages, the full gfx suite, lint_c.py, the iPhone. A tester's M2 Max run of 8 minutes saw Ocarina's Goron City ground stop strobing with the PR, with no miss counts. Open: issue seedds#2086's stale terrain map spans about 33 host pages, more than this race reaches by itself, so its cause is not found. The fix and the test are thehobbit85's (PR seedds#2136)

Co-authored-by: Eliran Zach <4012041+thehobbit85@users.noreply.github.com>
… controller applet's stand-in runs there: Drag x Drive (040041601D83A000, v196608) opened the controller applet from a game thread with too little stack left for the stand-in's log lines, SIGBUS in fprintf under focus_sync / h_hid_ShowCtrl 0x60 bytes below sp, then a hang in the crash handler (the PR author's report). Formatting one line takes about 2.7 KB of stack (fprintf to stderr, measured on macOS 27.2) and a hook runs on the stack of the game thread that calls it, so every hook that logs was exposed, as the file system, add-on content and audio hooks were before they moved one by one. LOG is now one call, dm_log (dm.h): the host's definition (hle_bigstack.c) formats the line through dm_bigstack_enter, on the host stack when the caller is on a guest stack and directly anywhere else, the variable arguments read from where the caller left them; programs that do not link hle_bigstack.c (unit tests) get dm.h's weak definition, which writes on the caller's stack. A hook needs HLE_FORCE_BIG only for its own stack use: both ShowControllerSupport overloads take it (the PR's change), since with too few players the front end's prompt runs on the game's thread. t_hid and t_hid_tsan link hle_bigstack.c (the PR left t_hid_tsan out, which no longer linked), and t_audio_stats captures dm_log where it captured fprintf. Not covered: direct fprintf(stderr) calls in a hook (the thread dumps of hle_thread.c, a debug line of hle_svc.c). Checked: t_bigstack (new case: a hook logs with 1 KB of guest stack left; SIGBUS with the line written on the guest stack), make run in dm/host/tests and dm/gfx/tests, the tsan, tsan-threads and memory-tsan targets, test_docs. OCTOPATH TRAVELER II on the Mac (M4 Pro), one full regress route on this host: 59.8 fps, no red line, clean exit (main: 59.5 fps); the regress comparison itself was not completed (the window was covered, and other jobs ran). Not run: Drag x Drive (no files here), iOS (PR seedds#1943)

Co-authored-by: FifteenPen <354289956+FifteenPen@users.noreply.github.com>
…ost's are: MLOG (nvn_mtl.m) wrote with fprintf directly, about 2.7 KB of stack a line, and the nvnCommandBuffer* recording calls run on the game thread's stack (every other NVN function goes through nvn_big_entry), so a line logged from one on a thread with little stack left would fault as the controller applet's did (2d3fb83). MLOG is now dm_log, as LOG is. No recording call was found to log on a small stack: this closes an exposure, not a reproduced crash. The reference entry (Log lines on small guest stacks) is corrected: the direct writes it named as not covered run on host stacks (an SVC, so the OutputDebugString line, on the thread's gate stack, entry.S; the crash handler and its thread dumps on its alternate stack; probes, haptics and save sync on host threads or behind HLE_FORCE_BIG). Open: dm_backtrace writes directly and nn::diag's abort hooks call it on the game's stack, so an abort on a thread with little stack left can fault before its backtrace. Checked: the Mac host builds without a format warning, make run in dm/gfx/tests (the graphics layer without hle_bigstack.c, so dm.h's weak definition), test_docs. Not run: a game, regress.py, iOS (PR seedds#1943)
…eir full docked picture: oe::GetCurrentGraphicsScale (am's graphics scaling parameters, 10 / 20 / 30 = tier 0 / 1 / 2) was answered by the operation mode, 0 handheld and 1 docked, and games size their picture and their GPU budget by the tier, full at 0. Docked, Star Fox rendered its scene at 768x432, smaller than its 960x540 handheld (it keeps only "tier 0", byte +0xa of its mode event, main+0xba69970, and renders 0.8 times smaller below it); Donkey Kong Bananza's frame buffer is the display's size times {1.0, 0.8, 2/3}[tier] (main+0x30f840) and its dynamic resolution adds 0, 9 or 13 to its GPU time; Ocarina of Time drew 2048x1152 for 2560x1440. The host now answers 0 in both modes (h_oe_GfxScale, hle_oe.c); DM_GFX_SCALE=1 or 2 answers a reduced tier. That the tier is how much of the GPU the game may use is an inference from the games' code, and which tier a console reports in which mode is not measured: the reference entry (The graphics scale does not follow the operation mode) says so. The code, diagnosis and test are PR seedds#1304's; here its conflict with main is resolved, its wording about the GPU share marked as an inference, and Bananza's and Ocarina's notes updated (Ocarina's sizes and times in its note were all taken with tier 1). Checked here: the host tests pass (t_oe 60 checks, with the tier 0 and DM_GFX_SCALE cases), test_docs passes. Donkey Kong Bananza docked on an M6 (16 GB), a window, fresh save into the mining tunnel, hosts of chain cfcc3a82c78b that differ in this answer only: frame buffer 2304x1296 → 2880x1620, main passes 1676x943 → 2095x1179, GPU p50 6.8-7.2 ms (three runs) → 8.3-8.9 ms (one run), 60 fps with both, the same four VP9 [RED] lines. Others' runs: Star Fox 768x432 → 960x540 on a build of the author's fork (M5 Pro); Ocarina of Time on main with only this answer changed, 2048x1152 → 2560x1440, 3D 1536x864 → 1920x1080, GPU p50 12.9-14.0 → 15.0 ms at about 59 fps (M4 Pro), and 12.7 ms at 58.4 fps over 24 minutes (M5 Pro). Not run: Bananza's busy views, where the larger picture leaves less room; Star Fox and Ocarina here; a slower Mac; the iPhone; lint_c.py; regress.py check (one game run by hand instead, the one with the frame-rate risk). Supersedes PR seedds#1838, the same switch with the docked tier 1 kept (PR seedds#1304)

Co-authored-by: Pedro Nascimento <91118+lunks@users.noreply.github.com>
Add the base 1.0 profile, captured shader tables, prewarm seed, smoke route
and game note. Mac gameplay covers movement, shooting, a room clear,
saving and Continue at 60 fps, with no game or SDK rewriter cuts.

Declare the blend helper output as a thread reference. Its missing address
space prevented all ten pixel shaders from compiling for the iOS target.
Cover both SDK compiler modes in the existing test and update the shared
chain stamp. All 19 shaders now build for Mac and iOS; the unsigned IPA
was packed and verified.

Validation: native Metal graphics suite, 475 graphics Python checks,
93 profile/chain/packing checks, exact captured-frame replay, and diff
review. The 1449 tool checks retain one pre-existing environment-switch
documentation failure; Python lint retains an unchanged unused import.
Regression risk is low: the helper now explicitly names its existing local
address space. Isaac was run; no additional game regressions were needed.
iPhone, later floors, local co-op and longer sessions remain untested.

Co-authored-by: seedds <seedds@gmail.com>
…ng the sharing table, so a scene that shares tens of thousands of textures loads: alias_take_over walked g_alias's whole capacity for every shared texture made, with a layout and a g_alias_seen lookup for each entry of the same pool, so the cost of each texture grew with the textures already shared. Mario Golf: Super Rush (0100C9C00E25C000, 4.0.0, issue seedds#814) registers 134,400 textures for All-Star Summit and shares about 90,000 as the course loads: on main no frame in 5 minutes with the submit thread at 100 % in alias_take_over, with the index the first frame about 3 s after the start (the PR author's runs, MacBook Pro M1 Pro). The shared textures are now indexed by where their storage lies (alias_index, g_alias_cells: {pool, 64 KB cell} → the entries whose bytes reach into the cell, each with its end), and the takeover reads the new texture's cells only. It chooses from the same entries (same pool, another description, overlapping bytes, not looked up lately, held by no serial); when more than 16 qualify, which 16 go first follows the cells instead of the table's order. The index, the diagnosis and the measurements are PR seedds#2229's. Added here: the table's keys have two writers, alias_put and alias_del, which keep the index, g_alias_set and g_alias_seen together (the PR called alias_index beside three writers, and t_alias_takeover's cost case, which inserted directly, passed with its entries hidden from the takeover); the image families' owner lookup (image_texture), which walked the table for each image made in a GPU-only pool, reads the one cell of its offset; tests and the reference entry (A storage takeover walked the sharing table for each texture made). Walks of the whole table remain where they run once per event: a pool's release, a texture's upgrade, the memory report and the census. Checked: t_alias_takeover (45 checks: an entry reaching in from an earlier cell, one in the same cell that ends before the new texture, a spanning entry taken once, another pool's entries, no cell left after a removal or a pool drop, and a takeover with 100,000 entries in the table in 0.0003 ms against 0.65 ms for main's walk, M6), t_image_alias (two families in one cell keep a heap each), make run in dm/gfx/tests, test_docs. regress.py check on Return of the Obra Dinn (M6, headless): the takeover alone PASS with 73 shared textures and 18 takeovers on both sides; the final code PASS in two of three runs (58.9 and 59.8 fps, no new red line), the third with two command buffers of about 8,500 failed by a GPU hang (kIOGPUCommandBufferCallbackErrorHang) and a moved screenshot, which four stored runs of this game from 7 and 8 November show too, one of them a baseline; its cause is not found. Not run: Mario Golf: Super Rush here, a game known to make image families (Luigi's Mansion 3, ASTRAL CHAIN), iOS, lint_c.py. Open: whether 90,000 live Metal textures for one course is what the game needs, and its memory on an iPhone (PR seedds#2229)

Co-authored-by: secretlemur28 <354896836+secretlemur28@users.noreply.github.com>
…o one chain version gives the same result on every Mac: the Mac compile named no deployment target, and Metal's language version follows it, so the compiler took the build Mac's system. 0662f9d's blend helper took its output as a reference with no address space, which the macOS 27 language accepts and the macOS 26 and iOS 18 languages refuse: it compiled where it was written, and 22,296 of Ocarina of Time's 42,848 Mac shaders failed on two Macs with macOS 26 (issue seedds#2272; 8fb5ffe added the thread qualifier, found on the iOS build). Measured with Metal front end 32023.922 on macOS 27.2, a shader with that signature: it compiles with no minimum and with iOS 27.0, and fails with -mmacosx-version-min=26.0, 15.0 and -mios-version-min=18.0. Every Mac compile now passes -mmacosx-version-min=MACOS_MIN (dm/mac/min_os.mk, 26.6, read as dmsh_chain.MAC_MIN): dmsh_build.py's MAC_METAL, vk_shaders.py, gl_shaders.py and dmsh_dryrun.py, as the host's own Metal libraries already did. min_os.mk is part of the chain version, and the flag is in each shader's cache key through the compile record; DMSH_CHAIN is 1fa63cf7c7ae, so every game's Mac shaders rebuild once. test_dmsh_blend_zero and test_shader_pch compile with the flag, and test_nsp_chain's temporary repository links dm/mac. The reference entry (The blend helper's output reference on iOS) said the Mac libraries compile, which held on macOS 27 only: it now gives the measured cases and the pin, and Ocarina's note links it. Checked: with the old signature put back, the six Mac compile cases of test_dmsh_blend_zero fail on macOS 27.2 (they passed before); test_dmsh_blend_zero, test_nsp_chain, test_docs, test_shader_pch and test_host_msl pass. regress.py check on Bastion (full route, baseline 8fb5ffe, Apple M6): 72 of 72 shaders build on both chains, no MSL changed (the 72 libraries differ, as expected), 59.4 -> 59.6 fps, p99 18.01 -> 17.72 ms, no new red line; its two screenshots differ slightly (6 dHash bits, RGB 5) with one run a side, not looked into. Not run: a large game with the flag (the reporters' macOS 26 builds of Ocarina suggest its language accepts the chain's output, if their compiler took macOS 26 as its target), a Vulkan or OpenGL game, the full gfx suite, lint_python.py, iOS (its compile line is unchanged)

Fixes seedds#2272
…build uses the cores it has: finishing a shader (the MSL rewrites, its reflection, its outputs and the cache) is Python, and the threads that did it share one GIL, so one core finished every shader while the Metal compiles they waited on left the others idle. Ocarina of Time's whole Mac map (0400486024DEC000, 42,848 shaders) on an M3 Max with 16 cores, J=16: 3,506 s with the build at 104 % CPU and 4 to 5 cores busy, 1,826 s with 16 workers; every shader restored from the cache 888 to 191 s (the PR author's runs). dmsh_build.py now finishes them in DMSH_PROCS worker processes (default J; 0 = threads, as before): forks of the build made once, after the cache check and before its first thread, so they have every table and fingerprint it read (spawned workers would run the script again, and its start clears the outputs), each with its own connection to cas.db (shader_cache.Store.forked). The build translates the batches itself and hands each shader's job to a worker; results and counts come back in batch order, so the summary, the progress file and every output are those of the threads. The next batch is handed out before this one is done (two at most), so no worker waits for a batch's slowest shader; paired vertex shaders still wait for every other shader. The workers, the batch overlap, the diagnosis and those measurements are PR seedds#2255's. Added here: the precompiled Metal headers are made before the fork (each worker made its own, three compiles a target, in a folder nothing removed without the PR's WORK override, which is gone: Red Dead Redemption's build peaked at 1.4 GB with them, 0.8 GB now); a worker that dies stops the build with one [RED] line instead of a traceback (checked by killing one); the reference entry (A shader build's Python finishes one shader at a time), which also resolves the open note under Rewrites that try every character of a large source, Ocarina of Time's note, and the memory advice in docs/development.md. PR seedds#2035 solved the same problem by running the build as J / 3 copies of itself (Ocarina of Time on an M5 Max 3,002 to 1,298 s; 1.41 times faster on an M3 Pro for 1.3 GB more, tobiashenn's run); side by side on one Mac it gained less (Red Dead Redemption: Mac 75 to 58 s, Mac and iOS 104 to 95 s against its own older main) and compiled about 9 % of the Metal sources twice, so it is not taken; its measurements are in the entry. Checked on an M6 (12 cores, 16 GB, J=12, empty cache, another game running beside it) against main f75ac06: Red Dead Redemption's 3,628 shaders, Mac 54 to 35 s, Mac and iOS 84 s to 53 and 63 s, restored from the cache 11 to 13 s (the headers are made though nothing compiles); 1,920 of Metroid Prime 4: Beyond's shaders 105 to 72 s, 89 s with DMSH_PROCS=6. Peak memory (summed resident size of the process tree, which counts the forks' shared pages once each): Red Dead Redemption 0.45 to 0.8 GB, the Metroid Prime 4 shaders 1.1 to 3.4 GB, 2.0 GB with 6 workers; a worker holds about 35 MB, the rest is J compilers running at once. Identical: Red Dead Redemption's Mac library (15,542 files) apart from the chain version and _b_cas.txt, and its iOS library (11,912 files); the author's 173,316 files of Ocarina of Time. Tests: test_shader_cache (forked workers share the file), test_shader_toolchain_cache, test_shader_pch, test_nsp_chain, test_docs. The chain version changes (dmsh_build.py), so every game's shaders are translated again once, their Metal compiles reused. Not run: regress.py check (the outputs are the same bytes), a Mac with 8 GB, a whole large map with iOS libraries, a large warm build here. lint_python.py lists one finding outside its baseline, an unused import in dmsh_entry.py, which this does not touch (PR seedds#2255)

Co-authored-by: cashcon57 <24542086+cashcon57@users.noreply.github.com>
… so a one-player game with two players no longer opens it in a loop: above playerCountMax (ControllerSupportArg +1) the stand-in (ctrl_support, hle_hid.c) answered with the count capped and left every npad connected. On a Switch the applet leaves no more controllers connected than the game takes, so the game saw the second npad on its next frame and opened the applet again: 1,671 times in one run of Ocarina of Time (0400486024DEC000, v131072), with no input until the game was quit, after one Bluetooth Pro Controller came back as players 1 and 2 (issue seedds#2237); a second controller or a receiver read as a pad (issue seedds#1657) did the same. The players past the maximum, the highest first, are now left out (g_benched): their npads read as not connected and their style events are signalled, as for a player on an npad the game does not support. With a maximum of one their controllers feed player 1 (merged_players), so whichever controller the player holds plays and a device that never sends input does no harm; with a higher maximum they are not used and the lowest players stay. They count again when the applet opens for more players (the lowest first), when the game sets its supported npads again (SetSupportedNpadIdType), or when their controller goes away; a controller that connects later is a player until the applet opens again. No prompt asks which controllers stay, as a Switch's applet does. It is in the host, so every game and front end has it. The reference entry (The controller applet leaves out the players past the maximum) is new, the keyboard receiver entry's open line points to it, and Ocarina's note links it. Checked: t_hid (251 checks, 22 new: one wanted with two and three players, the lowest kept with a maximum of two, the applet opened for more, a controller that goes and comes back, the supported npads set again), its thread sanitizer build, make run in dm/host/tests, test_docs, the Mac host builds. Not run: Ocarina of Time or any game (no second controller here), so that the game stops asking once No2 reads as not connected follows from its request for one player; regress.py check (the code runs only when the applet opens or a controller comes or goes); lint_c.py. Open: what the second HID device of the report is (a second I/O Registry entry at USB location 0 that refuses its calibration request with 0x10000003; the report has no ioreg listing), which would still take a player in a game for more than one; a game that opens the applet for one player and later expects a second controller without opening it again would not see that controller until it reconnects, none known (issue seedds#2237)

Refs seedds#2237
…s written, and a submission looks at a texture's pages once: one written page sent every layer and level of the texture through the upload again, into another Metal texture, and the pages were asked at every use, so while the queue's thread replayed a submission each look found the few pages a loader thread had written since the last and uploaded again. Ocarina of Time (0400486024DEC000, v131072) fills a 1800x1380x8 array of 38.5 MB piece by piece while it draws with it: walking into Hyrule Castle Town, 11 to 19 whole reads of the array a run (424 to 732 MB) and frames of 49 to 90 ms with a re-upload. Now the images (a layer's level, or a 3D texture's level) with a page written since the last upload are read from guest memory and the others copied on the GPU from the texture it replaces (pkg_written, up_copy_add; DM_NVN_PARTIAL_UPLOAD=0 reads whole); sparse, linear and multisample textures are read whole as before. A write another thread makes during the replay races the GPU's run of that submission on the console, so it is found at the next submission's first look, as a sparse texture's already was (229fc22); nvn_dirty_touch at that mtl_sub_begin sends the caches that remember "nothing written since" by generation through their check again. Writes by the replaying thread (nvn_dirty_own_writes) and looks outside a submission stay exact. A texture holding copied images is read whole once an upload batch was dropped (g_up_lost_gen), and the recovery of a dropped batch is no longer skipped for a texture with edge copies (pkg_edges_clean kept the unwritten texture); t_direct_upload now waits for the report. The DM_NVN_REUPLOADS line names what was read, the time and the submission. The code, the diagnosis, the test and the measurements are PR seedds#2263's; added here: the reference entry's open and not-checked lines. The author's runs (M4 Pro, headless, the recorded walk into the town, 70 s, baseline ced3612 and the branch interleaved, 8 and 3 runs): the array 7 to 9 reads of 4.7 to 19.0 MB (66 to 76 MB a run), the 3072x2096 BC5 texture 21-22 re-uploads to 2, the longest frame with a re-upload 20.5 to 23.6 ms, frame rate 57.96-60.12 and 58.42-58.91 fps. Checked here on 8b55ebb plus the change (M6): t_partial_upload 3,585 checks (every image against a CPU reference after each write; three re-uploads a submission of that array complete in 13.3 ms with one layer written, 68.5 ms read whole), t_direct_upload 26,384 and 26,388, t_cpu_tex, t_upload_slots, t_dirty_race, t_dirty_slots, test_docs. regress.py check, full routes, headless: Bastion PASS (59.5 to 59.1 fps, p99 17.55 to 17.61 ms) and The Binding of Isaac: Rebirth PASS (59.2 to 59.1 fps), no new red line; neither route makes a re-upload, nor does Ocarina's Kokiri Forest walk (run by hand on both hosts, 16.7 ms p50), so no game run here reached the partial read. Open: a single-image texture is still read whole, once a submission; DM_NVN_DIRTYCHECK=1 reports one dirty-page miss on the town route on the baseline, the branch's runs with the check did not reach the town, and those runs predate 1e69c18 (a write missed while opening shared pool pages), which may be that miss. Not run: the town route here (no save near it on this Mac), another game that re-uploads, the full gfx suite, lint_c.py, iOS. test_env_switches fails on main as here, for switches this does not touch (PR seedds#2263)

Co-authored-by: Roan de Graaf <36153028+roandegraaf@users.noreply.github.com>
…so a storage takeover leaves a live sRGB / linear twin's parent: a texture that differs from a shared texture only by the other format of an sRGB / linear pair is a view of it (tex_mtl_, srgb_twins), and the twin's serial entry holds the view. g_by_serial_held counted the view alone, so the shared texture looked unheld once its own object was finalized: alias_take_over evicted it under the live twin, and defer_drain took it out of the residency set. Since 0c7e88b the takeover's note names no serial (ser_note(0)), so nothing sent the twin's texture IDs through tex_mtl_'s stale-view check, which a twin only sampled through its IDs does not reach otherwise: pool tables kept naming a view whose parent no longer shared the storage's bytes and, for a texture with an allocation of its own, was no longer resident (a texture placed in a recycled heap, rh_texture, stays resident through its heap). No game symptom is known; the report is from the code and t_pool_notes, whose twin case passed only because the note of the twin's first resolution was still in the log when the takeover's walk ran (issue seedds#2125). Now count_add counts an object's parents with it, in the serial table and the ghost ring: a live twin keeps its parent from a takeover as a live texture of the parent's own format does, and a parent retired another way (its pool finalized, an upgrade, which bump g_ser_gen with no note and so reach the stale-view check as before) stays resident until the last view's entry goes. The twin path puts its entry in the table and then checks under g_smu that the parent is still the shared texture of its key, dropping the view otherwise (a takeover on another thread between the lookup and the entry). It is in the host, for every game. The diagnosis and the fixture's extra walk are dean0396's; their proposal was a map from each shared texture to its twins' serials, noted at the eviction, where this leaves the texture in use in place. The reference entry (A view's entry did not hold its parent) is new and the takeover bullet of Pool tables patched instead of built whole links it. Checked (M6): t_pool_notes 91 checks, with heap placement off (DM_NVN_RT_RECYCLE=0) so the residency check is real: a texture of another description over the storage leaves the twin's parent shared, held and resident, the table's entry unchanged and no table built, and once the twin is finalized the next such texture evicts the parent; the same fixture fails 3 checks on d2556cf's nvn_mtl.m. t_alias_takeover, t_cpu_tex, t_image_alias, t_pfv, t_srgb_alias, t_sparse_tiles, t_upgrade_alias, test_docs. regress.py check on Bastion (full route, headless, baseline d2556cf): 72 of 72 shaders on both sides, no MSL changed, 59.4 -> 59.6 fps, p99 17.6 -> 17.55 ms, no new red line; it reports the screenshot at 78 s as differing (RGB 31.5), which is the drifting fog and fireflies of that scene: two runs of the baseline host differ by 28.7 there. Bastion is not known to make twins, so no game run reached the twin path. Not run: the full gfx suite, lint_c.py, iOS, the check after the entry (it needs a second thread). Open: a twin already finalized when that check drops its view keeps the stale view in the ghost ring (resident, wrong bytes) until the ring lets it go

Fixes seedds#2125

Co-authored-by: dean0396 <4335213+dean0396@users.noreply.github.com>
…ontroller with a second, silent I/O Registry entry stays one player: the identical-pads path (pad_hid_mac.h, seedds#1218) counted every IOKit entry of a model against GameController's controllers of it, and after a long Bluetooth disconnect IOKit kept a second entry of one Pro Controller, at USB location 0, that answered its calibration request with 0x10000003 (MACH_SEND_INVALID_DEST: nothing receives what is sent to it) and outlived the next reconnect. Two entries against one controller read as two identical pads GameController had merged, so both became players and Ocarina of Time (0400486024DEC000, v131072) opened the controller applet 1,671 and 531 times (issue seedds#2237; 47343a4 already stops that loop). The "connected" then "disconnected ... is free" of the GameController controller just before was the host releasing it to the twin path, not a Bluetooth drop. The raw motion pairing (motion_pro_mac.h) counted the same entries, so the silent one also turned the Pro Controller's gyro off. Now an entry counts while a pad is behind it: macOS keeps a Pro Controller in full mode, which sends report 0x30 every 15 ms whether or not anything moves, so a Pro Controller's entry counts while its last 0x30 is under a second old (pro_live, motion_pro.h); another model's once it has sent any report (hidpad_live). Each such entry's reports are listened to (hidpad_listen; another model's until its first); an entry counts from its first report and again from its first after a silence, and one that falls silent without being removed is left out at the next change of its model's pads. Twins take a player only once they send. With two or more entries of a model, the log names each one that starts or stops counting, with its transport and registry entry ID, as does the twin line, so a report shows what a pad's entries are. New reference entry (A HID entry that sends nothing counted as a second pad); the applet entry's open line, Ocarina's note and the symptom index point to it. Checked: t_pad_hid_mac (new; the real pad_hid_mac.h with fake IOKit entries and GameController controllers: one pad with a silent second entry stays with GameController, as does a reconnected pad whose old entry fell silent; two pads over USB become twins only once both send, go back when one falls silent and return when it sends; with every entry counted it fails with the report's two "read here" lines), t_motion_pro_mac (a silent entry does not stop the pairing; a pad whose old entry fell silent is paired on its new one), t_motion_pro, make run in dm/host/tests, the Mac host build, lint_c.py tidy on the changed sources (0 findings), test_docs. Not run: any controller (none here), so that the location-0 entry sends nothing is inferred from its MACH_SEND_INVALID_DEST, not measured; two Pro Controllers over USB; regress.py check (no route uses a physical controller)

Refs seedds#2237
…and wait for a cloud save iCloud has only listed: with both saves changed since the last sync, the host kept the one with the newest file date, so a new game's first save written 45 s after a 54-minute save replaced it in the cloud (Cadence of Hyrule, 01000B900D8B0000 1.5.0, an iPhone and a Mac mini M2 Pro; the real save survived only in the phone's save-backups/<date> cloud). The host could ask instead (ss_decide's SS_ASK, DM_SAVE_SYNC_CHOICE in docs/frontends.md), but neither launcher set it. Now save_sync_report(save, title, folder, wait_ms, out, n) answers, before the start, one line about the two saves as the game's first mount will see them: hashes, dates, file counts, sizes (ss_meta.bytes), the cloud's device and whether both changed. It finds the cloud's file with the mount's own rules (cloud_path: DM_SAVE_SYNC, icloud, a folder named after the game) and fetches it through the same front-end call, into a file of its own under <save>.sync-tmp. Both launchers call it at Play through SaveSyncReport.swift (shared; pack_app.py builds it into the Mac launcher): on a conflict they show both saves with their date and size, since the newer is not always the one with progress (no default button on the Mac), and pass local:<hash> or cloud:<hash>; with nothing to choose, ask; a cloud save that did not come in a minute is said so, with this device's save (offline: the mount does not wait again), another try or Cancel; while it downloads, Play Without It goes on at once. The Mac launcher sets DM_SAVE before its window (launcher.c set it after, so the check could not read the save) and checks with the window off too; the iPhone launcher names the cloud file with dm_save_title() (hle_fs.c) and DM_SAVE_SYNC from dm_cloud_saves_env(). On the iPhone, front_save_sync_fetch asks iCloud for a save it has only listed and waits for the file until it is there or NSURLUbiquitousItemDownloadingErrorKey reports a failure, so an offline fetch ends at once; a refused request falls through to the coordinated read as before. The mount's own wait stays 10 s. With no launcher (DM_LAUNCHER=0, an iPhone app without launcher.json) the newer save still wins. The diagnosis, the report and the launcher prompts are PR seedds#2180's; changed here: the report finds the cloud file itself (the PR's launchers built the path, which missed the game's own folder and icloud: such a start passed ask with nothing compared and synced neither side from then on), the Mac's DM_SAVE order (its prompt never showed), sizes in the dialog, offline instead of ask when the cloud was not read (the PR's start waited 20 s in the report and 20 s more at the mount), the download wait stopping on iCloud's error, the shared Swift file; the PR's iOS folder picker rewrite is left out (issue seedds#1148, its own change). Reference entries: Both saves changed is the player's choice, not the newest file's; The cloud's save is listed but not downloaded. Checked: t_save_sync 101 checks (section 15: nothing anywhere, a save only here, in step, the game's own folder, only in the cloud, both changed with the new save the newer and the smaller, the cloud unreadable, sync off, DM_SAVE_SYNC when no folder is given, nothing left behind), t_save_sync_metadata 41, t_fs 146, test_docs, test_nsp_mac_app, test_launcher_storage; the Mac launcher compiles and links as pack_app.py builds it, the iPhone's Swift sources and SaveSync.m compile against the iOS SDK; lint_c.py tidy on the changed C files: nothing above the baseline. Not run: either dialog by hand, an iPhone (a listed save, an offline start, a reconnect), regress.py (no route turns cloud saves on). lint_python.py's one new finding is dmsh_entry.py's, on main before this

Front-ends: new: save_sync_report(save, title, folder, wait_ms, out, n) and dm_save_title() in dm/host/save_sync.h, the comparison a launcher asks the player with before the start
Front-ends: interface: pass DM_SAVE_SYNC_CHOICE=ask only after a comparison; with the cloud not read, offline

Co-authored-by: kendrasloane90 <257330740+kendrasloane90@users.noreply.github.com>
…hose width is not a whole number of tiles is padded as the game laid it out: SetPackagedTextureLayout was kept only as byte 0 (block height and depth) in the texture description, and byte 1's low nibble, log2 of a width alignment in GOBs, was dropped. With it the levels at least one tile in size are padded to whole tiles, as a sparse texture's are to its 64 KB tiles, the mip tail is packed as before, and a layered texture's layers align to the whole block times that width, whether or not the texture is SPARSE. Bayonetta Origins: Cereza and the Lost Demon (0100CF5010FEC000, 1.0.0, no profile in the repository) has a 2052x1026 ASTC 6x6 tutorial-card background with byte 0 3 and width 4: 96 GOBs wide and 0x120000 bytes, laid out 86 GOBs wide (0x102000), so its rows from y 384 on read ten GOB columns of padding, all-zero blocks that ASTC decodes as magenta (a fixed 240-pixel-wide magenta rectangle). nvn_texdesc.pkg_block_h is now pkg_layout (byte 0 and the width nibble, + 1); packaged_width_log2 feeds level_walk and layer_bytes, and every row-pitch consumer (the GPU and CPU deswizzles, WriteTexels) takes it through nvn_tex_level_gobs. A layout with a width nibble of 0 is laid out exactly as before; the packaged layouts logged in nine other games' runs on disk (Metroid Dread, DKC Returns HD, Fire Emblem Engage, Super Mario RPG, TUNIC and four more, 1,086 lines) all have byte 1 = 0. Flags and the sparse tile layout the game reads are unchanged. The [nvn] packaged texture log line prints the width alignment. New reference entry (Packaged textures carry width alignment as well as height and depth). The code, diagnosis, tests and checks are PR seedds#2268's: the fix confirmed on an iPhone on the tutorial card, the layout compared with the SDK's own arithmetic on 37,296 shapes and the game's texture replayed on the GPU (neither in the repository: they need the game's files), and regress.py check on five games (Bayonetta Origins, Yoshi's Crafted World, OCTOPATH TRAVELER, Metroid Prime Remastered, Rhythm Heaven Groove), all passing after a rerun of one moving-camera screenshot. Added here: the field's rename, the comments and the log line, the entry trimmed. Checked here on 68dde14: t_tex_layout 28 of 28 shapes (the width-4 ones fail without the fix), t_sparse_layout 28, t_nvn 304, t_partial_upload 3,585, t_tex 5,382, test_docs, lint_c.py tidy on the changed C sources (no finding above the baseline). Not run: regress.py check here (no logged layout sets the width nibble), any game. Open: a level exactly one tile high is padded (as the sparse rule does); a width nibble together with SPARSE, or with a block depth, has no test (PR seedds#2268)

Co-authored-by: doggy <443524+doggy@users.noreply.github.com>
seedds and others added 8 commits November 12, 2026 00:02
…e-texture movie into a LINEAR texture is no longer black: write_texels wrote every texture by block-linear address, nvn_deswizzle_geom refuses a LINEAR or LINEAR_RENDER_TARGET layout, so write_region_bl failed, and the whole-level fallback's nvn_swizzle refused it too with its result ignored: the storage kept what it held, with no log line for a whole-texture write. The host's native-texture movie output (nvn_host_write_texture) goes through it, so TSUKIHIME -A piece of blue glass moon- (01001DC01486A000, no profile in the repository) drew its title backdrop, a 1920x1080 RGBA8 LINEAR | VIDEO_DECODE movie texture, black. Now a linear texture is one 2D level of rows of its stride (tex_linear_row, the stride GetStorageSize counts, now shared by ReadTexels, the upload, gsb_geom and linear_fit), written as ReadTexels reads it; a region outside those rows, another target or level, or a block-compressed format is refused with a [RED] line, as is a block-linear write nvn_swizzle refuses. mtl_tex_linear_cpu_written leaves a texture viewed on its pool's buffer (linear_fit) as that view, which reads the storage itself (made CPU-written it would be uploaded whole at each write); any other is taken from its storage as tex_mtl_ takes one at first use. The diagnosis is PR seedds#1983's (the probe showing each title-movie frame in the source and not in the storage, and the author's Mac run of the title, the opening movie, event movies and gallery CGs with the fix); changed here: the PR's write_region_mirror no longer exists on main (ab41d6a), LINEAR_RENDER_TARGET is covered too, the buffer view is no longer made CPU-written, the DM_MOVIE_DBG probe is left out for the [RED] lines. New reference entry (WriteTexels into a linear texture dropped the write); movies.md no longer says the output is always block-linear. Checked: t_nvn 311 checks with the new 6c2b (a 37x5 LINEAR | VIDEO_DECODE texture of stride 256 and a 16x16 LINEAR_RENDER_TARGET of stride 128, four regions each, some with a padded source stride: storage byte for byte with the row padding and the bytes after, a region past the last row refused, ReadTexels back, no CPU-written texture added for the buffer views; without the linear branch 3 fail, with mtl_tex_cpu_written in place of the view rule the last fails), t_linear_readback 61 cases, t_cpu_storage 135, t_cpu_tex 23, t_direct_upload 26,384, t_partial_upload 3,585, test_docs; lint_c.py tidy on the changed sources: nothing above main's own count (nvn_mtl.m's nullability pair is 18 on main as here). Not run: any game (Tsukihime is not here), the full Mac host build, iOS, regress.py (only linear textures change, which were not written before). Open: a LINEAR_RENDER_TARGET or IMAGE linear texture the GPU drew into as a private texture and the CPU then partly writes is uploaded from its storage, as a block-linear one is (PR seedds#1983)

Co-authored-by: Beeven <5119686+beeven@users.noreply.github.com>
…gain from its first program, so Super Smash Bros. Ultimate no longer crashes after a language change: Options > Language > Yes ("the software will restart") saves the new language and calls it, the host did not hook it, and the SDK's version reads through the am application proxy, which the host never opens (CRASH sig=11 addr=0 at sdk+0x804c8, applet::RequestToLaunchApplication+0x98, 13.0.5, 2 of 2 runs). On Horizon the call ends the application and starts its first program with no launch parameter (oe::GetPreviousProgramIndex -1, as from HOME) and does not return. It is now the start oe::ExecuteProgram makes, for program 0 (oe_start in hle_oe.c; oe_plan and prog_plan_make make the Mac's plan, prog_exec the execve after the graceful exit): a multi-program application (DM_PROGRAMS) starts its first program's row, a program run by itself execves its own host with its own arguments, and either gets this environment less DM_LAUNCH_PARAM and DM_PREV_PROGRAM, plus DM_RELAUNCH=1, with which DM_CTL resumes at the end of its file instead of replaying the presses that led there. ExecuteProgram of a program's own index, with no table, now also starts its host again with the parameters, as on Horizon (it ended the program before); another program still cannot start. On the iPhone an app holding several programs records program 0 (DM_EXEC_OUT); an app of one program cannot start itself again, so the front end asks the player on screen for 3 s to open it again and the app ends (front_program_handoff with no DM_EXEC_OUT), and a multi-program app whose player refused notifications now asks the same instead of quitting silently. New reference entry (oe::RequestToRelaunchApplication: the application starts again); the ExecuteProgram entry, front.h, env_switches.tsv (DM_RELAUNCH) and the Smash note follow. The diagnosis, the hook and the Smash test are PR seedds#2156's: French to English and back on a Mac mini M4 (13.0.5, a program run by itself), menus in the new language, no crash, no red line. Changed here: the relaunch folded into ExecuteProgram's start (the PR read the table and filtered the environment a second time), the self start for ExecuteProgram, the iPhone notice, t_oe's plan checks. Checked here (M6): t_oe 70 checks (10 new: the plans with and without a table, the keys dropped and added, the parameters file, a missing row), t_hid 251, test_docs, the Mac host for Smash, hle_oe.c and front_ios.m compiled for iOS with no warnings, lint_c.py tidy on hle_oe.c and hle_hid.c (nothing above the baseline). Bastion run by itself on the Mac with stale DM_LAUNCH_PARAM / DM_PREV_PROGRAM, DM_CTL "program 0" once at the title: the same process boots again (a second build: line, graceful exit 0.000 s), DM_CTL does not replay the line and takes the next screenshot, the title draws, no red line. Not run: Smash here (its shader libraries are an old chain), a multi-program application (t_oe does not link with 3D All-Stars' profile, as on main), any iPhone, regress.py check (no route restarts or changes program) (PR seedds#2156)

Co-authored-by: maxzloty <295668652+maxzloty@users.noreply.github.com>
…ce's backup folder, so the staging folder never holds this device's save and a failed pull puts it back whole: pull (save_sync.c) unpacked the cloud's save into <save>.sync-tmp/in, swapped each folder with the live one, and only then moved the swapped-out folder, this device's, into <save>-backups. When that move failed, mount_once logged "playing on with this device's" while the cloud's save was in place, and its rm_tree of <save>.sync-tmp deleted this device's save; an app killed between the swap and the move lost it the same way, since every start clears that folder, and a failure at save_device after save had swapped left a save half the cloud's. Now the backup folder is made before anything moves, each of the cloud's folders is renamed into it and swapped from there with the live one (one renamex_np both puts the cloud's in place and leaves this device's in the backups), and a folder the cloud's save does not have is moved to the backups. pull records what it did to each folder (act[]) and on a failure undoes it in reverse order, so the save is this device's again and the empty backup folder goes (-1, and the log line is true); if a step of undoing fails, nothing is deleted, pull returns -2 and the red line names the backup folder holding what is not in place. The errno logged is the first failure's. New reference entry (A failed pull deleted this device's save). Checked: t_save_sync_metadata 102 checks, with rename and renamex_np faults: nothing fails, with and without the cloud's device save; the move into the backups fails (the report's case); save_device's swap fails and save is swapped back; save_device's move to the backups fails; that swap back fails too; after every rename and swap the staging folder holds nothing of this device's save; the old pull fails 22 of them, the reported loss among them. A fault-injection repro through save_sync_mount (EIO on the move into the backups, the player's choice of the cloud's) loses the save before and keeps it after. t_save_sync 101 checks, lint_c.py tidy on both changed files (0 findings), test_docs. Not run: an iPhone or a real iCloud pull, regress.py (no route turns cloud saves on). Open: backup_dir prunes the oldest local backup beyond 10 before the pull is known to succeed, as before
…or NSP build run no longer syncs its scratch save with the player's cloud save: regress.py (run_env), bench.py (run_one) and the NSP script's host runs (tool_env: the NRO, glslc, Oodle, JIT and shader captures, the heap and region checks, the pipeline prebuild) copied the caller's environment and replaced only DM_SAVE. With DM_SAVE_SYNC exported in the shell, the host synced the scratch save through <folder>/<title ID>/save.dmsync, the player's own file for that game: a save=new route started with the player's cloud save (only in the cloud: pulled in), and its first commit, the newer save, was sent over it; the cloud save it replaced was kept in <DM_SAVE>-backups inside the run folder, which the next run deletes. Now each sets DM_SAVE_SYNC=0 after its overrides (tool_env for the NSP script, and the prebuild after the environment file's switches, which are the player's); regress.py --env and a bench.py variant or --env naming a cloud folder are refused (0 or empty still pass). regress.py leaves DM_SAVE_SYNC* out of a baseline's context, since no run reads them. The play command the NSP script prints is unchanged. New reference entry (Automated runs synced their scratch save with the player's cloud save); env_switches.tsv's DM_SAVE_SYNC row says who sets 0. Checked: test_bench, test_regress, test_nsp_env_checks (new cases: with a cloud folder exported each run gets 0, an explicit folder is refused, an explicit 0 passes), test_docs: 93 tests; lint_python.py: the one new finding is dmsh_entry.py's, on main before this. Not run: regress.py check (only the tools' environment changes, and no route syncs), the report's end-to-end repro (DM_SAVE_SYNC=0 turns sync off in cloud_path)
…o a second CreateJitEnvironment after DestroyJitEnvironment no longer crashes: NRO data snapshots are lazy since the FFX/X-2 port (preload_nros records only pristine_len; the first load copies the initialized data), and nro_load took that copy, but nro_load_alone (the JIT plugin's load, hle_jit.c) did not, so its reload copied from a null pointer (SIGSEGV in nro_load_alone at load 2); its reload also left the bss as the previous environment had left it, while the jit service loads the plugin fresh for each environment. Now both loads start with nro_reset_data (loader.c): the first load snapshots the initialized data only, and a reload restores it and zeroes the bss; each keeps its own symbol binding (nro_load into the game's lookups, nro_load_alone against the module itself). No game has been seen to create a second environment; Super Mario 64 (3D All-Stars) is the one that takes this path. New reference entry (A JIT plugin loaded a second time crashed). Checked: t_nro with a new case (load alone, dirty the data, bss and relocation slots, mark unloaded as h_jit_Destroy does, load alone again: data and bss as rewritten, slots relocated against the module); without the fix it fails at the first load (no snapshot); test_docs; lint_c.py tidy on loader.c (nothing above the baseline). Not run: the full Mac host build, any game, regress.py (one helper on the NRO load paths, the linked load unchanged)
… its last attachment, and the current program deleted stays in use until another is made current, so a link after glDeleteShader no longer finds no shader or another one: glDeleteShader freed the shader at once and its name went to the next glCreateShader, while a program keeps its shaders by name, so a later link found nothing (its draws skipped) or a shader of the other stage (a fragment shader as the vertex stage); glDeleteProgram freed the current program and made none current, so the draws after it were skipped, where GL keeps it in use until the next glUseProgram. Now hle_gl.m counts each shader's attachments (shader_t.refs; one shader per stage, a new one replaces and releases the old), glDeleteShader of an attached shader sets deleted and shader_release frees it with its last attachment (glDetachShader, new; a replacing attach; the program's end), glDeleteProgram of the current program sets prog_t.deleted and glUseProgram of another frees it (prog_free, which releases its shaders), and both GL_DELETE_STATUS queries report the flag; DM_GL_LOG=1 logs the deletes. A linked program already held what its link took, so it draws as linked whatever happens to its shaders. No game shows the symptom: Balatro takes the path (LÖVE deletes its first default programs' shaders while attached, then the programs, when it makes its window again) but never links after deleting a shader. New reference entry (GL shaders and programs deleted while in use). Checked: t_gl_imports with new cases (the reported sequence, a flagged shader keeping its name and stage, a replacing attach, detach, a shader shared by two programs, the current program deleted, used again, then switched away), in both stub modes; with main's code the shader part fails at the first new check, and with the old glDeleteProgram / glUseProgram the program part fails; test_docs; lint_c.py tidy on hle_gl.m (nothing above the baseline). Balatro (built from its NSPs, M6), main's host against this one, 75 s headless each with the note's touch route: both to frame 4,200, no red line, the title and tutorial frames the same but for the animated background and particles; a first run of main's host at about 20 fps was machine load (a rerun ran at 60). Not run: regress.py (it does not cover GL games), Digimon and Well Dweller (no builds here), iOS
…es the source's image and keeps the destination's sampler, so a copy no longer replaces the sampler the layout fixed: vkUpdateDescriptorSets copied each descriptor whole (*t = *s), overwriting the sampler state the set's allocation had put in place from the layout, and a draw then sampled with the source's filtering, addressing and LOD clamps. Vulkan's updates, copies as well as writes, change only the image of a combined image sampler whose binding has immutable samplers (a sampler-only copy into one is not allowed); the write path (desc_write) already kept the sampler. Now copies go through desc_copy (hle_vk.m): the source descriptor whole, the destination's sampler kept when its binding has immutable samplers (lbind.imm); a source's immutable sampler is part of its descriptor and is copied into a binding without them. No game has been seen to show it. New reference entry (Descriptor copies into a binding with immutable samplers). Checked: t_vk_desc with a new case (source sampler A, destination immutable sampler B: after a write and a copy the destination holds the source's texture and B; copied back, B reaches the mutable binding), 19 checks; without the fix 2 fail; test_docs; lint_c.py tidy on hle_vk.m (nothing above the baseline). Not run: any game, regress.py (one copy path, covered by the unit test), iOS
37 upstream commits since the merge base 0cad950. Where upstream now does one of
the fork's picks itself, upstream's version is taken and the fork's copy dropped:

- seedds#2136 (e1ad1ae): upstream 1e69c18 is the same code.
- seedds#2262 (98f8e54): upstream 6a6a018 is the same code.
- seedds#2263 (35f4494): upstream d2556cf is the same code.
- seedds#2219 (98f61af, no uniform bound for Switch 2 games): upstream 1d090a6 bounds
  a slot at its size rounded up to 256 bytes, the driver's size, for issue seedds#2218.
- seedds#1838 (64871cd, DM_GRAPHICS_SCALE): upstream 084f5aa answers tier 0 in both
  modes and has DM_GFX_SCALE; it supersedes seedds#1838.
- seedds#2035 (77d5833, the shader build as J / 3 copies): upstream 8b55ebb finishes
  shaders in DMSH_PROCS worker processes and does not take seedds#2035.
- seedds#2258 (20a692c), its press-to-join part only: upstream 7ef8339 keeps a Switch 2
  controller waiting for its first press (attach returns 1 or 0, playerSync). The
  rest of seedds#2258 (the 200 Hz motion stream, the stick dead zone, the Pro Controller
  2's axes, sw2_gyro) stays; its reference entry's Fix line describes 7ef8339's code.

Every other pick and the fork's own three commits (351a992, dd8dbf1, 0e6c55f)
stay as they were. Adapted: the view cache's comment names rh_wait, which replaced
rh_take in upstream 707cac9.

Conflicts: the Ocarina of Time and Donkey Kong Bananza notes and the gfx tests
Makefile kept both sides; front_mac.m's s2pad_attach, pad_switch2_apple.h and
pad_switch2_apple.m took upstream's (7ef8339); t_hid.c kept both tests; the
rest were conflicts with the dropped picks and took upstream's side.

dm/gfx/nvn/dmsh_chain.h: b7dc2ede7e42 (dmsh_chain.py --header), upstream's
translator and tools with the fork's loop guard (seedds#2254) and texel fetch clamp
(seedds#1824). Every game's shaders are rebuilt.
@khalilgharbaoui
khalilgharbaoui merged commit 2b63f9f into main Nov 12, 2026
@khalilgharbaoui
khalilgharbaoui deleted the sync-upstream branch November 16, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants