Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(generals): give the window keyboard focus back after alt-tab
Olcay Seygan4a09d8d137a3
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 789af7ec3..aa87db327 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -408,6 +408,7 @@ found and fixed — EA's own, not port damage.**- The game fits the screen on a PC with Windows display scaling turned up. The game never told Windows it counts real pixels, so at 125% Windows blew the whole window up by a quarter: a 1920x1080 game on a 1920x1080 screen came out 2400x1350 and the right and bottom of it hung off the edge. Now the window is the size you picked.- Alt-tabbing out of a fullscreen match and back no longer leaves every building already on the map as a dark shadow with nothing standing in it. Coming back from the desktop switched the game over to Direct3D 11 halfway through the match, and the new picture only knew about what was built after the switch, so older buildings drew as their shadow alone while a new one beside them looked fine. A match keeps the picture it started with now.- Alt-tabbing back into a fullscreen game brings the game back, once. It used to flicker between the game and the desktop several times and could end as a minimised window that clicking on the taskbar would not open. Putting the screen back was itself switching windows, and every switch set off another round of it. The game now waits until the switch is over before it touches the screen, and nothing it does on the way in or out takes focus from anyone. When the game runs at your desktop's resolution, coming back changes no display mode at all, so a 144 or 165 Hz monitor no longer drops to 60 and goes black for a moment. At any other resolution it keeps your monitor's refresh rate if the monitor can run it there.+- Hotkeys work again after Alt+Tab, and the game's own pointer comes back with them. Since 2.4.0, returning to a fullscreen game left Windows thinking no window was listening to the keyboard: every key you pressed made the Windows error sound and did nothing in the game, and the plain Windows arrow stood in for the game's cursor. The game takes the keyboard back as it comes up from the taskbar now.- 481 base-game textures at four times the resolution now beat Zero Hour's downscaled copies.- The ground is drawn at twice the detail. Every map square used to get a 64-pixel patch of its ground texture, squeezed into sixteen-bit colour; it gets 128 pixels now in full colour, so sand, gravel and tracks stop turning to blocks and bands when you zoom in, and a ground texture that ships at twice the size is shown at that size.- The ground has relief. Every grain of sand, pebble and crack catches the map's own sun on one side and falls into shade on the other, worked out from the ground's own picture when the map loads, and it follows the sun on a dusk map or a night one. The light the ground already had from its hills is kept; the relief goes on top. It is part of the new picture, so a machine on the old renderer keeps the flat ground.diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cppindex 528d709d7..17ba6d08d 100644--- a/GeneralsMD/Code/Main/WinMain.cpp+++ b/GeneralsMD/Code/Main/WinMain.cpp@@ -578,6 +578,14 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message,{isDisplayShownActive = isWinMainActive;Reset_D3D_Device(isWinMainActive);+ // A fullscreen game is minimized while away, and Alt+Tab activates it while it is+ // still minimized, when DefWindowProc gives an active window no keyboard focus.+ // The restore above activates nothing, so the window came back active with no+ // focus: every key arrived as WM_SYSKEYDOWN and beeped, and no WM_SETFOCUS came to+ // reset the keyboard or take the mouse out of its lost-focus state, where it+ // leaves the Windows arrow on screen (issue #54).+ if (isWinMainActive)+ ::SetFocus(hWnd);}return 0;}