Repository navigation
Runtime: offline xgameruntime services (user, saves, package, threads, offline answers) - #279
IAmNotSiob wants to merge 2 commits into
Conversation
|
this looks great |
…, offline answers) Part 2 of the offline GDK runtime, on top of the XGameRuntime/XTaskQueue shim. One silent local user (XUserAddAsync and properties), XGameSave over files in LEONIDA_SAVE_DIR or %LOCALAPPDATA%\Leonida\saves (names %-encoded, updates written to a temporary file and renamed), XPackage (the game folder, host locale), XThread time-sensitive flags, and offline answers for the network connectivity hint, streaming and XLaunchUri. XStore licence queries are deliberately left out: answering them would be a protection workaround (CONTRIBUTING.md); they stay unimplemented and logged. xgameruntime_services_test drives it all through the shim registry.
619b55e to
fc215d5
Compare
|
Tested fc215d5 on Windows 11 Home (build 26200), MSVC 19.44.35222 (VS 2022), RTX 4090 (driver 621.14): pass. What I ran (AI-assisted: Claude Code did the build and test runs; I checked the results):
Two Windows filesystem edge cases in
Also worth noting, though maybe not worth handling: names that differ only in case ( No game data used or quoted. The test blobs never leave my machine. |
|
@kotorvr Thanks for the thorough test, and for the out-of-tree save import check. Both edge cases are fixed in ebc6342:
|
|
Tested fc215d5 with a native MSVC build (the PR was tested with MinGW + Wine): RTX 3060 Ti machine, Windows 11, MSVC 14.44: pass.
AI-assisted (Claude Code). |
docs/saves.md records the measured layout of the game's save containers: JSAV v3 (20-byte index + one JSON document of CodeSaveBlocks/ScriptSaveBlocks, rebuilt byte-for-byte), the ASAV header (checksum at 0x160 still unknown) and the SLAYER1 wrapper, whose packed body is noted and not decoded. tools/saves.py (stdlib only): info, extract, pack, verify, diff, and import into the offline XGameSave folder layout of xgameruntime_services.cpp (#279) with the same %-encoding. tests/test_saves.py covers it on synthetic files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Code read of
|
…paths docs/saves.md and the tools/saves.py docstring named runtime/shims/xgameruntime_services.cpp as the runtime's save store; that file is only in the open #279, and on main XGameSave* imports get the loader's default answers. docs/shader_validation.md named spirv_mini_interp without its .py. tests/test_docs_repo_paths.py checks that backticked tools/, runtime/, tests/ and scripts/ paths in docs/ name tracked files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@IAmNotSiob, an architecture question that I think decides where this lands. Your save and user logic is good, and #279 has three test reports plus @wildheathen's review. But on
The logic itself would carry over as it is: the store, the encoding, the atomic submit, the quota. Only the entry points change, to class slots behind Would you like to port the save store to AI-assisted (Claude Code). |
The rest of the offline
xgameruntimeshim claimed in #156, in one PR, on top of part 1 (#257, merged). Rebased onmainat83d0637, so it's one commit.What and why
After
XGameRuntimeInitialize, a GDK title signs in a user, opens save storage and asks about its package during boot, and stops if those fail. This adds them, plus offline answers for the network and streaming queries a title makes early. One file and one test:runtime/shims/xgameruntime_services.cppXUserAddAsync/XUserAddResultviaXAsyncBegin, duplicate/close counting, local id and lookup, id, state, age group, gamertag (per-component size limits, required size on a short buffer), and change events, which are accepted and never fire.LEONIDA_SAVE_DIR, by default%LOCALAPPDATA%\Leonida\saves\local-user\<container>\<blob>. Container and blob names are %-encoded so any name round-trips and none can leave the folder. An update writes each blob to a temporary file and renames it, so a crash leaves the old or the new blob, never a torn one. Covers sync/async provider, containers, updates (write/delete, sync/async),XGameSaveReadBlobData(one buffer: blob array, then names and data; all blobs or named ones; size reported when the buffer is short), container/blob enumeration (with prefix variants), delete container, and remaining quota against 256 MiB.XNetworkingGetConnectivityHint(network initialized, no connectivity) and its change registration,XGameStreamingIsStreaming(false),XLaunchUri(does nothing, fails).runtime/test/xgameruntime_services_test.cpp(CTestxgameruntime_services): a title-style boot throughrt::shims::find, from add user to delete container, with saves in a temporaryLEONIDA_SAVE_DIRthat it removes again.Deliberately left out:
XStorelicence queries. Answering them would mean telling the game it is licensed whatever the truth is. That's a protection workaround, which CONTRIBUTING.md rules out. They stay unimplemented, so a call logs[rt] unimplemented: …, and the test checks that they are not registered.Not included, and probably not needed: input and audio. The bundled
Bink2Scarlett.dllimportsXAudio2_9.dll, which desktop Windows provides, andGameInputalso exists on desktop Windows. The loader already falls back to host DLLs, so both may bind without a shim. That's unverified until the executable's imports are known, so no code for them here.Nothing goes online. No game data.
Tested
Cross-built with MinGW-w64 GCC 13 and run under Wine 9.0.
xgameruntime_services_testpasses all 37 checks, three runs in a row, andxgameruntime_test(part 1) still passes all 21. Our files are warning-free at-Wall -Wextra. The MSVC build is CI's: part 1 built and passed there in #257.Open points (marked
VERIFYin the code)XGameSaveerror codes (E_GS_*),XPACKAGE_IDENTIFIER_MAX_LENGTHand the struct layouts come from Microsoft's public GDK documentation. Check them once the executable exists.E_GS_CONTAINER_NOT_FOUND's name and value in particular are a best guess.xgameruntime.dll).Checklist