HLE: stub DirectStorage queue GetErrorEvent and RetrieveErrorRecord #2288

Closed
fuzeofficlal wants to merge 1 commit from upstream-pr/2290 into main
fuzeofficlal commented 2026-11-25 10:01:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T10:01:22Z.


Summary

Wires minimal stubs for DirectStorage queue vtable slots 0x48 (GetErrorEvent) and 0x50 (RetrieveErrorRecord) in crates/victory-hle/src/modules/dstorage.rs:

  • 0x48 (get_error_event): logs once at debug level and returns a null handle (0) instead of hitting missing::<9> (E_NOTIMPL cast to a handle).
  • 0x50 (retrieve_error_record): writes a zeroed 16-byte record header (failure_count = 0, hresult = S_OK, command_type = COMMAND_NONE / -1) when passed a non-null pointer; with failure_count == 0 and command_type == COMMAND_NONE, the trailing union payload is inactive so no request-specific union layout is needed.

Verification

  • cargo test -p victory-hle --lib modules::dstorage (error_slots_return_null_event_and_empty_record)
  • cargo clippy -p victory-hle --all-targets -- -D warnings
  • cargo xtask policy
<!-- greyfinch-sync:Marvisak/VIctory:issue:6601910689 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2290). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T10:01:22Z. --- ## Summary Wires minimal stubs for DirectStorage queue vtable slots `0x48` (`GetErrorEvent`) and `0x50` (`RetrieveErrorRecord`) in `crates/victory-hle/src/modules/dstorage.rs`: - `0x48` (`get_error_event`): logs once at `debug` level and returns a null handle (`0`) instead of hitting `missing::<9>` (`E_NOTIMPL` cast to a handle). - `0x50` (`retrieve_error_record`): writes a zeroed 16-byte record header (`failure_count = 0`, `hresult = S_OK`, `command_type = COMMAND_NONE` / `-1`) when passed a non-null pointer; with `failure_count == 0` and `command_type == COMMAND_NONE`, the trailing union payload is inactive so no request-specific union layout is needed. ## Verification - `cargo test -p victory-hle --lib modules::dstorage` (`error_slots_return_null_event_and_empty_record`) - `cargo clippy -p victory-hle --all-targets -- -D warnings` - `cargo xtask policy`
catminou4 commented 2026-11-25 11:04:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:19:09Z.

Review: COMMENTED


HLE DirectStorage: queue GetErrorEvent/ResetEvent via real event handles (CreateEventW/DuplicateHandle), file open cleanup. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. 485 lines of Windows threading/event plumbing; needs on-hardware validation.

<!-- greyfinch-sync:Marvisak/VIctory:review:6055711837 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2290#pullrequestreview-6055711837). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T10:19:09Z. **Review:** COMMENTED --- HLE DirectStorage: queue GetErrorEvent/ResetEvent via real event handles (CreateEventW/DuplicateHandle), file open cleanup. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. 485 lines of Windows threading/event plumbing; needs on-hardware validation.
cloph-dsp commented 2026-11-25 12:03:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T11:40:35Z.


Independent local verification (Windows, Rust 1.100.0/MSVC, head 58860ab, no game data):

  • cargo test --locked -p victory-hle --lib modules::dstorage -- --test-threads=1 -> 18 tests passed, 0 failed, 129 filtered, exit 0; one pre-existing try_update deprecation warning.
  • Baseline on upstream main (940d32f): same command -> 14 tests passed, 129 filtered, exit 0. The four extra tests are the new DirectStorage error-path coverage: error_record_layout_matches_gdk_abi, error_event_returns_unsignaled_event_and_closes_on_release, failed_request_signals_error_event_and_populates_error_record, retrieve_error_record_clears_exact_struct_and_tolerates_null.
  • The failure-path test is itself a synthetic scenario (temporary 16-byte file, past-EOF request, bad-zlib memory request) exercising vtable slots 0x48/0x50, the duplicated event wait, record layout/clearing, refcounts and CloseHandle — no game files involved.

