Discover containers and read committed blobs through the save provider #1327

Open
R0Y00 wants to merge 2 commits from upstream-pr/1334 into main
R0Y00 commented 2026-11-24 08:25:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T08:25:54Z.


Refs #1200. Depends on @tedin7's #1246. Please merge that PR first. Its latest head is 97a63a54 in the author's fork. This branch integrates that commit at 25aa7467. Review only the new change.

On the matched save class/interface pair, slot 13 performs exact container lookup, 14 enumerates containers, 18 enumerates blobs, and 20 reads the committed data. Callbacks run after a metadata snapshot has released the storage lock. The synchronous output contains record headers, terminated names, and payloads inside caller-owned memory. The local store reports its directory name as its display name.

The source-built Windows writer creates a container with a process-generated name, writes two binary preferences, submits and exits. A second process enumerates two containers, chooses the one reporting two blobs, verifies exact lookup, and obtains the names and sizes from blob enumeration. It reads 6 payload bytes in a 74-byte buffer and also checks early stop, a mismatched interface ID and a read-all count of two. A 73-byte buffer returns 0x80830007, and a missing second blob returns 0x80830008. Neither failure changes the supplied output.

The restart test also runs with a system Gaming Runtime immediate queue. A rejected slot 28 leaves slot 20 reporting a missing blob. The same update then commits through slots 28 and 29, and the second process discovers and reads it. On Windows 11 build 26200.9974 both Debug and Release /O2 ran 5/5 tests, with no skips. This exercises the provider vtable and a source-built QueryApiImpl service. The second-start setup behavior in #1200 and asynchronous reads remain open.

cmake --build --preset dev --target startup_stub_gameinput startup_gamesave_submit startup_gamesave_read startup_gamesave_persist
ctest --preset dev --no-tests=error -R '^startup_gamesave_' -V
cmake --build --preset release --target startup_stub_gameinput startup_gamesave_submit startup_gamesave_read startup_gamesave_persist
ctest --preset release --no-tests=error -R '^startup_gamesave_' -V

Microsoft documents the enumeration buffer calculation and synchronous read. XCL's table generated from the public PC GDK supplies the slot and identity cross-check.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5468662985 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1334). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T08:25:54Z. --- Refs #1200. Depends on @tedin7's #1246. Please merge that PR first. Its latest head is 97a63a54 in the author's fork. This branch integrates that commit at 25aa7467. [Review only the new change](https://github.com/R0Y00/Xbox2Windows/compare/97a63a54...25aa7467). On the matched save class/interface pair, slot 13 performs exact container lookup, 14 enumerates containers, 18 enumerates blobs, and 20 reads the committed data. Callbacks run after a metadata snapshot has released the storage lock. The synchronous output contains record headers, terminated names, and payloads inside caller-owned memory. The local store reports its directory name as its display name. The source-built Windows writer creates a container with a process-generated name, writes two binary preferences, submits and exits. A second process enumerates two containers, chooses the one reporting two blobs, verifies exact lookup, and obtains the names and sizes from blob enumeration. It reads 6 payload bytes in a 74-byte buffer and also checks early stop, a mismatched interface ID and a read-all count of two. A 73-byte buffer returns 0x80830007, and a missing second blob returns 0x80830008. Neither failure changes the supplied output. The restart test also runs with a system Gaming Runtime immediate queue. A rejected slot 28 leaves slot 20 reporting a missing blob. The same update then commits through slots 28 and 29, and the second process discovers and reads it. On Windows 11 build 26200.9974 both Debug and Release /O2 ran 5/5 tests, with no skips. This exercises the provider vtable and a source-built QueryApiImpl service. The second-start setup behavior in #1200 and asynchronous reads remain open. ```powershell cmake --build --preset dev --target startup_stub_gameinput startup_gamesave_submit startup_gamesave_read startup_gamesave_persist ctest --preset dev --no-tests=error -R '^startup_gamesave_' -V cmake --build --preset release --target startup_stub_gameinput startup_gamesave_submit startup_gamesave_read startup_gamesave_persist ctest --preset release --no-tests=error -R '^startup_gamesave_' -V ``` Microsoft documents the [enumeration buffer calculation](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgamesave/functions/xgamesaveenumerateblobinfo) and [synchronous read](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgamesave/functions/xgamesavereadblobdata). XCL's [table generated from the public PC GDK](https://github.com/ivall/xcl/blob/64b3f35599bb7102f55d640e1a791e7d6dd3b175/crates/xcl/src/hle/xgameruntime/gdk_table.rs#L261-L270) supplies the slot and identity cross-check.
R0Y00 commented 2026-11-24 10:02:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T09:09:39Z.


