Skip to content

NSP script: --work-dir sets the build folder and the default IPA location - #475

Closed
v0lumehi wants to merge 3 commits into
seedds:mainfrom
v0lumehi:nsp-work-dir
Closed

v0lumehi wants to merge 3 commits into
seedds:mainfrom
v0lumehi:nsp-work-dir

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What and why

A front end that packs games keeps each game's build in a folder it chooses (for example one folder per game on an external drive). The NSP script only had <NSP folder>/<title ID>_build. NX2Apple carries this option as a patch today; this adds it so forks can drop the patch (part of "fewer patches for forks", #388).

--work-dir <folder> (WORK_DIR in the settings block for Spyder) is the build folder, used as given. Without -o, the IPA (or the Mac app of --platform mac-app) defaults to the folder holding the build folder. Without the option nothing changes: the build folder is <title ID>_build in the NSP folder and the IPA is in the NSP folder. The survey and NSZ conversions of a game still go to the NSP folder.

The provisional profile of a game without one (and a derived profile) follows the build folder: without --profile-out it is <build folder>/profile, so --work-dir moves it too. A front end that stages inputs in a fresh folder per build (LNPANDY/NX2Apple#132) would otherwise regenerate it every time, and for a provisional profile split_shaders() keys the RomFS, captures and profile files by size and mtime, so the shader split would rerun for hours. With the default build folder the path is unchanged. Once, when --work-dir names a folder that has no profile and the default place has one, the profile is copied over and the original stays (no re-survey).

Checked

  • Tests: new dm/tools/tests/test_nsp_work_dir.py (6 tests: default, option, setting, -o wins, profile folder, profile migration; it fails without the change); test_nsp_alias, test_nsp_incremental, test_nsp_mac, test_nsp_mac_app, test_nsp_progress, test_nsp_space, test_nsp_nsz, test_nsp_dotnet, test_nsp_chain and test_docs pass.
  • Games run: none; the option only moves paths and the tests stop at the prerequisite check.

Docs

  • docs/development.md (the script's options) and docs/frontends.md ("Building: the NSP script")
  • No game files, keys or data extracted from a game in the change

v0lumehi and others added 3 commits October 28, 2026 16:43
…dir), copied once from the default place

Without --profile-out the profile is <build folder>/profile. A front end that stages each build in a fresh folder no longer regenerates it (and reruns the shader split, which keys on size and mtime). A profile in the default <title ID>_build/profile is copied to a new build folder that has none; the original stays.
seedds added a commit that referenced this pull request Oct 30, 2026
…l profile and the NSZ conversions follow it (PR #475)

--work-dir <folder> (WORK_DIR in Spyder) is the game's build folder, used as given. Without -o the IPA (or the
Mac app) defaults to the folder holding it. The provisional or derived profile goes to <build folder>/profile
unless --profile-out names another place, and the NSZ / XCZ conversions to <build folder>/nsp/. Without the
option every path is as before; the survey stays in the NSP folder.

A front end that stages the NSPs in a fresh folder for every build (LNPANDY/NX2Apple#132) lost the profile with
that folder: it was surveyed again, and its dated heap check line changed its content, which the shader split
and the iOS shaders key on, so both ran again (about 3.5 hours on a 73,000-shader game). Converted NSZ files
were lost the same way and converted again. A profile in the default <title ID>_build/profile is copied once
into a new build folder that has none; the original stays.

Co-authored-by: v0lumehi <[email protected]>
@seedds

seedds commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Thanks — landed on main as f35fe86, with you as co-author.

On top of your change: the NSZ / XCZ conversions now follow --work-dir too (<build folder>/nsp/), so a front end that stages the NSPs in a fresh folder per build no longer converts them again each time; the survey stays in the NSP folder. The script's header comment and docs/development.md say so, and test_nsp_nsz / test_nsp_work_dir check it.

One correction to the reasoning: the shader split keys the profile by its content, not by size and mtime. A re-surveyed profile still changes the key because its # heap check: line is dated, so moving the profile into the build folder is the right fix either way.

Checked with the NSP tests, the lint ratchet, and a real --platform mac --work-dir build of Baba Is You into a new folder (nothing written to the NSP folder; it boots, 1,200 frames, no red lines).

@seedds seedds closed this Oct 30, 2026
MIsaacM added a commit to MIsaacM/nxnative-lab that referenced this pull request Oct 30, 2026
Arcaneology pushed a commit to Arcaneology/NX2Apple that referenced this pull request Oct 31, 2026
seedds/nxnative ef9f9bb lands the cheat engine and the Mac Cheats panel (seedds/nxnative#406), and f35fe86 lands the NSP script's --work-dir (seedds/nxnative#475). Their patches are dropped: 0007-nsp-work-dir, 0028-cheats-engine and 0029-cheats-mac-panel.

Refreshed: 0001-runtime-profile (hle_fpslock.c's Unreal rows, the tests Makefile), 0003-ios-game-data-folder (front_ios.m and main.m beside the TV output), 0008-bc-cpu-decode (upstream now refuses a GPU without BC at start, and tex_bc_cpu on lets such a GPU through), 0009-mac-keymap (beside the cheats code in front_mac.m, the tests Makefile and docs/development.md).

Launcher: the iPhone runs data cheats only, so the Cheats sheet's iOS note says that code cheats run in the Mac app only. The README names the Xcode 27.1 download and the side-by-side setup, which upstream's toolchain test checks. GAMES.md has the three new ports.
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…l profile and the NSZ conversions follow it (PR seedds#475)

--work-dir <folder> (WORK_DIR in Spyder) is the game's build folder, used as given. Without -o the IPA (or the
Mac app) defaults to the folder holding it. The provisional or derived profile goes to <build folder>/profile
unless --profile-out names another place, and the NSZ / XCZ conversions to <build folder>/nsp/. Without the
option every path is as before; the survey stays in the NSP folder.

A front end that stages the NSPs in a fresh folder for every build (LNPANDY/NX2Apple#132) lost the profile with
that folder: it was surveyed again, and its dated heap check line changed its content, which the shader split
and the iOS shaders key on, so both ran again (about 3.5 hours on a 73,000-shader game). Converted NSZ files
were lost the same way and converted again. A profile in the default <title ID>_build/profile is copied once
into a new build folder that has none; the original stays.

Co-authored-by: v0lumehi <[email protected]>
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