xgamesave: a blob read accepts the unpadded buffer size (RT-XGAMESAVE-UNPADDED-READ) #2359
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2359
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2359"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@DadaCap on GitHub · 2026-11-26 15:22 UTC · original
DadaCap:xgamesave-unpadded-read→main· +30 −9 · 2 files · 1 commits · merged 2026-11-26 16:29 UTCClaimed in the coordination issue as: #1608
Depends on: none. It merges cleanly with current
main, #2003 and #1952 (both also touch the game-save files). It conflicts with draft #147, which already conflicts withmainon its own.What and why
XGameSaveReadBlobData(and the result ofXGameSaveReadBlobDataAsync) packs theXGameSaveBlobarray, then each blob's data and name into the title's buffer. A title sizes that buffer as the plain sum ofsizeof(XGameSaveBlob), the data, and the name with its NUL for each blob. The shim required its own 8-byte aligned layout, which is larger, so it refused such a buffer withE_GS_PROVIDED_BUFFER_TOO_SMALL. The retail title took that refusal as a failed save and showed its autosave error.The fix, in
runtime/shims/xgameruntime_gamesave.cpp:packed_size(blobs, aligned): the minimum the read requires, and the size the async read reports, is now the unpadded sum.pack(blobs, buffer, buffer_size)keeps the 8-byte aligned layout when the buffer has room for it, and packs the blobs back to back otherwise. Callers that already passed a larger buffer get the same layout as before.Tested
xgameruntime_gamesave_testgains two checks (made-up blobs, no game data): a read into a buffer of exactly the unpadded size succeeds and returns the blob byte for byte inside the buffer, and one byte less returnsE_GS_PROVIDED_BUFFER_TOO_SMALL.main's shim the new test fails (78 checks, 1 failures: the exact-size read is refused); with the change all checks pass (ctest -R ^xgameruntime_gamesave).gta6rt(Windows 11, MSVC, Ninja, RelWithDebInfo). Not run: the full ctest suite and the translator suite (no shader or translator code changes).python -I scripts/check_no_game_data.pyon the changed files: clean.mainplus other local work: in the retail game on an RTX 5080 the read that failed now succeeds and the autosave error dialog no longer appears. No log lines or captures are quoted here.GPUs tested: NVIDIA GeForce RTX 5080, driver 621.24, Windows 11 (game observation only; the test needs no GPU).
AI-assisted: yes (Claude Code, Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator rule)🤖 Generated with Claude Code
https://claude.ai/code/session_01Gt9hwNPurxyJ9LAfUbNiYr
@lixonik on GitHub · 2026-11-26 15:35 UTC · original · reviewed
Built
xgameruntime_gamesave_testwith MSVC on Windows 11. All 78 checks passed, including exact unpadded synchronous and asynchronous reads, preserved payloads, and rejection of a one-byte-short synchronous buffer. Synthetic save data only. No findings from these checks.AI-assisted.
@aslan2142 on GitHub · 2026-11-26 16:29 UTC · original
Merging.
XGameSaveReadBlobDatabuffer as the plain sum of its parts, and the shim demanded its 8-byte padded size and refused. That refusal is what the title's "couldn't autosave" dialog comes from. Blobs are now packed back to back when the padded layout does not fit; a larger buffer gets the same layout as before.main56bdd7e88+ this PR (be829a4d6):main's shim fails on the unpadded read, andxgameruntime_gamesavepasses on the merge.main. No test went from pass to fail.xmem_write_watchwent from fail to pass, which this change does not touch.test_ci_registration.pypasses, andcheck_no_game_data.pyis clean on both files.Thanks @DadaCap, and @lixonik for the MSVC run.
AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)