runtime: add PLS and XPackage contracts #1115

Merged
lambirou merged 2 commits from upstream-pr/1122 into main 2026-11-24 02:13:05 +00:00
lambirou commented 2026-11-24 01:21:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T01:21:55Z.


Change

Add the PLS and XPackage contracts to the XGameRuntime fixture.

  • PLS exposes XPersistentLocalStorageGetPathSize, XPersistentLocalStorageGetPath and
    XPersistentLocalStorageGetSpaceInfo. The path is deterministic under
    %TEMP%\xbox-recomp-pls\x2w-synthetic-title-0001; the 32-byte space structure reports
    32 MiB available, 48 MiB free, 16 MiB used and 64 MiB total. A short path buffer returns
    HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); the 32-byte structure is guard-checked so a
    write past it is detected.
  • XPackage exposes XPackageMount, XPackageGetMountPathSize, XPackageGetMountPath
    (three arguments) and XPackageCloseMountHandle. The synthetic mount points under
    %TEMP%\xbox-recomp-packages\<identifier>; two mounts return the same path and a query on a
    closed mount returns E_HANDLE.
  • XPackageMountWithUiAsync remains a named E_NOTIMPL stub because the public
    XAsyncBlock, async result and queue/callback contract is not available without a GDK header.
    XUser, XGameSave and the other stubs are unchanged.
  • The table now has 27 exports: 15 implemented HRESULT, 5 implemented void and 7 stubs.

Verification

  • cmake --build --preset dev --target xgameruntime_shim xgameruntime_shim_check xgameruntime_contracts_check xgameruntime_pls_xpackage_check xgameruntime_preflight_exe xmem_shim d3d12_xs_shim
    • Passed with MSVC 19.44.
  • ctest --preset dev --no-tests=error -R '^xgameruntime_' -V
    • 4/4 passed: thunks, XUser/XGameSave contracts, PLS/XPackage, strict preflight.
    • PLS/XPackage output:
      space=33554432/50331648/67108864 async=stub unmount=E_HANDLE xsystem=E_NOTIMPL calls=29 PASS.
  • python -B tests/xgameruntime_table_check.py
    • exports=27 classes=XAsync,XGame,XGameSave,XPackage,XPersistentLocalStorage,XSystem,XTaskQueue,XUser states=implemented_hr=15,implemented_void=5,stub=7 duplicate_control=detected PASS.
  • docs_links_check.py: Self-test passed., Checked 15 Markdown files and 252 links..
  • git diff --check origin/main...HEAD: clean.
  • Not run: full CTest, release preset, cross-process persistence, a real Xbox package service.

Evidence and follow-up

  • Branch runtime/pls-xpackage, head c4369fa, based on 32f63f9e (contains XCL-05).
    b9e0110 adds the contracts; c4369fa matches the documented PLS space structure and
    XPackage path signature.
  • Public sources: PLS GetPathSize,
    PLS GetPath,
    PLS GetSpaceInfo,
    XPackageMount,
    XPackageGetMountPath,
    XPackageCloseMountHandle.
  • Negative controls: small PLS buffer E_INVALIDARG, null PLS outputs E_POINTER, null or
    .. package id E_INVALIDARG, null mount output E_POINTER, closed/null mount
    E_HANDLE; async mount and XSystem remain E_NOTIMPL.
  • Limit: the PLS path uses GetTempPathW with a MAX_PATH + 1 bound; a longer temp path is
    untested. Persistence is process-local in this fixture.
  • The path is synthetic test state under %TEMP%; no game files, dumps, shader bytes, title
    paths or secrets are included.
  • Provenance: public Microsoft GDK docs above. No XCL code, table or output is used.

