feat(xgameruntime): implement XPersistentLocalStorage on a per-title folder #80
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#80
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?
@CaseReed on GitHub · 2026-11-23 10:43 UTC · original
What
Implements XPersistentLocalStorage from #20 on a per-title folder. This takes the issue in part: five of the six exports are done,
XPersistentLocalStorageMountForPackagestays a stub (it now carries its documented signature).XPersistentLocalStorageGetPathSize,XPersistentLocalStorageGetPath%LOCALAPPDATA%\AnyBox\<TitleId>\PersistentLocalStorage\, created on first use, beside theXGameSavefolder and outside it, so it never counts against the save quota or triggers the mixed-folder stops. UTF-8, trailing backslash, no\?\prefix, as XGameSaveFiles. The size andpathUsedcount the terminator. A short buffer returnsHRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), the documented PC error, without writing.XPersistentLocalStorageGetSpaceInfousedBytesis the sum of the file sizes under the title's folder;availableFreeBytesandtotalFreeBytesare the bytesGetDiskFreeSpaceExWreports free to the caller;totalBytesisusedBytes + totalFreeBytes. A folder link inside the storage stops, as in GameSave.cpp.XPersistentLocalStoragePromptUserForSpaceAsync,...ResultAbxUnsupportedfor every input.XPersistentLocalStorageMountForPackageAbxNotImplemented: a relinked title has no package identity, so which title's storage a package identifier names is unknown.Choices I would like your ruling on:
S_OKwhen the user acted,E_ABORTwhen they declined) and says not to use the call on PC. With no UI, either result would invent the user's answer. Completing withE_ABORTwould keep such a title running; say so if you prefer it.<PersistentLocalStorage>in MicrosoftGame.config is not read (the GetPath page says no entry is required on PC). It is in the fragment with aCloses when.OpenRootand the UTF-8 conversion ofSaveFilesFoldermoved unchanged out of GameSave.cpp intoTitleFolder.cpp/TitleFolder.hpp, to avoid a second copy. GameSave still maps their errors throughFromWin32. One stop message changed for XGameSave as a result: "no folder for the title's saves" is now "no folder for the title's data".This PR and #79 both add lines to the scenario lists (
core/libs/tests/CMakeLists.txt,FakeTitle.cpp,e2e.py), the xgameruntime source list,ARCHITECTURE.mdand the generatedREADME.md, so the second to land needs a rebase; I will rebase whichever remains.Tested
Windows 11, MSVC 19.38 (Visual Studio 2022), Ninja, Release, clean build directory:
pipeline_probeskipped (no Khronos validation layer here). The seven existinggamesave*scenarios still pass after the helper move.pls: exact path, size andpathUsedwith the terminator, a buffer one short and a zero-size buffer return the error without writing, a nullpathUsed, the folder is writable, a 4 KiB write leaves the XGameSave quota at exactly 256 MiB, rewriting a 1234-byte file in a subfolder growsusedBytesby exactly 1234,usedBytesequals the folder content summed bye2e.py,totalBytes == usedBytes + totalFreeBytes, and free space matchesGetDiskFreeSpaceExWread bye2e.py(1 GiB tolerance). A second run finds the first run's file; a third run under another title ID gets its own folder.pls_prompt,pls_prompt_result: the stop names the right function and message.usedBytes, and a walk that skips subfolders, each faile2e_pls("FAIL used bytes after a write").python tools/check_conventions.py,python tools/debt_fold.py --check(24 fragments),python tools/readme_docs.py: pass.progress.py --module xgameruntime: 77 implemented.windowsand bothrelinkerjobs green: https://github.com/CaseReed/AnyBox/actions/runs/45158110637Not tested: anything on a console or against the desktop GDK runtime (terminator, trailing backslash, encoding, the space fields). No test covers a folder link inside the storage, a subfolder vanishing during the walk,
GetDiskFreeSpaceExWor folder creation failing, the null-pointer stops, a non-ASCII or very longLOCALAPPDATA, or a host with per-user disk quotas. The folder walk runs on everyGetSpaceInfocall and was not timed on a large folder.Self-review: an independent pass over the diff (signatures and struct layout against the documentation, the helper move against the merged XGameSave behaviour, debt lines against the code, whether each test can fail, how
anybox_scan.pycounts stubs) found nothing blocking. Fixed from it before opening:usedBytesreported the whole volume's usage;MountForPackageand the promptResultcall counted as implemented while doing nothing useful (the first is a stub again, the second stops); the test compared against the volume's total free bytes instead of the caller's.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>.mdXPersistentLocalStorageMountForPackageremains)XPersistentLocalStorageSpaceInfo). No header copied, nothing disassembled.🤖 Generated with Claude Code
Pull request details or commits were not available from GitHub; kept as an issue.
@github-actions[bot] on GitHub · 2026-11-23 10:44 UTC · original
Progress report (
9f53c52→ 9057ced)📈 Libraries: 28.85% (+1.1013%, +5 implemented functions)
✅ 5 implemented
XPersistentLocalStorageGetPathXPersistentLocalStorageGetPathSizeXPersistentLocalStorageGetSpaceInfoXPersistentLocalStoragePromptUserForSpaceAsyncXPersistentLocalStoragePromptUserForSpaceResultChanged libraries