feat(xgameruntime): add the XPackage HLE (identity, mount, chunks and installation monitors) #37

Open
github-bot wants to merge 3 commits from github-bot/gh-37 into main AGit
Owner

@⁠wildheathen on GitHub · 2026-11-21 18:39 UTC · original
wildheathen:feat/xpackage → main · +1263 −0 · 4 files · 3 commits · open

Summary

Adds the public XPackage surface of the GDK (XPackage.h, 31 functions) to xgameruntime as an offline, deterministic HLE. The title always runs as a single packaged title, so every query describes exactly one package (the calling process), with no features, no DLC and nothing to download; installation is always complete.

  • Identity and locale: XPackageIsPackagedProcess, XPackageGetCurrentProcessPackageIdentifier, XPackageGetUserLocale (overridable with SCARLETTX_PACKAGE_IDENTIFIER / SCARLETTX_USER_LOCALE).
  • Packages and mount: XPackageEnumeratePackages, XPackageGetPackageKind, XPackageMount, XPackageGetMountPathSize, XPackageGetMountPath, XPackageCloseMountHandle, XPackageMountWithUiAsync/Result, XPackageEnumerateFeatures, XPackageGetWriteStats, XPackageEstimateDownloadSize, XPackageUninstallPackage, XPackageUninstallUWPInstance. The mounted folder is SCARLETTX_PACKAGE_ROOT when set, otherwise the folder that holds the executable.
  • Chunks and installation: XPackageEnumerateChunkAvailability, XPackageFindChunkAvailability, XPackageChangeChunkInstallOrder, XPackageInstallChunks/Async/Result, XPackageUninstallChunks, the installation monitor functions and the progress-changed / package-installed registrations (tokens are accepted once by the matching unregister; callbacks never fire because nothing ever changes).

Signatures and documented error codes come from the public reference pages on learn.microsoft.com (GDK, gdk-2610 view). Enums are exposed as uint32_t plus constants, like the rest of xgameruntime_abi.h.

Layout

Everything lives in new files so the change does not overlap the open XUser / XGameSave / XMem work: src/shims/xgr_package.cpp (registered in CMakeLists.txt) and tests/test_xpackage.cpp (new test_xpackage target). The header gets one hunk, inside a new // XPackage.h section. xgameruntime_shim.cpp and test_xgameruntime_abi.cpp are untouched.

Three commits, each building and passing test_xpackage on its own: identity and locale, enumeration and mount, chunks and installation.

Verification

  • Built with MSVC + Ninja x64; each of the three commits builds and passes test_xpackage and test_xgameruntime_abi separately.
  • Full suite on this branch: 21/24. The three failing tests, test_boot_hello_scarlett, test_boot_rt_showcase (the system xgameruntime.dll wins over our shim when the guest starts as a child process) and test_d3d12_guest_texture, fail the same way on a build of unmodified origin/main and are unrelated to this change (see #1 and #2).
**@⁠wildheathen** on GitHub · 2026-11-21 18:39 UTC · [original](https://github.com/Freminet/ScarlettX/pull/37) `wildheathen:feat/xpackage` → `main` · +1263 −0 · 4 files · 3 commits · open ## Summary Adds the public `XPackage` surface of the GDK (`XPackage.h`, 31 functions) to `xgameruntime` as an offline, deterministic HLE. The title always runs as a single packaged title, so every query describes exactly one package (the calling process), with no features, no DLC and nothing to download; installation is always complete. - **Identity and locale**: `XPackageIsPackagedProcess`, `XPackageGetCurrentProcessPackageIdentifier`, `XPackageGetUserLocale` (overridable with `SCARLETTX_PACKAGE_IDENTIFIER` / `SCARLETTX_USER_LOCALE`). - **Packages and mount**: `XPackageEnumeratePackages`, `XPackageGetPackageKind`, `XPackageMount`, `XPackageGetMountPathSize`, `XPackageGetMountPath`, `XPackageCloseMountHandle`, `XPackageMountWithUiAsync`/`Result`, `XPackageEnumerateFeatures`, `XPackageGetWriteStats`, `XPackageEstimateDownloadSize`, `XPackageUninstallPackage`, `XPackageUninstallUWPInstance`. The mounted folder is `SCARLETTX_PACKAGE_ROOT` when set, otherwise the folder that holds the executable. - **Chunks and installation**: `XPackageEnumerateChunkAvailability`, `XPackageFindChunkAvailability`, `XPackageChangeChunkInstallOrder`, `XPackageInstallChunks`/`Async`/`Result`, `XPackageUninstallChunks`, the installation monitor functions and the progress-changed / package-installed registrations (tokens are accepted once by the matching unregister; callbacks never fire because nothing ever changes). Signatures and documented error codes come from the public reference pages on learn.microsoft.com (GDK, `gdk-2610` view). Enums are exposed as `uint32_t` plus constants, like the rest of `xgameruntime_abi.h`. ## Layout Everything lives in new files so the change does not overlap the open XUser / XGameSave / XMem work: `src/shims/xgr_package.cpp` (registered in `CMakeLists.txt`) and `tests/test_xpackage.cpp` (new `test_xpackage` target). The header gets one hunk, inside a new `// XPackage.h` section. `xgameruntime_shim.cpp` and `test_xgameruntime_abi.cpp` are untouched. Three commits, each building and passing `test_xpackage` on its own: identity and locale, enumeration and mount, chunks and installation. ## Verification - Built with MSVC + Ninja x64; each of the three commits builds and passes `test_xpackage` and `test_xgameruntime_abi` separately. - Full suite on this branch: `21/24`. The three failing tests, `test_boot_hello_scarlett`, `test_boot_rt_showcase` (the system `xgameruntime.dll` wins over our shim when the guest starts as a child process) and `test_d3d12_guest_texture`, fail the same way on a build of unmodified `origin/main` and are unrelated to this change (see #1 and #2).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:56:41 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/37/head:github-bot/gh-37'
git switch 'github-bot/gh-37'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-37'
git switch 'github-bot/gh-37'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-37'
git switch 'github-bot/gh-37'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-37'
git switch 'main'
git merge --squash 'github-bot/gh-37'
git switch 'main'
git merge --ff-only 'github-bot/gh-37'
git switch 'main'
git merge 'github-bot/gh-37'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.