Skip to content

gta6rt: GAME: and the overlay are absolute, so a bare image name has a game folder - #2957

Merged
ItsNotRexed merged 2 commits into
ProjectLeonida:mainfrom
XFlawless1:fix/gta6rt-absolute-game-dir
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ProjectLeonida:mainfrom
XFlawless1:fix/gta6rt-absolute-game-dir

Conversation

@XFlawless1

Copy link
Copy Markdown
Contributor

Item: new RT item, claimed in #2716 (claim). Found while testing #2750. That PR's run_tiny_gdk_load fails for this reason, and passes unchanged once this is merged (details in my comment there).

What was wrong

runtime/src/main.cpp set game_dir = image.parent_path() when --game-dir was not given. For a bare image name, such as gta6rt --run game.exe started from the game folder, that path is empty. The run printed console paths: GAME: -> , writes -> overlay and every GAME: open failed with ERROR_PATH_NOT_FOUND. A relative --game-dir or --overlay worked only until the title called SetCurrentDirectory. After that, GAME: and the overlay pointed somewhere else.

The change

  • main.cpp makes the game folder (given, or the image's folder) and --overlay absolute at startup. If std::filesystem::absolute fails, the path stays as given. Absolute paths behave as before.
  • New CTest run_tiny_game_dir (runtime/test/check_game_dir.cmake) writes tiny_game_probe.txt next to tiny_game.exe and runs it twice, in its own folder: once by bare name, once with --game-dir .. The fixture's new opt-in game-file argument moves the current directory to %TEMP%, then reads GAME:\tiny_game_probe.txt. The script checks the guest's verdict, an absolute GAME: and overlay in the console paths line, and exit 0. As in check_loaded_gdk.cmake, it checks the printed output rather than trusting the exit status alone.
  • docs/runtime_imports.md: one sentence under the GAME: rules.

Tested

On Windows 11 Pro 26300, MSVC 19.44 (VS 2022 Build Tools), Ninja RelWithDebInfo via scripts/build_runtime.ps1, Vulkan SDK 1.4.363.0, at 77444fa0 (then rebased onto 16282101, which touches only docs).

  • Without the main.cpp change, run_tiny_game_dir fails both ways: bare name GAME: -> ,, open error 3; --game-dir . GAME: -> ., open error 2 once the current directory has moved. With the change, it passes.
  • Full ctest -j1, 122/122, on the default Vulkan device and with LEONIDA_VK_DEVICE=Radeon. The second is the Ryzen 7 9800X3D's RDNA2 iGPU, driver 32.0.21042.62; the PC also has an RTX 5080 (621.14). No GPU code is touched.
  • With Runtime: use game-facing shims for GetProcAddress on host modules #2750's check_loaded_gdk.cmake change and its --game-dir-free command line, its fixture passes once the game folder is absolute (tested by hand above).

I didn't run it under Wine. The script uses the same RUNNER pattern as check_loaded_gdk.cmake, and the regex accepts either a drive letter or a leading slash for the root.

No game files. AI-assisted (Claude Code).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md (n/a: no translator change).

🤖 Generated with Claude Code

…a game folder

`gta6rt --run game.exe`, started from the game folder, set the game folder to the image's parent path, which is
empty for a bare name: the run printed `console paths: GAME: -> , writes -> overlay` and every GAME: open failed
with ERROR_PATH_NOT_FOUND. A relative --game-dir or --overlay worked only until the title changed its current
directory. main.cpp now makes both absolute at startup (keeping the path as given if absolute() fails).

New CTest run_tiny_game_dir: tiny_game's opt-in `game-file` check moves its current directory, then reads
GAME:\tiny_game_probe.txt; check_game_dir.cmake runs it by bare name and with `--game-dir .`. Without the fix both
fail (open errors 3 and 2); with it both pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ray3242

ray3242 commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Small nit: the new header comment in runtime/test/fixtures/tiny_game.cpp line 9 has a literal TAB where \t was meant. It reads GAME:<TAB>iny_game_probe.txt instead of GAME:\tiny_game_probe.txt (grep -nP '\t' runtime/test/fixtures/tiny_game.cpp finds it). The code itself uses L"GAME:\\tiny_game_probe.txt" correctly. I found nothing else: the absolute_or_same resolution, the console paths: regex, and the PASS/OK lines check_game_dir.cmake expects all match the strings main.cpp and check() print.

AI-assisted review (diff inspection; the Windows runtime was not built here).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@XFlawless1

Copy link
Copy Markdown
Contributor Author

Thanks @ray3242, fixed in 0f414f4: the comment now reads GAME:\tiny_game_probe.txt and grep -nP '\t' finds nothing in the file. A comment-only change, so no rebuild was needed. AI-assisted (Claude Code).

@iurysf

iurysf commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 0f414f48 on RTX 4070 (NVIDIA 621.01, CPU-only test), Windows 11 (10.0.26300), MSVC 14.44, Windows SDK 10.0.26100, RelWithDebInfo: pass.

  • Full ctest -C RelWithDebInfo --output-on-failure: 122 passed, 0 failed (123 registered; base ec8ec4c9 has 122 registered, 121 passed). The new run_tiny_game_dir passes, as do the other six run_tiny_game* tests. The same 8 skips and gameinput disabled as on the base (no game files, no LEONIDA_VK_VALIDATION, no RGB9E5 render targets here, no SDL3). The build adds no warnings. The docs tests (test_docs_*, test_i18n_index) pass.
  • Negative control: with only runtime/src/main.cpp restored to main, run_tiny_game_dir fails (check_game_dir.cmake:33: GAME: did not resolve to the game folder); with this PR's main.cpp it passes.

Not tested: Wine/Linux, a relative --overlay with a real title that calls SetCurrentDirectory. Tested with AI assistance (Claude); synthetic fixture only, no game data.

@bielfreedom

Copy link
Copy Markdown

Tested 0f414f48 (on its base 16282101) on Windows 11 Pro build 26200, MSVC build of runtime/ (RelWithDebInfo, Ninja), AMD Radeon RX 9070 XT (driver 32.0.32029.2010), Vulkan validation on: pass.

  • run_tiny_game_dir (the new check) passes, and so do all the other run_tiny_* loader tests, run_tiny_gdk_load included.
  • Full ctest: 120/120, 0 validation errors.

This fixes the bare-image-name case I hit on #2750 (GAME: -> empty, so ERROR_PATH_NOT_FOUND for every GAME: read). Once this lands, #2750's check_loaded_gdk.cmake should pass without changes.

AI-assisted (Claude Code). No game files.

@Doffi4

Doffi4 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Independently tested 0f414f48 on Windows 11 (26200), MSVC 19.44 x64 Release. The four focused CTests passed: run_tiny_game, TLS, exception handling and run_tiny_game_dir. I also ran the guest from folders with spaces and Cyrillic, with bare image name, --game-dir . and an explicit relative --overlay. In all six launches the guest read the correct GAME: file after changing CWD, passed TLS and exception handling, and returned 0. In the ASCII folder the path log confirmed the explicit overlay is absolute.

One diagnostic issue: with a Cyrillic folder name the stdout line from the existing printf("console paths: … %ls …") truncates at the first Cyrillic character, omitting the overlay field even though the guest read succeeds. That printf is unchanged from main. Also applied the three runtime files from #2750 head 663c4d95 locally on top of this PR; its unchanged run_tiny_gdk_load passed with the bare guest basename, as did run_tiny_game_dir in that combined build. Synthetic inputs only. AI-assisted testing and reporting.

@ray3242

ray3242 commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Confirmed at 0f414f48: grep -cP '\t' runtime/test/fixtures/tiny_game.cpp is 0, so the nit is resolved. AI-assisted (Devin).

@ItsNotRexed
ItsNotRexed merged commit c8ed49e into ProjectLeonida:main Nov 22, 2026
2 of 4 checks passed
@XFlawless1
XFlawless1 deleted the fix/gta6rt-absolute-game-dir branch November 23, 2026 05:34
seblessa added a commit to seblessa/Leonida that referenced this pull request Nov 23, 2026
…est_docs_cli_flags

FORK.md: boot-prep is upstream main 3faac55 + ItsNotRexed#2861, ItsNotRexed#1895, fork/first-boot and
gdk-offline-classes (ItsNotRexed#3476, after its merge of main). ItsNotRexed#2218, ItsNotRexed#2784, ItsNotRexed#2594, ItsNotRexed#2839,
ItsNotRexed#2954, ItsNotRexed#2957, ItsNotRexed#2750, ItsNotRexed#2833 and our ItsNotRexed#3455 are upstream now; fork/first-boot and
gdk-runtime-calls are gone, so the fork-only files are carried as a patch when
boot-prep is rebuilt. gta6rt now seeds its VkPipelineCache from the
pipeline_cache.bin beside it when the header matches the device.

tests/test_docs_cli_flags.py failed on boot-prep only: FORK.md, merged from
fork/first-boot, quotes git commands, and the test wants every --flag in a
Markdown page to appear in a source file. git's flags join FOREIGN, next to gh's
and pip's (fork-only line).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

6 participants