Resolver: a console DLL without a route finds PC functions by name #876

Open
mastrr9 wants to merge 1 commit from upstream-pr/882 into main
mastrr9 commented 2026-11-24 07:24:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mastrr9 on 2026-11-24T07:24:45Z.


Adds a by-name Win32 fallback in crates/xcl/src/resolver.rs for unrouted console system DLLs that have no PC counterpart (e.g. the minuserx/kernel32legacy/advapi32legacy/minappmodelx class of imports):

  • Before falling back to a zero-returning stub for an unknown console DLL, resolves by-name imports against base PC system DLLs (kernelbase, kernel32, user32, advapi32, combase), strictly after XCL's own HLE function table so kernelx/HLE overrides always take precedence.
  • Does not search network DLLs (preserving XCL_NETWORK=0), does not alter DLLs that already exist on PC, and keeps ordinals and unknown names as stubs.
  • xcl inspect classifies these imports consistently.
  • Adds unit test resolver::tests::unrouted_console_dll_functions_resolve_by_name_in_base_system_dlls.

Tested

  • Hardware/OS: NVIDIA RTX 5080 (driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC debug, DXC Windows SDK 10.0.26100.0, d3d12SDKLayers.dll installed
  • Commit tested: 6b53ce15e420f6d13a546206688e981ee63fac26
  • cargo build --workspace: clean (no new warnings; only pre-existing fetch_update deprecation warning)
  • cargo test --workspace -- --test-threads=4: 714 passed, 0 failed, 41 ignored (resolver::tests::unrouted_console_dll_functions_resolve_by_name_in_base_system_dlls ok)
  • SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64

Regression run
Smoke run by @Toons29 in comment below: https://github.com/xcl-dev/xcl/pull/882#issuecomment-7151581158
Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted.

main:

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB

PR:

xcl-smoke v1
commit: 71ade01a01f9beb63d518ecdc47d6f7338dcb1b9
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1620 (PresentX 1620)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14811 MB

Tester's setup and limits: AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

Tester's AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; the tester checked the blocks before posting.

Not tested

  • No retail title was available to the author; whether the community regression run above reaches the code this PR changes is not known.

AI use

  • Authored with Claude Code (Claude Opus 5.5); reviewed, audited, and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5).
  • Claude Code (Claude Sonnet 5.5) added the community regression run to this description and updated the lines that it made out of date or that the PR check requires.
<!-- greyfinch-sync:ivall/xcl:issue:5467920131 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/882). Originally posted by [mastrr9](https://github.com/mastrr9) on 2026-11-24T07:24:45Z. --- Adds a by-name Win32 fallback in `crates/xcl/src/resolver.rs` for unrouted console system DLLs that have no PC counterpart (e.g. the `minuserx`/`kernel32legacy`/`advapi32legacy`/`minappmodelx` class of imports): - Before falling back to a zero-returning stub for an unknown console DLL, resolves by-name imports against base PC system DLLs (`kernelbase`, `kernel32`, `user32`, `advapi32`, `combase`), strictly **after** XCL's own HLE function table so `kernelx`/HLE overrides always take precedence. - Does not search network DLLs (preserving `XCL_NETWORK=0`), does not alter DLLs that already exist on PC, and keeps ordinals and unknown names as stubs. - `xcl inspect` classifies these imports consistently. - Adds unit test `resolver::tests::unrouted_console_dll_functions_resolve_by_name_in_base_system_dlls`. **Tested** - Hardware/OS: NVIDIA RTX 5080 (driver `617.42` / `32.0.16.1742`), Windows 11 Pro 25H2 (`26200.9974`), `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC debug, DXC Windows SDK `10.0.26100.0`, `d3d12SDKLayers.dll` installed - Commit tested: `6b53ce15e420f6d13a546206688e981ee63fac26` - `cargo build --workspace`: clean (no new warnings; only pre-existing `fetch_update` deprecation warning) - `cargo test --workspace -- --test-threads=4`: **714 passed, 0 failed, 41 ignored** (`resolver::tests::unrouted_console_dll_functions_resolve_by_name_in_base_system_dlls` ok) - `SKIPPED` GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` **Regression run** Smoke run by @Toons29 in comment below: https://github.com/xcl-dev/xcl/pull/882#issuecomment-7151581158 Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted. main: ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` PR: ``` xcl-smoke v1 commit: 71ade01a01f9beb63d518ecdc47d6f7338dcb1b9 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1620 (PresentX 1620) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14811 MB ``` Tester's setup and limits: AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. Tester's AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; the tester checked the blocks before posting. **Not tested** - No retail title was available to the author; whether the community regression run above reaches the code this PR changes is not known. **AI use** - Authored with Claude Code (Claude Opus 5.5); reviewed, audited, and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5). - Claude Code (Claude Sonnet 5.5) added the community regression run to this description and updated the lines that it made out of date or that the PR check requires.
SlopTart commented 2026-11-24 10:04:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T09:34:02Z.


Linux / AMD RDNA3 datapoint.

Merged state: head 71ade01 onto main 077ce40, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 707 passed, 10 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). name-based DLL routing tests green.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7127590992 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/882#issuecomment-7127590992). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-24T09:34:02Z. --- Linux / AMD RDNA3 datapoint. **Merged state:** head `71ade01` onto main `077ce40`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **707 passed, 10 failed, 41 ignored**; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). name-based DLL routing tests green. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Toons29 commented 2026-11-25 03:06:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:05:33Z.


