Skip to content

xgameruntime: serve XAppCaptureImpl offline (RT-5) - #7195

Closed
bitzin-dev wants to merge 1 commit into
ProjectLeonida:mainfrom
bitzin-dev:feat/xappcapture-and-fixes
Closed

bitzin-dev wants to merge 1 commit into
ProjectLeonida:mainfrom
bitzin-dev:feat/xappcapture-and-fixes

Conversation

@bitzin-dev

@bitzin-dev bitzin-dev commented Nov 23, 2026 •

Copy link
Copy Markdown

Serves XAppCaptureImpl (IXAppCaptureImpl4, slots 3-17) through QueryApiImpl in runtime/shims/xgameruntime_offline.cpp (coordination item RT-5).

The retail executable (game_scarlett_master.exe) references slot 5 (XAppCaptureTakeScreenshot). All slots fail before starting with E_FAIL (offline_failure).

What's included:

  • runtime/shims/xgameruntime_offline.cpp: Implements XAppCaptureImpl singleton and vtable for slots 0-17.
  • runtime/test/xgameruntime_offline_test.cpp: Added checks verifying that kAppCaptureClass and IXAppCaptureImpl4 resolve, slot 5 returns E_FAIL, and invalid interface queries return E_NOINTERFACE.
  • runtime/test/xgameruntime_test.cpp: Updated query check and removed from refused list.
  • tests/test_gdk_runtime_calls.py: Updated assertion confirming kAppCaptureClass is served.
  • docs/runtime_imports.md: Updated tables and notes.
  • Dropped all unrelated tool line-ending changes from this branch to keep the PR strictly focused on the runtime change.

Validation:

  • tests/test_gdk_runtime_calls.py: 23 tests OK.

@bitzin-dev
bitzin-dev force-pushed the feat/xappcapture-and-fixes branch from e4722ea to 68f04b9 Compare November 23, 2026 16:14
@bitzin-dev bitzin-dev changed the title Feat/xappcapture and fixes xgameruntime: serve XAppCaptureImpl offline and fix line endings in tools Nov 23, 2026
@brothernog

Copy link
Copy Markdown

Code read of the current head (Linux, no GPU, no game files):

  • runtime/shims/xgameruntime_offline.cpp: there is an extra } after app_capture_query_interface (closes the
    anonymous namespace before #undef FN), and an extra return true; } after the new kAppCaptureClass branch
    in xgameruntime_offline_query. As written this doesn't compile.
  • python -I tests/test_gdk_runtime_calls.py fails on this branch
    (test_the_default_source_is_every_runtime_shim) and passes on main: it still expects XAppCaptureImpl to be
    refused. runtime/test/xgameruntime_test.cpp:250-265 expects the same, and docs/runtime_imports.md (lines
    431-486) still lists XAppCaptureImpl as not served. Those need updating with the change.
  • The description mentions f64_omod_probe.py, which isn't in the diff (main already has newline="\n" there).
  • Suggest splitting the two tool line-ending tweaks from the runtime change, and adding the coordination item ID.

This review was AI-assisted.

@bitzin-dev
bitzin-dev force-pushed the feat/xappcapture-and-fixes branch from 68f04b9 to e698346 Compare November 23, 2026 16:25
@bitzin-dev bitzin-dev changed the title xgameruntime: serve XAppCaptureImpl offline and fix line endings in tools xgameruntime: serve XAppCaptureImpl offline and fix line endings in tools (RT-5) Nov 23, 2026
@bitzin-dev

Copy link
Copy Markdown
Author

Thanks for the thorough review @brothernog!

  • Fixed the extra braces in xgameruntime_offline.cpp.
  • Updated test_gdk_runtime_calls.py, xgameruntime_test.cpp, and docs/runtime_imports.md to reflect XAppCaptureImpl is now served (RT-5).
  • Cleaned up the commits and separated the tool line-ending fixes (leonida_tui.py and wave_diff.py).
  • Both test suites pass cleanly locally.

@bitzin-dev

Copy link
Copy Markdown
Author

Hey! Just to clarify:

Everything compiles clean and tests pass OK.

@Jadiac5

Jadiac5 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested e698346 on Windows 11, AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: pass, with one finding

  • The earlier head did not compile (stray } and return true; } in xgameruntime_offline.cpp, 12 MSVC errors). The new head builds clean. Built xgameruntime_offline_test and xgameruntime_test with MSVC 2022, RelWithDebInfo, CPU only: offline 44 checks, 0 failures; xgameruntime_test OK (143 checks). python -I tests/test_gdk_runtime_calls.py: 23 tests OK. git diff --check: clean.
  • Finding: nothing tests the new class. xgameruntime_offline_test has the same 44 checks as main, and the Python test only checks the class id is listed as served. A short offline check (class id and IXAppCaptureImpl4 resolve, slot 5 returns E_FAIL) would catch a wrong slot or id. Runtime: offline XAppCaptureImpl (screenshots and recordings unavailable) #7247 has one.
  • The PR still includes the two tool line-ending edits (tools/leonida_tui.py, tools/wave_diff.py) in the diff at this head, though the comment says they were split out.
  • Behaviour: slot 5 (XAppCaptureTakeScreenshot) returns E_FAIL (0x80004005) whatever the arguments, and logs one stderr line. All 15 methods (slots 3-17) return E_FAIL, including EnableRecord and DisableRecord. QueryInterface answers the class id and the three later interface ids. XAppCaptureMetadataImpl is not served.
  • Against Runtime: offline XAppCaptureImpl (screenshots and recordings unavailable) #7247: same ids and same return on every slot, so no difference in behaviour. They differ in tests and docs (see the Runtime: offline XAppCaptureImpl (screenshots and recordings unavailable) #7247 draft). git merge-tree of the two heads: conflicts in xgameruntime_offline.cpp and docs/runtime_imports.md. Only one can land.
  • Against xgameruntime: serve XAppCaptureImpl and XAppCaptureMetadataImpl offline (RT-270) #4307: slot 5 there returns E_INVALIDARG for a null user or result, else E_NOINTERFACE; EnableRecord and DisableRecord return S_OK; it also serves XAppCaptureMetadataImpl. It lives in xgameruntime.cpp, which is asked first, so it would shadow this class. git merge-tree with xgameruntime: serve XAppCaptureImpl and XAppCaptureMetadataImpl offline (RT-270) #4307: conflicts in docs/runtime_imports.md and runtime/test/xgameruntime_test.cpp.
  • Not done: no negative control (the new code has no new test to fail). Not run against the retail executable.

