runtime: read a persisted blob through async save slots 21 and 22 #1439

Manually merged
github merged 2 commits from gh-pr/1439/head into gh-pr/1439/base 2026-11-26 23:07:16 +00:00
Owner

@⁠SimSalabimse on GitHub · 2026-11-24 11:31 UTC · original
SimSalabimse:x2w-gamesave-read-async → main · +656 −9 · 7 files · 2 commits · merged 2026-11-24 12:11 UTC

Slots 21 and 22 (XGameSaveReadBlobDataAsync / XGameSaveReadBlobDataResult) now read committed blobs through the same system XAsync service as slots 28/29 and pack them into the caller's buffer.

Fixes #1355

Change

Slot 21 reserves the async block with its own identity (local XGameSaveReadBlobData). If XAsyncBegin rejects it, slot 21 returns before reading. Once accepted, it snapshots the named blobs with save_store().read_blobs under the existing shared file lock, packs them, and completes with the status and the byte size slot 22 needs. No user service, and no save lock is held across XAsyncComplete.

The layout is the one from draft #1334 (24-byte records, payload pointer at offset 16, then each name, a NUL and the payload), in a small helper src/startup_stubs/save_blob_pack.h on top of main's read_blobs. #1334 is not changed, and its publication_lock() / entries() are not used. When #1334 lands I can switch this to its helper so there's one copy of the layout.

Slot 22: short buffer 0x80830007, missing blob 0x80830008, and neither writes the caller's count or bytes. Busy and other storage failures are 0x80004005, a bad name is 0x80070057. Slots 13, 14, 18 and 20 are unchanged.

Verification

Windows 11 26200, MSVC 19.42, commit bb4272f, Debug (--preset dev) and Release (--preset release), same results in both:

  • ctest --preset dev --no-tests=error -R startup_gamesave -V: 8 tests, 0 failed. Passed persist, publish_locked, publish_unlocked, lock_errors, submit_controlled, read_async_controlled. Skipped submit_system, read_async_system.
  • ctest --preset dev --no-tests=error -R '^startup_gamesave_read_async_' -V: controlled passed, system skipped.
  • ctest --preset dev --no-tests=error -R startup_gamesave_submit_controlled -V: passed.

The system variants skipped (exit 77) because xgameruntime.dll isn't installed here. The system read variant has not run anywhere yet.

Evidence and follow-up

New fixture tests/startup_gamesave_read_async.cpp is source-built: one process commits two blobs, a second reads them through 21/22. It checks the callback, required size, count and exact bytes, a missing blob, a short buffer that leaves output unchanged, and two overlapping reads. Docs: Game saves section of docs/startup-runtime.md.

Follow-up anyone can pick up: run ctest --preset dev -R '^startup_gamesave_read_async_system$' -V on a PC with the Windows gaming runtime.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Grok Build)

**@⁠SimSalabimse** on GitHub · 2026-11-24 11:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1439) `SimSalabimse:x2w-gamesave-read-async` → `main` · +656 −9 · 7 files · 2 commits · merged 2026-11-24 12:11 UTC Slots 21 and 22 (`XGameSaveReadBlobDataAsync` / `XGameSaveReadBlobDataResult`) now read committed blobs through the same system XAsync service as slots 28/29 and pack them into the caller's buffer. Fixes #1355 ## Change Slot 21 reserves the async block with its own identity (`local XGameSaveReadBlobData`). If `XAsyncBegin` rejects it, slot 21 returns before reading. Once accepted, it snapshots the named blobs with `save_store().read_blobs` under the existing shared file lock, packs them, and completes with the status and the byte size slot 22 needs. No user service, and no save lock is held across `XAsyncComplete`. The layout is the one from draft #1334 (24-byte records, payload pointer at offset 16, then each name, a NUL and the payload), in a small helper `src/startup_stubs/save_blob_pack.h` on top of main's `read_blobs`. #1334 is not changed, and its `publication_lock()` / `entries()` are not used. When #1334 lands I can switch this to its helper so there's one copy of the layout. Slot 22: short buffer `0x80830007`, missing blob `0x80830008`, and neither writes the caller's count or bytes. Busy and other storage failures are `0x80004005`, a bad name is `0x80070057`. Slots 13, 14, 18 and 20 are unchanged. ## Verification Windows 11 26200, MSVC 19.42, commit bb4272f, Debug (`--preset dev`) and Release (`--preset release`), same results in both: - `ctest --preset dev --no-tests=error -R startup_gamesave -V`: 8 tests, 0 failed. Passed persist, publish_locked, publish_unlocked, lock_errors, submit_controlled, read_async_controlled. Skipped submit_system, read_async_system. - `ctest --preset dev --no-tests=error -R '^startup_gamesave_read_async_' -V`: controlled passed, system skipped. - `ctest --preset dev --no-tests=error -R startup_gamesave_submit_controlled -V`: passed. The system variants skipped (exit 77) because `xgameruntime.dll` isn't installed here. The system read variant has not run anywhere yet. ## Evidence and follow-up New fixture `tests/startup_gamesave_read_async.cpp` is source-built: one process commits two blobs, a second reads them through 21/22. It checks the callback, required size, count and exact bytes, a missing blob, a short buffer that leaves output unchanged, and two overlapping reads. Docs: Game saves section of `docs/startup-runtime.md`. Follow-up anyone can pick up: run `ctest --preset dev -R '^startup_gamesave_read_async_system$' -V` on a PC with the Windows gaming runtime. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Grok Build)
Slots 21 and 22 snapshot committed blobs through the system XAsync service
and pack them into the caller's buffer. A source-built Windows ctest covers
the callback, the bytes, a missing blob, a short buffer, and overlap.

