feat(xgameruntime): implement XGameSave on a per-title save folder #14
No reviewers
Labels
No labels
accessibility
bug
ci
docs
documentation
duplicate
enhancement
fixes issue
good first issue
help wanted
invalid
library request
libs
needs rebase
question
relinker
stale
tools
unblocks title
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Dark3581--AnyBox!14
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/14/head"
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?
@Callimann8 on GitHub · 2026-11-21 12:14 UTC · original
Callimann8:claude/project-thread-7i52ws→main· +1181 −60 · 13 files · 1 commits · merged 2026-11-21 12:25 UTCWhat
Implements XGameSave on top of a per-title save folder (issue #3).
GameSave.cppwith the provider, container, blob and update functions and their async variants:XGameSaveInitializeProvider[Async/Result],CloseProvider,GetRemainingQuota[Async/Result],DeleteContainer[Async/Result],CreateContainer,CloseContainer,GetContainerInfo,EnumerateContainerInfo[ByName],EnumerateBlobInfo[ByName],ReadBlobData[Async/Result],CreateUpdate,CloseUpdate,SubmitBlobWrite,SubmitBlobDelete,SubmitUpdate[Async/Result]. The declarations get their real signatures and the types (XGameSave*Handle,XGameSaveContainerInfo,XGameSaveBlobInfo,XGameSaveBlob, the two callbacks,XUserHandle) go inTypes.hpp. TheXGameSaveFiles*exports stay stubbed.<name with / as %>.xgs, in%LOCALAPPDATA%\AnyBox\<TitleId>\XGameSave. An update is written to a temporary file and moved over the container, so it applies atomically.E_GS_INVALID_CONTAINER_NAMEwith the documented name rules,E_GS_UPDATE_TOO_BIGabove 16 MiB,E_GS_QUOTA_EXCEEDEDabove 256 MiB,E_GS_BLOB_NOT_FOUND,E_GS_PROVIDED_BUFFER_TOO_SMALL,E_GS_HANDLE_EXPIREDfor an update used after submit,E_GS_OUT_OF_LOCAL_STORAGEfor a full disk.e2e_gamesavescenario: invalid names, a container hidden until its first update, write, reread, enumerate (with and without prefix, stopping early), read all and by name, buffer too small, missing blob, a 16 MiB+1 update, quota, async read, update, quota, init and delete, and on-disk persistence checked bye2e.py.e2e.pypointsLOCALAPPDATAat the scenario's work folder.feat-xgamesave.mdrecords what is ignored (user, SCID, sync) and everything the docs don't specify.gdk-inventory.md, README and ARCHITECTURE are updated to match.Tested
Linux (Ubuntu 24.04): cross-built every library and test with MinGW-w64 GCC (posix) with no warnings.
check_conventions.pyanddebt_fold.py --checkpass, and the relinker-only build passes all 20 CTest tests. I could not run the e2e scenarios here because Wine crashes on start in my environment, soe2e_gamesavehas not run yet. The Windows CI job is the first real run.Checklist
main; no other open PR implements the same functionspython tools/check_conventions.pypasses (no comments in code, one declaration per export, Conventional Commit subjects)AbxNotImplemented/AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragmentdocs/dev/debt/changes/<branch>.md@github-actions[bot] on GitHub · 2026-11-21 12:17 UTC · original
Progress report (
395947f→5d9bb19)📈 Libraries: 22.77% (+6.0268%, +27 implemented functions)
✅ 27 implemented
XGameSaveCloseContainerXGameSaveCloseProviderXGameSaveCloseUpdateXGameSaveCreateContainerXGameSaveCreateUpdateXGameSaveDeleteContainerXGameSaveDeleteContainerAsyncXGameSaveDeleteContainerResultXGameSaveEnumerateBlobInfoXGameSaveEnumerateBlobInfoByNameXGameSaveEnumerateContainerInfoXGameSaveEnumerateContainerInfoByNameXGameSaveGetContainerInfoXGameSaveGetRemainingQuotaXGameSaveGetRemainingQuotaAsyncXGameSaveGetRemainingQuotaResultXGameSaveInitializeProviderXGameSaveInitializeProviderAsyncXGameSaveInitializeProviderResultXGameSaveReadBlobDataXGameSaveReadBlobDataAsyncXGameSaveReadBlobDataResultXGameSaveSubmitBlobDeleteXGameSaveSubmitBlobWriteXGameSaveSubmitUpdateXGameSaveSubmitUpdateAsyncXGameSaveSubmitUpdateResultChanged libraries
@Dark3581 on GitHub · 2026-11-21 12:25 UTC · original · approved these changes
Reviewed — looks good
Merging as it is. The first real run of
e2e_gamesaveis green here, the format and the atomic replace are clean, and the debt fragment is thorough.What I ran
Head
5d9bb19, based on currentmain(395947f). MinGW (WinLibs GCC 15.2 UCRT, Ninja, Release) on Windows 10, clean build directory.Results
e2e_gamesave, repeatedtools/check_conventions.py,tools/debt_fold.py --checktools/progress.pyI also checked the two places I expected trouble.
XGameSaveReadBlobDataResultderives the count from the first laid-out name pointer, which holds becauseXAsyncGetResulthands the caller's buffer straight to the provider'sGetResult. AndStartdeleting the operation after a failedXAsyncBeginis not a double free, becauseXAsyncBeginonly fails before the provider is attached.Findings
Blocking
None.
Non-blocking
core/libs/xdll/xgameruntime/GameSave.cpp:312(called from:469and:363):Usedreads and parses every container in the folder in full, under the storage mutex, on everyXGameSaveSubmitUpdateand every quota query. Near the 256 MiB quota, each save re-reads up to 256 MiB from disk while blocking every other XGameSave call. Keeping the blob total in the file header, or summing file sizes from theFindFirstFileWdata, would make it proportional to the number of containers. Not a correctness problem.core/libs/xdll/xgameruntime/GameSave.cpp:847:XGameSaveSubmitUpdateAsynccheckssubmittedwhen called, but only the work sets it, on a worker thread. Two async submits of one update before the first completes both pass and both apply, andsubmittedis a plainboolread and written on different threads. Suggest marking the update busy (atomically) onceStartsucceeds, with an e2e case for the second call, and recording in debt what that call returns, since the docs don't say.E_GS_QUOTA_EXCEEDEDis not exercised bye2e_gamesave, which checks the remaining quota values only. Reaching it takes 17 updates of 16 MiB, so it is fine to leave as is.XGameSaveFiles*exports are still stubs. I'll adjust that line in a follow-up onmain.Not verified
Reading the saves back from a second run of the title (e2e checks the file on disk), the full-disk path, the MSVC build locally (CI covers it), and behaviour on a console, as recorded in debt.
Thanks, this is a careful implementation, and it closes #3.
@Dark3581 on GitHub · 2026-11-21 12:30 UTC · original
Follow-up landed in
ddd30ef: the README row now listsXGameSaveFilesamong the stubs. The other two non-blocking points (the full re-read inUsed, and a secondXGameSaveSubmitUpdateAsyncon one update) are open for a follow-up PR if you'd like to take them.