I did not run this against a real title or a different Windows build, and I did not independently verify the 656-byte ABI offsets beyond the committed layout test. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only unit tests). No game data, assets or extracted content used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161353705 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2290#issuecomment-7161353705). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-25T11:40:35Z. --- Independent local verification (Windows, Rust 1.100.0/MSVC, head 58860ab, no game data): - `cargo test --locked -p victory-hle --lib modules::dstorage -- --test-threads=1` -> 18 tests passed, 0 failed, 129 filtered, exit 0; one pre-existing `try_update` deprecation warning. - Baseline on upstream main (940d32f): same command -> 14 tests passed, 129 filtered, exit 0. The four extra tests are the new DirectStorage error-path coverage: `error_record_layout_matches_gdk_abi`, `error_event_returns_unsignaled_event_and_closes_on_release`, `failed_request_signals_error_event_and_populates_error_record`, `retrieve_error_record_clears_exact_struct_and_tolerates_null`. - The failure-path test is itself a synthetic scenario (temporary 16-byte file, past-EOF request, bad-zlib memory request) exercising vtable slots 0x48/0x50, the duplicated event wait, record layout/clearing, refcounts and CloseHandle — no game files involved. I did not run this against a real title or a different Windows build, and I did not independently verify the 656-byte ABI offsets beyond the committed layout test. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only unit tests). No game data, assets or extracted content used.
Marvisak commented 2026-11-25 14:07:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:32:13Z.


Automated triage for the maintainers.

Needs work. Thanks for trimming this down. The rebased version is small and readable, and CI (check) passes. What blocks it now is the evidence and the trade-off, not the code.

  • You confirmed in the thread that the title never calls queue slots 0x48 and 0x50. QUEUE_VTABLE's comment says the same: only 0x18/0x20/0x30/0x40 are called. So the PR changes runtime behaviour for calls that have not been observed.
  • Today those slots go to xgameruntime::missing, which logs warn!("runtime method not implemented") with the slot on every call. That warning is how a first call from the title would be noticed. The stub swaps it for a one-time debug! and returns a null handle, so a caller that waits on the event would get WAIT_FAILED silently.
  • The record header layout (EmptyErrorRecord: count, pad, HRESULT, command kind −1) comes from the Windows DirectStorage documentation. Nothing shows that the console runtime's record matches it.

What would change the verdict: a title call site that reaches 0x48 or 0x50, with the behaviour it expects (for example how it uses the event handle). If you cannot show one yet, consider keeping missing's warning on these slots.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163919250 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2290#issuecomment-7163919250). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T13:32:13Z. --- <!-- victory-triage v1 head=c42135594206d5d93d2ca83f9c7fffcd2e87f3f0 verdict=needs-work at=2026-11-25T16:18:11Z --> Automated triage for the maintainers. Needs work. Thanks for trimming this down. The rebased version is small and readable, and CI (`check`) passes. What blocks it now is the evidence and the trade-off, not the code. - You confirmed in the thread that the title never calls queue slots `0x48` and `0x50`. `QUEUE_VTABLE`'s comment says the same: only 0x18/0x20/0x30/0x40 are called. So the PR changes runtime behaviour for calls that have not been observed. - Today those slots go to `xgameruntime::missing`, which logs `warn!("runtime method not implemented")` with the slot on every call. That warning is how a first call from the title would be noticed. The stub swaps it for a one-time `debug!` and returns a null handle, so a caller that waits on the event would get `WAIT_FAILED` silently. - The record header layout (`EmptyErrorRecord`: count, pad, HRESULT, command kind −1) comes from the Windows DirectStorage documentation. Nothing shows that the console runtime's record matches it. What would change the verdict: a title call site that reaches 0x48 or 0x50, with the behaviour it expects (for example how it uses the event handle). If you cannot show one yet, consider keeping `missing`'s warning on these slots. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-25 14:07:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T13:43:45Z.


