WIP: feat(builder): accept .nx archives (NXFormat) as the game files #685
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!685
Loading…
Reference in a new issue
No description provided.
Delete branch "nussico/Longshot:builder/nx-format"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: feat · Risk: low · Tested on: Windows 11, RTX 2070 · Needs: Linux, any GPU
Why
Players who keep their game as a
.nxfile (NXFormat, github.com/fab918/nxformat, made withnxconvert pack-nup) have to convert it back to a.nupor to folders before Longshot can build. With this PR the builder takes the.nxdirectly.What changed
make_game.pynow reads a.nxarchive wherever it reads a.nup: it tells the two apart by the file's first bytes and runs a new reader for the.nx. The reader reusesnup.py's extraction, so path checks, progress and the damaged-.zslist behave the same, and every file is checked against its SHA-256 in the archive.nx2/nxar.py(classNxand a CLI likenup.py's) reads NX 0.2 and 0.3 archives holding exefs/romfs trees. A.nxholding NCA files (nxconvert pack) is refused with a message saying how to convert it.nx2/test_nxar.pybuilds archives from the spec, game-free.nx2/nup.py: the step after extraction (plain NSOs, ZBIC) moved intoplain_modules(), whichnxar.pycalls too. The.nuppath is unchanged.package_script()innx2/make_game.pypicksnx2/nxar.pyornx2/nup.pyby the NXAR magic, incheck()and inmain()'s extraction;--nupand--gamehelp mention.nx. Test:tests/test_make_game_package_script.py..gitignoreignores*.nxandscripts/release.py'sNOT_A_RELEASE_FILErefuses.nx(a.nxis a whole dump); CONTRIBUTING lists it with the game files.website/src/content/docs/requirements.mdx(its copy) anddocs/development.md.The launcher's side (finding, browsing and dropping
.nxfiles) is a separate PR on LongshotLauncher, and needs a Longshot release with this change.Measurements
Nothing to measure in the game: this changes only how the builder reads the game file; the build it makes and the game are unchanged (see Testing for the extraction check and its speed).
Flags and settings
None
Testing
Tested: On Windows 11 build 26300 (llvm-mingw 20260616), with my own copy, the same code in Hookshot's tree (this PR is that change with Longshot's names). The game files never left my PC.
.nxand the.nupof the same game hold the same 186,592 files by path, size and SHA-256, with byte-identical exefs and build ide0f3ccfa..nxdecoded and SHA-256-checked: 26.27 GB in 158 s from disk (166 MB/s).make_game.py --check --nup <file.nx>: "This is the version ... supports (build e0f3ccfa).".nxextracted all 186,592 files, mademaina plain NSO and translated 100% of the code. The game it built starts and plays (NVIDIA GeForce RTX 2070, driver 32.0.16.2101).nx2/test_nxar.pyandtests/test_make_game_package_script.pypass.python -I -B tests/run_all.py: 504 passed, 19 failed, 72 skipped; the same 19 fail onmain@53f96d7on this PC: test_appimage_player_build, test_cpm_discovery, test_cpp_preflight, test_crash_dialog, test_cv_signal_race, test_env_on, test_fpx_sticky, test_lift_cleanup_error, test_linux_preflight, test_make_game_cache, test_make_game_prepare, test_missing_nup, test_oot_state_tap, test_readback_late, test_spawn_emit, test_tested_configurations, test_vk_pgo, test_vram_budget_row, test_walk_key.Not tested: A build from this Longshot branch in the game (only Hookshot's tree with the same change); Linux (I have no Linux PC).
Must be tested:
python -I nx2/make_game.py --check --nup <your .nx>and then a build with--nup <your .nx>(a.nxmade from your.nupwithnxconvert pack-nup), expecting the check to report build e0f3ccfa and the game to start (by hand: a tester with a.nx, since the farm's copies are.nup).Risks
What could break: Only a file starting with
NXARgoes to the new reader; every.nupstill goes tonup.py, whose extraction is unchanged except that its last step moved into a function.Turning it off: revert the commit.
Compatibility: Nothing changes for a player who builds from a
.nupor folders: no saves, options, caches or vk ABI touched.Issues
Fixes #411
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
tests/that reads changed source updated in this PR, not weakened.012546faaec9d3ac620fRebased onto
main@7bacf846: no conflicts. No tests were run here; the test boxes stay yours.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.