-
Notifications
You must be signed in to change notification settings - Fork 79
[GEN][ZH] Fix Alt-tabbing crash #846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Debug log: Could not do WW3D::Begin_Render()! Are we ALT-Tabbed out? p.s #801 also makes alt tabbing instantaneous when resolution is the same |
Also with this, if you move the game to a different monitor it moves back on alt tab |
Not on my machine. It goes through the device reset code and takes 4 seconds or so to get back in the game, despite the game being technically in windowed mode (because of the DXMaximizedWindowedMode shim)
We would need to check if that is new behaviour specific to this change. If not, then can be addressed separately. |
I found that the first begin render issue is unrelated but I tested and the issue with moving the window to a different monitor is specific to this change. Is the windowed mode shim something you applied or just something modern windows does? |
Also with these changes if you select a resolution that doesn't match your desktop and alt tab then the could not do begin render issue gets logged every time |
This is what modern Windows applies forcefully and is what leads to this Alt-tabbing crash debacle in the first place. Windows XP will not do this.
Yes. This is ok. Basically Render function will figure out that it cannot render and reset the device when it can again.
Ok this needs fixing. I do not have a second monitor, so cannot test this right now. How can a fullscreen window be moved to another monitor however? It spawns on one and stays there, no? |
Windows + shift + → to move window to different monitor. Also test without the command line arguments for quick start and resolution and see if switching windows is still slow with alt tab using the original fix |
Ok interesting. I did not know that existed. Does the incorrect reposition only happen with Game Resolution == Desktop Resolution or also with Game Resolution != Desktop Resolution? |
Both. If the resolution is smaller then it actually gets anchored to the top left corner but that's not specific to these changes |
Works okay for me, i didn't have significant issues before hand and i can see it implicitly handling the render reset. Would need someone with windows 11 and an nvidia card to try who knows they have issues. |
Aka myself for example. Win 11 with a rtx 3080 |
I've looked into it more and I think it probably is better to merge this now and fix the window location bug separately because the double reset method is overkill and it still doesn't make it work correctly on the second monitor unless both monitors have the same resolution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As people with the issue say that this resolves the problem i will approve it.
I don't get the problem but the changes are sensible as the game already checks for device loss and appropriately recovers without the need for the dirty hack.
Do we have anyone that can test on Windows XP? |
Will you be able to fix this? Unfortunately I cannot test this here because I only have one monitor. |
I believe so. I was waiting on this pr and #541. I'll start working on it. |
At this point i don't think we would want to worry about compatibility for anything older than windows 7 x32. |
Ok |
1b10d4b
to
4df5354
Compare
I removed the logging from this change because it is not necessary for the fix and I will add that logging with a separate change instead. |
Finally |
This change fixes the infamous Alt-tabbing crash and is an alternative implementation to #801. The advantage of this change is that it gets rid of what the EA developer has called a "Giant hack" and no longer resets the device with windowed fullscreen from the
DXMaximizedWindowedMode
shim, which newer version of Windows apply. This makes Alt-tabbing instantaneous without delay, at least when the game resolution matches the desktop resolution. Otherwise it goes through the device reset routine as follows.Tested with 2560x1440 desktop, 1600x1200 game
This change adds additional debug logging to all device reset calls.WW3D::Begin_Render
typically takes care of resetting the device.TODO
Test on Windows XP?