Skip to content

xgameruntime: serve XGameStreamingImpl and XLauncherImpl offline - #4248

Open
Vonsek wants to merge 3 commits into
ItsNotRexed:mainfrom
Vonsek:claude/rt-streaming
Open

Vonsek wants to merge 3 commits into
ItsNotRexed:mainfrom
Vonsek:claude/rt-streaming

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Requested by Lucas · project thread

Claimed in the coordination issue as: EGEN-RT-STREAMING, #4084 (comment)

What and why

QueryApiImpl refused XGameStreamingImpl (class 0a2192aa-b2d5-4d58-83be-383b6d80799e, IXGameStreamingImpl..3) and XLauncherImpl (1b339674-328d-4283-a200-3171f18d3639); #3476 lists both as not served. They are now served in runtime/shims/xgameruntime_streaming.cpp, hooked in with one line in QueryApiImpl. Slot order follows xgameruntime-docs, signatures the public GDK reference. No package DLL calls them in a way this PR measured, so the table says the slots are not measured.

The port is not streamed to anyone and has no console shell:

  • XGameStreamingIsStreaming false, client count 0, GetClients returns none, every connection state Disconnected, connection-state registrations return a token that never fires (Unregister true once);
  • every call that names a client fails with HRESULT_FROM_WIN32(ERROR_NOT_FOUND), clearing outputs whose type is known; touch-control updates succeed and do nothing; SetResolution and XLaunchUri fail with ERROR_NOT_SUPPORTED (the URI is not logged);
  • XDisplayAcquireTimeoutDeferral hands out a handle, XDisplayCloseTimeoutDeferralHandle takes it back;
  • four slots past IXGameStreamingImpl3 that xgameruntime-docs does not list (35-38) answer 0 and log once.

XGameStreamingClientId's size is not in the pages read; on x64 a structure larger than 8 bytes is passed by pointer in the same register, so the argument positions hold either way.

Touches runtime/shims/xgameruntime.cpp (6 lines) and the source lists in runtime/CMakeLists.txt and scripts/build_runtime.ps1. #4235, #4239 and #3657 add a line at the same spot in QueryApiImpl; whichever lands later needs a trivial merge.

Tested

Windows 11, MSVC 2022 Build Tools, RelWithDebInfo. No GPU involved.

  • xgameruntime_streaming_test (new, ctest xgameruntime_streaming): 35 checks, 0 failures.
  • xgameruntime_test: OK (106 checks); gta6rt builds.
  • Negative control: making XGameStreamingIsStreaming return true fails XGameStreamingIsStreaming is false; reverted.

AI-assisted.

Checklist

  • 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. (No translator change.)

QueryApiImpl serves both classes as a console nobody streams from and with
no shell: not streaming, no clients (client calls fail with ERROR_NOT_FOUND),
touch-control updates do nothing, XLaunchUri and SetResolution are not
supported, and the screen-timeout deferral hands out a handle.
xgameruntime_streaming_test calls every slot.

AI-assisted.
@ray3242

ray3242 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Independent check of 1a2ae8c1 on a second toolchain: clang-cl 21 cross-build (xwin, Windows SDK 10.0.26100, RelWithDebInfo), run under Wine 11 on Ubuntu 22.04. No GPU involved.

  • xgameruntime_streaming_test: 35 checks, 0 failures, in 3 of 3 runs.
  • xgameruntime_test: OK (106 checks). gta6rt.exe links.
  • No new warnings under /W4. Every source list that compiles shims/xgameruntime.cpp (gta6rt, xgameruntime_test, the new test, and the cl.exe fallback in build_runtime.ps1) also gets the new file.

Heads-up: #4235, #4239 and #4248 each add a hook at the same spot in QueryApiImpl, a new test target at the same place in runtime/CMakeLists.txt, and an edit to the same $files line in build_runtime.ps1. git merge-tree shows each pair conflicting in all three files, so whichever two land after the first will need a rebase.

AI-assisted (Devin).

@SweatierKey

Copy link
Copy Markdown
Contributor

Independent code read + build/hygiene check at 1a2ae8c1 on Linux (WSL2, Python 3.13.5, no Windows/MSVC host, no game files): pass (Windows MSVC build & CTest execution still needed).

  • Code read (runtime/shims/xgameruntime_streaming.cpp, xgameruntime.cpp, xgameruntime_streaming_test.cpp):
    • All 5 GUID byte arrays (kStreamingClass, kStreaming1..3, kLauncherClass) match the string forms verified in xgameruntime_streaming_test.cpp bit-for-bit.
    • kStreamingVtable (static_assert 39 entries: IUnknown + slots 3–34 + unlisted 35–38) and kLauncherVtable (static_assert 6 entries: IUnknown + slots 3–5) match the documented slot map; client-scoped queries clear known outputs and return HRESULT_FROM_WIN32(ERROR_NOT_FOUND); connection-state tokens and timeout deferral handles are mutex-protected and monotonic; XLaunchUri rejects null URI (E_INVALIDARG), does not log the URI, and returns ERROR_NOT_SUPPORTED.
    • Wiring verified across all 3 shims/xgameruntime.cpp targets (gta6rt, xgameruntime_test, scripts/build_runtime.ps1) plus the new xgameruntime_streaming_test target and CTest registration.
    • Minor non-blocking notes: gs_get_clients returns S_OK (*used = 0) even if count > 0 && clients == nullptr (harmless when 0 clients exist); touches adjacent lines in xgameruntime.cpp, CMakeLists.txt, docs/runtime_imports.md, and scripts/build_runtime.ps1 with xgameruntime: serve XGameProtocolImpl and XGameInviteImpl offline #4239 (trivial rebase for whichever lands second).
  • Checks run (clean worktree on aa2988cc): git diff --check, test_ctest_registration.py (4/4), test_docs_links.py (6/6), test_docs_repo_paths.py (2/2), test_text_write_line_endings.py (3/3), test_text_encoding.py (2/2) all pass.
  • Not run here: Windows MSVC compile and xgameruntime_streaming_test execution.

AI-assisted review.

@dcastell1

Copy link
Copy Markdown
Contributor

Tested 1a2ae8c on Windows 11 x64 (MSVC 19.44, Ninja): pass. Built xgameruntime_test and xgameruntime_streaming_test from this tree and ran ctest -R xgameruntime → 2/2 passed (0.03 s / 0.10 s).

@Flyander Flyander left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The offline touch-control behavior should accept the documented optional default layout. Please adjust the null-layout case and its test.

return kNoClient;
}
HRESULT STDMETHODCALLTYPE gs_show_touch_with_state(void*, const char* layout, size_t count, const void* ops) { // 27
return (!layout || (count && !ops)) ? E_INVALIDARG : S_OK;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Accept a null layout as the documented default. XGameStreamingShowTouchControlsWithStateUpdate marks layout optional; passing null requests the standard layout, rather than being an invalid argument (Microsoft GDK reference). This offline shim drops the update anyway, so return success for the null/default case as it does for other global touch-layout no-ops, and update the test that currently expects E_INVALIDARG.

Conflicts: docs/runtime_imports.md, runtime/CMakeLists.txt,
runtime/shims/xgameruntime.cpp, scripts/build_runtime.ps1
XGameStreamingImpl is now served by xgameruntime_offline.cpp on main, so this
branch keeps only XLauncherImpl.

AI-assisted.
Conflicts: docs/runtime_imports.md

AI-assisted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants