diff options
| author | mariuslozo-boop <254631011+mariuslozo-boop@users.noreply.github.com> | 2026-11-23 01:48:51 +0100 |
|---|---|---|
| committer | mariuslozo-boop <254631011+mariuslozo-boop@users.noreply.github.com> | 2026-11-23 01:48:51 +0100 |
| commit | f87d05fdd3a96b5f42e712d376cfc0b9b4e398d5 (patch) | |
| tree | 6ec9160e28831d6d4a7170e9b06249cc0658827d /scripts/build_runtime.ps1 | |
| parent | 03b09a086592a197db64d91655c6e65c30764d96 (diff) | |
runtime: console DirectStorage (DStorageGetFactory) with file-to-memory reads
Serve the Xbox DirectStorage API (IDStorageFactoryX2, IDStorageQueueX2,
IDStorageFileX, IDStorageStatusArrayX) under dstorage_xs.dll, xcrdapi.dll and
dstorage.dll. Declarations are our own (shims/dstorage_xs_abi.h), written from
the public GDK reference; layouts are pinned with static_asserts.
- OpenFile goes through the registry's kernel32!CreateFileW, so GAME: paths use
the console path mapping and the write overlay. GetHandle returns a ReOpenFile
handle with its own file position.
- One worker thread per queue runs submitted entries in order: file and memory
requests, status arrays, ID3D12Fence::Signal, EnqueueSetEvent (on a duplicate
of the title's handle taken at enqueue).
- Auto-submit at half the capacity (or disabled through DSTORAGE_QUEUE_OPTIONS),
enqueue into a full queue waits, CancelRequestsWithTag (a cancelled request is
a success and not a failure), error record and error event, Close and the last
Release drain the queue, IDStorageFileX::Close waits for the file's submitted
reads.
- Request checks: reserved bits, source type, BCPack/swizzle ranges, sizes,
1 GiB limit, null and foreign objects and closed files (also for zero-size
requests), end of file, inaccessible memory.
- zlib, BCPack, swizzle and physical pages return E_NOTIMPL (later PRs).
- Interface ids of the X interfaces are not public: a creating call accepts and
logs a new id per object kind, but refuses system COM ids (IMarshal,
IAgileObject, ...) and the PC DirectStorage ids; QueryInterface accepts only
IUnknown, the PC IDStorageStatusArray id (same shape) and the ids creating
calls accepted for that kind. Bad arguments are logged once per method.
- registry.cpp classifies xcrdapi.dll!DStorageGetFactory as HRESULT; the cl.exe
fallback in build_runtime.ps1 builds the new shim too.
ctest dstorage: 258 checks over synthetic files in %TEMP%, no GPU, no game data.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts/build_runtime.ps1')
| -rw-r--r-- | scripts/build_runtime.ps1 | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/build_runtime.ps1 b/scripts/build_runtime.ps1 index 46dc10291..fd674b281 100644 --- a/scripts/build_runtime.ps1 +++ b/scripts/build_runtime.ps1 | |||
| @@ -38,7 +38,7 @@ if ((Test-Path $cmake) -and (Test-Path $ninja)) { | |||
| 38 | Write-Warning "VS C++ CMake tools not found: building with cl.exe directly, without the GameInput shim (SDL3). Install the CMake tools component to get it." | 38 | Write-Warning "VS C++ CMake tools not found: building with cl.exe directly, without the GameInput shim (SDL3). Install the CMake tools component to get it." |
| 39 | $xtaskqueueDir = Join-Path $root "third_party\xtaskqueue" | 39 | $xtaskqueueDir = Join-Path $root "third_party\xtaskqueue" |
| 40 | $xtaskqueueFiles = "Source\Task\TaskQueue.cpp", "Source\Task\AsyncLib.cpp", "Source\Task\ThreadPool_win32.cpp", "Source\Task\WaitTimer_win32.cpp" | ForEach-Object { "`"$xtaskqueueDir\$_`"" } | 40 | $xtaskqueueFiles = "Source\Task\TaskQueue.cpp", "Source\Task\AsyncLib.cpp", "Source\Task\ThreadPool_win32.cpp", "Source\Task\WaitTimer_win32.cpp" | ForEach-Object { "`"$xtaskqueueDir\$_`"" } |
| 41 | $files = "src\main.cpp", "src\pe_loader.cpp", "shims\registry.cpp", "shims\file_system.cpp", "shims\xmem.cpp", "shims\d3d12_xs.cpp", "shims\d3d12_xs_device.cpp", "shims\d3d12_xs_rootsig.cpp", "shims\xgameruntime.cpp", "shims\winhttp_offline.cpp", "shims\library_loader.cpp", "shims\process.cpp" | ForEach-Object { "`"$src\$_`"" } | 41 | $files = "src\main.cpp", "src\pe_loader.cpp", "shims\registry.cpp", "shims\file_system.cpp", "shims\xmem.cpp", "shims\d3d12_xs.cpp", "shims\d3d12_xs_device.cpp", "shims\d3d12_xs_rootsig.cpp", "shims\xgameruntime.cpp", "shims\winhttp_offline.cpp", "shims\library_loader.cpp", "shims\process.cpp", "shims\dstorage.cpp" | ForEach-Object { "`"$src\$_`"" } |
| 42 | $includes = "/I `"$src\src`" /I `"$src\shims`" /I `"$src\shims\xtaskqueue`" /I `"$xtaskqueueDir\Include`" /I `"$xtaskqueueDir\Source\Task`" /I `"$xtaskqueueDir\Source\Common`"" | 42 | $includes = "/I `"$src\src`" /I `"$src\shims`" /I `"$src\shims\xtaskqueue`" /I `"$xtaskqueueDir\Include`" /I `"$xtaskqueueDir\Source\Task`" /I `"$xtaskqueueDir\Source\Common`"" |
| 43 | $opt = if ($Debug) { "/Od /MDd" } else { "/O2 /MD" } | 43 | $opt = if ($Debug) { "/Od /MDd" } else { "/O2 /MD" } |
| 44 | $body = @" | 44 | $body = @" |