Pass a single XCI, NSP, XCZ, NSZ, DXCI or DNSP to recompile and play:
./build/scarletnx "Game.xci"
The driver runs each step as a child process and starts the game with its folder, recompiled/<id>/, as its working
directory. The game is named by its title ID, read from the dump's NCA headers, an NRO by its name (a dump without a
title ID of its own by its stem); recompiled/ is the data folder's, from a build tree too (Folders).
Nothing of the dump is extracted by default. The game's .ini records the dump's path as source= under [Game], and
the recompile reads the ExeFS's modules from the dump itself. When the game runs, the runtime maps the dump read-only
from that path and reads its ExeFS and RomFS out of it on the fly, decrypting what is encrypted, with the keys
where the driver finds them (the data folder recompiled/ is in, else ~/.switch). No copy or cache of those files is
kept anywhere: recompiled/<id>/<id>_data/ holds only the game's control.nacp and its saves. An update embedded in an
NSP is applied over the base as it is read. Moving or deleting the dump breaks the game until it is back, or until
source= names its new place, and the run says so. A game made by an older version has <id>.source in its folder
instead, a link to the dump, which is still read when the .ini names no dump. Playing the dump again records it in
the .ini.
--extract-container (the launcher's Extract dump) extracts the dump instead, straight into the game's
folder, recompiled/<id>/<id>_data/ (exefs/, romfs/, control.nacp), and the game is made from it there: there is no
second copy. <id>.extracting stays in the game's folder while an extraction is unfinished, and a stopped one is redone
on the next run, the game's saves kept. A made game's RomFS that a stopped extraction (<id>.extracting) or copy
(romfs.copying in its data folder) cut, or that is not there, is extracted again from the dump source= names at its
next start, and by -r --extract-container; with no source=, or one that is not there, both stop before the game
runs, saying which file they need, and the game itself refuses to start on such a RomFS. A game made from its dump is extracted on the first run with the option, with
no recompile, and a game run without it again has that extraction taken away, as long as the dump it records is there.
--data DIR and --build-dir DIR may precede the dump. Keys use the usual discovery paths below.
--outdir DIR puts the game's folder in DIR in place of the data folder's recompiled/, as -r takes it. With
--extract-container, --out DIR keeps the dump's extraction at DIR instead, as -x takes it, the game made from a
copy of it; an NRO has no extraction to name.
--tmpfs extracts to tmpfs instead, and implies --extract-container: <temp>/scarletnx/work/<title ID> ($TMPDIR,
else /tmp; the temporary folder on Windows), where the game reads its RomFS from while its ExeFS and saves stay in
recompiled/<id>/<id>_data/. On Linux and FreeBSD, when that folder is not a tmpfs, the driver says which filesystem it is on
and reads the dump in place instead, so a disk is not filled. The game's folder gets <id>.tmpfs while its RomFS is in tmpfs. A run extracts the RomFS again
from the dump the game records when the system emptied tmpfs, and moves it between tmpfs and the game's folder when
--tmpfs is given or left out. A game that records no dump says Can't be extracted to tmpfs: the game's settings name
no dump it was made from. -r --tmpfs on an extraction leaves its RomFS where it is.
-H (--headless) can precede or follow the dump and is passed to the game only.
Omitting it starts the game with a window.
-x means --extract, and -r means --recompile (--recomp, its older name, still works and says so once).
On UNIX, short flags can be combined. Windows accepts separate short flags only.
To prepare a dump without playing, use ./build/scarletnx -r "Game.xci".
This forces recompilation, even if a cached executable exists, and extracts nothing unless --extract-container is
given. scarletnx -r --outdir games -- "Game.xci" recompiles straight from a dump the same way, reading its ExeFS in
place. -rx (-r -x on Windows) prepares it extracted, as -r --extract-container does. -x alone only extracts.
An extracted game's folder, one whose exefs/ holds the game's main (beside its romfs/ and control.nacp when it
has them, as -x or hactool lays one out), plays and prepares as a dump does: ./build/scarletnx "Game/", or
-r "Game/". The game is named by the title ID of its exefs/main.npdm, and shown by its control.nacp's name, else
by that ID, with the icon.jpg beside its exefs/ when it has one (each run copies it into the game's data folder
when it changed, so a cover put there later shows from the next run). Nothing else of it is copied: the .ini records
the folder as source=, and each run reads the ExeFS and
RomFS from it, on whatever disk it is, --extract-container or not (its RomFS can take gigabytes a copy doubles; what
an older version copied into the game's data folder is taken away at the next run). --tmpfs copies it into tmpfs, as
it extracts a dump; -x --out DIR -- "Game/" copies it alone. Moving or deleting the
folder stops the game, the run naming it, until it is back or source= names its new place. --out names a dump's
extraction, and is refused for a folder. Removing a game's files never goes through a folder where a disk or another
folder is mounted (a RomFS bind-mounted into a game's data folder): the run stops naming the mount, to be unmounted
first.
A game made already plays the same way, named by its folder or its program: ./build/scarletnx recompiled/<id> (or
recompiled/<id>/<id>) runs it, recompiled first where it is when a build of another ABI made it, from what its <id>_data/
keeps (the ExeFS or the NRO: no dump, keys or extraction), or from the dump its .ini records when it was
made without extracting it. -r recompiles it without playing. --outdir and --out
name a dump's folders and are refused for it. --game=recompiled/<id> runs it as it is, whichever build made it.
Pass arguments to the game executable after --, for example:
./build/scarletnx "Game.xci" -- some arg
Everything after the -- reaches the game executable as given, one named like a runtime option too (-- --seconds=5
gives the game --seconds=5), so the runtime's own options go before the --.
The argument boundary is retained when launching the deployed game, so game arguments
cannot trigger launcher actions or overwrite runtime settings. This does not add a
homebrew-loader guest argv block.
-f (or --fullscreen, --fullscreen=1) can also precede or follow the dump and is forwarded to the game,
which then starts fullscreen (a timed test run too: the .ini's fullscreen=1 alone leaves one windowed).
--fullscreen=0 starts it windowed. Without either, the game's .ini decides (fullscreen=1 starts fullscreen).
--touch=0|1|2 is forwarded to the game too: its touch screen takes nothing, the fingers, or the fingers and the
mouse's left button (the default). The game's menu sets it too; the game's .ini keeps its own touch.
--controls=0|1|2 likewise hides or shows the on-screen controls, or shows them on a touch
screen while no gamepad is connected (2, the default); the game's .ini keeps controls. Any other --key=value of the game's
.ini is forwarded as well, for that run (scarletnx --settings lists them all), and so are the timed-run ones
(--seconds=, --shot=...); any other key stops the run with unknown option. A key is given with a - for each
_ (--state-slots=5, --aot-threads=4); the key as the .ini writes it (--state_slots=5), the older spelling, is
still read and said once a run, and goes on to the game and the recompile with -. A name with some _ left
(--aot-threads_most=2) is no setting.
The game's own executable also takes -v, the same as --log=2.
The host's native back end makes the code. --backend=llvm, which older scripts give, is said and changes nothing,
and any other --backend stops with an error (Deprecations).
Use the separate commands for other compiler options.
DXCI and DNSP with decrypted content need no keys. Containers are identified by their headers, including renamed files. A matching bundled update is applied automatically. DLC-only and update-only dumps cannot be used as a base game.
.\build\scarletnx.exe "C:\Games\Game.dxci"
.\build\scarletnx.exe --extract "C:\Games\Game.dnsp" --update "C:\Games\Update.dnsp"
XCZ and NSZ are an XCI and an NSP that nsz compressed: each of their NCZ files is
read as the NCA it holds, decompressed as it is read and nothing written to disk, everywhere an NCA is (extraction,
recompile, reading in place, an update or DLC dump). An NCZ in blocks (nsz -B, nsz's default for an XCZ) reads any
part at once. One compressed as one stream (nsz -S, its default for an NSZ) is decoded from its start as far as a
read reaches, and again from its start for a read behind where it got to that the 32 MB of it last read do not hold:
an extraction says after it how many times that happened, and a game that reads one in place says each in its log
(fs: a read at ... decoded again from its start), where a pause it makes shows. Extract dump, or an NSZ compressed in
blocks, plays without that. An NCZ whose header cannot be read stops the dump's opening, naming the file in it, where
and why.
--cpu-extensions=1 enables LSE atomics, RCpc loads and the PAuth branch, return and signing instructions with the emulated system's
instruction and data authentication controls disabled. Signing and authentication leave the pointers unchanged.
Pointer stripping uses 39-bit virtual addresses with top-byte ignore disabled.
It provides no pointer authentication protection, and does not implement a complete CPU or graphics profile for a
newer console. Instructions outside the implemented set still stop with an unsupported-instruction error.
The experimental graphics supervisor path currently supports startup requests only; its native GPU memory,
worker and display layer operations are incomplete, so games that require them may still stop during graphics setup.
Use the same value when recompiling and running. Changing it requires recompilation of existing ahead-of-time code. The default is 0, which keeps the Cortex-A57 instruction set. For example:
./build/scarletnx -r work/Game Game --cpu-extensions=1
./build/scarletnx --game=/path/to/recompiled/Game --cpu-extensions=1
Made from docs/user/usage.md at 69237645142c. GPL-3.0-or-later.