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

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2227
Author: @matinsanei
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: feat/fs-disk-free-space


📝 Commits (2)

  • fbafd7c file_system: add GetDiskFreeSpaceA/W and GetDiskFreeSpaceExA/W for console roots (RT-FS-DISK-FREE-SPACE)
  • 1fb1c5e file_system: validate requested directory against mounted console view

📊 Changes

2 files changed (+162 additions, -0 deletions)

View changed files

📝 runtime/shims/file_system.cpp (+133 -0)
➕ tests/test_fs_disk_free_space.py (+29 -0)

📄 Description

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)

🔄 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/2227 **Author:** [@matinsanei](https://github.com/matinsanei) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/fs-disk-free-space` --- ### 📝 Commits (2) - [`fbafd7c`](https://github.com/ubiquitarianism/leonida/commit/fbafd7cd2ab3be7b5aca78bb73efd8c5807c9a01) file_system: add GetDiskFreeSpaceA/W and GetDiskFreeSpaceExA/W for console roots (RT-FS-DISK-FREE-SPACE) - [`1fb1c5e`](https://github.com/ubiquitarianism/leonida/commit/1fb1c5e270e8a619fda427ab8fb08a1717ecb3c1) file_system: validate requested directory against mounted console view ### 📊 Changes **2 files changed** (+162 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/file_system.cpp` (+133 -0) ➕ `tests/test_fs_disk_free_space.py` (+29 -0) </details> ### 📄 Description 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) --- <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#2231
No description provided.