Skip to content

XGameSave: the documented errors for a full disk and a small read buffer - #429

Merged
Marvisak merged 2 commits into
Marvisak:mainfrom
marquezinii:fix/xgamesave-documented-errors
Nov 24, 2026
Merged

Marvisak merged 2 commits into
Marvisak:mainfrom
marquezinii:fix/xgamesave-documented-errors

Conversation

@marquezinii

Copy link
Copy Markdown
Contributor

Two XGameSave results that differ from the documented error codes, one commit each:

A full host disk. Update::submit compared the update with min(quota left, disk free) and returned E_GS_QUOTA_EXCEEDED when it did not fit. The game saves errors page keeps the two apart: E_GS_OUT_OF_LOCAL_STORAGE is "the device has run out of room for save games [...] even if the game's per user storage quota has not been exceeded", while E_GS_QUOTA_EXCEEDED is the 256 MB per-user quota. A game shows different UI for each (delete saves vs free space on the device). The check is now a small no_room function: quota first, then the disk. The disk check no longer credits the bytes of replaced blobs, since commit writes the new version before it removes the old one. GetRemainingQuota is unchanged.

A small buffer for an async read result. XGameSaveReadBlobDataResult passed on XAsyncGetResult's E_NOT_SUFFICIENT_BUFFER. The function's errors include E_GS_PROVIDED_BUFFER_TOO_SMALL, which the synchronous read here already returns. The result stays in place, so a retry with a larger buffer still works (the test does that).

Tests: no_room gets a unit test for each case (disk short, quota short, a replacement that fits a full quota); the existing async read test first asks with an 8-byte buffer (before: 0x8007007A, now 0x80830007), then reads normally. cargo test -p victory-hle passes, including the kill-at-any-step test, and clippy reports nothing new.

https://learn.microsoft.com/gaming/gdk/docs/features/common/game-save/game-saves-errors
https://learn.microsoft.com/gaming/gdk/docs/reference/system/xgamesave/functions/xgamesavereadblobdataresult

…TOO_SMALL

XGameSaveReadBlobDataResult lists E_GS_PROVIDED_BUFFER_TOO_SMALL among
its errors, and the synchronous read already returns it; the result
passed on XAsyncGetResult's E_NOT_SUFFICIENT_BUFFER instead.
An update that fit the user's 256 MB quota but not the host disk failed
with E_GS_QUOTA_EXCEEDED, which tells the player to delete saves. The
documentation keeps the two apart: E_GS_OUT_OF_LOCAL_STORAGE is the
device out of room and can come before the quota is reached. The disk
check also no longer credits the blobs an update replaces, since the
new version is written before the old one is removed.
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
… small read buffer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DaviTostes

Copy link
Copy Markdown

Verified f0ee35e on Arch Linux x86_64 with the Windows build under Wine 11.22 (cargo xwin, x86_64-pc-windows-msvc, release, rustc 1.98.1):

Not covered: a genuinely full host disk (the test uses the quota path) and title behaviour (no game data here).

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested f0ee35e on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed).

  • Checking no_room against the old remaining(root) + replaced:
    • The quota path is unchanged. QUOTA.saturating_sub(used) + replaced still credits replaced blobs.
    • The disk path no longer credits them. That is right, since commit writes the new version before remove_dir_all of the old one, so the disk briefly holds both.
    • The quota is checked first, so a title over both limits still sees QUOTA_EXCEEDED.
  • read_result maps only E_NOT_SUFFICIENT_BUFFER to BUFFER_TOO_SMALL and passes other failures through unchanged. The extended async test confirms that a retry with the right size still reads the result.

No issues found.

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…a full disk and a small read buffer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ghost ghost mentioned this pull request Nov 24, 2026
@Marvisak
Marvisak merged commit f0894c2 into Marvisak:main Nov 24, 2026
suirentakamura pushed a commit to suirentakamura/VIctory that referenced this pull request Nov 24, 2026
…nted-errors

XGameSave: the documented errors for a full disk and a small read buffer
itsonlysimbo pushed a commit to itsonlysimbo/VIctory that referenced this pull request Nov 24, 2026
…nted-errors

XGameSave: the documented errors for a full disk and a small read buffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants