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

Merged
SimSalabimse merged 2 commits from upstream-pr/1439 into main 2026-11-24 12:11:38 +00:00
SimSalabimse commented 2026-11-24 11:31:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T11:31:39Z.


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)

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6580800242 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1439). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-24T11:31:39Z. --- 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)
tedin7 commented 2026-11-24 12:03:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T11:47:52Z.

Review: COMMENTED


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).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6038632833 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1439#pullrequestreview-6038632833). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T11:47:52Z. **Review:** COMMENTED --- 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)**.
upstream-sync closed this pull request 2026-11-24 13:00:26 +00:00
R0Y00 commented 2026-11-24 13:00:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T12:06:14Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7130969361 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1439#issuecomment-7130969361). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T12:06:14Z. --- 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.
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!1432
No description provided.