-
Notifications
You must be signed in to change notification settings - Fork 66
[GEN][ZH] Fixed crash when alt-tabbing out of the game #801
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
base: main
Are you sure you want to change the base?
Conversation
As noted in the original comment, the game was intended to switch to windowed mode when alt-tabbing out. However, the code mistakenly passed the current window mode instead, resulting in no actual change. This update corrects the parameter to 1, explicitly enabling windowed mode and preventing the crash.
Did you test this with the game set to the same resolution as the desktop? |
Same and different both for both full screen mode and -win shortcut. Is it still crashing for you? |
No it didn't crash when i tested it, but i heard that the problem happens primarily when the game and desktop resolution match. The game would pause when i alt+tab and continue again once i brought it back into focus. It only crashed on me due to a different problem while debugging. |
Before the change, for me on window 11 it would always crash regardless of the resolution. It would sometimes be fine the first time I switched focus out of the game using alt-tab or the windows key and I'd still be focus back on to the game but it always crashed if I switched focus after this. |
Ah im running 10 still, so i might not as easily see the issue occur. |
Did you try without the Genpatcher fixes? |
I don't run gentool or genpatcher stuff, just our code from the repo. |
Unclear if this fix is correct. We need to understand what exactly crashes first, then decide on fix. Start with posting crash callstack and observations in #28. |
Done. I'm certain this fix is correct and I've shared the evidence. You can test for yourself |
It would be nice to see what code paths are avoided that originally would cause crashing. And why fullscreen is meant to be treated as windowed mode. Perhaps that variable is incorrectly named? What does it do exactly? |
I posted it in #28 like you had requested. Which variable are you asking about being incorrectly named? |
I can confirm that this fixes the crash (on Windows 10). Regarding the cause of the crash: This is quite likely a Windows issue. MS stopped caring about real fullscreen mode for some time now and all new games just use windowed mode for fullscreen. In my opinion we don't need to investigate it further. I would also prefer to always set windowed to true in WW3D::Set_Render_Device. At least when the resolution matches the desktop resolution. Then we don't have to minimize the game everytime it loses focus and Alt-Tabbing will be much faster. But we can do that later in another PR. |
Will need to check if setting it to windowed mode always would prevent edge scrolling or if it affects any other behavior. Alt tabbing seems to be pretty fast on my end when the resolution matches the screen resolution. I think the delay might have to do with the last argument to the function that determines if textures should be reloaded. |
As noted in the original comment, the game was intended to switch to windowed mode when alt-tabbing out. However, the code mistakenly passed the current window mode instead, resulting in no actual change.
This update corrects the parameter to 1, explicitly enabling windowed mode and preventing the crash.
Closes #28