file_system: shim GetDriveTypeA/W for GAME:, G:, and T: (RT-FS-DISK-SPACE) #1234

Closed
piyonchu wants to merge 1 commit from upstream-pr/1234 into main
piyonchu commented 2026-11-24 20:40:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by piyonchu on 2026-11-24T20:40:35Z.


Summary

  • Scope note: GetDiskFreeSpaceA/W and GetDiskFreeSpaceExA/W already landed on main (fbafd7cd2, RT-FS-DISK-FREE-SPACE), so after rebasing onto main (16f505304), this PR is narrowed to the remaining GetDriveTypeA/W shims.
  • Implement GetDriveTypeA and GetDriveTypeW in runtime/shims/file_system.cpp (RT-FS-DISK-SPACE):
    • Recognize virtual Xbox/PS5 drive paths (GAME:, G:, T:) using non-creating resolve_console_readonly_dir for T:\ so GetDriveType does not create directories on disk, returning DRIVE_FIXED (3).
    • Forward host/system drive paths (such as C:\, C:, or nullptr) to the real Win32 GetDriveTypeW.
    • Add GetDriveTypeW / GetDriveTypeA assertions to runtime/test/file_system_test.cpp.

Verification

  • python -I scripts/check_no_game_data.py ... -> PASS
  • python -I tests/test_fs_disk_free_space.py -> 1/1 OK
  • cmake --build runtime/build --config RelWithDebInfo --target gta6rt file_system_test -> build succeeded
  • ctest --test-dir runtime/build -C RelWithDebInfo -R "^file_system$" --output-on-failure -> 1/1 passed (17.88 sec)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5479971762 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1234). Originally posted by [piyonchu](https://github.com/piyonchu) on 2026-11-24T20:40:35Z. --- ## Summary - Scope note: `GetDiskFreeSpaceA/W` and `GetDiskFreeSpaceExA/W` already landed on `main` (`fbafd7cd2`, `RT-FS-DISK-FREE-SPACE`), so after rebasing onto `main` (`16f505304`), this PR is narrowed to the remaining `GetDriveTypeA/W` shims. - Implement `GetDriveTypeA` and `GetDriveTypeW` in `runtime/shims/file_system.cpp` (`RT-FS-DISK-SPACE`): - Recognize virtual Xbox/PS5 drive paths (`GAME:`, `G:`, `T:`) using non-creating `resolve_console_readonly_dir` for `T:\` so `GetDriveType` does not create directories on disk, returning `DRIVE_FIXED` (`3`). - Forward host/system drive paths (such as `C:\`, `C:`, or `nullptr`) to the real Win32 `GetDriveTypeW`. - Add `GetDriveTypeW` / `GetDriveTypeA` assertions to `runtime/test/file_system_test.cpp`. ## Verification - `python -I scripts/check_no_game_data.py ...` -> PASS - `python -I tests/test_fs_disk_free_space.py` -> 1/1 OK - `cmake --build runtime/build --config RelWithDebInfo --target gta6rt file_system_test` -> build succeeded - `ctest --test-dir runtime/build -C RelWithDebInfo -R "^file_system$" --output-on-failure` -> 1/1 passed (`17.88 sec`)
piyonchu commented 2026-11-26 02:53:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by piyonchu on 2026-11-26T02:53:49Z.


Rebased onto latest main (86dc3d86e, head commit 83ef3eea9) and updated parse_console_parts / resolve_console_readonly_dir so create_scratch = false inspects g_scratch_folders via existing_scratch_folder without creating <overlay>\.gta6rt-temp\<run> on disk while keeping T:\.. clamped and mapping T:\ root queries (parts.size() == 2) cleanly.

Verified locally after rebase:

  • git diff --check cont/main..HEAD
  • python -I scripts/check_no_game_data.py runtime/shims/file_system.cpp runtime/test/file_system_test.cpp
  • cmake -S runtime -B runtime/build -DLEONIDA_VULKAN_HEADERS_FETCH=ON
  • cmake --build runtime/build --config RelWithDebInfo --target gta6rt file_system_test
  • ctest --test-dir runtime/build -C RelWithDebInfo -R "^file_system$" --output-on-failure (1/1 passed)
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7181214443 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1234#issuecomment-7181214443). Originally posted by [piyonchu](https://github.com/piyonchu) on 2026-11-26T02:53:49Z. --- Rebased onto latest `main` (`86dc3d86e`, head commit `83ef3eea9`) and updated `parse_console_parts` / `resolve_console_readonly_dir` so `create_scratch = false` inspects `g_scratch_folders` via `existing_scratch_folder` without creating `<overlay>\.gta6rt-temp\<run>` on disk while keeping `T:\..` clamped and mapping `T:\` root queries (`parts.size() == 2`) cleanly. Verified locally after rebase: - `git diff --check cont/main..HEAD` - `python -I scripts/check_no_game_data.py runtime/shims/file_system.cpp runtime/test/file_system_test.cpp` - `cmake -S runtime -B runtime/build -DLEONIDA_VULKAN_HEADERS_FETCH=ON` - `cmake --build runtime/build --config RelWithDebInfo --target gta6rt file_system_test` - `ctest --test-dir runtime/build -C RelWithDebInfo -R "^file_system$" --output-on-failure` (1/1 passed)
MoonEyes commented 2026-11-28 18:00:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T18:00:32Z.


Hi @piyonchu, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/shims/file_system.cpp), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7243457007 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1234#issuecomment-7243457007). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T18:00:32Z. --- Hi @piyonchu, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/shims/file_system.cpp`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
OreoFR commented 2026-11-28 21:47:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:47:54Z.


