victory-hle: one definition of each HRESULT #461

Open
github-bot wants to merge 1 commit from github-bot/gh-461 into a-publier AGit
Owner

@⁠Jackster on GitHub · 2026-11-27 03:16 UTC · original
Jackster:hle/hresult-module → a-publier · +44 −23 · 11 files · 1 commits · open

What

Ten Windows HRESULT values were defined nineteen times across nine modules of victory-hle — E_OUTOFMEMORY four times, E_NOINTERFACE and E_FAIL three times each, E_POINTER and E_NOTIMPL twice each. A fix to one copy left the others wrong, and nothing made the copies agree.

One module now holds them: crates/victory-hle/src/hresult.rs. Values are unchanged (audited against 4eb6cfd), call sites are untouched, and the duplicated definitions are gone — grep "const E_" crates/victory-hle/src now matches only the new module.

Module-specific results stay where they are used, because they are one module's protocol rather than Windows': the XAPU 0x8AC8_1xxx set in apu.rs, DStorage's HRESULT_FROM_WIN32 codes (END_OF_FILE, INVALID_DATA), GameInput's 0x838A_* set, and media.rs's unsupported-scheme code.

The one compatibility shim, and why

xasync.rs keeps

pub(crate) use crate::hresult::{E_ABORT, E_ILLEGAL_METHOD_CALL, E_INVALIDARG,
    E_NOT_SUFFICIENT_BUFFER, E_NOTIMPL, E_PENDING};

because seven sibling modules reach those results by that path (display, speech, storage, xgameruntime, xgamesave, xpackage, xuser). There is still exactly one definition per value; this is a path, not a second name. The six that were pub there are pub(crate) now — no consumer outside the crate referenced them, and --all-targets compiles the integration tests that would have failed.

Testing

  • cargo check -p victory-hle --all-targets — clean, no warnings.
  • cargo test -p victory-hle — 162 passed, 2 ignored (pre-existing benchmarks), 0 failed; both integration tests pass.
  • cargo clippy -p victory-hle --all-targets -- -D warnings, default and --all-features — clean.

Notes

crates/victory-gpu/src/object.rs keeps its own E_NOTIMPL/E_NOINTERFACE, outside this crate; a shared crate-wide module would be a larger change than this PR.

**@⁠Jackster** on GitHub · 2026-11-27 03:16 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/461) `Jackster:hle/hresult-module` → `a-publier` · +44 −23 · 11 files · 1 commits · open ## What Ten Windows `HRESULT` values were defined nineteen times across nine modules of `victory-hle` — `E_OUTOFMEMORY` four times, `E_NOINTERFACE` and `E_FAIL` three times each, `E_POINTER` and `E_NOTIMPL` twice each. A fix to one copy left the others wrong, and nothing made the copies agree. One module now holds them: `crates/victory-hle/src/hresult.rs`. Values are unchanged (audited against `4eb6cfd`), call sites are untouched, and the duplicated definitions are gone — `grep "const E_" crates/victory-hle/src` now matches only the new module. Module-specific results stay where they are used, because they are one module's protocol rather than Windows': the XAPU `0x8AC8_1xxx` set in `apu.rs`, DStorage's `HRESULT_FROM_WIN32` codes (`END_OF_FILE`, `INVALID_DATA`), GameInput's `0x838A_*` set, and `media.rs`'s unsupported-scheme code. ## The one compatibility shim, and why `xasync.rs` keeps ```rust pub(crate) use crate::hresult::{E_ABORT, E_ILLEGAL_METHOD_CALL, E_INVALIDARG, E_NOT_SUFFICIENT_BUFFER, E_NOTIMPL, E_PENDING}; ``` because seven sibling modules reach those results by that path (`display`, `speech`, `storage`, `xgameruntime`, `xgamesave`, `xpackage`, `xuser`). There is still exactly one definition per value; this is a path, not a second name. The six that were `pub` there are `pub(crate)` now — no consumer outside the crate referenced them, and `--all-targets` compiles the integration tests that would have failed. ## Testing - `cargo check -p victory-hle --all-targets` — clean, no warnings. - `cargo test -p victory-hle` — 162 passed, 2 ignored (pre-existing benchmarks), 0 failed; both integration tests pass. - `cargo clippy -p victory-hle --all-targets -- -D warnings`, default and `--all-features` — clean. ## Notes `crates/victory-gpu/src/object.rs` keeps its own `E_NOTIMPL`/`E_NOINTERFACE`, outside this crate; a shared crate-wide module would be a larger change than this PR.
Nineteen copies of ten Windows results across nine modules: a fix to one
copy left the others wrong. Move them to crate::hresult and import them
where they were defined. xasync keeps a pub(crate) re-export because seven
sibling modules reach these results by that path; the six that were `pub`
there are `pub(crate)` now, and nothing outside the crate used them.

Values are unchanged (audited against 4eb6cfd) and call sites are
untouched. Results that belong to one module's own protocol stay where
they are used: the XAPU 0x8AC8_1xxx set, DStorage's HRESULT_FROM_WIN32
codes, GameInput's 0x838A_* and media's unsupported-scheme code.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:17:33 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 03:55 UTC · original

Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At 02862e5: cargo test --release -p victory-hle --lib 162 passed, 0 failed, 2 ignored.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 03:55 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/461#issuecomment-7209385086) Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At `02862e5`: `cargo test --release -p victory-hle --lib` 162 passed, 0 failed, 2 ignored. AI-assisted (Claude Code); no game data.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/461/head:github-bot/gh-461'
git switch 'github-bot/gh-461'

Merge

Merge the changes and update on Forgejo.
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-461'
git switch 'github-bot/gh-461'
git rebase 'a-publier'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-461'
git switch 'github-bot/gh-461'
git rebase 'a-publier'
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-461'
git switch 'a-publier'
git merge --squash 'github-bot/gh-461'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-461'
git switch 'a-publier'
git merge 'github-bot/gh-461'
git push origin 'a-publier'
This discussion has been locked. Commenting is limited to contributors.
No description provided.