Skip to content

RT-XAPPCAPTURE: serve XAppCaptureImpl in the xgameruntime shim - the exe's last unserved thunk - #537

Open
tengotengo wants to merge 2 commits into
ProjectLeonida:mainfrom
tengotengo:rt-xappcapture
Open

tengotengo wants to merge 2 commits into
ProjectLeonida:mainfrom
tengotengo:rt-xappcapture

Conversation

@tengotengo

@tengotengo tengotengo commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: RT-XAPPCAPTURE (#14)

What and why

The retail executable's one xgameruntime reference this file used to refuse: it queries the class
a4f1aee2-4bf1-4485-b008-a7c26d52ac27 for IXAppCaptureImpl4 and calls slot 5,
XAppCaptureTakeScreenshot (measured in game_scarlett_master.exe; one thunk). QueryApiImpl
answered kClassNotProvided for it, so the call died on a null pointer path and
XGameRuntimeIsFeatureAvailable(XAppCapture) reported false.

This pull request serves the class from runtime/shims/xgameruntime.cpp:

  • The full IXAppCaptureImpl .. 4 layout from tools/gdk_runtime_classes.json (18 slots:
    IUnknown + Impl's 8 + Impl2's 4 + Impl3's 2 + Impl4's 1). The class id is also
    IXAppCaptureImpl's id, and the object answers the class id and the v2/v3/v4 interface ids
    (the executable requests with the v4 interface id).
  • There is no console capture or record offline, so every method is E_NOTIMPL (the
    net_not_implemented pattern): a title that checks the HRESULT sees unsupported, and
    XAppCapture in the feature table becomes available, which matches Microsoft documenting it
    for Windows.
  • kAppCaptureClassId renamed to kAppCaptureClass, so tools/gdk_runtime_calls.py counts the
    class as served.

With it, every thunk the executable references is served: the tool's report on the exe goes
from not-served-referenced: XAppCaptureImpl (slot 5) to not-served=- not-served-referenced=-
(161 thunks, 158 referenced, 17 classes).

Tested

Windows cross-build (clang-cl 23.1.4 + xwin SDK 10.0.26100 splat) on a Linux box with an RTX 5060 Ti:

  • runtime/test/xgameruntime_test under Wine 11.21: 161 checks, all pass - three new: the object
    answers the class id and the v4 interface id, slot 5 refuses with E_NOTIMPL, a bogus interface
    id is E_NOINTERFACE; the feature-availability consistency check now covers XAppCapture=true.
  • Full ctest under Wine: 23 failures before and after this change, byte-identical failure set
    (276/299 pass both ways) - the 23 are the documented headless-Wine environment failures
    (presentation without a display, host-D3D12 comparisons, GameInput/SDL3), not regressions.
  • python3 -I tests/test_gdk_runtime_calls.py: 23 tests OK (the served-class assertion updated
    from notIn to kAppCaptureClass).
  • tools/gdk_runtime_calls.py re-run on the exe: XAppCaptureImpl now "served by the runtime";
    zero unserved classes.
  • scripts/check_no_game_data.py on the changed files: clean.
  • No game files were needed beyond the measured ids and slot; nothing was run against the
    retail package.

AI-assisted: yes (Claude Code)

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. (not applicable: no translator change)

@kawaii-shakal

Copy link
Copy Markdown
Contributor

Review of head df1800d (read-only; Linux, Python 3, no Windows/MSVC).

What ran:

  • python3 -I tests/test_gdk_runtime_calls.py: 23 tests, OK (including the updated kAppCaptureClass served assertion).
  • Not built: xgameruntime.cpp and xgameruntime_test.cpp include <windows.h>, so they cannot be built here.

Checked against the repository:

  • Class id a4f1aee2-... and the IIDs for Impl2 3a949778-..., Impl3 2bbca60a-... and Impl4 22e672d7-... match tools/gdk_runtime_classes.json. The class id is also IXAppCaptureImpl's IID there, and object_query_interface accepts *class_id, so v1 is served without being in kAppCaptureIids.
  • Vtable order 3-17 matches the method lists in that json (8 + 4 + 2 + 1 = 15, plus IUnknown = 18, as the static_assert says). Slot 5 is XAppCaptureTakeScreenshot, as docs/runtime_imports.md records for the executable.
  • Offline safety (reasoning): every slot returns E_NOTIMPL and writes nothing. On x64 a one-argument stub is safe for callers that pass more arguments. A caller that checks the HRESULT skips the call, and the out structs are left untouched, which is no worse than the previous null object.

Points to consider:

  • XGameRuntimeIsFeatureAvailable(XAppCapture) now returns true because the feature table follows "served". A title that gates capture on that call will now call in and get E_NOTIMPL where it used to skip capture. That is harmless if it checks the HRESULT. Still, "available" while every method refuses is a choice the doc row should state. (Reasoning; not run.)
  • The doc paragraph still lists two pull request numbers carried over from the old text; check they are current numbers.

Not tested: the C++ test on Windows, and the retail executable's actual call (needs game files).


Review written by Claude (Claude Code, Opus 5.5), an AI agent, posted from a contributor's account.

@tengotengo

Copy link
Copy Markdown
Contributor Author

Thanks - both points addressed in d323506 (docs-only):

  • The served-classes note no longer cites #4235/#4248. I checked: neither exists in this repository (404 as a pull request or an issue) - they name pull requests of the deleted predecessor repository. The live PR serving XAccessibilityImpl and XLauncherImpl is xgameruntime_offline: one silent speech voice with WAVE streams, display power requests for timeout deferrals (RT-GDK-SPEECH-DISPLAY-LIFECYCLE) #401 (RT-GDK-SPEECH-DISPLAY-LIFECYCLE), and the note now names it.
  • The XGameRuntimeFeatureImpl row now states the E_NOTIMPL nuance: for XAppCapture, "served" means the class id and the v1-v4 interface ids answer QueryApiImpl while every method of the offline object returns E_NOTIMPL - the feature is reported available, capture itself is not.

One more thing while we are here: #401 also serves XAppCaptureImpl (in xgameruntime_offline.cpp, TakeScreenshot -> ERROR_NOT_SUPPORTED) and updates the same xgameruntime_test.cpp / test_gdk_runtime_calls.py / docs/runtime_imports.md. If both merge, class a4f1aee2-4bf1-4485-b008-a7c26d52ac27 is served by two objects, and the shared files conflict on the second merge. I commented on #401 to coordinate: this PR's layout was measured against the retail executable (the class id, the v4 interface id it requests, and slot 5 - the executable's one thunk of the class), so I would keep #537 as the serving side.

Andretuta added a commit that referenced this pull request Nov 24, 2026
…lifecycle shim (#401 review)

- Speech is consistent now: XSpeechSynthesizerEnumerateInstalledVoices calls back once with a silent
  voice (XSpeechSynthesizerVoiceInformation in the GDK reference's layout), and SetCustomVoice accepts
  that voice id only. The enumeration takes (context, callback), the GDK reference's order; main read
  them the other way round.
- XAppCaptureImpl is left to #537, which serves it in xgameruntime.cpp with its full layout.
- The lifecycle shim (app-state callbacks, CreateWindowEx hook) moves to its own pull request.
- docs/runtime_imports.md: the speech and launcher bullets match the code; the launcher's display power
  request is called out as a side effect on the host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kawaii-shakal

Copy link
Copy Markdown
Contributor

Re-review of head d323506b83eaa610b7d42762c7697dd68b219932 (the one commit since my review: d323506, docs only).

What I re-checked:

  • git diff df1800d..d323506.
  • python -I tests/test_gdk_runtime_calls.py at the head: 23 tests OK.
  • The PR merged onto current main f3e26be7c in a scratch worktree: no textual conflict, and the same Python test passes (23 OK).
  • scripts/check_no_game_data.py on the changed files: clean.
  • Not built: the C++ xgameruntime_test (needs Windows/MSVC).

Earlier remarks:

  1. XGameRuntimeIsFeatureAvailable(XAppCapture) true while every method is E_NOTIMPL: resolved. The XGameRuntimeFeatureImpl row now says this.
  2. Stale PR numbers in the served-classes note: resolved as written at the time. #4235 / #4248 are replaced. However, the new text is already out of date, see below.

Overlap with #401, as of now:

Still open in this PR's docs (docs/runtime_imports.md around lines 551-554 after merging onto main): "Open pull request #401 ... serves both; it also serves XAppCaptureImpl, which overlaps g_app_capture ... the overlap is noted on #401" is no longer true, because #401 is merged and dropped the class. The sentence about the predecessor repository's numbers could go too. Please rebase and rewrite that paragraph for current main.

AI-assisted.

… unserved thunk

The retail executable queries the class a4f1aee2 (IXAppCaptureImpl .. 4,
from tools/gdk_runtime_classes.json) for IXAppCaptureImpl4 and calls slot
5, XAppCaptureTakeScreenshot - its one xgameruntime reference this file
used to refuse with kClassNotProvided. Serve the class with the full 18-
slot layout, every method E_NOTIMPL (no console capture or record
offline), the v2/v3/v4 interface ids answered alongside the class id, and
kAppCaptureClassId renamed to kAppCaptureClass so gdk_runtime_calls.py
counts the class as served. With it, every thunk the executable
references is served (161 thunks / 158 referenced / 17 classes, zero
unserved).

xgameruntime_test gains the positive checks (object, slot 5 refusal,
bogus interface id); test_gdk_runtime_calls.py's served-class assertion
and docs/runtime_imports.md's state notes follow.
…n (XAppCapture offline E_NOTIMPL availability)
@tengotengo tengotengo closed this Nov 24, 2026
@tengotengo
tengotengo deleted the rt-xappcapture branch November 24, 2026 17:09
@tengotengo
tengotengo restored the rt-xappcapture branch November 24, 2026 17:11
@tengotengo

Copy link
Copy Markdown
Contributor Author

Rebased onto a289278 (post-#401 main) and re-verified; the branch is ready at 2581f6d but the force-push is momentarily held by our token missing the workflow scope (the rebased tip carries main's updated .github/workflows/runtime.yml, which a repo-scoped classic PAT can't update). The only change on top of the rebase is the final paragraph of docs/runtime_imports.md, rewritten for post-#401 main (XAppCaptureImpl served by this change via g_app_capture; XAccessibilityImpl/XLauncherImpl served in xgameruntime_offline.cpp by merged #401, 05318a3; the stale "overlap with #401" sentence and the predecessor-repo numbers are gone). The code — 18-slot IXAppCaptureImpl..4 vtable, all methods E_NOTIMPL, the 3 new test checks, the flipped assertion — is unchanged.

Re-verified after the rebase: xgameruntime_test under Wine 11.21 — all 161 checks pass (incl. slot-5 refusal + class-id/v4-interface checks); tests/test_gdk_runtime_calls.py 23/23; 12/12 test_docs; full ctest failure set under Wine identical with vs without the change (22/301, the documented headless-Wine environment failures); check_no_game_data clean. gdk_runtime_calls.py on the exe: 158/158 referenced thunks served, none unserved. Pushing the moment the token gains the scope — no other changes needed.

@tengotengo

Copy link
Copy Markdown
Contributor Author

Reopened with the rebase pushed — head is now 2581f6d (on main a289278, and our four touched files are unchanged on main up to the current tip). The only content change vs d323506 is the rewritten final paragraph of docs/runtime_imports.md (per the 14:48Z review): XAppCaptureImpl served by this change via g_app_capture; XAccessibilityImpl/XLauncherImpl served in xgameruntime_offline.cpp by merged #401 (05318a3). Verification re-run after the rebase: xgameruntime_test under Wine — 161/161; tests/test_gdk_runtime_calls.py 23/23; 12/12 test_docs; ctest failure set identical with vs without the change (22/301, documented headless-Wine environment failures); check_no_game_data clean.

SwavyJayden pushed a commit to SwavyJayden/leonida that referenced this pull request Nov 24, 2026
…lifecycle shim (ProjectLeonida#401 review)

- Speech is consistent now: XSpeechSynthesizerEnumerateInstalledVoices calls back once with a silent
  voice (XSpeechSynthesizerVoiceInformation in the GDK reference's layout), and SetCustomVoice accepts
  that voice id only. The enumeration takes (context, callback), the GDK reference's order; main read
  them the other way round.
- XAppCaptureImpl is left to ProjectLeonida#537, which serves it in xgameruntime.cpp with its full layout.
- The lifecycle shim (app-state callbacks, CreateWindowEx hook) moves to its own pull request.
- docs/runtime_imports.md: the speech and launcher bullets match the code; the launcher's display power
  request is called out as a side effect on the host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants