Commit d66c4e5
committed
fix(alttab-fullscreen): patch SetFullscreenState to actually keep us windowed
MakeWindowAssociation(NO_ALT_ENTER) only blocks DXGI's automatic alt-enter
on the IDXGIFactory we walked back to via swapchain->GetParent(). It does
nothing against:
- direct SetFullscreenState(TRUE,...) calls from the engine, which still
happen because we silently rewrote Windowed=FALSE to TRUE and the engine's
own renderer state still expects exclusive
- DXGI's auto alt-enter on any other IDXGIFactory the process creates
later for the same HWND (HighFPSPhysicsFix, ENB, or the engine itself
enumerating adapters)
When either path fires, DXGI tries to transition the swap chain back into
exclusive fullscreen. Whether that succeeds, fails, or partially applies
depends on monitor state and timing, which shifts the window focus events
off the vanilla timeline. perchik71 hit the soft Creations load-order
mismatch dialog at ~1-in-10-20 launches, bisected to this module; the
working theory is that the focus-event timing shift races the Bethesda.net
Creations refresh callback against the save's CC list comparison.
This vtable-hooks slot 10 (SetFullscreenState) on the IDXGISwapChain
returned from D3D11CreateDeviceAndSwapChain. TRUE transitions on the game's
HWND are short-circuited to S_OK without forwarding; FALSE transitions
forward to the original. Scoping by HWND inside the hook avoids touching
other mods' swap chains (ReShade/ENB) that share the same vtable.
Notes:
- Pre-publish the original function pointer to std::atomic before calling
DetourVTable, so a racing thread that catches the patched vtable never
sees nullptr in the forward path.
- Patch is once-only via compare_exchange; failure rolls the flag back so
the next D3D11Create attempt can retry.
- Logs MakeWindowAssociation failure (was previously silently swallowed).
- Existing Windowed=TRUE rewrite and MakeWindowAssociation calls preserved
as belt-and-suspenders.1 parent 5391da2 commit d66c4e5
1 file changed
Lines changed: 62 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
19 | 45 | | |
20 | 46 | | |
21 | 47 | | |
| |||
58 | 84 | | |
59 | 85 | | |
60 | 86 | | |
61 | | - | |
| 87 | + | |
62 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
63 | 124 | | |
64 | 125 | | |
65 | 126 | | |
| |||
0 commit comments