Verified by OreoFR

  • Base: main c1ecf04ed + PR head 83ef3eea9
  • Test: not run (merge conflict with main)
  • Red on main: not run
  • Green with the PR: not run
  • Verdict: CONFLICT (runtime/shims/file_system.cpp conflicts with main)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246280443 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1234#issuecomment-7246280443). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:47:54Z. --- **Verified by OreoFR** - Base: main `c1ecf04ed` + PR head `83ef3eea9` - Test: not run (merge conflict with main) - Red on main: not run - Green with the PR: not run - Verdict: CONFLICT (runtime/shims/file_system.cpp conflicts with main) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
piyonchu commented 2026-11-29 01:30:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by piyonchu on 2026-11-29T01:30:09Z.


Rebased onto main (16f505304) at 894501117:

  • GetDiskFreeSpaceA/W and GetDiskFreeSpaceExA/W already landed on main (fbafd7cd2, RT-FS-DISK-FREE-SPACE), so I removed the duplicate definitions/exports from this branch and narrowed #1234 cleanly to GetDriveTypeA/W (using non-creating resolve_console_readonly_dir for T:\) plus GetDriveTypeW/A test assertions in runtime/test/file_system_test.cpp.
  • Updated the PR title and description to match the narrowed scope.
  • Verified:
    • git diff --check cont/main..HEAD: clean
    • python -I scripts/check_no_game_data.py ...: PASS
    • python -I tests/test_fs_disk_free_space.py: 1/1 OK
    • cmake --build runtime/build --config RelWithDebInfo --target gta6rt file_system_test: build succeeded
    • ctest --test-dir runtime/build -C RelWithDebInfo -R "^file_system$" --output-on-failure: 1/1 passed (17.88 sec)
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248822861 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1234#issuecomment-7248822861). Originally posted by [piyonchu](https://github.com/piyonchu) on 2026-11-29T01:30:09Z. --- Rebased onto `main` (`16f505304`) at `894501117`: - `GetDiskFreeSpaceA/W` and `GetDiskFreeSpaceExA/W` already landed on `main` (`fbafd7cd2`, `RT-FS-DISK-FREE-SPACE`), so I removed the duplicate definitions/exports from this branch and narrowed `#1234` cleanly to `GetDriveTypeA/W` (using non-creating `resolve_console_readonly_dir` for `T:\`) plus `GetDriveTypeW/A` test assertions in `runtime/test/file_system_test.cpp`. - Updated the PR title and description to match the narrowed scope. - Verified: - `git diff --check cont/main..HEAD`: clean - `python -I scripts/check_no_game_data.py ...`: PASS - `python -I tests/test_fs_disk_free_space.py`: 1/1 OK - `cmake --build runtime/build --config RelWithDebInfo --target gta6rt file_system_test`: build succeeded - `ctest --test-dir runtime/build -C RelWithDebInfo -R "^file_system$" --output-on-failure`: 1/1 passed (`17.88 sec`)
zmasi commented 2026-11-29 02:08:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:08:48Z.


