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>
build_runtime.ps1 and build_llvm_mc.ps1 started the generated batch with
`cmd.exe /c "path"`. cmd.exe drops those quotes when the path holds a
special character such as & or ^, then runs only the part before it, so a
checkout (build_runtime) or -Temp/%TEMP% (build_llvm_mc) in a folder like
`a & b` failed at once with "C:\...\a is not recognized". With /s and a
second pair of quotes, cmd.exe strips only the outer pair.
tests/test_build_batch_launch.py takes each script's launch line as written
and runs it on a stub batch in folders named plain, `a & b`, `a&b`, `x^y`,
`sp (x)` and `東京 & co`: the stub must run and its exit code (0 and 7) must
come back. It also checks that the old form fails there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A GDK title links the XUser* functions statically (xgameruntime.lib); each
thunk asks QueryApiImpl for XUserImpl and calls one slot with the function's
arguments after `this` (docs/runtime_imports.md). QueryApiImpl refused the
class, so XUserAddAsync, the call a title makes at boot before nearly
anything else, could not succeed.
runtime/shims/xgameruntime_user.cpp serves it, in its own file so the other
class PRs touching xgameruntime.cpp only meet it at one line:
- ids and slot order from xgameruntime-docs (facts only), signatures, enum
values and E_GAMEUSER_* codes from the public GDK reference;
- IXUserImpl..IXUserImpl6 answer with one 50-slot vtable, IXUserGamertagImpl
(XUserGetGamertag) with a second;
- one offline user, always signed in: XUserAddAsync (silent or not;
AllowGuests with AddDefaultUserSilently is E_INVALIDARG), fixed ids,
FindUserById/ByLocalId, Duplicate/Close/Compare, not a guest, adult, every
privilege, ResolvePrivilegeWithUi, AddByIdWithUi, IsStoreUser, change-event
tokens; gamertag from LEONIDA_GAMERTAG, "Player" otherwise;
- tokens, gamer picture, MSA tokens and resolve-issue fail synchronously
before starting; no sign-out deferral; private and PC-only slots log once.
xgameruntime_user_test (40 checks) drives every served slot; a second ctest
run checks LEONIDA_GAMERTAG.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- tests/semantic: BaseVertex/BaseInstance read 0 in the wave interpreter; the LDS MockGens follow
SHADER-309 (lds_bound, lds_access, lds_atomic); abs emission tests load their operand, since
SHADER-315 folds scalar ALU on constants.
- test_translate: the dynamic gather sampler is a loaded word, not s16 + 0 (SHADER-315 folds it).
- test_world_build: DDS downscale weights colours by alpha (62804d0d).
- test_fspx_shaders_stage: the fake disassembler writes the listing make_game now checks.
- xgameruntime_test: re-read the package id after clearing the LEONIDA_PACKAGE_ID override.
- docs: one row per topic again in design.md (72 topics) and README.md; one Other languages line;
embedded_shaders.md keeps one copy of each bullet; animation.md links the heading anchor.
- tools/scripts: character_textures uses report_paths.same_report_path; stdout guard on six programs;
LF write in vs_input_survey; the cl.exe fallback compiles winhttp_offline.cpp.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without Vulkan headers everything under if(TARGET Vulkan::Headers) is left
out: the D3D12 COM objects, the Vulkan D3D12 device in gta6rt
(LEONIDA_D3D12=vulkan) and most of ctest. The only output was a STATUS line
naming four test tools, so a build whose VULKAN_SDK never reached CMake ran
45 of 125 tests and reported "100% tests passed".
- runtime/cmake/vulkan_headers_missing.cmake: a WARNING that names what is
left out and that CMakeCache.txt keeps the failed lookup.
- LEONIDA_REQUIRE_VULKAN=ON turns it into a configure error; both CI
configures pass it, and scripts/build_runtime.ps1 does when VULKAN_SDK is set.
- tests/test_cmake_vulkan_missing.py runs the module with cmake -P and checks
that CMakeLists.txt and CI use it; docs/testing.md gets a troubleshooting row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main.cpp calls rt::fs::configure (GAME: paths), but the direct-cl.exe
fallback (VS Build Tools without the CMake component) left
shims/file_system.cpp out of the launcher's sources, so gta6rt failed to
link (LNK2019/LNK1120, found by @Ingenioeren). Added to $files.
test_build_runtime_fallback: every .cpp in CMake's add_executable(gta6rt
...) must be in the fallback's launcher list, so the two can't drift apart
again (fails before this change on shims\file_system.cpp).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The package's GDK modules don't import xgameruntime.dll. libHttpClient.GDK.dll and XCurl.dll have no import
entry for it, but both carry the wide string "xgameruntime.dll" and the names InitializeApiImpl[Ex|Ex2],
QueryApiImpl and UninitializeApiImpl next to a statically linked XGameRuntimeInitialize: xgameruntime.lib's
thunks LoadLibraryW the runtime and GetProcAddress those names. Bound to the host, that bypasses the offline
shim. The executable is very likely built the same way.
- library_loader.cpp: LoadLibrary*/GetModuleHandle*/GetProcAddress/FreeLibrary for kernel32, kernelbase and the
api-ms-win-core-libraryloader sets. A module the registry owns (rt::shims::owns_dll) gets a pseudo-handle and
GetProcAddress resolves through the registry; an unserved name is NULL with ERROR_PROC_NOT_FOUND. Every other
module goes to the host.
- xgameruntime.cpp: the five entry points, with the signatures and the unknown-class error documented by
xodus-gaming/xgameruntime-docs (GPL-3.0, facts only). QueryApiImpl logs the class and interface ids and refuses
them, so the first boot with the executable names the COM interfaces to implement.
- xgameruntime_test drives the path through XCurl.dll's api-set binding; docs/runtime_imports.md records the
measurement and the new dry-run counts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without VS's "C++ CMake tools" component, build_runtime.ps1 compiles
with cl.exe directly, and that list never built vk_compute_test,
vk_store_test or vk_harness (the programs check.py and run_gpu_tests.py
require and valu_fuzz.py/lds_fuzz.py run), nor vk_image_fuzz
(image_fuzz.py's harness). TEST-71 on that path stopped at
"vk_compute_test not found". Build them the way the fallback builds
vk_texture_test. tests/test_build_runtime_fallback.py checks that the
fallback builds every harness those tools name and that each source it
compiles exists.
Found by @derekhearst.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shim is built with an installed SDL3 (find_package) or with
-DLEONIDA_SDL3_FETCH=ON / FETCHCONTENT_SOURCE_DIR_SDL3; otherwise configure
prints a message, gta6rt builds without it, and CTest lists gameinput as
disabled. build_runtime.ps1 gains -FetchSdl3 and warns that its cl.exe
fallback never builds the shim. Review nits: delivering_thread is atomic,
and SDL's own GameInput joystick driver is pinned off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fallback block (no VS CMake tools) built vk_texture_test when
VULKAN_SDK is set but not the two tests this branch adds. They are built
the same way now: both include their headers by relative path and need no
library.
Not run here: this machine has no MSVC or PowerShell. The two sources
build with MSVC through CMake (reported on the pull request).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Wrap the PC ID3D12Device in a copied-vtable proxy: per-slot thunks swap `this` to the PC device, with IUnknown refcounting/QueryInterface, per-slot hit counters and XS_TRACE=1 first-call logging.
- Override Xbox slot 62 to the PC CreateComputePipelineState (PC slot 62 is CreateStateObject) and Xbox slot 76 to CreateCommittedResource (PC slot 27). The 56-byte description prefix is copied and its 0x101/0x1 layout word replaced by ROW_MAJOR for buffers and UNKNOWN for textures.
- Slot 14 wraps the created descriptor heap. On the measured PC runtime the heap getters take the hidden return pointer in RDX, while the Xbox ABI expects the 8-byte handle in RAX; heap slots 9/10 convert between them. Device slots 9/10 stay CreateCommandAllocator/CreateGraphicsPipelineState, because the measured handle getters are ID3D12DescriptorHeap methods.
- Heap slot 7 GetDevice returns the device proxy, not the raw PC device. The heap holds a device-proxy reference, so GetDevice cannot dangle; the device proxy does not reference heap proxies, so there is no cycle.
- Add device_proxy_test (WARP, no game executable): shim-created proxy, QI/refcount, slot 14 heap, heap GetDevice/refcount, raw RAX handles vs the PC hidden-pointer result, slot 9/16/30/43 forwarding, slot 76 buffer and texture, slot 62 compute PSO, and counter checks. Register it with ctest.
- Wire both CMake and scripts/build_runtime.ps1.
Verified against Windows SDK 10.0.26100 d3d12.h (slot counts through ID3D12Device14; no Device15/16 exists there) and a live WARP device. Still unknown: PresentX, queue/fence/command-list extensions, Xbox vtable order beyond the measured slots, and struct returns other than the heap handles.
Clean-room: implemented from the measured ABI-facts spec; no americas-recomp or AnyPS5 source was read or copied.
- xmem: XMemVirtualQuery(process, address, out64) fills the known MEMORY_BASIC_INFORMATION prefix and zeroes the rest; the working-set size goes at +8 with a TRUE return; allocator alignment and size-0 behaviour are documented.
- d3d12_xs: copy root-signature descriptors and clear the Xbox high flag byte (0x03000000) before forwarding to the PC serializer; add the legacy serializer; keep the deserializer.
- d3d12_xs: add D3D12XboxCreateDevice, create a PC device and log the 24-word params block. The Xbox ABI proxy is not implemented; measured slot overrides are documented as TODO and logged at runtime.
- test: root_sig_test serializes synthetic flags=0x03000000 descriptors through the PC d3d12.dll, checks the untouched copy is rejected and the cleared copy is accepted, and exercises the registered shim.
Clean-room: implemented from an ABI-facts spec derived from public write-ups; no source from americas-recomp or AnyPS5 was read or copied.
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V),
asset export via rpf9-explorer's Core (submodule), PE loader and shim
skeleton, and make_game.py, which builds from the user's own copy of the game.
No game data, keys or executables are included.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>