Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 101 additions & 79 deletions AGENTS.md

Large diffs are not rendered by default.

97 changes: 42 additions & 55 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Thanks for helping. A few rules keep the project safe to host:

- **No game data, ever.** That covers archives, the executable, carved files, shaders (DXBC, FSSM, disassembly,
SPIR-V), textures, models, audio, videos, and reports or logs that quote them. `.gitignore` blocks the common
types; check `git status` before you commit anyway.
types; check `git status` and run `python -I scripts/check_no_game_data.py` before committing.
- **No keys, decryption or protection workarounds**, and no links to where to get them. The tools only read files
that are already plain on disk.
- **Nothing online:** no Xbox Live or Rockstar services or domains.
- Short excerpts needed to explain a format (a few header bytes, one instruction sequence) are fine in docs and
comments.

Expand All @@ -21,71 +22,56 @@ list for others. When two pull requests overlap anyway, the one that lands first
rebase or close. Pull requests target `main`.

The original repository (`ItsNotRexed/Leonida`) went private on 23 November 2026, and its issues and pull requests
went with it. A `#N` in the docs, in a code comment or in a commit message from before that date is an **old**
number and links nowhere now, including the two this page used to send you to: #166 (GPU test results) and #313
(the D3D12 → Vulkan page).

- The titles of the issues that were open there are indexed in
[#18](https://github.com/ubiquitarianism/leonida/issues/18). To carry one on, open it again here and link the
index.
- The pull requests that were open there are kept as `old-pr/<old number>` branches, listed in
[#17](https://github.com/ubiquitarianism/leonida/issues/17). To carry one on, rebase it on `main`, keep its
author's commits and open a pull request here.
- A GPU test result is a pull request that adds a file to [`gpu-test-results/`](gpu-test-results) in the format of
the files there; [docs/testing.md](docs/testing.md) has how to run the tests.
went with it. A `#N` from before that date is an **old** number and links nowhere now (including old #166 and #313):

- Old open issues are indexed by title in [#18](https://github.com/ProjectLeonida/mandy/issues/18); open a new issue
here and link the index to carry one on.
- Old open pull requests are kept as `old-pr/<old number>` branches in
[#17](https://github.com/ProjectLeonida/mandy/issues/17); rebase on `main`, keep the author's commits and open a
pull request here.
- A GPU test result is a pull request adding a file to [`gpu-test-results/`](gpu-test-results);
[docs/testing.md](docs/testing.md) covers how to run the suite.
- The plan and status of the D3D12 → Vulkan layer are in [docs/d3d12_vulkan.md](docs/d3d12_vulkan.md).

[claims]: https://github.com/ubiquitarianism/leonida/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22
[claims]: https://github.com/ProjectLeonida/mandy/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22

## Working on the code

- Python tools run with `python -I` and use only the standard library unless a file says otherwise.
- A text file a tool writes (JSON, CSV, a manifest, an assembly listing) names its line ending: `open(path, "w",
encoding="utf-8", newline="\n")` (the same for `Path.open`, `Path.write_text` and a text-mode
`tempfile.NamedTemporaryFile`), so the output is LF on Windows too and the same input gives the same bytes on every
platform. `tests/test_text_write_line_endings.py` fails for a writer that forgets it.
- A report writer refuses an output that names one of its inputs or another output, and asks
`tools/report_paths.same_report_path(a, b)` rather than deriving the answer again: it resolves both paths,
applies the volume's case rules and falls back to `os.path.samefile`, so a new tool reuses one answer
instead of a private copy. `tests/test_report_paths.py` covers it.
- `tools/rpf9dump` needs the submodule: `git submodule update --init`.
- A new shader-translator rule goes into the contract table in `docs/design.md`, with how it was confirmed: a GPU
test, a Mesa/LLVM reference, or a count over the corpus.
- `python -I tests/test_<name>.py` runs one of the unit tests (standard library only; CI runs them all). The test
files with no `__main__` block or an `import pytest` (they need the packages in `tests/requirements.txt`) run with
`python -m pytest tests/test_<name>.py` instead, as [AGENTS.md](AGENTS.md) describes; under `python -I` they fail
to import or run nothing.
- Runtime tests: `cmake -S runtime -B runtime/build`, `cmake --build runtime/build --config RelWithDebInfo`, then
`ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure`. The CPU tests that need no game data are configured
on Windows; Linux and macOS configure the portable subset (`gta6rt` and the shims are Windows-only). Tests that need the retail package read `LEONIDA_GAME_DIR` (and `LEONIDA_MOVIE` for the Bink
decode test) in place and print `SKIP` when the variable is unset; never copy or commit those files.
- Viewer streaming tests: `node --test tests/test_viewer_streaming.cjs` (Node.js 22+, CI tests 24 LTS; no packages,
browser, network or game data). These execute the viewer streaming code with a synthetic loader and clock.
- `loader_test` writes small PE images to a `leonida_loader_test` folder in `%TEMP%`. Antivirus that blocks newly
written executables makes it stop with that reason; exclude the folder or set `LEONIDA_TEST_DIR` to one it skips.
- Tool checks: `python -m compileall -q make_game.py tools tests`. The optional
`vk_pipeline_check <spirv dir> [cache.bin] [--jobs N]` creates a module (and, for compute shaders, a
pipeline) for every translated shader and reports failures plus the saved cache path.
- GPU tests are small hand-written RDNA2 programs in `runtime/test/shaders`. `build.py` turns them into SPIR-V
using `llvm-mc` with the AMDGPU target (LLVM 21+). `check.py` runs them on your GPU and compares the results.
A new test gets its expected values in the comment at its top and a check in `check.py`.
[docs/testing.md](docs/testing.md) covers setup per OS, including native Windows options, and known problems.
- Say what you tested and on which GPU in the pull request.
- Run the translator tests with `python -I scripts/run_semantic_tests.py tests/semantic` (see `tests/semantic/README.md`). A new
translator rule should come with a small hand-written `.asm` fixture and its expected output words.
- **Engineering bar:** fix root causes instead of stacking workarounds, and keep changes simple, clean, modular,
maintainable and performant (see [AGENTS.md](AGENTS.md#engineering-bar)).
- **Python tools:** run with `python -I` and use only the standard library unless noted in
[AGENTS.md](AGENTS.md#conventions).
- **Deterministic line endings:** every text file a tool writes (JSON, CSV, manifests, assembly listings) must pass
`encoding="utf-8", newline="\n"` (`open`, `Path.open`, `Path.write_text`, text-mode `NamedTemporaryFile`) so Windows
and Unix produce identical bytes. `tests/test_text_write_line_endings.py` enforces this.
- **Report paths:** a report writer refuses an output naming one of its inputs or another output via
`tools/report_paths.same_report_path(a, b)` (`tests/test_report_paths.py`).
- **Submodule:** `tools/rpf9dump` needs `git submodule update --init`.
- **Shader-translator rules:** add every new rule to the contract table in `docs/design.md` with how it was confirmed
(GPU test, Mesa/LLVM reference, or corpus count), plus a small hand-written `.asm` fixture in `tests/semantic/` (see
`tests/semantic/README.md`).
- **Running no-game-files tests:** see [AGENTS.md](AGENTS.md#test-without-the-game-first) for the full command
reference covering Python stdlib (`python -I tests/test_<name>.py`) vs `pytest` (`python -m pytest` for files using
`tests/requirements.txt` or without `__main__`), docs checks, viewer `.cjs` tests, the semantic translator suite,
`rpf9dump`, `runtime/` CMake/CTest, `d3d12/` Cargo, and `launcher/native/`.
- **GPU and pipeline tests:** small hand-written RDNA2 programs in `runtime/test/shaders` (`build.py` with `llvm-mc`
from LLVM 21+, `check.py` on your GPU; see [docs/testing.md](docs/testing.md)). The optional
`vk_pipeline_check <spirv dir> [cache.bin] [--jobs N]` builds a module (and compute pipeline) for every translated
shader and reports failures.

## AI-assisted contributions

Read [AGENTS.md](AGENTS.md) before letting an agent edit the repository. When using AI models or coding agents here,
match the model to the work and review its output independently:
Read [AGENTS.md](AGENTS.md) before letting an agent edit the repository. Match the model to the work and review its
output independently:

- **New code and reviews:** Claude Opus or Fable; GPT Sol or Astra; Gemini Neon or Carbon.
- **Documentation and simple fixes:** at least Claude Sonnet or better, GPT Terra or better, Gemini Hydrogen or better,
Muse Wonder or better, DeepSeek v4.1 or better, Kimi K3.1 Pro or better, or Qwen 4 Max or better.
- **Separate reviewer agent:** Run a separate reviewer agent (using one of the models listed for new code and reviews
above) to independently review AI-written changes before opening a pull request.
- **Disclosure and verification:** Note in the pull request that the change was AI-assisted, and what specific models were used, along with what you tested
(and on which GPU and driver when GPU tests apply), as described in [AGENTS.md](AGENTS.md).
- **Separate reviewer agent:** Always run a separate, read-only reviewer agent (using one of the models listed for new
code and reviews above) to independently audit diffs, edge cases, tests and clean-room rules before opening or
updating a pull request.
- **Disclosure and verification:** Note in the pull request that the change was AI-assisted and which specific models
were used (including the reviewer agent), along with what you tested and on which GPU and driver.

## Pull requests

Expand All @@ -94,7 +80,8 @@ match the model to the work and review its output independently:
- Fill in the [template](.github/pull_request_template.md): the claim, `Depends on:`, `Fixes: #N` for an issue it
closes, what you tested, `GPUs tested:` (vendor, model, driver and OS) and whether it was AI-assisted.
- A pull request that conflicts with `main` is labeled `needs rebase` (`tools/pr_conflict_label.py`, run on every
push to `main` and hourly). Rebase it on `main` yourself; the label goes within the hour once it merges cleanly. Reviews start with the pull requests that do.
push to `main` and hourly). Rebase it on `main` yourself; the label goes within the hour once it merges cleanly.
Reviews start with the pull requests that do.

## Maintainer quick guide

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ game's shaders itself: you need neither the large shader and asset build nor the
> from your game and stays on your PC. Never share those files.

> [!NOTE]
> **This is a continuation of [NotRexed's Leonida project](https://github.com/ProjectLeonida/Leonida).** The original
> **This is a continuation of NotRexed's Leonida project (`ItsNotRexed/Leonida`, now private).** The original
> author has left the project, and development continues here with its full commit history. Credit for the work up to
> that point belongs to NotRexed and the contributors listed in the history.

Expand Down Expand Up @@ -217,7 +217,7 @@ files, extracted assets, generated shaders or logs that quote them to issues or

## Credits

- [Leonida](https://github.com/ItsNotRexed/Leonida) by NotRexed and contributors: the original project, which this
- Leonida (`ItsNotRexed/Leonida`, now private) by NotRexed and contributors: the original project, which this
repository continues.
- The Direct3D 12 runtime is a tree of other people's work: [VIctory](https://github.com/Marvisak/VIctory) by
Marvisak and its contributors (the loader, the runtime services, the Direct3D 12 back end and the shader
Expand Down
Loading