Skip to content

XGameSave: defer container deletion until work dispatch - #108

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
certified-retart:fix/gamesave-defer-delete
Nov 23, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
certified-retart:fix/gamesave-defer-delete

Conversation

@certified-retart

Copy link
Copy Markdown
Contributor

A title using a manual work port could submit a container delete, see the operation still pending, and find its save already gone. A terminated queue could report E_ABORT after the same deletion.

Resolve the container path while the caller's inputs are valid, and delete it in the queued work callback. Serialize deletion with blob updates and report the status through XGameSaveDeleteContainerResult. Both delete entry points now apply the same name length checks as container creation.

Three synthetic tests cover manual dispatch with released inputs, queue termination before work runs or before submission, and invalid arguments preserving existing saves. On Windows, 432 library tests and 2 launcher integration tests passed with a single test thread. The library suite reported 16 ignored.

@raylitebull

Copy link
Copy Markdown
Member

Nice fix — deferring async container deletion until work dispatch and serializing it with apply() is much cleaner and strictly supersedes #95 (which only added the empty/overlong name guard). I've closed #95 in favor of this PR.

Note: #97 touches the complementary parts of gamesave.rs (atomic ~xcltmp + MoveFileExW writes inside apply(), NTFS case-insensitive lookups, and null out validation in XGameSaveInitializeProviderResult) — happy to rebase #97 cleanly on top once this lands.

@certified-retart

Copy link
Copy Markdown
Contributor Author

Thanks for the name-validation fix in #95 and for coordinating the overlap. I checked the current heads locally: #97 at 2d94699 and #108 at b3dd82d merge cleanly with git merge-tree. The mutation lock in #108 covers apply(), including the atomic write path proposed in #97.

@ivall
ivall merged commit 221b5fd into xcl-dev:main Nov 23, 2026
@ivall

ivall commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Merged. It conflicted with #95's identical name check, which had landed on main with #96–#102 before #95 was closed; resolved in favour of your deferred form (delete_path + delete_container under SAVE_MUTATION). Checked on Windows 11 with an RX 9070: cargo test --workspace green with the retail samples (shader pack, console DLLs, texture archive), lib tests also with XCL_SPLIT_WAVE64=1; Unicorn Overlord runs with #107–#109 merged. Thanks!

theaustinayers pushed a commit that referenced this pull request Nov 24, 2026
…nment

GetResourceAllocationInfo (#25) and GetResourceAllocationInfo2 (#108)
laid several resources out one after another, each at its own
alignment, but returned the end of the last one as the size. The PC's
docs for GetResourceAllocationInfo with several descriptions: "the C++
algorithm for calculating a structure size and alignment are used" - a
4 MiB-aligned resource between two 64 KiB-aligned ones takes 12 MiB,
first or last 8 MiB, the alignment 4 MiB. XCL answered 8 MiB + 64 KiB
and 4 MiB + 128 KiB: a title sizing one heap for the group from it got
a heap that does not end on the alignment its resources need.

The arithmetic of both is now one function, `allocation_of`, which pads
the total to the largest alignment when there is more than one
resource. One resource's info is still the driver's or XG's as it is
(#108 asks #25 for each one alone); the per-resource offsets #108
writes are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
Add standalone host-driver parity and contract tests for D3D12.X's
memory-layout and copy-footprint query hooks (Part of xcl-dev#480):
GetResourceAllocationInfo (xcl-dev#25), GetResourceAllocationInfo2 (console
xcl-dev#108 vs PC ID3D12Device8 xcl-dev#68), GetCustomHeapProperties (xcl-dev#26), and
GetCopyableFootprints (xcl-dev#38).

No runtime files outside crates/xcl/tests/ are modified. Full suite
(.\scripts\test.ps1) passed 895 passed, 0 failed, 42 ignored (1 GPU
test skipped: heap_window_out_of_memory_falls_back_to_the_switch_form).

Part of xcl-dev#480
Assisted-by: Antigravity
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.

3 participants