Windows 11 NTFS Verification (894501117b merged with main 791899f652) — PASS

  • Environment: Windows 11 (10.0.26200), NTFS, MSVC 19.44.35207 (/O2 /MD /EHsc /std:c++20 /W4 /permissive- /utf-8, /link /OPT:NOREF).
  • Merge & Hygiene: Clean git merge-tree onto main (791899f652) individually and in a 5-PR batch (0 conflicts); python -I scripts/check_no_game_data.py rc=0; 0 new /W4 warnings.
  • Red -> Green:
    • Red (file_system_test.cpp compiled against main runtime/shims/file_system.cpp): fails with rc=1 (FAIL GetDriveTypeW/A resolve through the shim registry, 545 check(s), 1 failure(s)).
    • Green (894501117b + main 791899f652): file_system_test.exe passes with rc=0 (582 check(s), 0 failure(s)), covering:
      • GetDriveTypeW / GetDriveTypeA shim resolution across kernel32.dll, kernelbase.dll, and api-ms-win-core-file-l1-*;
      • GAME:\, G:\, and T:\ root queries (\ and /, upper and lower case) returning the backing NTFS volume's DRIVE_FIXED type;
      • DRIVE_NO_ROOT_DIR on subpaths (GAME:\sub\, T:\save), drive-relative paths (GAME:, T:sub), unconfigured GAME:\, and T:\ with an empty overlay;
      • nullptr parity with the host Win32 GetDriveTypeW(nullptr) / GetDriveTypeA(nullptr) and zero directory-creation side effects (overlay and .gta6rt-temp remain uncreated after read-only GetDriveType* probes).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249238799 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1234#issuecomment-7249238799). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T02:08:48Z. --- ### Windows 11 NTFS Verification (`894501117b` merged with `main` `791899f652`) — PASS - **Environment**: Windows 11 (`10.0.26200`), NTFS, MSVC `19.44.35207` (`/O2 /MD /EHsc /std:c++20 /W4 /permissive- /utf-8`, `/link /OPT:NOREF`). - **Merge & Hygiene**: Clean `git merge-tree` onto `main` (`791899f652`) individually and in a 5-PR batch (`0` conflicts); `python -I scripts/check_no_game_data.py` `rc=0`; `0` new `/W4` warnings. - **Red -> Green**: - **Red (`file_system_test.cpp` compiled against `main` `runtime/shims/file_system.cpp`)**: fails with `rc=1` (`FAIL GetDriveTypeW/A resolve through the shim registry`, `545 check(s), 1 failure(s)`). - **Green (`894501117b` + `main` `791899f652`)**: `file_system_test.exe` passes with `rc=0` (**`582 check(s), 0 failure(s)`**), covering: - `GetDriveTypeW` / `GetDriveTypeA` shim resolution across `kernel32.dll`, `kernelbase.dll`, and `api-ms-win-core-file-l1-*`; - `GAME:\`, `G:\`, and `T:\` root queries (`\` and `/`, upper and lower case) returning the backing NTFS volume's `DRIVE_FIXED` type; - `DRIVE_NO_ROOT_DIR` on subpaths (`GAME:\sub\`, `T:\save`), drive-relative paths (`GAME:`, `T:sub`), unconfigured `GAME:\`, and `T:\` with an empty overlay; - `nullptr` parity with the host Win32 `GetDriveTypeW(nullptr)` / `GetDriveTypeA(nullptr)` and zero directory-creation side effects (`overlay` and `.gta6rt-temp` remain uncreated after read-only `GetDriveType*` probes). AI-assisted.
fiestorra commented 2026-11-30 11:26:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T11:26:42Z.


Independent verification on this machine (Windows 11, MSVC 19.44.35226), with a negative control that bites.

1. It applies and builds. merge-tree clean onto main d367675c7; runtime/shims/file_system.cpp plus its test.

2. With the branch: ctest -R 'file_system' -> 100% tests passed, 0 failed out of 1.

3. The control - revert only the shim, keep the test:

git checkout origin/main -- runtime/shims/file_system.cpp
cmake --build … --target file_system_test
ctest -R 'file_system' --output-on-failure
0% tests passed, 1 tests failed out of 1
FAIL GetDriveTypeW/A resolve through the shim registry

The assertion is the change: GetDriveTypeW and GetDriveTypeA must resolve through the shim registry rather than the host's, so a title that queries a drive letter gets the emulated answer. main's file_system.cpp does not install them, and the test says so by name.

Note for reviewers of the file_system changes: #2375 and #977 also touch this shim (MoveFile* onto a directory, and the file-system API), each with a control that bites. Three pull requests on one shim means two rebases whichever lands first - and the three cover different entry points, so none supersedes another.

What I did not test: the rest of the drive/volume surface, and whether the registry route matches the console's behaviour for drives that do not exist.

Why I am commenting: I verify open pull requests that replay onto current main, then revert only the source change. 28 controls so far: 23 bite.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7277033055 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1234#issuecomment-7277033055). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T11:26:42Z. --- Independent verification on this machine (Windows 11, MSVC 19.44.35226), with a negative control that bites. **1. It applies and builds.** `merge-tree` clean onto `main` `d367675c7`; `runtime/shims/file_system.cpp` plus its test. **2. With the branch:** `ctest -R 'file_system'` -> **100% tests passed, 0 failed out of 1**. **3. The control - revert only the shim, keep the test:** ``` git checkout origin/main -- runtime/shims/file_system.cpp cmake --build … --target file_system_test ctest -R 'file_system' --output-on-failure 0% tests passed, 1 tests failed out of 1 FAIL GetDriveTypeW/A resolve through the shim registry ``` **The assertion is the change**: `GetDriveTypeW` and `GetDriveTypeA` must **resolve through the shim registry** rather than the host's, so a title that queries a drive letter gets the emulated answer. `main`'s `file_system.cpp` does not install them, and the test says so by name. **Note for reviewers of the `file_system` changes:** **#2375 and #977 also touch this shim** (`MoveFile*` onto a directory, and the file-system API), **each with a control that bites**. **Three pull requests on one shim means two rebases** whichever lands first - and the three cover different entry points, so none supersedes another. **What I did not test:** the rest of the drive/volume surface, and whether the registry route matches the console's behaviour for drives that do not exist. **Why I am commenting:** I verify open pull requests that replay onto current `main`, then revert **only** the source change. **28 controls so far: 23 bite.** Written with an AI assistant.
aslan2142 commented 2026-12-01 16:34:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:34:11Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317823402 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1234#issuecomment-7317823402). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:34:11Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1234
No description provided.