xgameruntime: packaged identity, content mounts and folder saves #530

Merged
csj0oe merged 3 commits from upstream-pr/530 into main 2026-11-29 21:06:32 +00:00
csj0oe commented 2026-11-29 20:10:54 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by csj0oe on 2026-11-29T20:10:54Z.


What

Three storage behaviours a title can reach.

  • Packaged identity agrees with itself. The launcher sets TUXBOX_PACKAGED=1 with env.setdefault when it computed a package root, from the same answer it already passes to the game, so XPackageIsPackagedProcess and XPackageGetCurrentProcessPackageIdentifier can no longer disagree.
  • Content mounts. One handle table serves the mount and path slots and the persistent-local-storage mount. The running package mounts at the drive root, but only when the launcher actually attached it there: package_drive_mounted() requires the marker it writes after taking the drive over, so a title never receives a G:\ that is not the package. Anything else completes with ERROR_NOT_FOUND; short buffers get INSUFFICIENT_BUFFER; stale or foreign handles get E_INVALIDARG; closing twice is a no-op.
  • Folder saves. The folder save API runs over a per-configuration directory, with the quota derived from the bytes used and the documented provider-mismatch error when mixed with the classic save API in either direction.

Verification

  • Slots and interface identities were measured from the local reference's wrapper table, not header order: the mount slots, the storage mount slot and the folder save slots all match, and the mount path reaches slot 25 as recorded.
  • Compiler static_asserts for the install-progress and storage-space layouts (32 bytes each), the identifier maximum, the prototypes, and both error codes.
  • 10 Rust tests pass as a real x64 binary under Proton GE, including a four-way matrix of packaged identity with and without the drive marker.
  • Control guest passes in all four environment combinations; python tuxbox.py check --no-gpu 7/7.

The follow-up commit fixes review findings: the ABI test passes /I so it works with cl as well as clang-cl; the mount root is gated on the drive claim; the quota walk uses symlink_metadata, counts only regular files and caps depth; the quota arithmetic is saturating; the empty configuration maps to a name the encoder cannot produce; the guest releases its four API objects.

Not covered

  • No live launch, so the packaged-identity flip needs one run without the override and one with TUXBOX_PACKAGED=0.
  • The /I path is cl-compatible by construction but was not executed under MSVC.
  • Native Windows launches still never map G:; they now correctly get ERROR_NOT_FOUND instead of a path that is not the package.
  • Real DLC mounting is ERROR_NOT_FOUND offline by design; no shipped DLC existed to mount.
<!-- greyfinch-sync:brcly/TuxBox:issue:5554639440 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/530). Originally posted by [csj0oe](https://github.com/csj0oe) on 2026-11-29T20:10:54Z. --- ## What Three storage behaviours a title can reach. - **Packaged identity agrees with itself.** The launcher sets `TUXBOX_PACKAGED=1` with `env.setdefault` when it computed a package root, from the same answer it already passes to the game, so `XPackageIsPackagedProcess` and `XPackageGetCurrentProcessPackageIdentifier` can no longer disagree. - **Content mounts.** One handle table serves the mount and path slots and the persistent-local-storage mount. The running package mounts at the drive root, but only when the launcher actually attached it there: `package_drive_mounted()` requires the marker it writes after taking the drive over, so a title never receives a `G:\` that is not the package. Anything else completes with `ERROR_NOT_FOUND`; short buffers get `INSUFFICIENT_BUFFER`; stale or foreign handles get `E_INVALIDARG`; closing twice is a no-op. - **Folder saves.** The folder save API runs over a per-configuration directory, with the quota derived from the bytes used and the documented provider-mismatch error when mixed with the classic save API in either direction. ## Verification - Slots and interface identities were measured from the local reference's wrapper table, not header order: the mount slots, the storage mount slot and the folder save slots all match, and the mount path reaches slot 25 as recorded. - Compiler `static_assert`s for the install-progress and storage-space layouts (32 bytes each), the identifier maximum, the prototypes, and both error codes. - 10 Rust tests pass as a real x64 binary under Proton GE, including a four-way matrix of packaged identity with and without the drive marker. - Control guest passes in all four environment combinations; `python tuxbox.py check --no-gpu` 7/7. The follow-up commit fixes review findings: the ABI test passes `/I` so it works with `cl` as well as `clang-cl`; the mount root is gated on the drive claim; the quota walk uses `symlink_metadata`, counts only regular files and caps depth; the quota arithmetic is saturating; the empty configuration maps to a name the encoder cannot produce; the guest releases its four API objects. ## Not covered - No live launch, so the packaged-identity flip needs one run without the override and one with `TUXBOX_PACKAGED=0`. - The `/I` path is `cl`-compatible by construction but was not executed under MSVC. - Native Windows launches still never map `G:`; they now correctly get `ERROR_NOT_FOUND` instead of a path that is not the package. - Real DLC mounting is `ERROR_NOT_FOUND` offline by design; no shipped DLC existed to mount.
brcly commented 2026-11-29 20:38:04 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T20:38:04Z.


Thanks. From reading, this looks fine: honest local answers and tests for each case. We're adding Lanes self-test scenarios that call these providers, so they're checked without booting a title. We'll merge it once those pass with it.

<!-- greyfinch-sync:brcly/TuxBox:comment:7262236773 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/530#issuecomment-7262236773). Originally posted by [brcly](https://github.com/brcly) on 2026-11-29T20:38:04Z. --- Thanks. From reading, this looks fine: honest local answers and tests for each case. We're adding Lanes self-test scenarios that call these providers, so they're checked without booting a title. We'll merge it once those pass with it.
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
brcly/TuxBox!530
No description provided.