Updated to 09e3bbb3 to address the review points:

  1. Removed all header/SDK-style names and comments: renamed the private constants (COMMAND_NONE, COMMAND_REQUEST, ERROR_PATH_LEN, ERROR_NAME_LEN), structs (ErrorRecord, FirstFailure, FailureParams, FailedRequest, FailedStatus, FailedSignal), comments, and layout test (error_record_field_offsets) in crates/victory-hle/src/modules/dstorage.rs, and updated the PR description accordingly.
  2. Source of slot order and record layout: both come from Microsoft's public DirectStorage for Windows queue specification (IDStorageQueue on Microsoft Learn / Microsoft.Direct3D.DirectStorage), where GetErrorEvent and RetrieveErrorRecord follow Close (0x40 -> 0x48, 0x50), GetErrorEvent returns an event signaled on the first failure since the previous retrieval, and RetrieveErrorRecord fills the 656-byte (0x290) record (u32 failure count + 4-byte alignment pad + 0x288 first-failure union with HRESULT, command kind -1/0, 260-u16 path, and 64-byte request name).
  3. Title call sites: confirmed — only 0x18, 0x20, 0x30, and 0x40 have been seen on the happy path; 0x48 and 0x50 were not observed called during normal startup/loading and are only wired so error-handling callers do not receive E_NOTIMPL cast to HANDLE or an uninitialized record.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7164202745 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2290#issuecomment-7164202745). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T13:43:45Z. --- Updated to `09e3bbb3` to address the review points: 1. **Removed all header/SDK-style names and comments**: renamed the private constants (`COMMAND_NONE`, `COMMAND_REQUEST`, `ERROR_PATH_LEN`, `ERROR_NAME_LEN`), structs (`ErrorRecord`, `FirstFailure`, `FailureParams`, `FailedRequest`, `FailedStatus`, `FailedSignal`), comments, and layout test (`error_record_field_offsets`) in `crates/victory-hle/src/modules/dstorage.rs`, and updated the PR description accordingly. 2. **Source of slot order and record layout**: both come from Microsoft's public DirectStorage for Windows queue specification (`IDStorageQueue` on Microsoft Learn / `Microsoft.Direct3D.DirectStorage`), where `GetErrorEvent` and `RetrieveErrorRecord` follow `Close` (`0x40` -> `0x48`, `0x50`), `GetErrorEvent` returns an event signaled on the first failure since the previous retrieval, and `RetrieveErrorRecord` fills the 656-byte (`0x290`) record (`u32` failure count + 4-byte alignment pad + `0x288` first-failure union with `HRESULT`, command kind `-1`/`0`, 260-`u16` path, and 64-byte request name). 3. **Title call sites**: confirmed — only `0x18`, `0x20`, `0x30`, and `0x40` have been seen on the happy path; `0x48` and `0x50` were not observed called during normal startup/loading and are only wired so error-handling callers do not receive `E_NOTIMPL` cast to `HANDLE` or an uninitialized record.
upstream-sync changed title from [PR #2290] HLE: implement DirectStorage queue GetErrorEvent and RetrieveErrorRecord to [PR #2290] HLE: stub DirectStorage queue GetErrorEvent and RetrieveErrorRecord 2026-11-25 16:07:19 +00:00
fuzeofficlal commented 2026-11-25 16:09:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T15:55:57Z.


Rebased onto da82e444 and trimmed to c4213559 (+77/-9 lines) following the triage suggestion:

  • Removed File::filename, Lane failure tracking, DuplicateHandle/CreateEventW, and the FailedRequest union layout.
  • 0x48 (get_error_event) now returns null (0) with a one-time debug! log.
  • 0x50 (retrieve_error_record) writes only the 16-byte header (failure_count = 0, hresult = S_OK, command_type = COMMAND_NONE), leaving any union storage untouched.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7167441217 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2290#issuecomment-7167441217). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T15:55:57Z. --- Rebased onto `da82e444` and trimmed to `c4213559` (`+77/-9` lines) following the triage suggestion: - Removed `File::filename`, `Lane` failure tracking, `DuplicateHandle`/`CreateEventW`, and the `FailedRequest` union layout. - `0x48` (`get_error_event`) now returns null (`0`) with a one-time `debug!` log. - `0x50` (`retrieve_error_record`) writes only the 16-byte header (`failure_count = 0`, `hresult = S_OK`, `command_type = COMMAND_NONE`), leaving any union storage untouched.
upstream-sync closed this pull request 2026-11-25 18:01:56 +00:00
fuzeofficlal commented 2026-11-25 18:02:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T17:20:26Z.


Closing this PR: as noted in triage, no title currently hits DirectStorage queue slots 0x48/0x50 and replacing the missing warning with a quiet null-event stub could mask a future first call. Happy to revisit once a title calls them.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7169361544 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2290#issuecomment-7169361544). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T17:20:26Z. --- Closing this PR: as noted in triage, no title currently hits DirectStorage queue slots `0x48`/`0x50` and replacing the `missing` warning with a quiet null-event stub could mask a future first call. Happy to revisit once a title calls them.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2288
No description provided.