Skip to content

Experimental builder: an opt-in setting that hands stages to nxbuild - #752

Merged
v0lumehi merged 5 commits into
mainfrom
v0lumehi/experimental-builder
Nov 5, 2026
Merged

v0lumehi merged 5 commits into
mainfrom
v0lumehi/experimental-builder

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fix or feature

  • Fix
  • Feature

What and why

Closes #749 (milestone v1.2.0).

nxbuild is a new build tool in Rust. It reproduces stages of the NSP script byte for byte and is much faster there. This PR lets players try it with an opt-in setting. The standard Python build stays the default and the fallback.

Engine, patch 0073 (forwarded as seedds/nxnative#1325). The NSP script stays the driver. With DM_EXPERIMENTAL_BUILDER=1 and NXB_BIN (the nxb binary or its folder) it runs nxb-extract for each version and nxb-split for the shader split. Stage names, JSON events, the work folder and the reuse keys do not change. These cases run the Python step, with a note in the build log:

  • a case it does not hand over: XCI, NSZ, a merged package, --program, --allow-damaged, DLC, run-time captures, NROs, a game decoder, a provisional or derived profile
  • an nxbuild exit code other than 0 (4 is "not supported yet", the contract I asked nxbuild for)
  • an output that fails the checks: the title, ExeFS/main, RomFS.img and the profile's marker for an extraction, the data rows of the profile's shader tables for the split

nxbuild's own [RED] lines stay in its log, so the failure classifier never sees them.

Launcher. Settings, Build tools gets "Use experimental builder", off by default, with one sentence: faster, may not support every game, falls back by itself. Under it, when it is on, the nxb program it uses and a Choose button. The setting is stored with the other build settings in BuildStore. The build gets the two variables, and the log names the binary. Without a usable nxb the log says so and the standard builder runs. Texts in en, de, sv, zh and it.

Shipping. The app carries nxb in Contents/Resources/nxbuild/nxb. frontend/nxbuild.pin names the nxbuild release: v0.1.0 of v0lumehi/nxbuild, asset nxb-v0.1.0-macos-arm64.zip. The SHA-256 is still PLACEHOLDER until the release is published, and a placeholder bundles nothing. build-mac-app.yml and tools/try-local run frontend/tools/nxbuild.py fetch: download, SHA-256 check against the pin before anything is unpacked, nxb signed ad hoc into Resources. nxbuild.py bump <version> pins a release from its SHA256SUMS. Players download nothing at run time. The launcher takes a chosen nxb first, then the app's copy. The script takes a stage binary beside nxb (nxb-extract, nxb-split) when there is one, else the subcommand (nxb extract, nxb split). frontend/README.md, section "Experimental builder", has the details and how to try a local nxbuild.

Not handed over yet: the shader step, the pipeline archive and the Mac app. The shader step writes nxbuild's own _b_cas.txt, and the script's cache pruner would then delete the whole Python shader cache. The archive is not faster than Python's. The Mac app needs the launcher build and the icon from outside. The requests are in nxbuild's docs/integration-requests.md.

The Qt front end gets no switch: nxbuild is built for macOS on Apple silicon only, and on a Mac the SwiftUI launcher is the one to use.

Checked

  • Tests: cd frontend && swift test (748 tests in the app bundle, 0 failures), python3 -m unittest discover -s frontend-qt/tests, python3 -m unittest discover tools/tests, python3 tools/engine.py check. New: ExperimentalBuilderTests (which nxb is taken, the variables, the digest check), BuildStoreTests (off by default, saved, the environment and the log line), GameFolderStoreTests (the command line stays the same with the switch on), test_nsp_experimental_builder.py in the engine (9 tests with stand-in binaries: each fallback, a stage binary or the subcommand, the update's arguments, a taken and a refused split), tools/tests/test_nxbuild_pin.py (the pin, the digest check before unpacking, SHA256SUMS).
  • dm/tools/lint_python.py with the pinned tools: no new finding from this patch. It reports one on main without it (dm/ios/tools/gen_manifest.py, F401). env_switches.py --check fails on main already for DM_TOUCH_HINT, DM_TOUCH_LAYOUT, DM_TOUCH_SIZE and DM_TOUCH_STICK (patch 0070). The new switch has its row.
  • Visual QA: NX_LAUNCHER_CAPTURE_DIR=<dir> swift test --filter testRenderExperimentalBuilderForVisualQA, in en, de, sv, zh and it.
  • Run on a Mac: Super Mario Bros. Wonder 010015100B514000, v0 and v327680, M2 Max, macOS 27.2, --platform mac-app --gpu none, stopped when the Mac shaders stage started.
    • With the switch's variables (nxbuild at main 9e118db, stage binaries nxb-extract and nxb-split): both extractions and the split went through nxbuild. Extract v0 17.1 s, v327680 10.1 s, split 9.1 s. All 74 files of extract/ and shader/pkg/ are byte-identical to the Python build of the same game.
    • Events: the same stage names, counts and summaries as the code path without the variables, plus one say line per stage nxbuild ran. I did not run a second Python-only pass for a line by line compare.
    • Not tested: the app build with a real pinned release (none yet), a real fallback with a real game (only the stand-in tests), a whole build to the app with the switch on, the launcher app itself with the switch on (no fresh app launches on this Mac). The machine had other builds running (load average 20 to 40), so the times are not a benchmark.

Screenshots

Before, Settings, Build tools (release app and checkout):

before-release
before-checkout

After, release app, off, on, and on without an nxb:

after-off
after-on
after-not-found

After, checkout, on:

after-checkout-on

After, on, in de, sv, zh and it:

after-de
after-sv
after-zh
after-it

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository: a change there is a patch in patches/ (a commit in engine/, then tools/engine.py export, and tools/engine.py check passes), with its Upstream-Status
  • A fix to the engine or a game profile also goes to seedds/nxnative as a PR in parallel: this PR's patch says forwarded seedds/nxnative#1325
  • A change to a launcher view has before and after screenshots above
  • No keys, game files or data extracted from a game in the change or the attachments

…749)

nxbuild reproduces the extraction and the shader split byte for byte and
much faster. Settings, Build tools gets "Use experimental builder", off by
default, with the nxb binary to use. When it is on and nxb is found, the
build gets DM_EXPERIMENTAL_BUILDER=1 and NXB_BIN, and the log names the
binary. When nxb is missing the log says so and the standard builder runs.

The engine side is patch 0073: the NSP script stays the driver and runs
nxb-extract and nxb-split where nxbuild supports the case. Any other case,
a failure or an output that fails the checks runs the Python step.

No nxbuild release exists yet. ExperimentalBuilder pins a release URL and
its SHA-256 together once there is one (both nil now), and resolves a
chosen path first, then a downloaded release. frontend/README.md describes
the setting, the fallbacks and the dev workflow.
@v0lumehi v0lumehi added enhancement New feature or request build Building a game fails launcher The NX2Apple launcher app mac Mac patch-queue Changes the patch queue or the upstream pin labels Nov 5, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation windows Windows (the Qt front end) labels Nov 5, 2026
@v0lumehi v0lumehi added this to the v1.1.2 milestone Nov 5, 2026
…749)

