fix(dstorage): read titles' requests with the Xbox dstorage_xs.h layout #25
No reviewers
Labels
No labels
accessibility
bug
cross-platform
documentation
duplicate
enhancement
gdk-shims
good first issue
graphics
hardware-report
help wanted
invalid
question
shaders
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/californiaAlmonds--OpenScarlett!25
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/25/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Ahmet-Dedeler on GitHub · 2026-11-22 17:34 UTC · original
Ahmet-Dedeler:fix/xbox-dstorage-request-layout→main· +877 −174 · 14 files · 3 commits · merged 2026-11-22 18:50 UTCWhat
IDStorageQueueX::EnqueueRequestdeclaredDSTORAGE_REQUESTwith the PCdstorage.hshape. A title built against Xboxdstorage_xs.hpasses the 0x48-byte Xbox struct, so every field was read at the wrong offset (reported as a crash inside XCRDAPI.dll).CreateQueuehad the same problem:DSTORAGE_QUEUE_DESC::SourceTypeis a UINT64 enum on Xbox (Capacity at +0x08, Name at +0x10), and the shim's extraDevicefield meant it read the title's Name from the Capacity bytes.Layouts from the public GDK reference:
The same request layout is in Microsoft's MIT Xbox-GDK-Samples,
Samples/System/SimpleDirectStorageCombo/DirectStorageWin32/dstorage_win32.h.Changes
dstorage_abi.h: XboxDSTORAGE_REQUEST,DSTORAGE_REQUEST_OPTIONS(Zlib bit 0, BcpackMode 1-4, SwizzleMode 5-20, DestinationIsPhysicalPages 21, SourceType 22, SourceIsPhysicalPages 23),DSTORAGE_QUEUE_DESC,DSTORAGE_QUEUE_INFO,DSTORAGE_ERROR_RECORD(0x290), BCPACK/SWIZZLE/COMMAND_TYPE enums. AlsoDSTORAGE_MAX_QUEUE_CAPACITYis now 0x2000 (it said 2000 decimal). static_asserts on every size and offset.OpenScarlettDStorageRequestDesc, a host extension for GDeflate and D3D12 destinations, sent through a newOpenScarlettDStorageEnqueueRequestDescexport. Queue devices move toOpenScarlettDStorageSetQueueDevice.EnqueueRequestdecodes the option word. Zlib/BCPack requests fail withE_DSTORAGE_DECOMPRESSION_ERRORbecause the shim's ZLIB/BCPACK codecs are its own synthetic container, not RFC 1950 or console BCPack. Swizzle, physical-page and reserved bits fail withE_INVALIDARG.RetrieveErrorRecordfills inFirstFailure.Request.dstorage_xs.huse the Xbox layout. The MS sample runner now builds on its_GAMING_XBOX_SCARLETTpath.test_dstorage_xbox_request_layout: it writes each field at its documented byte offset into a raw buffer with poisoned padding, then checks memory copies, option decoding, the error record, CancelRequestsWithTag and (on Windows) file reads.Testing
__uuidofand XAsync).ctestbefore merging.Follow-up, not in this PR: real zlib (RFC 1950) inflate for
ZlibDecompressrequests. The IIDs and vtable order were not audited.@marquezinii on GitHub · 2026-11-22 17:55 UTC · original
Tested
0958c5c(on current main85e2d3d) on an RTX 5070, driver 621.24, Windows 11 26H2 (26300), VS Build Tools 18 (MSVC 14.52), SDK 10.0.26100.0:ctest: 61/63 passed. The newtest_dstorage_xbox_request_layoutpasses, as dotest_xg_dstorage,test_dstorage_audio_diag_parity,test_gdk_shims,test_s12_streaming_vramand the GDK sample tests.test_rdna2_corpus_benchandtest_rdna2_gpu_accuracy, fail the same way on main without this PR. NVIDIA's driver rejects themem_ds_atomicspipeline (E_OUTOFMEMORYon a groupshared atomic add of a negated value), so they're unrelated to DirectStorage. Fix and reproducer in #26.@californiaAlmonds on GitHub · 2026-11-22 18:50 UTC · original · approved these changes
Huge Xbox dstorage_xs.h ABI accuracy fix with comprehensive offset static_asserts and layout tests, and 4/4 CI jobs are green. Thanks @Ahmet-Dedeler!