Skip to content

xgameruntime: keep persistent local storage out of GAME:\ (RT-274) - #4327

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
AirKyzzZ:fix/pls-outside-game-root
Nov 23, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
AirKyzzZ:fix/pls-outside-game-root

Conversation

@AirKyzzZ

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: RT-274 (claim)

What and why

Persistent local storage lived at <overlay>\persistent. The overlay root is what a title sees as GAME:\, and internal_dir() only hides the .gta6rt-* folders, so the title could see its own storage through the package. After writing into the folder XPersistentLocalStorageGetPath returns, FindFirstFileW(GAME:\persistent\*) listed those files, a package file at GAME:\persistent\<name> read back as the storage copy, and DeleteFileW on that path deleted the storage file.

The folder is now <overlay>\.gta6rt-persistent. The name is declared once as rt::fs::kPersistentStorageDir in file_system.h, since xgameruntime.cpp needs it too, and internal_dir() hides it like the other three. The xgameruntime comment and docs/runtime_imports.md say so.

Not handled: someone who already ran a build with the old path keeps a visible <overlay>\persistent folder. Nothing migrates it.

Tested

Windows 10 22H2 (19045), RTX 2060 / NVIDIA 566.14, Ryzen 5 2600X, clang-cl 23.1.6 + lld-link, Windows SDK 10.0.26100, Ninja, on 03b09a08:

  • xgameruntime_test: 109/109. The new check writes into the storage folder, then checks through the file shims that GAME:\ doesn't list it and that a package file of the same relative name keeps its own bytes. On main 4 of the 109 fail.
  • The full non-GPU ctest set (file_system, xgameruntime, pe_loader bounds, run_tiny_game*, loader tests): 73/73, same as main.

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, with how it was confirmed. (no translator change)

@2-CD

2-CD commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Windows + GPU check: NVIDIA GeForce RTX 5080 (driver 621.01) + AMD Radeon 610M iGPU (driver 32.0.13018.6), Windows 11, MSVC (VS BuildTools 18) + Ninja, RelWithDebInfo, Vulkan SDK headers fetched. Tested head ee658a91 (base 03b09a08).

Build: clean, 76 targets.

