Build it
Leonida isn’t downloaded ready-made. It’s built on your PC, from the source code and your own copy of the game. The game doesn’t boot yet, so a build today is for testing and development.
Before you start
Install these first. Build.bat checks all of them and the free space before it starts, and lists anything missing in one go.
Your ticks are saved in this browser.
The easy way
Three steps, and the build finds your game by itself.
Install the prerequisites
Everything in the list above, in any order.
Download the project with its submodule
git clone --recursive https://github.com/ItsNotRexed/LeonidaGitHub’s “Download ZIP” leaves out
third_party/rpf9-explorer. The build fetches it if git is installed, and otherwise tells you what to do.Double-click Build.bat
It looks for your game in Downloads, Desktop, Documents (OneDrive too), Games, your home folder and the top of every drive, two folders deep, and recognises the version from a few file sizes. With more than one copy it asks which, and with none it asks for the folder.
The result goes to
Documents\Leonida. A stopped build continues where it left off.
The five stages
Stages run in this order. Translating the shaders takes longest; it runs on half your CPU threads by default, which ‑‑jobs changes.
checkCheck your copy
Finds the game folder and confirms it’s the Xbox Series package, version 1.0.2.1, by name and size. Add --full-check to compare the SHA-256 of every file.
shadersTranslate the shaders
Carves 26,503 native RDNA2 GPU programs, disassembles them with LLVM and translates each to SPIR-V. The longest stage, spread over half your CPU threads by default.
assetsExport the assets
Reads models, textures and audio banks out of the RPF9 archives and texture pools, as OBJ, DDS and Ogg Opus.
runtimeBuild the runtime
Compiles the loader, gta6rt.exe, and the shims that stand in for the console’s system software.
pipelinesWarm the pipelines
Creates every translated shader on your own GPU driver and saves a pipeline cache, so the first boot doesn’t stop to compile them.
From a terminal
make_game.py behaves the same as Build.bat, with more control. Run it from the project folder.
List the copies found on this PC
python -I make_game.py --findChoose the game folder in a folder dialog
python -I make_game.py --pickCheck your copy, build nothing
python -I make_game.py --checkAlso compare the SHA-256 of every file (slow)
python -I make_game.py --check --full-checkChoose where the game, the result and the work files are
python -I make_game.py --game "D:\path\to\your\package" --out "D:\Games\Leonida" --work "E:\leonida-work"Run only some stages
python -I make_game.py --stages shaders,assetsAlso decode Opus audio to PCM WAV (large)
python -I make_game.py --wavauto (the default), on or off
python -I make_game.py --wave64-emulate off
--wav is off by default because 16-bit PCM WAV is several times larger than Ogg Opus. Existing WAV files are skipped when a build resumes.
The build records which llvm-mc and which translator sources produced the shaders. Changing either reruns the affected steps and keeps the rest.
Which wave64 mode will I get?
Most of the console’s shaders run 64 lanes wide. Pick your graphics card to see what --wave64-emulate auto, the default, chooses.
The mode is saved next to the translated shaders, and changing it translates them again. Force it with --wave64-emulate on or off.
Emulation on
NVIDIA cards run 32-wide subgroups, so auto turns wave64 emulation on. Compute and mesh shaders come out exact. Operations that cross the two halves of a wave in vertex, pixel and geometry shaders are still approximate.
Emulation on
Intel GPUs run 32-wide subgroups, so auto turns wave64 emulation on, with the same result as on NVIDIA: compute and mesh shaders exact, cross-half operations in other shaders approximate.
Native wave64
These are RDNA2 GPUs. On AMD’s Windows driver they run wave64 natively, and that driver’s shader compiler crashes on the emulated code (issue #857), so auto leaves emulation off for them, even with an Intel iGPU in the same PC.
Native wave64
AMD GPUs report 64-wide subgroups, so the shaders run exactly as on the console. Auto leaves emulation off when every GPU in the PC reports 64-wide subgroups, and turns it on when one doesn’t, such as an Intel iGPU alongside.
Leave it on auto
The build asks vulkaninfo, part of the Vulkan SDK, which GPUs you have, and turns emulation on whenever it can’t tell. You don’t need to choose anything.
Older or unusual GPUs
Four fallback flags work around missing Vulkan features. Like the wave64 mode, each is saved with the shaders, and changing one translates them again.
| Flag | Use it on |
|---|---|
--no-float-controls | For devices without shaderSignedZeroInfNanPreserveFloat32 |
--bary-fallback | For devices without VK_KHR_fragment_shader_barycentric |
--texel-offset-fallback | For devices without VK_KHR_maintenance8 |
--mesh-compute | Mesh shaders as compute, for devices without VK_EXT_mesh_shader |
On Linux
make_game.py runs on Linux too. The loader is a Windows program and runs under Wine or Proton, and every change to the runtime is tested under Wine automatically.
Build the Vulkan pipeline check
With CMake 3.24+, a C++20 compiler, and the Vulkan headers and loader installed:
cmake -S runtime -B runtime/build/linuxcmake --build runtime/build/linux --parallelThe pipelines stage builds it there itself if it’s missing.
Use a ready-made Windows runtime
The runtime stage cross-builds the loader with clang-cl against an xwin SDK. Or unzip the runtime-windows artifact from the project’s Runtime workflow and point the build at it:
python3 -I make_game.py --runtime-build ~/Downloads/runtime-windowsIt copies gta6rt.exe into your output folder with a gta6rt.sh that starts it under Wine, or under the Wine named by WINE for Proton.
Stuck?
Read the known problems, search the issues, or ask in the Discord. Never attach game files, extracted assets or generated shaders to an issue.
