Skip to content

Fix Windows 10 Game-Init crash and root-signature fallback - #623

Closed
bittertea0323 wants to merge 3 commits into
Marvisak:mainfrom
bittertea0323:fix/win10-init-and-rootsig
Closed

bittertea0323 wants to merge 3 commits into
Marvisak:mainfrom
bittertea0323:fix/win10-init-and-rootsig

Conversation

@bittertea0323

Copy link
Copy Markdown

Fixes the title crashing at +0xb5a5f8 right after XUserAddAsync (issue #348) by implementing the XUser maximum-users slot, plus a token and a root-signature fallback. See #622 for reproduction and measurements.

- XUser maximum-users slot 0x30 now returns one user instead of E_NOTIMPL,
  which gets the title past Game Init into the render loop (issue Marvisak#348).
- token_async reports S_OK with the empty token buffer instead of
  FAILED_TO_GET_TOKEN, matching resolve_privilege_async.
- The 1.1 root signature falls back to serialization without the
  CBV_SRV_UAV/SAMPLER_HEAP_DIRECTLY_INDEXED flags when Windows 10's
  d3d12core refuses them, instead of dropping every draw.

@LAKSHYA-cmd-tech LAKSHYA-cmd-tech left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: test failure in modules::xuser::tests::startup_adds_the_user_and_reads_its_id and PR overlap

Tested on Windows 11 with Rust 1.98.1 (x86_64-pc-windows-msvc).

1. Test Failure in �ictory-hle

Running cargo test -p victory-hle fails on this branch:
`
---- modules::xuser::tests::startup_adds_the_user_and_reads_its_id stdout ----

thread 'modules::xuser::tests::startup_adds_the_user_and_reads_its_id' panicked at crates\victory-hle\src\modules\xuser.rs:408:9:
assertion left == right failed
left: 0
right: -1994108655
**Root cause**: Line 232 of crates/victory-hle/src/modules/xuser.rs changes oken_async's finished status from FAILED_TO_GET_TOKEN (-1994108655 / �x89240011) to S_OK (�), but the existing unit test at line 408 explicitly verifies:
ust
assert_eq!(
xasync::XAsyncGetStatus(&mut block, true),
FAILED_TO_GET_TOKEN
);
`
If returning S_OK with an empty token is intentional to satisfy title account init without contacting external servers, the test expectation must be updated to match, and any callers expecting offline error handling considered.

2. get_max_users slot 6 (0x30)

Implementing get_max_users (out = 1, S_OK) for slot 6 in VTABLE looks very clean and directly resolves the null dereference at title+0xb5a5f8 described in #348. Please consider adding a unit test for get_max_users asserting out receives 1.

3. Root signature fallback overlap

The root signature fallback change in crates/victory-gpu/src/pipeline/host.rs overlaps with PR #626. In addition to serializing without �xC01 flags, note that some host environments can fail during device.CreateRootSignature as well, which #626 also handles with unit test coverage.

@bittertea0323

Copy link
Copy Markdown
Author

Agility SDK plan for Windows 10 hosts posted on issue #622: the two mandatory exports, the loader-lock trap, the import-lib generation, and the one remaining Rust linking gap. This PR intentionally ships without the Agility bits.

The refusal error E_INVALIDARG names nothing, so the field dump
(vs/ps sizes, RTV/DSV formats, samples, input count, cull/fill,
depth/blend, topology) is what shows whether a refusal is a
translation defect or a description defect. Seen in the field: it is
neither on this host - it is the SM 6.6 bindless OS boundary
documented in issue Marvisak#622.
The token path is never reached during Game Init on the repro host (the
offline log line never fires before the +0xb5a5f8 fault), so the S_OK
change was unnecessary and it broke the pinned unit test. Keep the
failure status. Add the unit test for the maximum-users slot requested
in the review.
@bittertea0323

Copy link
Copy Markdown
Author

Thanks for the review — all three points addressed in 7c01e3d.

  1. token_async reverted to FAILED_TO_GET_TOKEN. You were right to flag it. On the repro host the token path is never reached during Game Init (the "token and signature: offline" log line never fires before the +0xb5a5f8 fault), so the S_OK change was speculative and it broke the pinned test. Reverted, test passes again.

  2. Unit test added for get_max_users (slot 0x30): asserts out == 1 and S_OK, in the same style as the existing slot tests. cargo test -p victory-hle modules::xuser is green.

  3. Root signature fallback vs GPU: fall back to standard root signature flags when host runtime rejects 0xC01/0xC00 #626: mine handles the D3D12SerializeVersionedRootSignature refusal (the "Unsupported bit-flag set" from Windows 10's d3d12core) and retries without the two 1.1 heap-indexing flags. If GPU: fall back to standard root signature flags when host runtime rejects 0xC01/0xC00 #626 additionally covers CreateRootSignature failure, the two are complementary, not conflicting — happy to drop my host.rs change entirely if GPU: fall back to standard root signature flags when host runtime rejects 0xC01/0xC00 #626 lands first and maintainers prefer one path.

@LAKSHYA-cmd-tech LAKSHYA-cmd-tech left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. All 86 tests in �ictory-hle pass cleanly (including startup_adds_the_user_and_reads_its_id and the new unit test for get_max_users), and all 43 tests in �ictory-gpu pass cleanly. Great follow-up!

@Zilumz1

Zilumz1 commented Nov 24, 2026

Copy link
Copy Markdown

Tested 7c01e3d on Windows 10 Pro + AMD Radeon RX 580 2048SP (Polaris), driver 31.0.21925.1001, Rust 1.98.1, MSVC 14.44, in-box D3D12 runtime (no Agility SDK). No title run, only the synthetic checks below.

Tests: cargo test -p victory-hle -p victory-gpu --no-fail-fast -- --test-threads=1

  • victory-gpu: 43 passed, 0 failed, 1 ignored
  • victory-hle: 85 passed, 1 failed. The new get_max_users assertion passes inside startup_adds_the_user_and_reads_its_id. The one failure is net::tests::only_loopback_is_reachable (winhttp.dll lacks WinHttpGetProxySettingsEx). That's the Windows 10 net test fixed on main by net: skip newer-Windows-only exports in only_loopback_is_reachable #152, which isn't on this branch's base (d2a4bae), so it's unrelated to this PR. A rebase should clear it.

The root-signature error reproduces on this host. Empty 1.1 signature, D3D12SerializeVersionedRootSignature on the in-box runtime:

Flags Result
0x601 (input layout + both heap-indexing flags, as root_signature() builds it) 0x80070057 "Unsupported bit-flag set (root signature flags 601)."
0x001 (input layout only, the retry) S_OK

So the fallback does serialize where the original doesn't.

One question about the fallback. The translated shaders reach their descriptors through SM 6.6 ResourceDescriptorHeap[] / SamplerDescriptorHeap[] (createHandleFromHeap, emit/mod.rs:17-21). As I understand the D3D12 rules, a PSO whose shaders index the heaps needs a root signature with *_HEAP_DIRECTLY_INDEXED. So on a host where the retry kicks in, does pipeline creation then get refused instead, or do the menu's pipelines not use heap indexing? I haven't measured this, since I don't run the title. If they do, the Agility SDK route (#463 for victory.exe, #486 for the tests) would be the fix, and the retry would only move the failure into PSO creation. The extra fields in the host pipeline refused warning would show that either way.

The same flags are also set in crates/victory-shader/src/emit/host.rs:191, which this PR doesn't touch.

AI-assisted; the results above are real runs on my machine.

@Zilumz1

Zilumz1 commented Nov 24, 2026

Copy link
Copy Markdown

Follow-up to my question above: measured, not guessed. Same machine (Windows 10 Pro, RX 580 / Polaris, driver 31.0.21925.1001), main at ba7d873.

I added a temporary test to emit/valu_tests.rs (not committed). It lowers a real synthetic GFX10 compute shader through the normal pipeline (build_valu_cs, a v_mov_b32 + raw UAV store, so the DXIL is cs_6_6 with createHandleFromHeap). Then it creates its root signature and compute PSO directly on the hardware device, once with the heap-indexing flags and once without (#623's fallback):

Runtime Highest SM With *_HEAP_DIRECTLY_INDEXED Without (#623 fallback)
In-box (Windows 10) 0x65 root signature refused, 0x80070057 root signature OK, PSO refused 0x80070057
Agility SDK 1.620.2 (#486 opt-in) 0x66 root signature OK, PSO OK root signature OK, PSO refused 0x80070057

So on Windows 10 the retry only moves the failure from root-signature serialization into PSO creation. The menu would still drop its draws, just with a "host pipeline refused" warning instead of a root-signature one. Even on a host that does have SM 6.6, the PSO without the flags is refused, because the shaders index the heaps.

What actually works on this machine is shader model 6.6 through the Agility runtime, with the flags kept: #463 for victory.exe, #486 for the tests.

Suggestion for #623: keep the get_max_users fix (the crash) and the extra host pipeline refused fields. Drop the root-signature retry, or have it log a clear "this host lacks SM 6.6 / the Agility runtime" error instead of retrying. I can share the probe test if useful.

AI-assisted; the results above are real runs on my machine.

@bittertea0323 bittertea0323 reopened this Nov 24, 2026
Yaekai pushed a commit to Yaekai/VIctory that referenced this pull request Nov 24, 2026
Yaekai pushed a commit to Yaekai/VIctory that referenced this pull request Nov 24, 2026
Upstream Marvisak#623 made token_async report S_OK instead of FAILED_TO_GET_TOKEN; update the test to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #626.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
geiyiliyabumo pushed a commit to geiyiliyabumo/VIctory that referenced this pull request Nov 25, 2026
…-backoff-484-111a

GPU: back off swap-chain creation when the desktop cannot present (Marvisak#484)
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.

4 participants