Targeted, --repeat until-fail:3:

  • xgameruntime (the PR's new persistent-local-storage cases) and file_system: both pass x3.

Full suite (ctest -C RelWithDebInfo -j 6, excluding the 4 window-showing tests dxgi_swapchain|d3d12_present|vk_presenter_sync|xbox_present):

  • NVIDIA RTX 5080: 150/150 passed, 0 failed.
  • AMD Radeon 610M iGPU (LEONIDA_VK_DEVICE=Radeon): 150/150 passed, 0 failed.

The PR's unstable CI state did not reproduce locally.

Synthetic fixtures only, no game files. AI-assisted (opencode); runs on my machine.

@sh1shu1

sh1shu1 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested ee658a9 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 03b09a0.

  • ctest: 154/154 passed, same 9 skips as main 03b09a0
  • xgameruntime: 1/1
  • run_gpu_tests (LEONIDA_VK_VALIDATION=1): 164/210 native, 195/210 with LEONIDA_W64_EMULATE=1, 0 failed; identical to main 03b09a0
    AI-assisted (Claude Code, Claude Fable 5.1).

@evilclanker9000

Copy link
Copy Markdown
Contributor

Tested ee658a9 on Windows 11 (MSVC BuildTools 2022, Ninja, RelWithDebInfo, -j 4; RTX 5080 driver 616.92 and AMD Radeon iGPU driver 26.10.1 present but not used, these tests are CPU-only): xgameruntime_test.exe reports 109 checks OK; ctest -R "xgameruntime|file_system|run_tiny" 13/13 pass. No game files.

AI-assisted.

@sds-228 sds-228 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review of ee658a9: diff review only (no local C++ toolchain): persistent local storage stays out of the virtual game drive and the new test expectations match the mapping. Diff check clean.

AI-assisted (OpenCode).

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested ee658a9 on NVIDIA GeForce RTX 4090 (driver 32.0.16.2101), Windows 11, MSVC 14.51: pass.

I built the branch with CMake and Ninja, RelWithDebInfo. The build has no Vulkan SDK, thus no validation layers.

xgameruntime_test.exe prints xgameruntime_test: OK (109 checks). The 3 new GAME: checks and the check for <overlay>\.gta6rt-persistent print PASS.

ctest --output-on-failure -j 4 gives 134 tests: 133 pass and 1 fails. The failure is xbox_present. Main 03b09a08 gives 134 tests with 2 failures on this computer: xbox_present and d3d12_present. These two tests fail here because of the window size. The 9 skipped tests and the 1 disabled test are the same.

Negative control: with file_system.cpp, file_system.h and xgameruntime.cpp from main 03b09a08, the test prints 4 of 109 checks failed. The 4 lines are the path check and the 3 new GAME: checks.

No game files. An AI tool helped me to run the tests.

@erickbobd

Copy link
Copy Markdown
Contributor

One pre-existing follow-up found while checking ee658a911a5f934ad2f366b99da82f546174f655: the reserved overlay folders are hidden from root listings but remain reachable by an explicit GAME: path.

A temporary synthetic probe opened and read the storage file through GAME:\.gta6rt-persistent\index.bin on this head. On main 03b09a08, probes also listed deletion markers through GAME:\.gta6rt-deleted\... and created a file through GAME:\.gta6rt-temp\... that T: then saw. The source probes were removed after testing.

Reported as a separate finding in the coordination issue, with the measured cases distinguished from the untested implications. This predates the PR for the older reserved folders; the current change still fixes the ordinary GAME:\persistent\... collision. Leaving the old folder unmigrated also avoids confusing title writes with storage files.

Our CPU-only xgameruntime_test result (109/109) and unchanged-main negative control (4/109 fail, with only the PR's test file applied) agree with @shdann's newly posted control.

Windows 11 26200.9974, MSVC 14.51, Ninja RelWithDebInfo; installed RTX 5070 Ti / NVIDIA 617.14 (not used by these CPU probes). No game files. AI-assisted: Claude Code ran the tests and probes; Codex checked the logs, unchanged head and current discussion and prepared this note.

@traeb0n

traeb0n commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Tested ee658a9 on NVIDIA GeForce RTX 5070, driver 621.01, Windows 11 Pro 26300, MSVC 14.44 RelWithDebInfo (scripts/build_runtime.ps1), Vulkan SDK 1.4.363, LEONIDA_VK_VALIDATION=1 for ctest: pass.

Code read: the folder is hidden from listings only. GAME:\.gta6rt-persistent\x still opens if named directly, just like .gta6rt-temp and the other internal folders, so this PR doesn't change that, and a title has no reason to guess the name.

Baseline on main 03b09a0, same machine and settings: 150/150 ctest.

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

@tupacfan04

Copy link
Copy Markdown
Contributor

APPROVE. The path mapping is untouched: storage moves under <overlay>\.gta6rt-persistent, internal_dir hides it at the root in both listing paths (file_system.cpp:286,467), package paths still resolve (read_target :308-336), and the new test writes the storage copy then proves the package file wins and survives a delete. Static review of the constant/header/test is clean, mergeable, no conflicts.

Nits: docs/runtime_imports.md:196 says "which GAME: does not see", but GAME:\.gta6rt-persistent\x still resolves (:322-328) - "does not list" is accurate; old <overlay>\persistent is not migrated, so upgraded overlays keep the original leak (acknowledged in the body); and xgameruntime.cpp:351 still says "a folder beside the overlay" (pre-existing).

The full pytest run's 11 failures are all outside this PR and reproduce on untouched main (translator ISA cases, the Windows check_no_game_data cleanup, one u16_high_half assertion).

AI-assisted review, no game files, no GPU.

Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
@AirKyzzZ
AirKyzzZ force-pushed the fix/pls-outside-game-root branch from ee658a9 to 2521a68 Compare November 23, 2026 03:44
@AirKyzzZ

Copy link
Copy Markdown
Contributor Author

Rebased onto round 43 (7b7d73f8): one conflict in docs/runtime_imports.md, where main rewrote the XPackage/XGame rows. I kept main's text and re-applied only the folder name in the persistent-storage row. Head 2521a683 on Windows 10 (clang-cl): xgameruntime_test 131 OK, file_system_test 159 OK.

@evilclanker9000

Copy link
Copy Markdown
Contributor

Tested 2521a68 on Windows 11 (MSVC BuildTools 2022, Ninja, RelWithDebInfo, -j 4; no Vulkan validation layer installed), one GPU at a time, device line confirmed: AMD Radeon RDNA2 iGPU (driver 26.10.1) and NVIDIA RTX 5080 (driver 616.92). Ran ctest -R "^(xgameruntime)$" (the tests this PR adds/changes): pass on both GPUs, 1/1 each. No game files.

AI-assisted.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built and ran xgameruntime_test at 2521a683b on Windows 11: xgameruntime_test: OK (131 checks), exit 0. git diff --check clean.

Persistent local storage is now kept out of GAME:\ (the shim asks for a writable location instead), and the added cases cover the path choice and the existing module checks. The two fopen C4996 warnings are the test's existing style, not new behaviour. No blocking issue.

@sds-228 sds-228 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review of 2521a68: still clean at the new head. Diff review only (no local C++ toolchain): persistent storage now uses a hidden overlay folder excluded from GAME: listings, and the added runtime test checks both listing and deletion isolation. Docs and expectations match.

AI-assisted (OpenCode).

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.