#1246 is on main at 843f8d4b. The draft conflicts in CMakeLists.txt and save_store.h; please preserve both the new read fixture and the upstream publication tests. In the combined code, slot 20 reads each blob separately under a process-local mutex. Please use one shared publication lock for the entire requested set, including capacity validation against the snapshot. The upstream read_blobs primitive can snapshot an explicit batch. Container/blob enumeration also needs a coherent per-container metadata view. Add a source-built control where a second process publishes between reads; slot 20 should observe one generation or return busy with the destination untouched. The existing restart test remains useful.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7127037529 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1334#issuecomment-7127037529). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T09:09:39Z. --- #1246 is on main at 843f8d4b. The draft conflicts in CMakeLists.txt and save_store.h; please preserve both the new read fixture and the upstream publication tests. In the combined code, slot 20 reads each blob separately under a process-local mutex. Please use one shared publication lock for the entire requested set, including capacity validation against the snapshot. The upstream read_blobs primitive can snapshot an explicit batch. Container/blob enumeration also needs a coherent per-container metadata view. Add a source-built control where a second process publishes between reads; slot 20 should observe one generation or return busy with the destination untouched. The existing restart test remains useful.
tedin7 commented 2026-11-25 03:01:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:58:17Z.


Claiming a focused slice: XGameSaveInitializeProviderAsync plus XGameSaveInitializeProviderResult in the xgameruntime stand-in (completes through the existing synchronous provider path; XAsyncGetStatus and task queues stay out of scope).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7151440870 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1334#issuecomment-7151440870). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T02:58:17Z. --- Claiming a focused slice: XGameSaveInitializeProviderAsync plus XGameSaveInitializeProviderResult in the xgameruntime stand-in (completes through the existing synchronous provider path; XAsyncGetStatus and task queues stay out of scope).
tedin7 commented 2026-11-25 11:02:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T10:26:11Z.


Claiming a focused slice: XGameSaveEnumerateBlobInfo and XGameSaveEnumerateBlobInfoByName in the xgameruntime stand-in (synchronous callback walk over the existing in-process store; container enumeration and async reads stay out of scope).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7159691856 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1334#issuecomment-7159691856). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T10:26:11Z. --- Claiming a focused slice: XGameSaveEnumerateBlobInfo and XGameSaveEnumerateBlobInfoByName in the xgameruntime stand-in (synchronous callback walk over the existing in-process store; container enumeration and async reads stay out of scope).
R0Y00 commented 2026-11-28 00:34:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T00:34:15Z.


The enumeration and synchronous read scope from this draft is on main through #1761 and #2159. In particular, #2159 carries the read-side work and attribution from this draft, and it uses one shared-publication snapshot for the requested set. Main still covers short buffers and missing blobs without modifying the caller's output. Keeping the draft available as a record of the original proposal.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7231018535 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1334#issuecomment-7231018535). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-28T00:34:15Z. --- The enumeration and synchronous read scope from this draft is on main through #1761 and #2159. In particular, #2159 carries the read-side work and attribution from this draft, and it uses one shared-publication snapshot for the requested set. Main still covers short buffers and missing blobs without modifying the caller's output. Keeping the draft available as a record of the original proposal.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1334:upstream-pr/1334'
git switch 'upstream-pr/1334'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1334'
git switch 'upstream-pr/1334'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1334'
git switch 'upstream-pr/1334'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1334'
git switch 'main'
git merge --squash 'upstream-pr/1334'
git switch 'main'
git merge --ff-only 'upstream-pr/1334'
git switch 'main'
git merge 'upstream-pr/1334'
git push origin 'main'
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!1327
No description provided.