XSEmu docs

The reference for XSEmu.exe and the launcher, from the repository’s README. Run XSEmu --help for the full help text of the build you have.

Command line

The executable is XSEmu.exe; older builds called it xcl.exe. Opened from Explorer, it shows a small menu that asks for the game’s exe or its MicrosoftGame.config.

XSEmu run <game folder | game.exe> [-- game arguments]
Runs a title.
XSEmu inspect <file.exe | file.dll> [--json]
Lists a binary’s imports and how XCL resolves each one.
XSEmu disasm <file> [--hex] [--fssm FILE]
Disassembles RDNA2 code and console shader containers.
XSEmu shaders <file | folder | package.rpf> [--top N] [--recomp] [--compile N]
Reports on, recompiles or compiles the shaders in a package.
XSEmu shaders <file | folder | package.rpf> --precompile [--pipelines]
Fills the DXIL cache ahead of time, so the title doesn’t wait for DXC on first use.
XSEmu rpf <package.rpf> [--find NAME] [--extract NAME --out DIR]
Lists, finds or extracts files in an RPF package.
XSEmu warm-up [--full]
Rebuilds the pipelines recorded in the manifest before the next run.
XSEmu --version
Prints the version.

Warm-up modes

Warm-up rebuilds the pipelines a game recorded in its manifest, so the driver compiles less while the game loads. It refuses to start while another XSEmu is running: run one process tree at a time.

In release 0.1.0-pre.1, warm-up from the launcher exits after a few seconds without building anything. Skip it; Play builds shaders as the game runs.

XSEmu warm-up
Rebuilds the pipelines in the manifest so the driver compiles less while a title loads. Stops after 20 minutes, leaves out programs over 1 MB of DXIL, and leaves out pipelines that none of the last 3 runs made.
XSEmu warm-up --full
Builds everything, with no time limit, and resumes where an earlier full pass stopped.
XSEmu warm-up --mesh-only
Builds only the missing driver blobs for mesh pipelines.
XSEmu warm-up --giants-only --floor-mb N
Builds the large compute programs one at a time and keeps N MB of RAM free. N must be 1024 or more.

XSEmu shaders <package> --precompile works from the other end: it translates every VS, PS, MS and CS program in a shader package into the DXIL cache, and with --pipelines also creates each compute pipeline so the driver caches its own compile.

Title data and configuration

Each title gets a data folder at %LOCALAPPDATA%\XCL\<title>\, or under %XCL_DATA_ROOT% if you set it. It holds:

  • xcl.toml, the title’s settings;
  • the write overlay, saves, and the console’s S:\ and T:\ storage;
  • caches;
  • logs\xcl.log and logs\report.json, which lists called stubs, unknown D3D12.X slots, shader statistics and the crash, if there was one.

Which console the title sees is one line in xcl.toml:

# "anaconda" is a Series X, the default. "lockhart" is a Series S.
device_type = "lockhart"

Environment variables

The ones most people need. The code reads many more XCL_* variables for tracing and diagnostics; the source has those. In the launcher, set them in Settings › Run profile.

VariableEffect
XCL_DATA_ROOTRoot folder for per-title data, instead of %LOCALAPPDATA%\XCL.
XCL_DXC_DIRFolder that holds dxcompiler.dll and dxil.dll.
XCL_D3D12_DIRFolder that holds the D3D12 Agility SDK.
XCL_ADAPTERGPU to use, by index (1) or by name (radeon).
XCL_SHADER_BACKENDhlsl, the default, compiles with DXC. dxil uses the direct DXIL backend and falls back to DXC.
XCL_DXIL_CACHEFolder of the DXIL cache, instead of %LOCALAPPDATA%\xcl\dxil.
XCL_TRANSLATED_CACHE=0Turns off the disk cache of translated shaders.
XCL_PSO_DISK_CACHE=0Turns off the driver blob cache.
XCL_PSO_MANIFEST=0Stops recording pipelines in the manifest.
XCL_ASYNC_PSO=0Builds every pipeline inside the create call, with no stand-in.
XCL_WARMUP_BUDGET_STime limit in seconds for XSEmu warm-up without --full.
XCL_NETWORK=0Runs the title with no network, like a console that’s offline. Loopback still works.
XCL_STORE=offline-errorEvery store query fails with the GDK store network error. No licence is granted.
XCL_BCPACK_TABLESPath to the BCPack table file. It isn’t in the repository; without it, BCPack requests fail.
XCL_D3D12_DEBUGTurns on the D3D12 debug layer.
XCL_BIND_BACKSTOP_MSLongest a graphics bind waits for its pipeline. 3000 by default.
XCL_FRAME_STALL_BUDGET_MSTotal wait allowed per frame before draws with unbuilt pipelines are skipped. 1000 by default.