The app carries nxb in Contents/Resources/nxbuild, from the release
frontend/nxbuild.pin names (v0.1.0, digest still a placeholder). The app
build downloads the zip, checks its SHA-256 against the pin before it is
unpacked and signs nxb ad hoc (frontend/tools/nxbuild.py fetch). A
placeholder bundles nothing. `nxbuild.py bump <version>` pins a release
from its SHA256SUMS. The runtime download design is gone: the launcher
takes a chosen nxb first, then the app's copy.

Patch 0073: the script takes nxb's subcommand (nxb extract, nxb split)
when no stage binary sits beside nxb, as the releases ship one binary.
@github-actions github-actions Bot added the ci Workflows and repository tooling label Nov 5, 2026
@v0lumehi

v0lumehi commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

The nxbuild release v0.1.0 is published: https://github.com/v0lumehi/nxbuild/releases/tag/v0.1.0. The pin in frontend/nxbuild.pin now holds its SHA-256 (43c1988c9cdb968acc96fb7205dc305d2633ee49be312907502c1c956977c420). I checked frontend/tools/nxbuild.py fetch against the real release: it downloads the zip, checks the digest, unpacks nxb and signs it. The app build now bundles nxb. The release zip also holds nxb-extract and nxb-split beside nxb, which the NSP script uses for the extraction and the split.

@v0lumehi v0lumehi modified the milestones: v1.1.2, v1.1.1 Nov 5, 2026
@v0lumehi
v0lumehi merged commit 681bf66 into main Nov 5, 2026
17 checks passed
@v0lumehi
v0lumehi deleted the v0lumehi/experimental-builder branch November 20, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Building a game fails ci Workflows and repository tooling documentation Improvements or additions to documentation enhancement New feature or request launcher The NX2Apple launcher app mac Mac patch-queue Changes the patch queue or the upstream pin windows Windows (the Qt front end)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Experimental builder (nxbuild)

1 participant