[PR #131] [MERGED] runtime: restore the console DirectStorage shim, with the typed-error inflate it needs (RT-DSTORAGE-RESTORE, #47) #184

Closed
opened 2026-11-26 20:17:04 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/131
Author: @Mumogg
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: restore-directstorage


📝 Commits (1)

  • 2d7be48 runtime: restore the console DirectStorage shim (DStorageGetFactory) on main

📊 Changes

8 files changed (+3042 additions, -31 deletions)

View changed files

➕ docs/directstorage.md (+197 -0)
📝 runtime/CMakeLists.txt (+21 -0)
➕ runtime/shims/dstorage.cpp (+1125 -0)
➕ runtime/shims/dstorage_xs_abi.h (+387 -0)
📝 runtime/shims/registry.cpp (+5 -2)
📝 runtime/src/shader_library.h (+46 -28)
➕ runtime/test/dstorage_test.cpp (+1260 -0)
📝 scripts/build_runtime.ps1 (+1 -1)

📄 Description

Claimed in #14 as RT-DSTORAGE-RESTORE. Addresses #47 (stop 5 of docs/retail_boot_chain.md).

What and why

The merge that brought the mirrored pull requests into main (6dece9231) did not take the DirectStorage shim; its message says it "needs the typed-error zlib inflate". The shim's commits (f87d05fdd, ac1843da2 by mariuslozo-boop, 00551ba00 by Kelebek) are ancestors of main, but the files are not in the tree, so XCRDAPI.dll!DStorageGetFactory is the one unimplemented import #47 reports, and a plain merge of those commits is a no-op.

  • shims/dstorage.cpp, shims/dstorage_xs_abi.h, test/dstorage_test.cpp and docs/directstorage.md are back, byte for byte as those commits left them. None of this code is mine.
  • leonida::zlib_inflate takes an optional ZlibError* why (header, data, checksum, limit), which the shim turns into its E_DSTORAGE_ZLIB_* codes. It is the interface the shim was written against, added to main's current table-driven inflater. A caller that passes no pointer gets the same bool as before. This is the part I wrote.
  • registry.cpp classes xcrdapi.dll!DStorageGetFactory as an HRESULT import: the retail spelling #47 found missing from the policy class.
  • CMake and scripts/build_runtime.ps1 build the shim into gta6rt (with /EHa for that file under clang-cl, as before); CMake builds and registers dstorage_test.

Measured

Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off.

  • The import listing changes from UNIMPLEMENTED XCRDAPI.dll!DStorageGetFactory to shim (shim=94, unimplemented=0).
  • --run on main + this + #127 (under Wine the title stops earlier without #127): 0 D3D12 calls before, D3D12XboxCreateDevice ok after. The next stop is in the host at device slot 26, the first forwarded call (stop 7 of the chain document).
  • shader_library_test under Wine: passes, including its inflate cases (stored, fixed, dynamic, truncated, bad Adler-32, over the limit).
  • dstorage_test under Wine: 329 checks, 2 failures, both in the one case that holds a copy on a PAGE_GUARD page with a vectored handler (the copy reached the guard page, a running request is pending). I have not run it on Windows and do not know whether that case passes there on this tree; CI will say. I did not change the test.

Not done here

  • Not tested with MSVC or on Windows.
  • scripts/build_runtime.ps1 gets the source file added but I could not run that script.

AI-assisted (Claude Code); built and run on the machine above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt


🔄 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/131 **Author:** [@Mumogg](https://github.com/Mumogg) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `restore-directstorage` --- ### 📝 Commits (1) - [`2d7be48`](https://github.com/ubiquitarianism/leonida/commit/2d7be48dec529446e0ead3393e2b3acabb29ff64) runtime: restore the console DirectStorage shim (DStorageGetFactory) on main ### 📊 Changes **8 files changed** (+3042 additions, -31 deletions) <details> <summary>View changed files</summary> ➕ `docs/directstorage.md` (+197 -0) 📝 `runtime/CMakeLists.txt` (+21 -0) ➕ `runtime/shims/dstorage.cpp` (+1125 -0) ➕ `runtime/shims/dstorage_xs_abi.h` (+387 -0) 📝 `runtime/shims/registry.cpp` (+5 -2) 📝 `runtime/src/shader_library.h` (+46 -28) ➕ `runtime/test/dstorage_test.cpp` (+1260 -0) 📝 `scripts/build_runtime.ps1` (+1 -1) </details> ### 📄 Description Claimed in #14 as `RT-DSTORAGE-RESTORE`. Addresses #47 (stop 5 of `docs/retail_boot_chain.md`). ### What and why The merge that brought the mirrored pull requests into `main` (`6dece9231`) did not take the DirectStorage shim; its message says it "needs the typed-error zlib inflate". The shim's commits (`f87d05fdd`, `ac1843da2` by mariuslozo-boop, `00551ba00` by Kelebek) are ancestors of `main`, but the files are not in the tree, so `XCRDAPI.dll!DStorageGetFactory` is the one unimplemented import #47 reports, and a plain merge of those commits is a no-op. - `shims/dstorage.cpp`, `shims/dstorage_xs_abi.h`, `test/dstorage_test.cpp` and `docs/directstorage.md` are back, byte for byte as those commits left them. None of this code is mine. - `leonida::zlib_inflate` takes an optional `ZlibError* why` (`header`, `data`, `checksum`, `limit`), which the shim turns into its `E_DSTORAGE_ZLIB_*` codes. It is the interface the shim was written against, added to `main`'s current table-driven inflater. A caller that passes no pointer gets the same `bool` as before. This is the part I wrote. - `registry.cpp` classes `xcrdapi.dll!DStorageGetFactory` as an HRESULT import: the retail spelling #47 found missing from the policy class. - CMake and `scripts/build_runtime.ps1` build the shim into `gta6rt` (with `/EHa` for that file under clang-cl, as before); CMake builds and registers `dstorage_test`. ### Measured Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off. - The import listing changes from `UNIMPLEMENTED XCRDAPI.dll!DStorageGetFactory` to `shim` (`shim=94`, `unimplemented=0`). - `--run` on `main` + this + #127 (under Wine the title stops earlier without #127): 0 D3D12 calls before, `D3D12XboxCreateDevice ok` after. The next stop is in the host at device slot 26, the first forwarded call (stop 7 of the chain document). - `shader_library_test` under Wine: passes, including its inflate cases (stored, fixed, dynamic, truncated, bad Adler-32, over the limit). - `dstorage_test` under Wine: 329 checks, **2 failures**, both in the one case that holds a copy on a `PAGE_GUARD` page with a vectored handler (`the copy reached the guard page`, `a running request is pending`). I have not run it on Windows and do not know whether that case passes there on this tree; CI will say. I did not change the test. ### Not done here - Not tested with MSVC or on Windows. - `scripts/build_runtime.ps1` gets the source file added but I could not run that script. AI-assisted (Claude Code); built and run on the machine above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:04 +01:00
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#184
No description provided.