Regression run of 71ade01a on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 71ade01a01f9beb63d518ecdc47d6f7338dcb1b9
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1620 (PresentX 1620)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14811 MB

Against the limits in CONTRIBUTING.md: 100 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7151581158 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/882#issuecomment-7151581158). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-25T03:05:33Z. --- Regression run of `71ade01a` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 71ade01a01f9beb63d518ecdc47d6f7338dcb1b9 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1620 (PresentX 1620) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14811 MB ``` Against the limits in CONTRIBUTING.md: 100 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
DavidM1911 commented 2026-11-25 10:10:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T09:52:24Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7158914752 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/882#issuecomment-7158914752). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T09:52:24Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
upipibi commented 2026-11-25 22:06:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T21:18:05Z.


NVIDIA test report for 71ade01 (head as is, base beaa245), for #1607's "one more test report" list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, after cargo build --workspace:

  • cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2: 705 passed, 0 failed, 41 ignored. The end-to-end title tests pass, and so does the new resolver::tests::unrouted_console_dll_functions_resolve_by_name_in_base_system_dlls.
  • Skipped hle::xaudio2, because its tests fail or hang on this machine on main too. The PR doesn't touch it.
  • SKIPPED lines: 2, both no wave64 on this card.

AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.

<!-- greyfinch-sync:ivall/xcl:comment:7174890917 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/882#issuecomment-7174890917). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-25T21:18:05Z. --- NVIDIA test report for `71ade01` (head as is, base `beaa245`), for #1607's "one more test report" list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, after `cargo build --workspace`: - `cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2`: **705 passed, 0 failed, 41 ignored**. The end-to-end title tests pass, and so does the new `resolver::tests::unrouted_console_dll_functions_resolve_by_name_in_base_system_dlls`. - Skipped `hle::xaudio2`, because its tests fail or hang on this machine on `main` too. The PR doesn't touch it. - SKIPPED lines: 2, both `no wave64` on this card. AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.
github-actions[bot] commented 2026-11-30 08:40:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:40:15Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7273196121 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/882#issuecomment-7273196121). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T08:40:15Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 04:23:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:23:56Z.


Triage (#1607) – head 71ade01

No open or merged PR adds this fallback; main's resolve_inner_opt still ends in stub_for() after the HLE find_any lookup for a console DLL with no route and no PC counterpart. The fallback runs after the HLE table and only for by-name imports from DLLs the PC lacks, and the test checks ordinals, unknown names and a present PC DLL (version.dll) stay stubs. The risk is a console-only DLL whose same-named function has a different ABI from the PC one, which would now be called instead of a stub returning 0; the PR names no title it changes.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300693791 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/882#issuecomment-7300693791). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:23:56Z. --- **Triage (#1607)** – head 71ade01 No open or merged PR adds this fallback; main's resolve_inner_opt still ends in stub_for() after the HLE find_any lookup for a console DLL with no route and no PC counterpart. The fallback runs after the HLE table and only for by-name imports from DLLs the PC lacks, and the test checks ordinals, unknown names and a present PC DLL (version.dll) stay stubs. The risk is a console-only DLL whose same-named function has a different ABI from the PC one, which would now be called instead of a stub returning 0; the PR names no title it changes. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/882:upstream-pr/882'
git switch 'upstream-pr/882'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/882'
git switch 'upstream-pr/882'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/882'
git switch 'upstream-pr/882'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/882'
git switch 'main'
git merge --squash 'upstream-pr/882'
git switch 'main'
git merge --ff-only 'upstream-pr/882'
git switch 'main'
git merge 'upstream-pr/882'
git push origin 'main'
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
xcl-dev/xcl!876
No description provided.