Skip to content

runtime/README.md: document the five xgameruntime environment overrides, with a docs test - #3686

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
kotorvr:docs-xgameruntime-env-overrides
Nov 23, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
kotorvr:docs-xgameruntime-env-overrides

Conversation

@kotorvr

@kotorvr kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new PROC item, claim in #3574 (no ID yet)

What and why

runtime/shims/xgameruntime.cpp reads five environment variables that no document names: LEONIDA_DEVICE_TYPE (line 397), LEONIDA_ANALYTICS_FORM (546), LEONIDA_PACKAGE_ID (566, 592), LEONIDA_CONTENT_PACKAGES (601) and LEONIDA_PACKAGED (692). git grep finds none of them in any .md, while runtime/README.md documents the runtime's other variables one by one. The source calls the first "for trying other code paths on day one", which is when someone will look for it.

The change

  • runtime/README.md, under "Shims": a table of the five, each with its default, the values it accepts and which call it changes, read from the code. For example LEONIDA_DEVICE_TYPE takes 0..8 (the XSystemDeviceType values, listed), a number outside that range is ignored, and 6 also changes the form that XSystemGetAnalyticsInfo reports.
  • tests/test_docs_env_vars.py (standard library; reads sources and Markdown): every LEONIDA_*/GTA6RT_* name that appears as a string literal in runtime/src, runtime/shims or make_game.py is written in some tracked .md file. Two names are excepted, and the test checks they are still read: LEONIDA_BASE_RESERVED and LEONIDA_RT_ENV_INIT, which the runtime sets or looks up for itself.

What this means for other pull requests: once this is merged, a pull request that adds a LEONIDA_*/GTA6RT_* literal under runtime/src, runtime/shims or make_game.py without naming it in a .md file fails this test. That is the point of it. The open pull requests I found that add one already document it in the same change (LEONIDA_SAVE_DIR in #3505, LEONIDA_GAMERTAG in #3363).

No behaviour changes; no code touched.

Tested

Windows 11, Python 3.13, on main f847748c:

  • python -I tests/test_docs_env_vars.py: 4 tests OK. With main's runtime/README.md: 1 failure, naming the five variables with the line each is read on.
  • python -I on tests/test_docs_links.py, test_docs_list_items.py, test_docs_repo_paths.py, test_docs_design_rows.py, test_ci_registration.py, test_text_write_line_endings.py: OK.
  • Not run: the runtime itself. The table is read from the source; runtime/test/xgameruntime_test.cpp already exercises LEONIDA_PACKAGE_ID, LEONIDA_CONTENT_PACKAGES and LEONIDA_PACKAGED=0, and the other two overrides have no test.

Trial merges with the five open pull requests that touch runtime/README.md (#3321, #3351, #3488, #3601, #3671) are clean. An independent run by a second session reproduced the counts and read each table row against the source before this was opened.

No game files, no GPU.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

kotorvr and others added 2 commits November 22, 2026 21:13
…es, with a docs test

LEONIDA_DEVICE_TYPE, LEONIDA_ANALYTICS_FORM, LEONIDA_PACKAGE_ID,
LEONIDA_CONTENT_PACKAGES and LEONIDA_PACKAGED are read by
runtime/shims/xgameruntime.cpp and were named in no document, while the
README documents the runtime's other variables one by one.

Adds a table read from the code (default, accepted values, which call each
one changes) and tests/test_docs_env_vars.py: every LEONIDA_*/GTA6RT_*
variable that appears as a string literal in runtime/src, runtime/shims
or make_game.py is named in some tracked Markdown file, except the two the
runtime sets for itself.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…haracters is ERROR_INSUFFICIENT_BUFFER

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@leoleahy

Copy link
Copy Markdown
Contributor

Independent CPU review at 8e5b781d on Windows (CPython 3.14.8, no GPU, no game files): pass.

  • python -I tests/test_docs_env_vars.py: 4 OK.
  • Negative control (head tests against merge base f847748c runtime/README.md): 1 failure reporting the undocumented LEONIDA_* variables in runtime/shims/xgameruntime.cpp.
  • python -m compileall -q tests/test_docs_env_vars.py: clean; LF line endings preserved on both files.

AI-assisted.

@Maraco91

Copy link
Copy Markdown

Tested 8e5b781 on Windows 11, Python 3.12.6: pass

  • python -I tests/test_docs_env_vars.py: 4/4 OK.

Since the earlier check covered the test and its negative control, I read the new README table against runtime/shims/xgameruntime.cpp row by row instead:

  • LEONIDA_DEVICE_TYPE: default 7 (XboxScarlettAnaconda), the nine names and numbers match the enum, a value outside 0..8 falls through to the default, and non-numeric text is atoi → 0 (Unknown), as the table says. 6 switches the analytics form to Xbox Series S: correct.
  • LEONIDA_ANALYTICS_FORM: a 64-byte buffer with n < sizeof, so "up to 63 characters" is right.
  • LEONIDA_PACKAGE_ID: XPACKAGE_IDENTIFIER_MAX_LENGTH is 33, so "up to 32 characters" is right, the default is the 32-character LeonidaPackageIdentifier00000000, and resolve_package_path does refuse that same identifier with E_ACCESSDENIED.
  • LEONIDA_CONTENT_PACKAGES: a 1,024-byte buffer, id=path pairs split on ;, ERROR_NOT_FOUND for an unlisted identifier: all as written.
  • LEONIDA_PACKAGED: atoi(s) == 0 returns false, so 0 and non-numeric text both do; any other number stays true.

I found no row that disagrees with the code. No blocker.

AI-assisted (Claude Code); no game files or GPU.

@sh1shu1

sh1shu1 commented Nov 22, 2026

Copy link
Copy Markdown

Tested 8e5b781 on NVIDIA RTX 4070 SUPER (driver 616.92), Windows 11 26200, MSVC 14.44, Vulkan SDK 1.4.363, RelWithDebInfo: pass, no regression against main f847748.

  • ctest: 140/140 passed, same 8 skips as main f847748
  • run_gpu_tests (LEONIDA_VK_VALIDATION=1): 153/199 native, 184/199 with LEONIDA_W64_EMULATE=1, 0 failed; identical to main f847748
    AI-assisted (Claude Code, Claude Fable 5.1).

@ItsNotRexed
ItsNotRexed merged commit 221b892 into ItsNotRexed:main Nov 23, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants