mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:25:53 +01:00
[PR #2359] [MERGED] xgamesave: a blob read accepts the unpadded buffer size (RT-XGAMESAVE-UNPADDED-READ) #2363
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2363
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2359
Author: @DadaCap
Created: 11/26/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142
Base:
main← Head:xgamesave-unpadded-read📝 Commits (1)
be829a4xgameruntime_gamesave: accept an XGameSaveReadBlobData buffer of the unpadded size📊 Changes
2 files changed (+30 additions, -9 deletions)
View changed files
📝
runtime/shims/xgameruntime_gamesave.cpp(+16 -9)📝
runtime/test/xgameruntime_gamesave_test.cpp(+14 -0)📄 Description
Claimed in the coordination issue as: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7196167761
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.