Checklist

  • One PLS/XPackage synthetic-title behavior.
  • Positive path/space/mount/unmount and named negative controls.
  • Async gap named and kept as a stub.
  • No game files, dumps, logs or secrets.
  • Provenance checked; no XCL code used.
  • AI-assisted (Codex).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6572441207 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1122). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T01:21:55Z. --- ## Change Add the PLS and XPackage contracts to the XGameRuntime fixture. - PLS exposes `XPersistentLocalStorageGetPathSize`, `XPersistentLocalStorageGetPath` and `XPersistentLocalStorageGetSpaceInfo`. The path is deterministic under `%TEMP%\xbox-recomp-pls\x2w-synthetic-title-0001`; the 32-byte space structure reports 32 MiB available, 48 MiB free, 16 MiB used and 64 MiB total. A short path buffer returns `HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)`; the 32-byte structure is guard-checked so a write past it is detected. - XPackage exposes `XPackageMount`, `XPackageGetMountPathSize`, `XPackageGetMountPath` (three arguments) and `XPackageCloseMountHandle`. The synthetic mount points under `%TEMP%\xbox-recomp-packages\<identifier>`; two mounts return the same path and a query on a closed mount returns `E_HANDLE`. - `XPackageMountWithUiAsync` remains a named `E_NOTIMPL` stub because the public `XAsyncBlock`, async result and queue/callback contract is not available without a GDK header. XUser, XGameSave and the other stubs are unchanged. - The table now has 27 exports: 15 implemented HRESULT, 5 implemented void and 7 stubs. ## Verification - `cmake --build --preset dev --target xgameruntime_shim xgameruntime_shim_check xgameruntime_contracts_check xgameruntime_pls_xpackage_check xgameruntime_preflight_exe xmem_shim d3d12_xs_shim` - Passed with MSVC 19.44. - `ctest --preset dev --no-tests=error -R '^xgameruntime_' -V` - 4/4 passed: thunks, XUser/XGameSave contracts, PLS/XPackage, strict preflight. - PLS/XPackage output: `space=33554432/50331648/67108864 async=stub unmount=E_HANDLE xsystem=E_NOTIMPL calls=29 PASS`. - `python -B tests/xgameruntime_table_check.py` - `exports=27 classes=XAsync,XGame,XGameSave,XPackage,XPersistentLocalStorage,XSystem,XTaskQueue,XUser states=implemented_hr=15,implemented_void=5,stub=7 duplicate_control=detected PASS`. - `docs_links_check.py`: `Self-test passed.`, `Checked 15 Markdown files and 252 links.`. - `git diff --check origin/main...HEAD`: clean. - Not run: full CTest, release preset, cross-process persistence, a real Xbox package service. ## Evidence and follow-up - Branch `runtime/pls-xpackage`, head `c4369fa`, based on `32f63f9e` (contains XCL-05). `b9e0110` adds the contracts; `c4369fa` matches the documented PLS space structure and XPackage path signature. - Public sources: [PLS GetPathSize](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpathsize?view=gdk-2604), [PLS GetPath](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath?view=gdk-2604), [PLS GetSpaceInfo](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo?view=gdk-2510), [XPackageMount](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpackage/functions/xpackagemount?view=gdk-2604), [XPackageGetMountPath](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpackage/functions/xpackagegetmountpath?view=gdk-2604), [XPackageCloseMountHandle](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpackage/functions/xpackageclosemounthandle?view=gdk-2510). - Negative controls: small PLS buffer `E_INVALIDARG`, null PLS outputs `E_POINTER`, null or `..` package id `E_INVALIDARG`, null mount output `E_POINTER`, closed/null mount `E_HANDLE`; async mount and XSystem remain `E_NOTIMPL`. - Limit: the PLS path uses `GetTempPathW` with a `MAX_PATH + 1` bound; a longer temp path is untested. Persistence is process-local in this fixture. - The path is synthetic test state under `%TEMP%`; no game files, dumps, shader bytes, title paths or secrets are included. - Provenance: public Microsoft GDK docs above. No XCL code, table or output is used. ## Checklist - [x] One PLS/XPackage synthetic-title behavior. - [x] Positive path/space/mount/unmount and named negative controls. - [x] Async gap named and kept as a stub. - [x] No game files, dumps, logs or secrets. - [x] Provenance checked; no XCL code used. - [x] AI-assisted (Codex).
upstream-sync closed this pull request 2026-11-24 06:46:26 +00:00
tedin7 commented 2026-11-24 06:46:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:02:56Z.

Review: COMMENTED


