Skip to content

xgameruntime: XPackage enumeration, installation monitors and package-installed registration offline - #166

Closed
Andretuta wants to merge 1 commit into
mainfrom
old-pr/9900
Closed

Andretuta wants to merge 1 commit into
mainfrom
old-pr/9900

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

Carried over from old PR 9900 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9900, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
tedin7: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

@ItsNotRexed: an exe PR, as you asked.

What

Offline answers for the XPackage calls a title makes at boot to learn what is installed: XPackageEnumeratePackages (Game lists the process's package; Content lists the ids in LEONIDA_CONTENT_PACKAGES, in order; a callback returning false stops the walk), XPackageCreateInstallationMonitor and its progress, update, close and registration calls (installed, launchable, complete; a package that is not installed gets ERROR_NOT_FOUND), and XPackageRegisterPackageInstalled (hands out a distinct nonzero token). IXPackageImpl slots 5, 6, 9, 28, 29 forward to the same functions, so both ways in answer alike.

Why

Without them every one of these calls failed and a title took the not-installed path.

Tested

Built locally with clang-cl 19 + lld-link against the xwin SDK, run under Wine: xgameruntime_test.exe.

  • With the change: xgameruntime_test: OK (171 checks).
  • Negative control (same test, shim from origin/main): 1 of 159 checks failed, FAIL XPackageEnumeratePackages is exported, exit code 1.
  • New checks: about 100 lines in runtime/test/xgameruntime_test.cpp (enumeration of Game and Content, early stop, invalid kind/callback, slot 28, monitor open/close/progress/registration, missing package, double close, distinct package-installed tokens). Slot 5 moved from the E_NOTIMPL check to slot 27.

…-installed registration offline

XPackageEnumeratePackages lists the process's package (Game) or the LEONIDA_CONTENT_PACKAGES ones (Content); XPackageCreateInstallationMonitor and its progress, update, close and registration calls answer installed and complete; XPackageRegisterPackageInstalled hands out a token. IXPackageImpl slots 5, 6, 9, 28, 29 forward to the same functions.
ubiquitarianism pushed a commit that referenced this pull request Nov 24, 2026
… original

CONTRIBUTING.md, AGENTS.md, the French contributing page and the issue
template's build link sent contributors to ItsNotRexed/Leonida, which went
private on 23 November 2026: the claims search, the gh command an agent is
told to run, #166 and #313 all led nowhere.

They now use ubiquitarianism/leonida, say that older #N numbers are from the
original tracker, and name what replaces them here (#18, #17,
gpu-test-results/, docs/d3d12_vulkan.md). Adds the done: line and the main
target from the coordination issue.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@kawaii-shakal

Copy link
Copy Markdown
Contributor

Built and ran this natively on Windows (MSVC 19.50.35721.0, head f14804d on its own base, RelWithDebInfo). ctest -R xgameruntime passes 8/8, and xgameruntime_test: OK (171 checks), the same count as the Wine run in the description.

Two things I'd fix before it leaves draft, and one small one. Each is cited.

1. The interface slots that are actually called are still E_NOTIMPL; the ones wired are not called.

  • The shim answers XPackageImpl as IXPackageImpl3: slots 3-34 are IXPackageImpl, 35-38 IXPackageImpl2, 39-40 IXPackageImpl3 (tools/gdk_runtime_classes.json; the vtable's own static_assert of 41 entries).
  • docs/runtime_imports.md:343 and :575 list the slots libHttpClient.GDK.dll's thunks call: 3-19, 22, 24-27, 30, 32-34, 37-40. Slots 28 and 29 are not among them; 39 (EnumeratePackages) and 40 (RegisterPackageInstalled) are. tests/test_gdk_runtime_calls.py pins slot 40 as XPackageRegisterPackageInstalled with 4 arguments.
  • This PR wires 5, 6 and 9 (good, all called) and 28/29, but leaves 35, 36, 39 and 40 as PN(n). This very run logs XPackageImpl slot 40 not implemented offline (E_NOTIMPL) while the suite passes. The new test checks slot 28 only.
  • Pointing 35/36 and 39/40 at pkg_enumerate/pkg_register_installed, with a test through slot 39 and 40, would close it.

2. XPackageDetails is 80 bytes in current GDKs, not 64.

Microsoft Learn's reference for XPackageDetails (pages for gdk-2510, 2604 and 2610, the only versions it covers) lists 12 fields. After installing come uint32_t index, uint32_t count, bool ageRestricted and const char* titleID. On x64 that is 60 index, 64 count, 68 ageRestricted, 72 titleID, 80 total. The offsets are my own MSVC layout arithmetic; the page lists fields, not offsets.

A title built against that header reads titleID from past the end of the 64-byte struct on the shim's stack. I could not find which GDK version added the fields, and I cannot say whether that change is why the interface was re-versioned. Filling the 80-byte layout is safe either way: an older title reads only the first 57 bytes. The docs say index/count are 0/1 in the package-installed callback, and titleID is 8 uppercase hex digits, empty for DLC. MicrosoftGame.Config's title id, which XGameGetXboxTitleId already serves, would fit.

3. Small: XPackageGetInstallationProgress answers totalBytes = installedBytes = launchBytes = 0. A caller that computes a percentage before checking completed divides by zero. Equal nonzero values (for example the package size, or 1) say the same thing more safely.

GPU (not exercised by these tests): NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 Pro 26300.

AI-assisted.

@aslan2142

Copy link
Copy Markdown
Collaborator

This carry-over of old upstream PR 9900 has been taken over in #997, so I'm closing this draft as #17 describes. The branch old-pr/9900 stays.

AI-assisted (Claude Code, Claude Opus 5.5).

@aslan2142 aslan2142 closed this Nov 24, 2026
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.

4 participants