Skip to content

[GEN][ZH] Fix game halting when left Alt key is pressed #837

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

Merged
merged 1 commit into from
May 12, 2025

Conversation

Mauller
Copy link

@Mauller Mauller commented May 10, 2025

This PR prevents the game from freezing when the left ALT key is pressed.

The underlying issue is due to the games window process not acknowledging the WM_SYSCOMMAND SC_KEYMENU message.

Due to this, the message is then processed by the default window process which then will try to open the windows context menu which does not exist in this instance but causes the message loop to freeze.

This may also help prevent some mismatches that could be caused by a game freezing for too long when someone is playing in window mode.

@Mauller Mauller self-assigned this May 10, 2025
@Mauller Mauller added Gen Relates to Generals ZH Relates to Zero Hour Fix Is fixing something, but is not user facing labels May 10, 2025
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the way it should be fixed is like so:

            switch( wParam )
            {
                case SC_MOVE:
                case SC_SIZE:
                case SC_MAXIMIZE:
                case SC_MONITORPOWER:
                  if( FALSE == ApplicationIsWindowed )
                    return 1;
                  break;
                case SC_KEYMENU:
                  return 1;
            }

@Mauller Mauller force-pushed the fix-left-alt-freeze branch from d83b11a to 0dc277c Compare May 11, 2025 16:15
@Mauller
Copy link
Author

Mauller commented May 11, 2025

I think the way it should be fixed is like so:

            switch( wParam )
            {
                case SC_MOVE:
                case SC_SIZE:
                case SC_MAXIMIZE:
                case SC_MONITORPOWER:
                  if( FALSE == ApplicationIsWindowed )
                    return 1;
                  break;
                case SC_KEYMENU:
                  return 1;
            }

Did something similar to this but i stuck the SC_KEYMENU option first in the switch.

@Mauller Mauller force-pushed the fix-left-alt-freeze branch from 0dc277c to ce9f0de Compare May 12, 2025 17:10
@Mauller
Copy link
Author

Mauller commented May 12, 2025

Tweaked based on requests and also matched the indentation to match the surrounding code block.

@xezon xezon added Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker and removed Gen Relates to Generals ZH Relates to Zero Hour labels May 12, 2025
@xezon xezon changed the title [GEN][ZH] Fix left alt freezing game in window mode [GEN][ZH] Fix game halting when left Alt is pressed May 12, 2025
@xezon xezon changed the title [GEN][ZH] Fix game halting when left Alt is pressed [GEN][ZH] Fix game halting when left Alt key is pressed May 12, 2025
@xezon xezon merged commit ee7cc0e into TheSuperHackers:main May 12, 2025
20 checks passed
@xezon xezon deleted the fix-left-alt-freeze branch May 12, 2025 21:27
@xezon xezon added Gen Relates to Generals ZH Relates to Zero Hour labels May 16, 2025
@xezon xezon removed the Fix Is fixing something, but is not user facing label Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working right, typically is user facing Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pressing ALT key in Windowed Mode stops the game update
3 participants