Skip to content

HLE: implement blocking and prefix-enumeration XGameSave vtable slots - #884

Open
sagouindupm wants to merge 2 commits into
fxceless:mainfrom
sagouindupm:xgamesave-sync-and-enum
Open

sagouindupm wants to merge 2 commits into
fxceless:mainfrom
sagouindupm:xgamesave-sync-and-enum

Conversation

@sagouindupm

Copy link
Copy Markdown

Implements the remaining six missing::<...> slots in crates/victory-hle/src/modules/xgamesave.rs matching the Microsoft GDK XGameSave API signatures:

Vtable slot Offset Method Shared helper
3 0x18 XGameSaveInitializeProvider (blocking) open_at (shared with initialize_async)
7 0x38 XGameSaveGetRemainingQuota (blocking) remaining_quota (shared with quota_async)
10 0x50 XGameSaveDeleteContainer (blocking) remove_container (shared with delete_async)
15 0x78 XGameSaveEnumerateContainerInfoByName Prefix filter over report, shared with enumerate_containers (0x70)
18 0x90 XGameSaveEnumerateBlobInfo Delegates to enumerate_blobs (0x98) with null prefix
27 0xd8 XGameSaveSubmitUpdate (blocking) Delegates directly to Update::submit

Verification

Run on Windows 11 Pro (x86_64-pc-windows-msvc, Rust 1.98.1):

  • cargo test --release -j 2 -p victory-hle -> 99 passed; 0 failed (lib) + 1 passed; 0 failed (no_dll_planting), including new modules::xgamesave::tests::blocking_and_prefix_methods_work covering all six vtable offsets (0x18, 0x38, 0x50, 0x78, 0x90, 0xd8), null/invalid arguments (E_INVALIDARG, INVALID_CONTAINER_NAME, NO_ACCESS), prefix filtering, blob enumeration, blocking submit, quota tracking, and deletion.
  • cargo clippy -j 2 -p victory-hle --all-targets --no-deps -- -D warnings -> 0 warnings, exit 0 (uses --no-deps because workspace dependency victory-gpu on f85101b has two pre-existing lints noted in DirectStorage: a destination page number the title has not written yet is read again, not failed at once #855).
  • cargo run -j 2 -p xtask -- policy -> asset policy: 175 files ok.

Note: Tested via synthetic unit tests in victory-hle; the new unit test validates all six slots end-to-end without requiring game files.

AI-assisted: code, tests, and PR description were written with AI assistance.

@avt0m4t48

Copy link
Copy Markdown

I found one missing failure output in the blocking provider initializer on de1f1f0. The GDK declares its provider parameter _Outptr_result_nullonfailure_. This implementation returns the error from open_at() and leaves the caller's old output value in place. Microsoft API contract

I reproduced it through slot 0x18 on Windows with a synthetic storage root. Opening a valid root returns a provider. With an ordinary file blocking the next provider's path, the next call returns NO_ACCESS and leaves that earlier provider value in the output. Clearing out with put(out, std::ptr::null_mut()) in the Err(hr) arm passed the new failure test and the existing blocking/prefix test. Synthetic probe · Windows run

AI-assisted using Codex.

@sagouindupm

Copy link
Copy Markdown
Author

Good catch @avt0m4t48! Fixed in 94061d0 (clear out to null_mut() on failure in initialize_at per _Outptr_result_nullonfailure_, plus regression test in blocking_and_prefix_methods_work).

Verified on Windows (cargo test --release -p victory-hle, clippy -D warnings, xtask policy).

AI-assisted: Gemini / Claude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants