[PR #1234] file_system: shim GetDiskFreeSpaceExA/W, GetDiskFreeSpaceA/W, and GetDriveTypeA/W (RT-FS-DISK-SPACE) #1266

Open
opened 2026-11-26 20:20:39 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1234
Author: @piyonchu
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: pr/file-system-disk-space


📝 Commits (1)

  • 83ef3ee file_system: shim GetDiskFreeSpaceExA/W, GetDiskFreeSpaceA/W, and GetDriveTypeA/W for GAME:, G:, and T: (RT-FS-DISK-SPACE)

📊 Changes

2 files changed (+370 additions, -10 deletions)

View changed files

📝 runtime/shims/file_system.cpp (+197 -10)
📝 runtime/test/file_system_test.cpp (+173 -0)

📄 Description

Summary

Claim ID: RT-FS-DISK-SPACE

Shims GetDiskFreeSpaceExA/W, GetDiskFreeSpaceA/W, and GetDriveTypeA/W in runtime/shims/file_system.cpp (registered across kernel32.dll, kernelbase.dll, and api-ms-win-core-file-l1-{1,2}-0.dll / l2-1-0.dll) for console paths (GAME:, G:, and T:):

  • Resolves read-only console queries through resolve_console_readonly_dir + parse_console_parts(..., create_scratch=false) using win32_io_path, so querying T:\ or missing console directories does not create .gta6rt-temp or overlay on disk.
  • Preserves overlay-over-package precedence and deletion markers (ERROR_PATH_NOT_FOUND for GetDiskFreeSpaceEx* / DRIVE_NO_ROOT_DIR for GetDriveType*, ERROR_FILE_NOT_FOUND for GetDiskFreeSpace*, ERROR_DIRECTORY for files, ERROR_INVALID_NAME for escaped/reserved paths).
  • GetDriveTypeA/W checks is_root and delegates volume type lookup via GetVolumePathNameW.
  • Adds host-comparison and edge-case tests in runtime/test/file_system_test.cpp.

Verification

  • Host: Windows 11 (10.0.26200), MSVC 19.44.35228.0 (RelWithDebInfo), CMake configure & build for file_system_test and gta6rt.
  • ctest --test-dir runtime/build -C RelWithDebInfo -R file_system --output-on-failure: 1/1 Test #56: file_system ... Passed (1.10 sec).
  • git diff --check: clean.
  • No game files used; CPU/filesystem shim test only (no GPU required). AI-assisted.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1234 **Author:** [@piyonchu](https://github.com/piyonchu) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/file-system-disk-space` --- ### 📝 Commits (1) - [`83ef3ee`](https://github.com/ubiquitarianism/leonida/commit/83ef3eea92eb72c615b003c04556e4a05d7d86ae) file_system: shim GetDiskFreeSpaceExA/W, GetDiskFreeSpaceA/W, and GetDriveTypeA/W for GAME:, G:, and T: (RT-FS-DISK-SPACE) ### 📊 Changes **2 files changed** (+370 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/file_system.cpp` (+197 -10) 📝 `runtime/test/file_system_test.cpp` (+173 -0) </details> ### 📄 Description ### Summary Claim ID: `RT-FS-DISK-SPACE` Shims `GetDiskFreeSpaceExA/W`, `GetDiskFreeSpaceA/W`, and `GetDriveTypeA/W` in `runtime/shims/file_system.cpp` (registered across `kernel32.dll`, `kernelbase.dll`, and `api-ms-win-core-file-l1-{1,2}-0.dll` / `l2-1-0.dll`) for console paths (`GAME:`, `G:`, and `T:`): - Resolves read-only console queries through `resolve_console_readonly_dir` + `parse_console_parts(..., create_scratch=false)` using `win32_io_path`, so querying `T:\` or missing console directories does not create `.gta6rt-temp` or `overlay` on disk. - Preserves overlay-over-package precedence and deletion markers (`ERROR_PATH_NOT_FOUND` for `GetDiskFreeSpaceEx*` / `DRIVE_NO_ROOT_DIR` for `GetDriveType*`, `ERROR_FILE_NOT_FOUND` for `GetDiskFreeSpace*`, `ERROR_DIRECTORY` for files, `ERROR_INVALID_NAME` for escaped/reserved paths). - `GetDriveTypeA/W` checks `is_root` and delegates volume type lookup via `GetVolumePathNameW`. - Adds host-comparison and edge-case tests in `runtime/test/file_system_test.cpp`. ### Verification - Host: Windows 11 (`10.0.26200`), MSVC `19.44.35228.0` (`RelWithDebInfo`), CMake configure & build for `file_system_test` and `gta6rt`. - `ctest --test-dir runtime/build -C RelWithDebInfo -R file_system --output-on-failure`: `1/1 Test #56: file_system ... Passed (1.10 sec)`. - `git diff --check`: clean. - No game files used; CPU/filesystem shim test only (no GPU required). AI-assisted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1266
No description provided.