file_system: add GetDiskFreeSpaceA/W and GetDiskFreeSpaceExA/W for console roots (RT-FS-DISK-FREE-SPACE) #2227

Merged
leonida/mandy
matinsanei merged 2 commits from feat/fs-disk-free-space into main 2026-11-28 09:49:06 +00:00

Pull request successfully merged and closed

matinsanei commented 2026-11-26 07:52:17 +00:00

Claimed in the coordination issue as: RT-FS-DISK-FREE-SPACE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7185888432)

What and why

Adds shims for GetDiskFreeSpaceA, GetDiskFreeSpaceW, GetDiskFreeSpaceExA, and GetDiskFreeSpaceExW to runtime/shims/file_system.cpp:

  • Resolves console paths (e.g. GAME:\, G:\, T:\) to the mapped host directories (r.game, r.overlay, r.scratch) before calling the host API.
  • If a root path is null or host-qualified, it delegates directly to host Win32 GetDiskFreeSpace[Ex]W.
  • If the directory does not exist or has not been mounted yet, it falls back to reporting standard Xbox console capacity figures (500 GB free / 1000 GB total) to prevent early storage assertion failures during title asset streaming and save verification.
  • Exports are bound across kernel32.dll, kernelbase.dll, and API set forwards.
  • Added standard regression test tests/test_fs_disk_free_space.py.

Tested

  • python -I tests/test_fs_disk_free_space.py: Passed (1/1).
  • python -I tests/test_text_write_line_endings.py: Passed (3/3).
  • python3 scripts/check_no_game_data.py: Clean (0 errors).
  • Built runtime with CMake/Ninja on Linux (150/150 targets).

GPUs tested: n/a (file system shim)

AI-assisted: yes (Antigravity)

Checklist

  • Based on current main and merges cleanly
  • One topic; follow-up work goes in a new pull request.
  • 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. (n/a)
Claimed in the coordination issue as: RT-FS-DISK-FREE-SPACE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7185888432) ### What and why Adds shims for `GetDiskFreeSpaceA`, `GetDiskFreeSpaceW`, `GetDiskFreeSpaceExA`, and `GetDiskFreeSpaceExW` to `runtime/shims/file_system.cpp`: - Resolves console paths (e.g. `GAME:\`, `G:\`, `T:\`) to the mapped host directories (`r.game`, `r.overlay`, `r.scratch`) before calling the host API. - If a root path is null or host-qualified, it delegates directly to host Win32 `GetDiskFreeSpace[Ex]W`. - If the directory does not exist or has not been mounted yet, it falls back to reporting standard Xbox console capacity figures (500 GB free / 1000 GB total) to prevent early storage assertion failures during title asset streaming and save verification. - Exports are bound across `kernel32.dll`, `kernelbase.dll`, and API set forwards. - Added standard regression test `tests/test_fs_disk_free_space.py`. ### Tested - `python -I tests/test_fs_disk_free_space.py`: Passed (1/1). - `python -I tests/test_text_write_line_endings.py`: Passed (3/3). - `python3 scripts/check_no_game_data.py`: Clean (0 errors). - Built runtime with CMake/Ninja on Linux (150/150 targets). GPUs tested: n/a (file system shim) AI-assisted: yes (Antigravity) ### Checklist - [x] Based on current `main` and merges cleanly - [x] One topic; follow-up work goes in a new pull request. - [x] 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. (n/a)
copilot-pull-request-reviewer[bot] reviewed 2026-11-26 07:52:31 +00:00
copilot-pull-request-reviewer[bot] left a comment
No description provided.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
lixonik reviewed 2026-11-26 08:47:42 +00:00
lixonik left a comment
No description provided.
The new source check and the native `file_system` CTest pass. I exercised the new exports through the real shim registry with synthetic package and overlay roots and found a Win32 behavior mismatch below. No game files. AI-assisted.
matinsanei reviewed 2026-11-26 10:11:50 +00:00
lixonik reviewed 2026-11-26 10:32:31 +00:00
MoonEyes commented 2026-11-28 09:48:58 +00:00

Red/green: tests/test_fs_disk_free_space.py fails on main (1 failed) and passes with this PR (1 passed).
Runtime batch of 20 PRs tested by OreoFR (full build, ctest without the game, Python suite, translator): same results as main 09c153948, RTX 4070 Laptop / Windows 11.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: tests/test_fs_disk_free_space.py fails on main (1 failed) and passes with this PR (1 passed). Runtime batch of 20 PRs tested by OreoFR (full build, ctest without the game, Python suite, translator): same results as main 09c153948, RTX 4070 Laptop / Windows 11. AI-assisted (Claude Code, Claude Opus 5.5)
OreoFR commented 2026-11-28 22:00:15 +00:00

Verified by OreoFR

  • Base: main 09c153948 + PR head 1fb1c5e27; integration package 1 of 6 (20 PRs, merged without conflict)
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite
  • Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps)
  • Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures
  • Verdict: CLEAN PACKAGE (no new failure vs 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).

**Verified by OreoFR** - Base: main `09c153948` + PR head `1fb1c5e27`; integration package 1 of 6 (20 PRs, merged without conflict) - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite - Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps) - Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures - Verdict: CLEAN PACKAGE (no new failure vs 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).
Sign in to join this conversation.
No description provided.