AI-assisted (Claude Code).

@bitzin-dev
bitzin-dev force-pushed the feat/xappcapture-and-fixes branch from e698346 to 1deb0da Compare November 23, 2026 16:33
@bitzin-dev bitzin-dev changed the title xgameruntime: serve XAppCaptureImpl offline and fix line endings in tools (RT-5) xgameruntime: serve XAppCaptureImpl offline (RT-5) Nov 23, 2026
@bitzin-dev

Copy link
Copy Markdown
Author

Thanks for testing on hardware @Jadiac5!

Addressed all findings in 1deb0da:

  1. Offline test added: Added tests in runtime/test/xgameruntime_offline_test.cpp checking that kAppCaptureClass and IXAppCaptureImpl4 resolve, slot 5 returns E_FAIL, and invalid IIDs return E_NOINTERFACE.
  2. Clean scope: Completely dropped the tool line-ending tweaks from this branch so the PR is 100% focused on the runtime change (RT-5).
  3. Registered claim in Coordinating who works on what (42) (moved to #7333) #7231.

@brothernog

Copy link
Copy Markdown

Thanks, re-checked e698346: the brace/return issues are gone, tests/test_gdk_runtime_calls.py passes (23 OK), and
the C++ test now uses XGameInviteImpl as the unserved class, which checks out.

One leftover in docs/runtime_imports.md:487-488: the edit dropped the start of a sentence, so the line after
"...is served by the runtime." begins "executable calls, and the argument counts the tool estimates...". The removed
lead-in was "The slots of XUserImpl, XStoreImpl and XGameSaveImpl the". Optional: a Launcher-style check for
XAppCaptureImpl in runtime/test/xgameruntime_offline_test.cpp (~:234) would cover the new vtable.

This review was AI-assisted.

@claudetools-gh

Copy link
Copy Markdown

Tested 1deb0da on Windows 11, RTX 5070 Ti, driver 621.01 (CPU side; these tests touch no GPU): pass.

  • Base: main@511e3826b + xgameruntime: serve XAppCaptureImpl offline (RT-5) #71951deb0da, merged locally without conflicts. MSVC 14.51 (VS 2026), RelWithDebInfo, Ninja.
  • ctest -R "^xgameruntime(_offline.*)?$": 3/3 passed (xgameruntime, xgameruntime_offline, xgameruntime_offline_hdr).
  • python -I tests/test_gdk_runtime_calls.py: 23 tests OK.
  • No new compiler warnings in the changed files. xgameruntime_test.cpp has C4456/C4996 warnings at lines 746, 766, 827 and 862, but those lines are unchanged from main.

No game files used. AI-assisted (Claude Code).

@bitzin-dev
bitzin-dev force-pushed the feat/xappcapture-and-fixes branch from 1deb0da to 9b3c85b Compare November 23, 2026 16:36
@bitzin-dev

Copy link
Copy Markdown
Author

Good catch on the cut sentence in docs/runtime_imports.md! Restored the missing lead-in text ("The slots of XUserImpl, XStoreImpl and XGameSaveImpl the...").

Also, the offline Launcher-style check for XAppCaptureImpl (checking class ID, IXAppCaptureImpl4, slot 5 E_FAIL, and invalid IID) was added to runtime/test/xgameruntime_offline_test.cpp in commit 1deb0dae2 / 9b3c85b33.

Pushed the update cleanly. Thanks again for the review!

@dcastell1

Copy link
Copy Markdown
Contributor

Tested 1deb0da on RTX 5090, 621.24, Windows 11 (CPU side): pass. Built all five xgameruntime targets → 8/8 passed (xgameruntime 0.17 s, _user, _gamesave, _store, _offline, _offline_hdr, and both --expect-gamertag variants).

One caveat so this is not over-read: on the retail image the dry-run counters are identical to main b2801e26 (shim=54 host=432 module=72 unimplemented=29), and the executable imports no XAppCapture* symbol at all (83 imports checked), so the map cannot show this change. The evidence here is the unit tests, not the mapping.

@3greasier-quantifies

Copy link
Copy Markdown

Tested 9b3c85b33 on RTX 3070 (driver 32.0.16.2101), Windows 11 x64, MSVC 2022 (Build Tools), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0: pass.

Not checked: the real game executable or any game files, so the slot numbers are only checked against the PR's own tests.

AI-assisted: yes (Claude Code ran the build and tests; I read the results).

@skorex

skorex commented Nov 23, 2026

Copy link
Copy Markdown

Duplicate of #4307

#4307 makes the same change and was opened earlier. Topic: XAppCaptureImpl served offline.

Suggest closing this PR in favour of #4307, and porting anything this one adds that #4307 lacks there.

@Pierrot1398

Copy link
Copy Markdown

Tested 9b3c85b on NVIDIA GeForce RTX 5060 Ti, driver 621.24 (32.0.16.2124), Windows 11 Pro 26300, MSVC (VS 18 Build Tools) RelWithDebInfo, Vulkan headers via -DLEONIDA_VULKAN_HEADERS_FETCH=ON: pass.

  • ctest -R "^xgameruntime(_offline)?$" --repeat until-fail:3: both 3/3 pass (XAppCaptureImpl answers its class id and IXAppCaptureImpl4, slot 5 returns E_FAIL; XGameInviteImpl is still refused).
  • python -I tests/test_gdk_runtime_calls.py (Python 3.15.2): OK.

Read the full diff before building. No game files. AI-assisted (Claude Code).

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

Tested 9b3c85b on Windows 11, MSVC 14.44, NVIDIA RTX 4080: pass. One doc row is out of date (below).

Setup: 9b3c85b3 merged onto main 0656b0b2 (clean merge). Built with CMake + Ninja, RelWithDebInfo, VS 2022 BuildTools. CPU tests only: the GPU is busy with another job, so -E "d3d12|vk_|vulkan|bink|fsr|bvh|gpu".

  • ctest -j 6 on that CPU set: 137/137 pass. On main the same set has no failures.
  • xgameruntime_offline_test: 47 checks, 0 failures (44 on main). xgameruntime, _user, _gamesave, _store, _offline_hdr and both gamertag tests pass.
  • python -I tests/test_gdk_runtime_calls.py: 23 tests OK.
  • Negative control: I built this PR's xgameruntime_offline_test.cpp against main's shims. It fails with FAIL XAppCaptureImpl for its class id and IXAppCaptureImpl4 and exits 1.

gta6rt --dry-run game_scarlett_master.exe (own 1.0.2.1 copy, --game-dir the package, overlay outside it): shim=61 host=432 module=72 unimplemented=22 on both main and this PR, and the per-import lines are identical. That is expected: XAppCaptureImpl is reached through QueryApiImpl, not through an import name. Per docs/runtime_imports.md the executable has 1 thunk for it (slot 5).

Code read: the class id, the four interface ids and the 18-slot vtable (IUnknown plus slots 3-17) match the layout the PR cites. QueryApiImpl answers the class id and IXAppCaptureImpl2-4 with the same object and refuses other interface ids with E_NOINTERFACE. Every capture slot returns E_FAIL through offline_failure, so all of XAppCapture* remains a stub. The title's one call (slot 5, XAppCaptureTakeScreenshot) gets E_FAIL.

Finding (docs): serving the class flips XGameRuntimeIsFeatureAvailable(XAppCapture) (feature 1) to true. That happens because runtime_is_feature_available follows class_served (runtime/shims/xgameruntime.cpp:1272), and xgameruntime_test's consistency check passes on it. The XGameRuntimeFeatureImpl row at docs/runtime_imports.md:433 removes XAppCapture from the false list but does not add it to the "true … today" list, so the row now names it in neither list. Add XAppCapture to the true list.

Behaviour note, not a defect of this PR: the feature now reports XAppCapture as available although every call fails offline. XLauncher already works the same way.

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.

10 participants