Compile and archive format-unspecialized Metal 4 mesh pipeline bases (task + mesh + pixel), specialize them across attachment/blend/depth states at draw time, proactively prefetch them on NVN program creation, and prebuild static (task, mesh, pixel) triples offline and on device via mesh_pairs.tsv.
- Reflection & chain: mark mesh shaders that emit per-primitive outputs with mesh_stage.prim in dmsh_meshstage.py / dmsh_build.py and bump DMSH_CHAIN to 3fe2e3787fdf.
- Host Metal 4 mesh bases (nvn_geometry.inc, nvn_mtl.m): build, deduplicate, archive, compact, and specialize Metal 4 mesh bases (preserving mtk_spill payload clamping and tagging dm_mesh_nop); fall back to whole pipelines for mesh_stage.prim and reads_prim_id as a workaround for an Apple Metal 4 compiler/driver bug (verified on Apple M6, macOS 27.2.1 / Metal 32023.922) that non-deterministically zeroes per-primitive outputs and [[primitive_id]] on specialized mesh bases; skip recording M manifest rows when a base hits archive; prefetch mesh bases from mtl_prog_prefetch() on a bounded background queue (DM_NVN_MESH_PREFETCH=0 disables).
- Static mesh triples & prebuild (shader_split.py, pso_offline.py, pack_app.py, build_ipa_from_nsp.py, build_ipa.sh, regress.py, nvn_mtl.m): emit mesh_pairs.tsv (M\t<task or ->\t<mesh>\t<pixel or ->), compile eligible mesh bases into MTL4Archive via metal-tt, route depth-only / non-default-constant triples to rest_pairs.tsv, and load mesh_pairs.tsv / DM_MESH_PAIRS in pso_prebuild().
- Tests & docs: extend t_pso_archive, t_pso_bundle, test_pso_offline, test_dmsh_meshstage, test_dmsh_pairs, and test_nsp_incremental; update env_switches.tsv, docs/reference/shaders.md, and Ocarina of Time's note.
Checked: Mac host build, Metal 4 GPU tests (t_pso_archive 441/441 + 15/15 restarts, t_pso_bundle 118/118, t_mesh_first_use, t_pso_stall 124/124), Python suites (test_pso_offline, test_nsp_incremental, test_nsp_mac_app, test_docs, test_env_switches, test_nsp_chain, test_game_profile, test_dmsh_pairs, test_dmsh_meshstage prim checks), regress.py on Fast Fusion (PASS), and regress.py + 3-way cold-start A/B/C on Ocarina of Time (mesh stall 15,847.5 ms -> 6,056.4 ms with prefetch -> 2.6 ms with offline mesh bundle).
Front-ends: break: shader libraries must be rebuilt for chain 3fe2e3787fdf.
Co-authored-by: Eric Schaal <[email protected]>
After the last regular shader, dmsh_build.py wrote no more progress to DMSH_PROGRESS, leaving ShaderWatch frozen at a stale ~99% count through mesh-library compilation, library-image publishing, and the c1_guard.py and cb_extent.py table passes. ShaderWatch also mapped every step other than cache check back to compiling, hiding compiling RT library.
Have dmsh_build.py report all of its phases directly through DMSH_PROGRESS: flush the final counts of cache check and compiling, flush immediately on step changes, report compiling mesh libraries across _mesh, pass an optional on_progress callback through publish_library to shader_lib.write for writing the library image (or writing the Mac / iOS library image on dual-image builds, with file counts and bytes written), and report c1 guard and uniform read extents before unlinking DMSH_PROGRESS at exit. Simplify ShaderWatch to forward step, counts, unit, and formatted byte notes straight from DMSH_PROGRESS. Regenerate dm/gfx/nvn/dmsh_chain.h.
Checked: 159 tests across test_nsp_mac, test_shader_lib, test_shader_toolchain_cache, test_nsp_chain, test_dmsh_abi, test_dmsh_code_fp, test_pr_areas, test_usage, and test_docs; ruff check (0 new findings).
Co-authored-by: UserDerezzed <[email protected]>
c1_guard.py and cb_extent.py stamped the current clock time on the first line of c1_full.tsv and cb_extent.tsv, so every full shader build rewrote both files and invalidated packed app reuse keys even when no shader changed.
Write the canonical header ('# chain b-<V> inputs <digest>') with no clock stamp, skip writing when the file already holds the exact same bytes (preserving bytes and mtime), and update all four header readers (nvn_mtl.m for c1_full.tsv and cb_extent.tsv, scripts/build_ipa_from_nsp.py, and dm/ios/tools/build_ipa.sh) to accept both the canonical header and older timestamped headers.
Co-authored-by: Flying Saucer Studios <[email protected]>
Give Switch 2 (spec: Ounce) titles a 128 GB default alias region on Mac in hle_svc.c while keeping iOS on the profile's mem_alias, clear DM_ALIAS_SIZE in region_check so Switch 2 probes run in the host's console-sized alias region, and enforce Horizon's physical-pool limit (mem_map_limit) by default on Switch 2 while keeping explicit on/off overrides and Switch 1's existing default.
This resolves the Switch 2 startup allocator failures diagnosed in PR #3188 (two 60 GB reservations exceeding 64 GB and an uncapped physical-memory probe nulling the allocator) in the host without putting a 128 GB reservation into provisional iOS profiles.
Co-authored-by: Eriksrevenge1 <[email protected]>
Pass the packager's selected Python interpreter to build_ipa.sh and dm/host/Makefile via DM_PYTHON (defaulting to python3 on PATH, with FONT_PY still overriding it for make_shared_fonts.py) so offline iOS pipeline archives and other helper tools do not silently fall back to an older system Python on PATH. Document DM_PYTHON in docs/env_switches.tsv and add regression coverage for paths with spaces.
Co-authored-by: Giacomo Barbieri <[email protected]>
Xenoblade Chronicles 3's six build-bound Monolith allocator cuts shrink
its 60 GB reservation to 4 GB and its first arena to 512 MB to fit an
iPhone's 4.375 GB alias region. Because patch_nso.py rewrites modules
once for every platform, the Mac ran that compact layout too, where the
first chapter's cutscene after the mid-scene battle returns null for a
0x217a0-byte allocation (sig=11 addr=0x8 at main+0x43060, issue #3149).
Extract the Mac restoration policy from PR #3218 without its unverified
DM_WIDE_ALIAS / wide-IPA entitlement changes or the 288 MB compact-arena
change, and generalize it to cover both build-bound CUTS and matched
MATCH_CUTS:
- Rewriter (patch_nso.py, nso_match.py): mark iOS-only alias cuts via
ALIAS_CUTS or alias_only=True on MATCH_CUTS, assert the cut bytes
survive later rewrite passes, and emit # ALIAS_CUT rows in fixups.tsv.
- Host (dm.h, hle_svc.c, loader.c): share dm_alias_size() in dm.h so
standalone loader tests keep linking; on Mac, undo_alias_cuts restores
original bytes before sealing text when the alias region is at least
the Switch's 64 GB (DM_SWITCH_ALIAS), failing closed on byte mismatch,
and keeps cuts when DM_ALIAS_SIZE < 64 GB or DM_KEEP_ALIAS_CUTS=1.
- Packing (scripts/build_ipa_from_nsp.py): set DM_KEEP_ALIAS_CUTS=1 in
region_check so derived-profile checks still measure the iPhone binary.
- Profile (dm/games/010074F013262000/patches.py): list all six Monolith
allocator cuts in ALIAS_CUTS while keeping the 512 MB iOS cut intact.
Checked: test_patches, test_nso_match, test_nsp_incremental,
test_ipa_unsigned (154/154), test_env_switches, test_docs (8/8), ruff
(0 new findings), t_nro / t_symbols / t_svc_memory (plain + ASan/UBSan
for t_nro and t_symbols), Mac host build for 010074F013262000, iOS
syntax check for loader.c and hle_svc.c, and DOOM 3 (010029D00E740000)
full-route regress.py check + live HUD gameplay.
Open: rerun Xenoblade Chronicles 3 Handheld mode (Zstd worker crash in
issue #3149) with the restored 60 GB layout before associating it with
the same cause, and fingerprint XC3's allocator functions into
MATCH_CUTS (build -> game) once XC3's main binary is mounted.
Co-authored-by: Gabriel Tran <[email protected]>
Xcode 26+ mounts the Metal toolchain cryptex under a directory whose random suffix changes on every reboot, and `metal --version` prints that path on its trailing `InstalledDir:` line. Hashing the raw output invalidated `regress.py` chain keys and `build_ipa_from_nsp.py` shader stage reuse keys across reboots even with no toolchain change.
Strip `InstalledDir:` lines in `scripts/regress.py` (`toolchain_fp`) and `scripts/build_ipa_from_nsp.py` (`fingerprint`'s `cmd` branch), matching `dmsh_mtlcache.compiler_id`, while preserving compiler version, build, target, SDK build version, and `spirv-cross`.
Checked: `test_regress.py` (72), `test_shader_toolchain_cache.py` (35), `test_nsp_incremental.py` (88).
Co-authored-by: David Padron-Harris <[email protected]>
Dual-source blending for NVN pixel shaders relied on per-game dual_want.tsv
lists to emit a separate main0_d entry point into <key>_b. Nine profiles had
accumulated 542 keys, and PR #2736 found 7 more /gamedata/nvn/branch_shader/*.fpo
shaders drawn only during FINAL FANTASY XII limit breaks (with 45 more .fpo
shaders still unlisted).
- dmsh_abi.h / dmsh_entry.py: add DMSH_TYPED_DUAL_FC (234, dm_du) to main0_u in
the lazily-loaded side library <key>_bx whenever colours 0 and 1 share a width
and every colour >= 1 is typed. With dm_du on, colour 1 is returned as
[[color(0), index(1)]] and colours 1..7 are absent, while the alpha test
(dm_at) still composes. Remove fs_dual and DUAL_WANT / dual_want.tsv handling
from dmsh_build.py, dmsh_chain.py, dmsh_live.py, pack_app.py and
build_ipa_from_nsp.py.
- nvn_mtl.m: load entry_u_dual, route SRC1-blended pipelines through typed_fn
(ignoring integer target 0 in pso_reads_src1 where blending is disabled), mark
attachments 1..7 unwritten when dual_fn is active, simplify at_fn to fn only,
and remove fn_d and DM_NVN_DUAL_WANT.
- Profiles and docs: delete all 9 dual_want.tsv files, add PR #2736's iPhone Duo
validation and raw_shaders re-split bullets to FFXII's note, and update game
notes, reference docs, env_switches.tsv and symptoms.md.
Checked: unit/ABI/packaging/docs suites (test_dmsh_abi, test_dmsh_code_fp,
test_nsp_chain, test_shader_toolchain_cache, test_shader_rewrites,
test_game_profile, test_dmsh_pairs, test_nsp_mac_app, test_dmsh_typed,
test_dmsh_alpha, test_dmsh_logic, test_dmsh_side, test_dmsh_fetch, test_docs),
GPU replay (t_typed_outputs on Metal 4 and DM_PSO_MTL4=0, t_alpha, and
t_missing_src1's dual-source checks), all 72 FFXII branch_shader/*.fpo shaders
built for Mac and iOS (72/72 entry_u_dual + entry_u_side, 0 lost), and
regress.py check on The Binding of Isaac: Rebirth (PASS).
Front-ends: break: shader libraries must be rebuilt for chain b94eb3685250.
Co-authored-by: Gabriel Tran <[email protected]>
Fix two assumptions in scripts/build_ipa_from_nsp.py for multi-build profiles:
1. Shader coverage (profile_derivation_reason): committed shader tables cover shader_versions plus any extra registered builds explicitly verified in shader_covers (Hades II v655360, FIFA 23 v196608). Any other registered build derives its own shader tables even when shader_versions is present, preventing a registered update with different shaders (Mario Kart World 1.8.0 beside v0) from silently packing v0's shader libraries. derive_profile strips shader_covers when deriving a single version, and dm/games/game.py validates shader_covers against registered builds and shader_versions.
2. Status reporting (report_profile_status): compare pkg_ver's module build IDs (ignoring display spelling) against reg.builds().get(pkg_ver) instead of comparing the whole build table, so registered builds packed with derived shader tables on multi-build profiles are not reported [RED] while mixed, mismatched, or unregistered modules stay [RED].
Register Mario Kart World 1.8.0 (v917504) in dm/games/0400C3F00006E000/game.tsv without shader_covers so 1.8.0 derives its own shaders whether v0 is present or not. Add unit tests in test_nsp_registered_update.py and test_game_profile.py, update profile docs and docs/reference/packing.md, and regenerate docs/agents/symptoms.md.
Checked: 262 unit tests (test_nsp_registered_update, test_game_profile, test_nsp_alias, test_nsp_incremental, test_nsp_nup, test_nsp_dump, test_nsp_chain, test_patches, test_docs), docs_patches.py --check, and ruff check (0 new findings).
Follow-up to PR #2621.
Co-authored-by: Hector Villarreal <[email protected]>
Load Atmosphère exefs/subsdk<N> code plugins (such as exlaunch plugins beside a mod's romfs/) on the Mac, and answer the Horizon SVCs their start-up requires:
- Rewriter (patch_nso.py, mod_layout.py): walk raw .eh_frame when MOD0's .eh_frame_hdr range is empty (devkitA64-linked plugins), indexing CIEs by offset, supporting CIE v1/v3/v4 and all pointer formats, skipping empty (0, 0) MOD0 ranges, and relocating raw .eh_frame pointers on 16 KB data relayout.
- Offline preparation (scripts/prepare_mod.py): rewrite a mod's subsdk<N> NSOs into <mod>/exefs/nxnative/ in numeric order without DM_GAME, validating NSO0 magic and warning on exefs/main.
- Loader & shared code writes (loader.c, code_write.h, hle_cheats.c): reserve one contiguous PROT_NONE span on macOS for non-JIT startup modules (with a 3-page rtld slot below main and 1-page guards between modules) so modules sit in Horizon load order; sync open MapProcessMemory views after each module's DT_INIT; share mach_vm_remap writable alias and BUILD_ID-verified changed.tsv helpers between cheats and exlaunch plugins.
- Exlaunch HLE & SVCs (hle_exl.c, hle_svc.c, main.c): load prepared subsdk<N> plugins from DM_ROMFS_OVERLAY mods before sdk (skipped safely on iOS); populate the stand-in rtld only when mod plugins are loaded (or on a .rodata-only exlaunch signature match for manually loaded subsdks); answer GetInfo(65001) with the current-process handle; implement MapProcessMemory / UnmapProcessMemory with ASLR-only destination bounds, key_page_off source bounds, changed.tsv refusal, lock-safe sync, and guest_release on unmap; fix svcGetSystemTick (0x1E) to return the 64-bit tick in x0.
- Tests & docs: add t_exl.c and test_exl_mod.py, add dm_exl_* stubs to t_heap_size.c and t_svc_memory.c, document DM_EXL_TRACE and DM_ROMFS_OVERLAY, and update docs/reference/rewriter.md and docs/agents/symptoms.md.
Checked: Mac host build, iOS SDK -fsyntax-only -Wall -Werror on changed C files, host tests (exl, cheats, heap_size under ASan/UBSan; memory, nro, symbols), Python tool tests (23/23), clang-tidy ratchet (0 new findings), ruff/pyright ratchet (0 new findings in changed files), and quick regression check on Hades (0100535012974000, PASS).
Front-ends: new: on the Mac, a mod with exefs/subsdk<N> code plugins runs its code once scripts/prepare_mod.py <mod> has prepared it into <mod>/exefs/nxnative/; enabling the mod (its romfs in DM_ROMFS_OVERLAY) loads the plugins and disabling it leaves them out
Fixes#1133
Co-authored-by: Seif Ateek <[email protected]>
cheat_anchor.py assumed len(img) included .bss, but dm/tools/nso.py's image stops at the end of .data and exposes bss as a size on nso.Module. Both Build.where() and Compiler.addr() therefore rejected every address in .bss—where games keep most singletons pointer cheats start from—as outside the main NSO image.
Load the NSO once through dm/tools/nso.py in Build.__init__, compute self.end from bss_start + mod.bss, and bound .bss by self.end in both Build.where() and Compiler.addr(). Add .bss boundary and import/compile roundtrip tests, document the symptom in docs/reference/cheats.md (and regenerate docs/agents/symptoms.md), and map scripts/cheat_anchor.py in dm/tools/impact_map.tsv.
Co-authored-by: Eriksrevenge1 <[email protected]>
The shader split writes each variation's vertex / geometry pairs to geo_pairs.tsv (kept beside the shader package, like pso_pairs.tsv), and dmsh_build.py builds a mesh library for every pair whose geometry shader has a lean passthrough kernel. Before, only pairs the game had already drawn (G rows) or a hand-kept geo_mesh.tsv got one, so new areas drew their geometry through the compute path.
A composed mesh library now undefines the vertex part's include guards before the kernel's namespace, so a guarded helper (dm_uword) exists in both parts; 20 kernels did not compile before.
Variation pairs that cannot be composed or compiled are counted, not printed as [RED]. regress.py's chain key and the NSP script's split reuse, derived profiles and shader step key include the table. Donkey Kong Bananza's geo_mesh.tsv is removed: the split names both its rows.
Co-authored-by: Paolo Moretti <[email protected]>
Promote legacy desktop GLSL (#version 110/120/130) to #version 450 core in gl_shaders.py and rewrite texture3D/texture3DLod/texture3DProj so desktop implicit int-to-float conversions and sampler3D translate cleanly. Record explicit sampler layout(binding = N) units on GL shader table rows and initialize u->unit from them in glLinkProgram while leaving unqualified samplers at unit 0. Implement GL_TEXTURE_SWIZZLE_RGBA in glTexParameteriv/glTexParameterfv.
In profile_guess.py and build_ipa_from_nsp.py, stop suppressing DM_GL_CAPTURE when main embeds GLSL strings alone or the RomFS contains non-standalone .glsl snippets, honor gl_capture.tsv/vk_capture.tsv when present, and fall back to Mac GL capture when offline translation yields no RomFS shaders.
Verified with 121 Python unit/invariant tests, Mac host build, and Metal GPU readback tests (gl-imports with MTL_DEBUG_LAYER=1 on Apple M6). Addresses #3021 and incorporates findings from PR #2034.
Co-authored-by: Cloud <[email protected]>
Co-authored-by: Ali <[email protected]>
interface_check was the only place in scripts/regress.py that loaded a revision tree's Python tool in-process via load_module. Because pso_offline.py imports dmsh_abi, dmsh_side, romfs, shader_lib and vol_space by name, the baseline and candidate shared sys.modules (and got the harness checkout's romfs), causing a candidate that adds a dmsh_abi constant (such as PR #3176's DMSH_BLEND_OFF_FC) to fail with AttributeError against the baseline's header and risking silently masking helper differences.
Run pso_offline.read_pairs/pair_text and (when suspects exist) pso_offline.plan through Tree.py with JSON over stdin instead, matching how regress.py already isolates dmsh_chain and game.py.
Co-authored-by: David Padron-Harris <[email protected]>
Horizon maps code modules at 4 KB, while macOS and iOS map at 16 KB
with W^X (loader.c seals [0, round16K(text_end)) read+execute and
gen_embed.py places it in __TEXT). Any NSO or NRO whose data starts
below round16K(text_end) (such as FINAL FANTASY VIII Remastered's
Math.nro at 0x2000 and Platform.nro at 0x3000) ends up with read-only
data and faults with SIGBUS in relocate().
Add dm/tools/mod_layout.py and invoke relayout_module() inside
patch_nso.py right after nso.load() for all NSO and NRO modules:
- Shift ro, data and bss up by whole 4 KB pages so data starts at or
past round16K(text_end), keeping TEXT_END at the true code end and
leaving on-disk .nro files and nro.tsv untouched.
- Rewrite the embedded NRO0 header (when present), MOD0 (+4 and its
six offsets), dynamic pointer tags, .dynsym values (excluding
STT_TLS), RELA/JMPREL/RELR, text adrp/adr/literal references into the
moved range (skipping +4, MOD0 in text, in-text literal pools and
unallocated 0xDC words), and .eh_frame_hdr/.eh_frame (including
empty FDE augmentations, sdata4 counts, omitted search tables and
explicit LSDA lpstart pointers).
- Check data_off >= round16K(text_end) in loader.c read_layout() for
every module, and add mod_layout.py to the rewriter cache keys in
build_ipa_from_nsp.py and regress.py.
Co-authored-by: Gabriel Tran <[email protected]>
Set the game's unconditional idle and responsive frame-rate targets in
its shipped Feral specification when packing the RomFS. Match by
registry path and setting name across builds. Keep the specification
UUID so saves that have already applied it keep their preferences.
The base release and v131072 both match. On an M4 Pro a fresh v131072
build measured 59.98 fps in the opening, against 30.0 fps at stock
defaults. A copy of a 30 fps save kept both targets. The Mac packer
tests and the iOS project preparation with separate RomFS passed.
- Implement glGetShaderSource in dm/gfx/gl/hle_gl.m with SP_CHECK, negative-size GL_INVALID_VALUE, NULL-buffer/zero-size guards, and spec-accurate GL_SHADER_SOURCE_LENGTH for empty shaders.
- Read nn::oe::GetDisplayVersion directly from control.nacp (+0x3060) via shared dm_control_read in hle.h (falling back to profile build rows when control.nacp is absent) and preserve raw NACP display versions (such as '1.0.2 b723') in nacp.display_version() and build_ipa_from_nsp.py surveys/derived profiles while keeping Apple bundle versions numeric. This fixes Fate/hollow ataraxia REMASTERED's savedata version gate (723 >= 438 instead of truncated 2 < 438) with zero game-specific patches.
- Add the Fate/hollow ataraxia REMASTERED (010070E022546000) game profile with its 78-shader gl_capture.tsv list, unit tests, and reference documentation.
Fixes#2930
Co-authored-by: Beeven <[email protected]>
A NUP without embedded DLC could not accept Pokopia's separately
extracted marker image. Use --aoc-dir to select the current set of
numbered RomFS images and stage them separately from cached package
extractions. Incremental Xcode builds check the contents of these
images so equal size and modification time cannot hide replacements.
Checked 308 focused tests and synthetic Mac and Xcode rebuilds with
stale, replaced and removed images. Pinned lint reports the same two
unrelated findings on main.
Front-ends: new: pass --aoc-dir with a durable input folder for a NUP without embedded DLC.
Co-authored-by: HC Bille <[email protected]>
The boot capture misses shaders GLSLC compiles when a later scene first
needs them. Allow the existing capture to feed a separate optional
shader split without changing the registered game's module settings.
Mac development runs and Mac apps can opt in to translating missing
NVN1 graphics stages when the game supplies them to SetShaders.
On Catherine 1.0.1a, Night 2 loaded twice on an M4 Pro with empty runtime
shader caches. Each run translated 21 stages and drew the floor, carpet
and lighting using the existing 3,128 packaged shaders. No gameplay
shader capture or offline build was needed. iPhone gameplay is untested.
Co-authored-by: Oliver Ames <[email protected]>
Co-authored-by: kenCalx <[email protected]>
Checked first-copy selection changed source labels for shaders collected
with main. The labels also order package records, so equivalent copies
could make a registered build fail the strict table check.
During registered packing, keep the map's source if the same key and
stage occur at that source in the split. Check each duplicate against
the first before choosing the registered record. Standalone and new
profile splits keep checked first-copy selection.
Echoes of Wisdom 1.1.0 goes from 36 differing rows to a clean split
with all 9,858 shader payloads byte-identical by key. Kirby's Dream
Buffet passes the Mac smoke check with all 4,503 shaders and no new
pipeline interface or log failures. The focused 144-test suite and
Python lint ratchet pass.
Refs #3092, #3095, #3096, #3099.
Co-authored-by: LNP <[email protected]>
Co-authored-by: Scott Lowry <[email protected]>
Co-authored-by: Meannekes <[email protected]>
Upstream nup PR #20 started its TLV enum at 0 instead of SPEC §5's
1. This wrote JPEG icons at the NACP type and display versions at
the icon type. Normalize affected blocks at the shared reader.
Prefer NACP and icon content, then use the markers described in
upstream nup PR #32. Preserve correctly numbered control data when
it appears with shift markers.
Reject NACP payloads of any size other than 0x4000 in the same
reader. Package scanning previously trusted the ID fields of some
truncated or oversized payloads, which could reject valid DLC.
Filter those payloads before either scanning or extraction uses them.
Verified with the upstream writer and a one-line enum correction,
real shifted and SPEC-numbered archives, and synthetic regression
cases for wrongly sized NACPs and valid titles beginning with META.
Ported from kencalx/NX18 (3acdfeacb, 0d343ee5d, 9fffe70e0).
PR #2879
Co-authored-by: Oliver Ames <[email protected]>
Co-authored-by: kenCalx <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Pass explicit subprocess arguments, restore the missing GL fixture and audio switch entry, and validate Metal resources in the graphics tests. Suppress the Vulkan clear-value lifetime false positive at its test call site and shrink the C lint baseline.
Control the service reply in the scheduler fixture so it still tests the handoff when the runner delays the starter. Verified with both lint ratchets, the tool tests, the three Metal test targets, and the scheduler test under ASan, UBSan, and TSan.
If the packed update has no NACP, prefer its registered version before
falling back to the base game's NACP. The base control data can describe
an older release. The selected NUP's numeric label is the final fallback.
Register Ocarina of Time v131072 as 1.1.1 for its verified main build ID.
The local NUP has no control data or numeric label, so the app version
and the host's version service both use this registered value.
Checked 186 targeted tests, the generated symptom index, and both Mac
bundle version fields with the local NUP. OoT reached its title menu on
an M6 running macOS 27.2.1 and called GetDisplayVersion. The Pyright
findings match clean main.
Follow-up to PR #2822.
Co-authored-by: UserDerezzed <[email protected]>
A NUP can carry a display version without carrying control data. Use
its selected package's numeric label in the survey, the derived profile,
and the app after the applicable control data and registered version.
Read the base NACP for the app even when only the update is extracted.
Keep Ocarina of Time's registered runtime row as it is.
Checked the real Mario Kart World 1.8.0 NUP and both version fields in
signed Mac app fixtures. Focused packing, unsigned IPA, and docs tests
passed. Python lint matches the findings on main.
Combines PR #2822 and PR #3070 and addresses issue #2902.
Co-authored-by: UserDerezzed <[email protected]>
Co-authored-by: Eliran Zach <[email protected]>
Co-authored-by: Saqib Razaq <[email protected]>
An update-only build can omit the base extraction folder, leaving the
launcher without an icon even when the NUP has one on the base record.
Use the base icon when the selected update supplies none, with the same
localized icon selection the packer already uses. Keep NACP selection
independent of icon selection.
Reproduced the missing icon on main and passed 56 targeted NUP, icon and
documentation tests with the fix. The PR author repacked the Ocarina of
Time v131072 Mac app on an older main with this fix and verified its
AppIcon.icns and signature. The local Pyright findings match clean main.
PR #2823
Co-authored-by: UserDerezzed <[email protected]>
Read BIG4, EASF, chunkzip and NXSHADER through the normal shader-split worker and error paths. Discover digest-verified keys in each version's own main module and share CommonCrypto AES-CBC/ECB with existing readers, without adding a Python crypto dependency or unneeded key-source settings.
Synthetic archive, AES, version/DLC, image IO and package checks pass. The combined FIFA integration extracts 386 expected shaders and builds all Mac and iOS libraries.
Co-authored-by: ZZG <[email protected]>
Fresh captures start without a packaged shader library. Compile each
missing GLSL stage with the same translator and Metal compiler used
for packing, and load its reflection and function for normal linking
and rendering. Reuse compiled stages within the capture run and stop
compiler children with the host.
Remove the uniform fallback from PR #1864. nsklaus identified the
MojoShader viewport-flip failure that blocked Timespinner's capture.
On Apple M6 with macOS 27.2.1, fresh captures matched all 14
Timespinner stages and all 66 DOOM 3 stages byte for byte. The full
DOOM 3 regression, Metal readback, and 161 Python tests passed.
Co-authored-by: nsklaus <[email protected]>
A guard on the result of a wrapping W-register subtraction can need
a new symbolic root. Keep the width of the expression so a join and
widening cannot reintroduce upper bits that the instruction cleared.
The existing solver tracks Timespinner's copy of its jump table base.
Fingerprint jump_solver.py in the packer and regression harness so
cached rewrites track changes to the solver. The Timespinner 1.0.0
rewrite proved four targets at each of the six dispatches. DOOM 3 and
Hades rewrote byte-for-byte identically to the baseline.
Co-authored-by: nsklaus <[email protected]>
Resolve named Vulkan functions after guest lookup, extract the embedded
RenderDragon SPIR-V, and replay the required commands on Metal. Preserve
transfer usage, regions and layers in blits and resolves. Use a material
shader variant for the scalar a_indices input only when its location is
bound as R16_UINT, so high-bit values survive the conversion to int.
Package and register update 1.26.62. Check unsigned high-bit inputs,
partial resolve, scaled blit, compute dispatch and query-result copies
under Metal validation. The Mac playtest reached a local world before
the actor fix. Hades passed its runtime smoke route and Sunshine's
Vulkan shaders matched main. iOS and other graphics modes are untested.
The named loader and materials work draws on PR #1652.
Co-authored-by: Aoba_d1snet <[email protected]>
UnMetal 1.2.0 uses EGL and OpenGL 1.x client arrays, matrices and
texture state. Use a built-in Metal program in contexts that support
fixed function when no guest program is bound. Detect fixed-function
games when packing and add the UnMetal profile.
Reject GL_TEXTURE_ENV_COLOR in scalar glTexEnvf and glTexEnvi before
reading any vector data. Keep RGBA handling in the vector entry points.
On the M4 Pro, a fresh game with subtitles off reached the first cell
after the full intro and again via the in-game skip. Document why
UnMetal presents black while out of focus during an unattended run.
Well Dweller passed its full regression route with all 93 shaders
unchanged. The focused OpenGL and Python checks passed.
Front-ends: new: UnMetal 1.2.0 is supported by the existing NSP build and launch flow.
Co-authored-by: Oleh Khomei <[email protected]>
Recognize the four-slot Unreal v8 footer and its one-byte entry method.
Normalize stored and Zlib v1 shader records to decoded v2 archives.
Route shared archives independently of inline shaders and invalidate old
archive-preparation results so reused extractions pick up the new reader.
The full Minecraft Dungeons splits yielded 7,853 shaders for v0 and
14,903 for v1769472 with DLC. All 51 pak indexes parsed to their end.
Ordinary v8, serialized v9 and frozen v9 controls passed. OCTOPATH
TRAVELER II matched its registered v11 tables. Bloodstained still needs
a full split.
Combines PR #2652 and PR #1270.
Co-authored-by: BoL <[email protected]>
Co-authored-by: Matai <[email protected]>
Slay the Spire 1.0 keeps glShaderSource in UTF-16LE. Count that encoding
under the existing EGL rule. Use the same RomFS reader for packing and
translation, and require a standalone shader of each stage in the same
directory before .vs and .fs files can suppress runtime capture.
Verified v0 on an Apple M6. Main classified it as NVN. The new packer
translated 14 RomFS files into 11 shaders without capture. Mega Man
Legacy Collection kept all 10 translations and identical MSL.
Co-authored-by: Saveli Victor <[email protected]>
Civilization VII's survey on exFAT passed the AppleDouble sidecar to the dynamic symbol reader, which asserted no MOD0. Use the same ._ prefix filter as the NSP package scan and retain the file check for directories ending in .nro.
Checked with a synthetic survey that reproduces the assertion on main, resolves an import from the real NRO with both filters, and still rejects a malformed ordinary NRO. The 100 related packaging tests and the Python lint ratchet passed. No games were run.
Co-authored-by: hi <[email protected]>
Read Polish and Thai from NACP bits 16 and 17 and expose them in the
packer and launcher. The settings enum uses ordinals 18 and 19.
Let reviewed Ounce SDKs with both language-query exports supply their
own list and count. Service-backed and unverified SDKs keep the host's
18-code fallback. The loader selects the SDK by its revision stamp.
Checked native control data from Wonder and Breath of the Wild. Called
both exports from rewritten SDKs 20.5.25 and 22.2.10 on the Mac. The
Catherine full regression passed and a direct loader probe of the final
code confirmed its SDK still takes the fallback. Focused host and Python
tests and lint passed.
Front-ends: the Game language row of dm/launcher.json may list pl and th.
Fixes#1231
Co-authored-by: Atomsk <[email protected]>
Layton and Kirby Star Allies use movie SDKs that assign different keys
to the same native-buffer colour index. Recognize the verified direct
mapping in the exported converter and report colour metadata for the
matrix and range of the planes delivered to that SDK.
On an Apple M6 Mac, five frames from Layton's opening averaged
0.22–0.82 levels of absolute RGB error per channel against FFmpeg,
down from 10.07–10.74 with the GL fix alone. Kirby played both movies
through to the world map. AVC and VPx tests passed under sanitizers.
Co-authored-by: Sergio Santos <[email protected]>
Games such as Ocarina of Time got an empty SDK input-device list,
so their microphone streams never opened. Feed the supported polling
streams with one AUHAL capture, convert the input to 48 kHz mono PCM16,
and keep its callback free of locks and allocation. Use power-of-two
queue storage so cursor rollover preserves the requested capacity and
the samples in it. Rebuild capture on device changes while retaining
the streams that are still started.
Offer microphone settings only for the supported polling import. Ask
for macOS consent in the opted-in app before spawning the host, even
when the settings window is hidden. Legacy AudioIn and iOS capture
remain open in #2796.
Checked queue rollover and simulated device recovery and consent,
the Mac host and iOS source compile, and a quick Well Dweller
regression. Fresh microphone gameplay and physical device switching
still need hardware validation.
Front-ends: DM_MIC=1 opts in on Mac. Apps spawning the host directly
need NSMicrophoneUsageDescription and must request macOS consent.
DM_MIC_DEVICE selects the input UID and DM_MIC_GAIN sets its gain.
Co-authored-by: Felipe Parra <[email protected]>
Build ID discovery tries the newest update before probing the base game
alone. An unreadable unused base, reported with Pokemon Violet Rev 4,
could stop the survey even after the update's code extracted successfully.
Keep the PR's conditional recovery: catch BuildError only on the optional
base-only probe after a successful update read, report it and discard its
partial output. Failed updates and required base-only reads still fail.
Document the lookup rule separately from sparse-base detection, and keep
the underlying reported hash failure marked undiagnosed.
Validation: 95 selected alias, dump, NUP, extraction-cache and docs tests
pass. Six additional subprocess-boundary checks passed during review;
the new regression test fails on the baseline. The Python lint ratchet
has identical findings on unchanged main in this environment. No gameplay
regression runs: low-risk discovery-only change, off runtime paths.
Co-authored-by: Matías Serrano <[email protected]>
Keep complete lines at both boundaries when sampling oversized logs before
redaction. Arbitrary byte cuts could detach a synthetic key value from its
name or leave a short fragment that the existing matcher could not recognize;
the tail case survives in the finished report ZIP on the old reader.
Retain the PR's implementation and tests unchanged, refresh the finding's
documentation context, and regenerate the symptom index against current main.
Reads stay bounded and the omitted-byte count includes discarded fragments.
No real-key exposure is claimed.
Validation: 23 collector/documentation tests pass; both new boundary subcases
fail with the original reader. Pinned Ruff and Pyright pass on changed Python
files; the full lint ratchet reports 305 baseline findings and zero new ones.
The final diff passes whitespace checks. No game, device, or gameplay runs:
this low-risk change affects only the standalone diagnostic collector.
Co-authored-by: Louis <[email protected]>
The offline IPA archive already holds pulling bases and compute pipelines,
but omitted the prewarm list's vertex-layout bases and native mesh pipelines.
Use the existing Mac host descriptor exporter, then metal-tt for each target
GPU, to supply those pipelines through the existing bundle format.
Keep prewarm validation independent of the pair archive's fast path. Track
library images, directory libraries and reflection in the host cache; resolve
child paths before changing directory and scope launch failures to prewarm.
Do not publish complete indexes for periods where metal-tt omitted pipelines.
Discover the current per-game host target, and share publication that preserves
unchanged file identities with the Mac packer. Retain the original phone seed
rows and record the current validation and coverage limits in the game note.
Validation: 190 tool, Mac packaging, docs and chain tests passed; Python lint
has no new findings; shell syntax, diff and current manifest parser checks pass.
A real M4 Pro export supplied 6,646 bases and 164 mesh pipelines with no failures;
its 21 files total 788 MiB and took 381.6 s to generate. Cached export took
0.3 s without changing published identities. A 280.5 s walking test crossed
from Hyrule Field into Castle Town and exited cleanly with no red lines or GPU
errors. Prepare compiled no bases and used all 164 mesh pipelines from archives;
play subsequently compiled 41 further bases outside the recorded seed coverage.
The focused NieR regression has identical shaders/interfaces, successful boots
and no new red lines. Its raw screenshot flag remains: the same host and shader
artifacts reached different flight animation/tutorial phases. The environment
switch metadata check fails identically on the pinned baseline. Matched phone
starts with and without these files, rebased phone traversal and broader seed
coverage remain open; no comparative startup or fps benefit is claimed.
Co-authored-by: Stan Bono <[email protected]>
Fate's remaining three shader failures came from direct Metal resource slots:
one fragment had a legal buffer 16 rejected by the translator, and two others
actually read 17 samplers, beyond Metal's 16 direct sampler arguments. Move
all GL stage resources into one Tier 2 argument buffer with independent IDs.
Keep the game's uniform names in shader table ABI 2 while reflecting the
actual generated Metal resource IDs. Encode each draw's buffers, textures
and samplers, declare indirect reads, retain samplers through completion,
and snapshot changed default uniforms in transient memory. Older direct-slot
tables report that their libraries must be rebuilt.
Add translation cases for 16, 17 and 32 live samplers and a GPU readback test
through generated GLSL, its table/library and the real GL compile/link/draw
path. Cover both stages, vertex attribute 15, changed uniforms and sampler
units, and named-block ranges across three draws in one command buffer.
Fix the regression watchdog to recognize GL frame progress while display-link
present messages stop during timed fallback. A controlled-clock test reproduces
the false hang and verifies the fix. Document both root causes and the rebuild.
This follows the Fate diagnosis and shader path from PR #2819.
Checked: 93 focused Python/docs tests; gl-imports and gl-arguments under Metal
validation; Ruff; clang-tidy at baseline; Mac builds; iPhone host syntax and
all 78 Fate shaders compiled and linked for iPhone. Full Python lint retains
only the unrelated NumPy/Unicorn environment differences.
Full Mac regressions against 5d54b885 on M4 Pro, macOS 27.2.1, Xcode 27.2:
Fate 75/78 -> 78/78 shaders, 59.9 -> 59.8 fps; DOOM 3 66/66 shaders,
59.9 -> 60.0 fps. Both routes reach their checkpoints, matching screenshots
and no new red-log messages. iPhone gameplay and the individual in-game paths
of Fate's three formerly rejected shaders remain untested.
Front-ends: rebuild GL shader libraries and the host together for shader-table ABI 2.
Co-authored-by: Beeven <[email protected]>
Fix the five semantic issues found while reviewing the PR #2819 rework.
Program validation now records the executable and sampler checks, its result
and its log. EGL rejects a conflicting bind with EGL_BAD_ACCESS, leaves the
owner's binding intact, and releases ownership when its thread exits.
Shader rewrites keep a per-translation map and choose unused identifiers,
preserving genuine game names and matching varyings across stages. Texture
clears convert the source value to the destination format without unpack
state and encode earlier deferred framebuffer clears before their writes.
These are general GL fixes, with no game or build gates and no stopgaps.
Extend regress.py to compare GL translations, MSL and table fields, including
runtime captures and compiler fingerprints. Add reusable smoke routes for
Well Dweller and DOOM 3; DOOM's screenshots wait for standing gameplay because
the moving intro cutscene is unsuitable for timed image comparisons.
Checked: 93 focused Python/docs tests; t_gl_imports in both stub modes; Mac
and iPhone source compilation without warnings; Ruff; clang-tidy at baseline.
Full Python lint has identical unrelated environment findings on the baseline.
Full regressions against ba9ce212 on M4 Pro, macOS 27.2.1: Fate and Well
Dweller PASS at 59.9 fps; DOOM 3 PASS at 59.8 -> 59.7 fps, with no new shader
failures or red messages. Fate's three sampler-slot failures remain in both.
iPhone gameplay, combat and later DOOM levels were not tested.
Co-authored-by: Beeven <[email protected]>
Keep unchanged Mac app inputs, prewarm archives and metadata stable, reuse
the format survey and table analyses, avoid blob reads during a no-op cache
prune, and read shader-library sources in parallel. Preserve signed data
bundles across harmless change-time drift and interrupted packs.
Make reader creation and registration atomic with cache recovery. Reserve
each reader through execute and fetchall, and wait for active readers before
closing or replacing their database. Release the reservation before falling
back to the primary connection. This fixes the reproduced recovery KeyError
and prevents active connections from being retired or published for an old
database generation.
Include inode and change time in the offline archive fast key so changed
shader bytes with a preserved size and modification time reach the existing
content-based archive check. Version the fast key and cover both defects
with regression tests; independent readers still execute in parallel.
Checked: 220 of 221 Python test modules passed after providing an isolated
.NET 10 runtime for the extraction fixtures. The environment-switch table
check fails identically on the unchanged baseline. Graphics tests, pinned
Ruff/Pyright, documentation tests, tool fingerprints and diff checks passed.
16,000 concurrent reads across 100 cache recoveries passed. Full regress.py
check passed on Cuphead (3,131 NVN shaders and interfaces; no smoke route)
and Hades (74 Vulkan shaders and the full smoke route), against ba9ce212.
The PR author measured Ocarina of Time on an M3 Max at 105 to 10 seconds for
unchanged builds and 17:24 to 11:08 after an unchanged-MSL chain rebuild.
Those build timings were not repeated here. iOS/device, exFAT and OpenGL
gameplay checks were not run. No translation-chain inputs change.
Co-authored-by: UserDerezzed <[email protected]>
DOOM 3 (010029D00E740000, 1.0.5, id Tech 4 with the BFG Edition renderer, OpenGL through EGL) plays on the Mac: the title, the campaign menus, a new game through the intro movie into Mars City Hangar, lit and with stencil shadows, at 60 fps (about 800 draws a frame, 0.9 GB footprint). Everything is general; the profile has no rewriter cut, build-keyed row or switch.
GL layer (hle_gl.m): the extensions a renderer checks for (it stopped with "<name> not available"), including GL_ATI_separate_stencil and GL_ARB_fragment_program, whose assembly program entries only report a call; a name ending in ARB gets the core function of the name without it; named uniform blocks (gl_shaders.py's n: rows, glGetUniformBlockIndex, glUniformBlockBinding, the indexed bindings of glBindBufferRange / Base, a short range or buffer padded with zeros); two-sided stencil (each face's state, the separate calls and ATI's); programs with a vertex shader alone (its shadow volumes); glCopyTexImage2D / glCopyTexSubImage2D as an ordered blit (each frame's _currentRender); glCompressedTexSubImage2D on the compressed sub-image path; GL_UNPACK_SWAP_BYTES; glPolygonMode GL_LINE with GL_POLYGON_OFFSET_LINE; glIsSync, glShadeModel, glClientActiveTexture and a few queries.
Shaders: gl_shaders.py takes DOOM 3's GLSL 1.50 (built-ins redeclared as varyings, the gl_FrontColor / gl_Color pair as one varying, `sampler` as a name); profile_guess.py and gl_shaders.py count a '#version' string in main only when it defines main, so the renderer's GLSL prefix no longer passes for a shader and the game gets a run-time capture. The renderer converts each render program to GLSL on first use, so the capture run has the game convert all of them: idtech4_programs.py finds its FindVertexShader / FindFragmentShader and manager from its code (the loader by its GLSL cache path, the per-stage loaders by the stage they pass, the material parser's load of the manager) and lists the programs of its .resources containers; the host (DM_GL_RENDERPROGS) calls them at the first swap after the game's own compiles. 82 programs, 66 distinct texts, captured 1 s into a headless boot; a run that played into the first level had made 62 of them, byte for byte the same.
Checked: t_gl_imports (DM_GL_STUBS=0 and 1, Metal validation; new test_doom3: ARB names, extensions, named blocks, two-sided stencil, frame copies, compressed and byte-swapped images, vertex-only programs, sync, wireframe), test_gl_shaders.py, test_idtech4_programs.py, test_profile_guess.py, the NSP-script, docs and architecture tests, lint_python (at the baseline); the NSP script end to end for the Mac from an empty capture; about 8 minutes of play in Mars City Hangar on an M6. Balatro (GL, the other affected path) against origin/main's host, 75 s along its note's taps: the same 4,200 frames, draws, passes and pipelines, no red line on either side, the screens alike but for the animated background; its 35 shaders get identical tables and fix-ups from both gl_shaders.py versions. regress.py does not cover GL games. Not run: Digimon and Well Dweller (no builds here), the iPhone, combat and later levels.
Issue #1180 reported DOOM 3 first; its findings were checked against the game and implemented anew (no code from its patch).
A Switch 2 Edition of a Switch 1 game is one application of two programs. pack_nup.scan
took one base package and derived the application and its DLC from that program's ID, so
such a NUP stopped at "2 base packages" or "is not a base title ID" (both Switch 2 Edition
NUPs at hand, Super Mario Bros. Wonder's and Xenoblade Chronicles X's, were refused).
The game, not the system, layers the data: Wonder's Switch 2 program mounts its own RomFS
as content:, and when that lacks System/AddressTable it mounts program 0's RomFS with
nn::fs::MountRom(name, 0, ...) as conorig: and the upgrade add-on as aocup:, after checking
aocup:/System/AocUpgradeVersion.txt. The host ignored the program index.
- scan groups base and update packages by NPDM program ID (low 12 bits: the program index),
checks they belong to one application (NACP SaveDataOwnerId), indexes DLC from the NACP's
AddOnContentBaseId, and packs one program (--program N, default the highest). Each other
program's RomFS goes beside its own as romfs_programs/<index>.img, at its newest update
no newer than the packed version. The add-on stays DLC only.
- Host: MountRom(name, index, ...) mounts romfs_programs/<index>.img beside DM_ROMFS
(DM_ROMFS_PROGRAMS), else this program's own; err::ShowUnacceptableAddOnContentFor-
UpgradeVersionError logs a red line instead of crashing in the SDK's applet call.
- The build script (survey, disk estimate, format check), the Mac app (GameDataPrograms
bundle), the IPA, Xcode staging and the iOS app carry the folder beside the RomFS.
Replaces the PR's merge of the add-on into the program's RomFS, which skipped the game's
version check and its own layering. Mac: Wonder's Switch 2 program 1.2.1 reaches the menus
from the S790 NUP, and the opening from the PR's two-program layout.
Front-ends: new: a NUP of several programs packs romfs_programs/<index>.img beside RomFS.img; a front end that places the RomFS itself carries that folder beside it (or sets DM_ROMFS_PROGRAMS)
Co-authored-by: Josh Haines <[email protected]>
A game packed under another title ID than its profile's (Persona 5 Royal's
Asian title 01004B10157F2000, the same main build) ships CPK/ALL_ASIA.CPK
where the registered profile names CPK/ALL_USEU.CPK. derive_profile copied
the marker, so the app step stopped after the shaders were built.
derive_profile, for a profile derived under another title ID, keeps a
marker the version's RomFS holds and otherwise takes its largest file, as
a provisional profile does; the choice is in the derived key. A profile
derived under its own title, a shader-only one and an empty RomFS keep the
marker, so the app step still stops on a damaged or mixed-up RomFS.
extract reused an image only when it held the registered profile's marker,
read before any derivation, so this edition was extracted again on every
build. It now reuses an image by its extraction key and a valid index.
The finding is in docs/reference/packing.md; the game note links it.
Co-authored-by: magicwang1111 <[email protected]>
Ocarina of Time's run/pso_archive held 13.9 GB in 99 files: about
33,700 indexed pipelines against a prewarm of under 10,000, and 8.4 GB
of unindexed files from its first week. A pipeline's archive key covers
its libraries' bytes, so a chain change, a profile edit or an OS update
leaves pipelines no lookup reaches, and only compaction of small files
ever dropped any. What the build retired was deleted in place, so what
was unused could not be told apart from what was in use without a tool.
Everything unused now goes to <id>_build/obsolete/. The NSP script moves
old chains' libraries, keys and compile caches into
obsolete/<date time> build/ at their places in the build folder (one
rename each); a successful build empties what earlier builds and runs
put there, keeps its own until the next one, and logs what is left.
The host counts the pipelines taken from each archive file, and once a
start has asked for the prewarm lists' pipelines and every shader
pair's pulling base (the prebuild's walk after a chain change), moves
the files none was taken from, with their indexes, to
$DM_OBSOLETE/<date time> <archive folder>/ (the Mac run command sets it;
the app, without it, removes them). Both walks are required: a run file
can hold pulling bases beside other bases. It also logs how much of the
kept files is used.
Compaction of mostly unused files was measured and not built: Pokemon
Legends: Arceus's archive from chain 66eab9c9a6b4 under 19d183a2b462
kept 9,172 of 9,339 pipelines in use (every Metal compile byte-identical),
none of its files under a quarter used, while compaction recompiles each
kept pipeline (about 85 ms each on Ocarina).
Checked: t_pso_archive and test_pso_archive.py (a new two-process sweep
test), the other pipeline suites, NSP and cache tests, clang-tidy and
Python lint ratchets; the prebuild tool on a copy of OKAMI HD's run
folder moved its old-chain archive file to obsolete/ and rebuilt its 41
bases, and the next run took all 41 and moved nothing. No windowed
gameplay start, no regress.py run.
Ocarina of Time's shader/cache/cas.db had grown to 52 GB, of which its
current Mac library used 10.3 GB: about seven generations of Mac Metal
compiles (31.4 GB), one of iOS (5.3 GB), three sets of 42,848 per-shader
entries, the variants nothing reads since c8bfa161 (2.1 GB) and stopped
builds' staging (1.0 GB). Every chain wrote into the one file, and its
Metal compiles are keyed by the MSL, not the chain, so no prune could
tell old from current, and a development build's leftovers could not be
removed without a tool.
Each chain version now has its own file, shader/cache/cas-<chain>.db
(shader_cache.for_chain). A build writes only its own file; another
chain's per-shader entries never hit, and a Metal compile it reads from
an older file is copied into its own first. After a successful or reused
build the NSP script removes the other files whole, and cas.db, the one
file from before (shader_cache.drop_generations); a target the build
compiled nothing for first takes the newest other file's compiles of it.
regress.py reads the player's generations through --readonly <folder>.
dmsh_build.py changes, so DMSH_CHAIN moves to 19d183a2b462.
Checked: shader cache, NSP, Mac app, regress, toolchain-cache and docs
tests; two dmsh_build.py runs on a copy of OKAMI HD's cache (the first
reused 60 Metal compiles from the old cas.db; after dropping it the
second hit all 126 shaders and compiled nothing). Ocarina's own folder
is not converted yet; its next build does it.
The Mac prewarm cache read inputs.tsv only as a normal filesystem path.
After a full shader build packs the library into an image, the stamp was
missing from the key. Adding Civilization VII's second dual-source shader
therefore recompiled the library but reused pipelines with old functions.
Read the stamp through shader_lib.view for both folders and packed images.
The regression test reproduces stale reuse for an image before the fix,
then checks invalidation and unchanged-input reuse in both storage forms.
Checked: 39 packing-script/chain tests (one unrelated skip), documentation
checks and Python lint with no new findings. Civilization VII's app rebuilt
77 render and 20 compute prewarm pipelines with zero failures or warnings.
Regression risk is low: only an offline cache key changes, with no runtime,
host or chain change; no additional game run.
Co-authored-by: seedds <[email protected]>
Every --allow-damaged build ran the shader split again and restored every shader from
the compile cache, though nothing changed, even with no file damaged: the option alone
gave split_shaders no key (key = None if ALLOW_DAMAGED). A good copy that replaces a
damaged one keeps every path and size, all the RomFS's 'tree' input sees, so that key
would have kept the damaged split; but the shader step takes the package's key as its
input, so it never reused either, and the Vulkan and OpenGL steps were told not to reuse.
Ocarina of Time on an M3 Max: 56-77 s of split and about 9.5 minutes of shaders (42,848)
on every build.
A damaged copy is now keyed as the same extraction: its RomFS by its files' times
('stat'; inside RomFS.img, the image's time) and by check_formats' list of damaged files
(RomFS.img.formats). The Vulkan and OpenGL steps key it by times too (provisional). The
same extraction reuses the split and the shaders (Ocarina: about 14 s in all); a repaired
copy writes a new image and splits again: an NSP through extraction_key (package times),
a NUP through its TOC digest or a byte check against it, a dump through source_digest
(each file's identity). An undamaged build's key is unchanged.
Checked: test_nsp_incremental (SplitShaders.test_damaged_reuses_only_the_same_extraction),
test_xcode_workflow, test_docs; a damaged .zs in a dump repaired at the same size changes
the key through a real RomFS.img (the 'tree' form did not). Not run: regress.py (only
reuse changes), a Vulkan or OpenGL game with damaged files.
Co-authored-by: UserDerezzed <[email protected]>
Discover Monolith's native frame interval from reviewed engine function
cohorts and coherent relocated globals. Record it in fixups and use the
existing engine frame-limit writer for the selected 30 or 60 fps target.
Select 60 by default for Xenoblade Chronicles X: Definitive Edition.
Correct the game's orbit camera, whose angular gain assumed 30 updates a
second, with its own clamped elapsed-time ratio. Match the complete camera
and three timing functions across both supplied builds; retain raw input
and saved sensitivity units. Ordinary MATCH_STUBS allocate no frame-step
state page. An incomplete required correction blocks native FPS targets,
including when the engine interval itself is still discovered.
On Apple M6 the opening field improves from frame p50 33.24 to 16.62 ms.
Timed walking reaches the same spot; a half-second camera turn measures
1.367 radians at 30 and 1.361 at 60. The updated unsigned IPA defaults to
60 with a 30/60 launcher choice, and all 82 payload CRCs pass.
Validation: 281 focused Python checks, 38 native frame-limit cases,
160 synthetic AArch64 stub executions, positive discovery on four NSOs,
16 distinct non-Monolith negative builds, actual base and altered-update
fail-closed rewrites, documentation and zero new lint findings. Moderate
regression reach: Xenoblade 2 covers the shared engine/host path and its
quick baseline/candidate comparison passes with unchanged shaders and
no new red diagnostics or interface failures.
Open: iPhone performance, combat, later progression and event cameras.
Other camera easing and shake effects are not globally retimed.