Reviewed at c4369fadb632dc96bd88d328f604490f35b60425d (diff + src/xgameruntime_shim.cpp, tests/xgameruntime_pls_xpackage_check.cpp, tests/xgameruntime_table_check.py, docs/experiments.md).

  • XPersistentLocalStorageSpaceInfo layout (sizeof == 32), ASCII-only valid_package_identifier() path-traversal guards (. / ..), SRWLOCK mount table handling, and negative controls (E_POINTER, E_INVALIDARG, ERROR_INSUFFICIENT_BUFFER, E_HANDLE, and E_NOTIMPL stubs) look clean and well-scoped.
  • docs/experiments.md and tests/xgameruntime_table_check.py are updated in sync and remain title-neutral.
  • Linux checks run in a detached worktree: python3 -B tests/docs_links_check.py, python3 -B tests/bidi_controls_check.py, python3 -B tests/gpu_report_format_check.py, python3 -B tests/xgameruntime_table_check.py (exports=27, implemented_hr=15,implemented_void=5,stub=7), and python3 -m py_compile tests/xgameruntime_table_check.py — all passed.
  • Windows MSVC build and xgameruntime_pls_xpackage execution were not run locally on this Linux host and rely on CI (Windows build jobs currently pending on this head).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6032526161 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1122#pullrequestreview-6032526161). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:02:56Z. **Review:** COMMENTED --- Reviewed at `c4369fadb632dc96bd88d328f604490f35b60425d` (diff + `src/xgameruntime_shim.cpp`, `tests/xgameruntime_pls_xpackage_check.cpp`, `tests/xgameruntime_table_check.py`, `docs/experiments.md`). - `XPersistentLocalStorageSpaceInfo` layout (`sizeof == 32`), ASCII-only `valid_package_identifier()` path-traversal guards (`.` / `..`), `SRWLOCK` mount table handling, and negative controls (`E_POINTER`, `E_INVALIDARG`, `ERROR_INSUFFICIENT_BUFFER`, `E_HANDLE`, and `E_NOTIMPL` stubs) look clean and well-scoped. - `docs/experiments.md` and `tests/xgameruntime_table_check.py` are updated in sync and remain title-neutral. - Linux checks run in a detached worktree: `python3 -B tests/docs_links_check.py`, `python3 -B tests/bidi_controls_check.py`, `python3 -B tests/gpu_report_format_check.py`, `python3 -B tests/xgameruntime_table_check.py` (`exports=27`, `implemented_hr=15,implemented_void=5,stub=7`), and `python3 -m py_compile tests/xgameruntime_table_check.py` — all passed. - Windows MSVC build and `xgameruntime_pls_xpackage` execution were not run locally on this Linux host and rely on CI (Windows build jobs currently pending on this head).
R0Y00 commented 2026-11-24 06:50:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T01:36:42Z.


I pushed c4369fad to match the public Windows ABI. XPackageGetMountPath takes three arguments. XPersistentLocalStorageSpaceInfo has four 64-bit fields, including usedBytes. The fixture now calls the three-argument export and checks every counter with output guards. The PC short-buffer result matches the documented error. Windows Release passed 4/4 with ctest --preset release --no-tests=error -R '^xgameruntime_'.

Package path signature · PLS structure

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119272891 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1122#issuecomment-7119272891). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T01:36:42Z. --- I pushed c4369fad to match the public Windows ABI. XPackageGetMountPath takes three arguments. XPersistentLocalStorageSpaceInfo has four 64-bit fields, including usedBytes. The fixture now calls the three-argument export and checks every counter with output guards. The PC short-buffer result matches the documented error. Windows Release passed 4/4 with `ctest --preset release --no-tests=error -R '^xgameruntime_'`. [Package path signature](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpackage/functions/xpackagegetmountpath) · [PLS structure](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpersistentlocalstorage/structs/xpersistentlocalstoragespaceinfo)
lambirou commented 2026-11-24 06:50:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T01:55:15Z.


Adopted c4369fad. The PLS space structure is now 32 bytes with usedBytes (16 MiB synthetic used) and guard checks; a short PLS path returns ERROR_INSUFFICIENT_BUFFER; XPackageGetMountPath is the documented three-argument form. 4/4 XGameRuntime tests pass, docs_links 15 files/252 links.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119580458 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1122#issuecomment-7119580458). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T01:55:15Z. --- Adopted c4369fad. The PLS space structure is now 32 bytes with usedBytes (16 MiB synthetic used) and guard checks; a short PLS path returns ERROR_INSUFFICIENT_BUFFER; XPackageGetMountPath is the documented three-argument form. 4/4 XGameRuntime tests pass, docs_links 15 files/252 links.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1115
No description provided.