Fixes #1355
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:07:14 +00:00
github manually merged commit 310ad97305 into gh-pr/1439/base 2026-11-26 23:07:16 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 12:06 UTC · original

310ad973 catches construction failure before reserving the async block. I independently ran Windows Debug and Release: all five persist, submit and read tests passed in each, with no skips. In the system-runtime round a fresh process read back the committed blobs, and the missing result, short output and overlapping blocks were distinguished.

**@⁠R0Y00** on GitHub · 2026-11-24 12:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1439#issuecomment-7130969361) 310ad973 catches construction failure before reserving the async block. I independently ran Windows Debug and Release: all five persist, submit and read tests passed in each, with no skips. In the system-runtime round a fresh process read back the committed blobs, and the missing result, short output and overlapping blocks were distinguished.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 11:47 UTC · original · reviewed

Reviewed at bb4272f5:

  • Diff & static audit: git diff --check clean. XAsyncBegin precedes snapshot_read (rejected blocks leave storage untouched), save_lock is released before read_blobs and XAsyncComplete, remember_read runs before XAsyncComplete (safe for immediate callbacks), and slot 22 returns 0x80830007 before XAsyncGetResult on short buffers without modifying caller memory or consuming the pending result.
  • Linux checks: docs_links_check.py (322 links) and bidi_controls_check.py (1184 files) passed.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207):
    • Debug (--preset dev, startup_gamesave_read_async): startup_gamesave_read_async_controlled PASS (0.14s); startup_gamesave_read_async_system Skipped (77) (capability skip, xgameruntime.dll unavailable).
    • Release /O2 (--preset release, startup_gamesave_read_async): startup_gamesave_read_async_controlled PASS (0.12s); startup_gamesave_read_async_system Skipped (77).
**@⁠tedin7** on GitHub · 2026-11-24 11:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1439#pullrequestreview-6038632833) · **reviewed** Reviewed at `bb4272f5`: - **Diff & static audit**: `git diff --check` clean. `XAsyncBegin` precedes `snapshot_read` (rejected blocks leave storage untouched), `save_lock` is released before `read_blobs` and `XAsyncComplete`, `remember_read` runs before `XAsyncComplete` (safe for immediate callbacks), and slot 22 returns `0x80830007` before `XAsyncGetResult` on short buffers without modifying caller memory or consuming the pending result. - **Linux checks**: `docs_links_check.py` (322 links) and `bidi_controls_check.py` (1184 files) passed. - **Windows Server 2025 (Build 26100, MSVC 14.44.35207)**: - Debug (`--preset dev`, `startup_gamesave_read_async`): `startup_gamesave_read_async_controlled` **PASS** (`0.14s`); `startup_gamesave_read_async_system` **Skipped (77)** (capability skip, `xgameruntime.dll` unavailable). - Release `/O2` (`--preset release`, `startup_gamesave_read_async`): `startup_gamesave_read_async_controlled` **PASS** (`0.12s`); `startup_gamesave_read_async_system` **Skipped (77)**.
This discussion has been locked. Commenting is limited to contributors.
No description provided.