Launcher

The launcher finds XSEmu.exe next to itself, or uses the one chosen in Settings › About.XSEMU_EMULATOR wins over both. Its own settings live in settings.ini in the app’s local data folder;XSEMU_LAUNCHER_DATA moves them.

  • It reads emulator data from %LOCALAPPDATA%\XCL and the shader cache from %LOCALAPPDATA%\xcl\dxil, the same places XSEmu uses.
  • Every control in Settings is backed by an xcl.toml key, an XCL_* variable or a launcher setting. Controls XSEmu can’t honour yet are greyed out, with the reason.
  • A game’s own settings in its details page win over the defaults in Settings, including its own run profile.
  • Cover art comes from SteamGridDB once you add an API key in Settings › Game folders.
  • Community runners are installed into a runners folder, which XSEMU_RUNNERS_DIR can move. The launcher warns when it has under 20 GB free.

The launcher’s README has the full table of settings and what backs each one.

Build and test

You need the Rust MSVC toolchain (stable-x86_64-pc-windows-msvc; CI uses 1.99.0) and the Visual Studio C++ build tools.

cargo build --release --locked --workspace   # target\release\XSEmu.exe
.\scripts\test.ps1                           # build, then cargo test --workspace

The test suite builds and runs its own synthetic test title. GPU tests need a physical D3D12 adapter; when the adapter can’t run one, the test prints SKIPPED <test>: <reason> and passes. Tests that read real game data are opt-in through XCL_SAMPLE_* variables.

The direct DXIL backend has no dependencies and no Windows code, so it also builds and tests on Linux:

cargo test --manifest-path crates/xcl-dxil/Cargo.toml

The launcher needs CMake 3.21 or later, Ninja, and Qt 6.4 or later with Core, Gui, Widgets, Network, Svg and Test:

cmake -S launcher -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=C:/Qt/6.8.3/msvc2022_64
cmake --build build
cmake --install build --prefix dist   # runs windeployqt into dist/bin

On Linux the launcher builds for development only, with fake-xsemu standing in for XSEmu.exe. Pick its behaviour with FAKE_XSEMU_SCENARIO: ok, crash, device_removed, slow_boot,warmup_fail and more.

Repository layout

crates/xcl
The translation layer and XSEmu.exe: PE loader, virtual file system, launcher code and command line.
crates/xcl/src/hle
Console library replacements: kernelx, xgameruntime, d3d12x (D3D12.X), dstorage, xaudio2, xma2, gameinput, bink and more.
crates/xcl/src/gpu
RDNA2 decoder, console shader containers, texture tiling and adapter selection.
crates/xcl/src/gpu/recomp
The RDNA2 to HLSL recompiler, the DXC driver and pipeline building.
crates/xcl-dxil
The direct DXIL backend, with the xdxc and xdiff tools.
crates/xcl-bcpack
The BCPack decoder.
launcher/
XSEmu Launcher, a Qt 6 Widgets app in C++17.
tests/
A synthetic test title, a test DLL and test data.
docs/
Design notes: the design spec, mesh shaders, wave64 on wave32, the launcher protocol.

Contributions go through pull requests on GitHub. Never commit game files, firmware, SDK headers or binaries, keys or dumps; the repository’s PR check refuses binary files and game file names.