Repository navigation
Fix re-entering VR crash (#138) and startup crash with DLSS 5 mod layers - #139
Merged
2 commits merged intoNov 14, 2026
Merged
2 commits merged into
2 commits merged into
Conversation
…s layer Issue 138: MSFS 2024 crashed re-entering VR on Virtual Desktop. 0.20.1 stamps the runtime's clock just before xrCreateSession (dab7806), through xrConvertWin32PerformanceCounterToTimeKHR taken at the previous session. That pointer outlived its instance; after xrDestroyInstance the runtime's DLL is unloaded, so the next xrCreateSession called into unmapped code (the crash dump's faulting call is that clock call in the signed 0.20.1 DLL). Every function taken from the runtime's instance now goes with it (the clock, xrGetInstanceProperties, xrGetVisibilityMaskKHR, xrPathToString, xrGetCurrentInteractionProfile and the chain's xrGetInstanceProcAddr), and the clock is taken again for each instance. DLSS 5 mods: a layer above VectorXR that asks for a function before any instance exists (Cheeky Foveated DLSS's layer probes xrEnumerateInstanceExtensionProperties that way) made VectorXR call through an empty pointer, so the game crashed at startup whenever such a layer was above it. It now gets XR_ERROR_HANDLE_INVALID, which such probes treat as unknown. The log names Cheeky Foveated DLSS's OpenXR layer above or below VectorXR, and its in-game modules. Above, it takes the application's quad-view request for its own quad views, and the Quadviews INACTIVE line now says so instead of pointing at the game's setting. Test: layer_load. A function asked for before any instance, and after the last instance is destroyed, is refused with no call below; an instance above Cheeky's layer logs it. The framegen presenter timing tests (pacing, ceiling, policy_late) failed on this run with Star Citizen holding the CPU at 100%; unrelated to this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The clock conversion was also taken at instance creation, which gave an instance's first xrCreateSession a runtime clock stamp it did not have in 0.20.1, and with it the clock-based stale-event check instead of the first-IDLE fallback. Only the clearing is needed for issue 138; the clock is again taken at the session's Turbo setup, so first sessions behave exactly as in 0.20.1. Test: layer_load, eye_gaze, turbo_frame, turbo_trace, turbo_recovery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Michael · project thread
Fixes #138. Branch is cut from
v0.20.1.Re-entering VR crash (#138)
0.20.1 stamps the runtime's clock just before
xrCreateSession(dab7806, the PimaxXR stale-event fix) throughxrConvertWin32PerformanceCounterToTimeKHR. That pointer was taken during the previous session and never cleared when the instance ended. MSFS 2024 destroys its instance when it leaves VR, and the Virtual Desktop runtime DLL gets unloaded. On re-entry,xrCreateSessioncalled into the unmapped DLL. I checked this against the signed 0.20.1 DLL: the crash dump's faulting return address (+0xC512C) sits right after that clock call.Every function pointer taken from the runtime's instance is now cleared when the instance ends. That covers the clock,
xrGetInstanceProperties,xrGetVisibilityMaskKHR,xrPathToString,xrGetCurrentInteractionProfileand the chain'sxrGetInstanceProcAddr. The clock is looked up again at each session's Turbo setup, as in 0.20.1, so an instance's first session behaves exactly as before (5f5feea).Startup crash with DLSS 5 mod layers
Cheeky Foveated DLSS ships an OpenXR layer that calls the next layer's
xrGetInstanceProcAddr(XR_NULL_HANDLE, "xrEnumerateInstanceExtensionProperties")before it creates its instance. With that layer above VectorXR, VectorXR called through an empty pointer and the game crashed at launch, in 0.20.0 and 0.20.1 alike. VectorXR now returnsXR_ERROR_HANDLE_INVALID, and the probing layer treats the extensions as unknown.Logging
The log now names Cheeky's OpenXR layer when it is above or below VectorXR, and lists its in-game modules. Above VectorXR, Cheeky removes
XR_VARJO_quad_viewsfrom the request VectorXR gets. The "Quadviews INACTIVE" line now says this, instead of pointing at the game's quad-view setting.Tests
layer_load(new checks): a function requested before any instance, and after the last instance is destroyed, is refused without calling the chain below. An instance created above Cheeky's layer logs it.framegen_presenter_tests_pacing,_ceiling,_policy_late) are wall-clock pacing tests. Star Citizen was holding the CPU at 100% during the run, and they still failed when rerun one at a time. They need a rerun on an idle machine or in CI. This change doesn't touch the presenter.🤖 Generated with Claude Code