Skip to content

xgameruntime: serve XGameProtocolImpl and XGameInviteImpl offline - #4239

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

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

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-ACTIVATION, #4084 (comment)

What and why

QueryApiImpl refused XGameProtocolImpl (class 95fd18d2-74dd-4d7c-aa1b-0b51827665d6, interface 026b010c-…) and XGameInviteImpl (class 0651aae2-4012-4077-bf84-8b9097090e2c, IXGameInviteImpl2 014d1cc3-…), so XGameProtocolRegisterForActivation and XGameInviteRegisterForEvent failed with ERROR_NOT_SUPPORTED at title start. They are now served in runtime/shims/xgameruntime_activation.cpp, hooked in with one line in QueryApiImpl. Slot order follows xgameruntime-docs; signatures follow the public GDK reference. No package DLL calls them, so the slots are not measured (docs/runtime_imports.md says so).

Activations and invites come from the console shell, so nothing ever fires. A registration succeeds and hands out a token; Unregister returns true once for a live token and false afterwards or for an unknown one. The three IXGameInviteImpl2 slots (October 2025 GDK, no public signature) answer E_NOTIMPL and log once. XGameActivationImpl is left out because its signatures are undocumented.

Touches runtime/shims/xgameruntime.cpp (6 lines) and the source lists in runtime/CMakeLists.txt and scripts/build_runtime.ps1. #4235 (XAccessibilityImpl) and #3657 (XGameUiImpl) 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_activation_test (new, ctest xgameruntime_activation): 21 checks, 0 failures.
  • xgameruntime_test: OK (106 checks); gta6rt builds.
  • Negative control: making Unregister always return true fails three checks (a removed token, an unknown token, and the cross-class check); 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 the two registration classes: Register hands out a token
per registration, Unregister returns true once for a live token. Nothing
ever fires offline. The three undocumented IXGameInviteImpl2 slots answer
E_NOTIMPL and log once. xgameruntime_activation_test calls every slot.

AI-assisted.

@Kam471 Kam471 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.

Built xgameruntime_activation_test at e5146cef on Windows 11 and ran it: 21 checks, 0 failures, exit 0; ctest -R xgameruntime_activation -> 1/1 passed (0.01 s).

The checks cover the XGameProtocolImpl and XGameInviteImpl class ids, the IXGameInviteImpl2 same-object answer, invite registration/unregistration tokens (live, second token, null callback/token E_INVALIDARG, already-removed and never-handed-out false), the three undocumented IXGameInviteImpl2 slots returning E_NOTIMPL/false, and the protocol/invite token separation. No blocking issue.

@ray3242

ray3242 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Independent check of e5146cef 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_activation_test: 21 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 e5146cef 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_activation.cpp, xgameruntime.cpp, xgameruntime_activation_test.cpp):
    • All 4 GUID byte arrays (kProtocolClass, kProtocolIface, kInviteClass, kInvite2Iface) match the string forms parsed by xgameruntime_activation_test.cpp bit-for-bit.
    • register_event<R> clears token->token = 0 when non-null, validates !callback || !token → E_INVALIDARG, allocates distinct monotonic tokens under mutex, and tracks live tokens separately per class (g_protocol vs g_invite); unregister_event<R> returns true once and false thereafter.
    • Undocumented IXGameInviteImpl2 slots 5–7 log once via std::atomic<bool> and return E_NOTIMPL/false/E_NOTIMPL; vtable sizes pinned with static_assert (5 and 8).
    • Wiring verified across all 3 shims/xgameruntime.cpp targets (gta6rt, xgameruntime_test, scripts/build_runtime.ps1) plus the new xgameruntime_activation_test target and CTest registration.
    • Note: touches adjacent lines in xgameruntime.cpp, CMakeLists.txt, docs/runtime_imports.md, and scripts/build_runtime.ps1 with xgameruntime: serve XGameStreamingImpl and XLauncherImpl offline #4248 (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_activation_test execution.

AI-assisted review.

@dcastell1

Copy link
Copy Markdown
Contributor

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

Conflicts: docs/runtime_imports.md, runtime/CMakeLists.txt,
runtime/shims/xgameruntime.cpp, scripts/build_runtime.ps1

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