Skip to content

[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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aliendroid1
Copy link

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

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.
@Mauller
Copy link

Mauller commented May 3, 2025

Did you test this with the game set to the same resolution as the desktop?

@aliendroid1
Copy link
Author

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?

@Mauller
Copy link

Mauller commented May 3, 2025

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.

@aliendroid1
Copy link
Author

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.

@Mauller
Copy link

Mauller commented May 3, 2025

Before the change, for me on window 11...

Ah im running 10 still, so i might not as easily see the issue occur.

@Mauller Mauller added Minor Severity: Minor < Major < Critical < Blocker Generals Related Generals only ZeroHour Relates to Zero Hour Fix Is fixing something labels May 3, 2025
@aliendroid1
Copy link
Author

Before the change, for me on window 11...

Ah im running 10 still, so i might not as easily see the issue occur.

Did you try without the Genpatcher fixes?

@Mauller
Copy link

Mauller commented May 3, 2025

Before the change, for me on window 11...

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.

@xezon
Copy link

xezon commented May 5, 2025

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.

@aliendroid1
Copy link
Author

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

@xezon
Copy link

xezon commented May 6, 2025

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?

@aliendroid1
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Is fixing something Generals Related Generals only Minor Severity: Minor < Major < Critical < Blocker ZeroHour Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows 10: Game crashes on ALT+Tab
3 participants