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
refactor(gameclient): drop the dead showhudoverlay switch
Olcay Seygan9c0c4e776fc5
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.hindex d169b42e7..b234b4564 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h@@ -448,8 +448,7 @@ public:Int m_menuTransitionSpeed; ///< percent of the authored speed the menus slide and fade at; 100 = as drawnInt m_textureFilterMode; ///< 0 bilinear, 1 trilinear, 2 anisotropicInt m_anisotropyLevel; ///< samples anisotropic filtering may take; 0 = whatever the card offers- Bool m_showHudOverlay; ///< draw the fps / elapsed time / income line in the corner- Bool m_showNetBox; ///< the player's own switch for that corner: the network box, or the plate where the bar has no page+ Bool m_showNetBox; ///< the player's own switch for the top right info strip (InGameUI::drawHudOverlay)Bool m_showEmptyBuildingPips; ///< the row of empty slots over a building nobody is inBool m_workersReturnToSupply; ///< a worker that finishes a build job goes back to the dock it leftBool m_archiveReplays; ///< keep a timestamped copy of every replay, instead of only the last onediff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cppindex 83e8eeb02..5fb244912 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp@@ -1488,16 +1488,6 @@ Int parseMaxGameFrames(char *args[], int num)* graphics work in the upstream ledger sits unclosed - not because the code is hard, because* nobody could see the result. Combine with -autoskirmish, -map and -maxframes; -headless draws* nothing and says so. The file goes next to the save games, as sshotNNN.bmp. */-/** -showHudOverlay: the corner readout on, whatever the build's default (off in Release) and GameData.ini- * say. The harnesses whose screenshots are evidence pass it, so every picture names its renderer, clock- * and frame; the command line is read after GameData.ini, so nothing there turns it back off. */-Int parseShowHudOverlay(char *args[], int)-{- if (TheWritableGlobalData)- TheWritableGlobalData->m_showHudOverlay = TRUE;- return 1;-}-Int parseScreenShot(char *args[], int num){if (TheWritableGlobalData && num > 1)@@ -2860,7 +2850,6 @@ static CommandLineParam params[] ={ "-noaudio", parseNoAudio },{ "-maxframes", parseMaxGameFrames },{ "-screenshot", parseScreenShot },- { "-showHudOverlay", parseShowHudOverlay },{ "-video", parseVideo },{ "-directorrecord", parseDirectorRecord },{ "-recordfps", parseRecordFps },diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex ed2563ed5..976fa1590 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -72,8 +72,8 @@ GlobalData* TheWritableGlobalData = NULL; ///< The global data singleton//-------------------------------------------------------------------------------------------------GlobalData* GlobalData::m_theOriginal = NULL;-// A key the shipped GameData.ini still carries but nothing reads. It has to stay in the table,-// because an unknown key throws, so it is parsed into nothing.+// A key the shipped GameData.ini, or an older player's own, still carries but nothing reads. It has to+// stay in the table, because an unknown key throws, so it is parsed into nothing.static void parseIgnoredField( INI *, void *, void *, const void * ){}@@ -216,7 +216,7 @@ static void parseIgnoredField( INI *, void *, void *, const void * ){ "IsometricCamera", INI::parseBool, NULL, offsetof( GlobalData, m_isometricCamera ) },{ "FormationDrag", INI::parseBool, NULL, offsetof( GlobalData, m_formationDrag ) },{ "ChromaLighting", INI::parseBool, NULL, offsetof( GlobalData, m_chromaLighting ) },- { "ShowHudOverlay", INI::parseBool, NULL, offsetof( GlobalData, m_showHudOverlay ) },+ { "ShowHudOverlay", parseIgnoredField, NULL, 0 },{ "WorkersReturnToSupply", INI::parseBool, NULL, offsetof( GlobalData, m_workersReturnToSupply ) },{ "ArchiveReplays", INI::parseBool, NULL, offsetof( GlobalData, m_archiveReplays ) },{ "Bloom", INI::parseInt, NULL, offsetof( GlobalData, m_bloomIntensity ) },@@ -1181,14 +1181,6 @@ GlobalData::GlobalData()m_moneyPerMinute = 0;m_buildPlacementOpacity = PLACEMENT_SILHOUETTE_OPACITY;m_buildPlacementShadows = TRUE;- // The corner readout (InGameUI::drawHudOverlay): on in the developer builds (Debug, _INTERNAL), off in- // Release, RELEASE_DEBUG_LOGGING included, which is a Release build that also logs. A player turns it on- // with "ShowHudOverlay = Yes" in GameData.ini; a harness whose pictures must show it passes -showHudOverlay.-#if defined(_DEBUG) || defined(_INTERNAL)- m_showHudOverlay = TRUE;-#else- m_showHudOverlay = FALSE;-#endifm_showNetBox = TRUE;m_showEmptyBuildingPips = TRUE;m_workersReturnToSupply = TRUE;diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 34f17877c..a085ac9a8 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -13326,13 +13326,6 @@ TEST(gameplay_conveniences_are_forced_on_and_left_the_catalog)CHECK( scratch->m_workersReturnToSupply );CHECK( scratch->m_archiveReplays );- /* The HUD overlay is out of the catalog too, but its default is the build's: on in the developer- builds, off in Release (a project rule; GameData.ini or -showHudOverlay turns it on). */-#if defined(_DEBUG) || defined(_INTERNAL)- CHECK( scratch->m_showHudOverlay );-#else- CHECK( !scratch->m_showHudOverlay );-#endif/* HealthBars is what is left, and it is still a menu row. */const OptionDef *bars = findOptionDef( "HealthBars" );@@ -13747,12 +13740,8 @@ TEST(net_box_is_a_check_box_that_starts_on_under_its_own_key)TheWritableGlobalData = scratch;CHECK( scratch->m_showNetBox );- // the older plate's own switch is not this one's to move. Its default is the build's (on in the- // developer builds, off in Release), so what is checked is that the net box leaves it as it was.- const Bool hudOverlayBefore = scratch->m_showHudOverlay;def->set( 0 );CHECK( !scratch->m_showNetBox );- CHECK_EQ( (Int)scratch->m_showHudOverlay, (Int)hudOverlayBefore );TheWritableGlobalData = saved;delete scratch;diff --git a/GeneralsMD/Code/Tools/linux-packages-check.sh b/GeneralsMD/Code/Tools/linux-packages-check.shindex a976cdb0f..57fb3e09a 100755--- a/GeneralsMD/Code/Tools/linux-packages-check.sh+++ b/GeneralsMD/Code/Tools/linux-packages-check.sh@@ -138,7 +138,7 @@ RUNNERdocker exec -u "$(id -u):$(id -g)" -e HOME="$T/draw-home" -e ZH_USER_DATA_DIR="$T/draw-user/" -e ZH_UNATTENDED=1 \-e APPIMAGE_EXTRACT_AND_RUN=1 -e TMPDIR="$T/tmp" -e LIBGL_ALWAYS_SOFTWARE=1 -w "$T" "$name" sh -c \"Xvfb :77 -screen 0 1024x768x24 -nolisten tcp > '$T/xvfb.log' 2>&1 & sleep 2; DISPLAY=:77 timeout 900 '$run' -root '$FARM' \- -quickstart -noshellmap -multiInstance -noaudio -showHudOverlay -xres 800 -yres 600 -randommap 0 2 -autoskirmish 2 -aidiff brutal \+ -quickstart -noshellmap -multiInstance -noaudio -xres 800 -yres 600 -randommap 0 2 -autoskirmish 2 -aidiff brutal \-seed 0 -observer -maxframes 90 -screenshot 80 > '$T/draw.out' 2> '$T/draw.err'; echo \$? > '$T/draw.status'"shot="$(find "$T/draw-user" -name 'sshot*.bmp' | head -1)"local colours=0diff --git a/PORTING.md b/PORTING.mdindex 9827a5346..d09533db5 100644--- a/PORTING.md+++ b/PORTING.md@@ -168,11 +168,10 @@ which are now accepted in Release. A hidden or offscreen run is silent unless `Z`ZH_UNATTENDED=1` (or `-headless`) makes the message boxes that could wait for a person print to stderr and exitinstead.-The corner readout (the render rate, the clock, the renderer and the frame; upstream's `ShowHudOverlay`) is off-by default in Release builds and on in Debug and `_INTERNAL` ones. `ShowHudOverlay = Yes` in GameData.ini turns it-on, and `-showHudOverlay` turns it on for one run whatever the INI says; the harnesses whose screenshots are-evidence pass it. Nothing shipped may force it on: the staged overlay and the packages refuse a-`ShowHudOverlay = Yes`.+The top right info strip (the clock, the frame rates and the connection) is the player's own `ShowNetBox` option,+on by default in every build. Upstream's `ShowHudOverlay` decides nothing here: the GameData.ini key is read and+ignored so an old file still loads, and `-showHudOverlay` is gone. The staged overlay and the packages still refuse+a `ShowHudOverlay = Yes`, a check left from when the key turned the readout on.**Menu Layout** (Options, Display) chooses how the 800x600 menu layouts meet a wider screen. **Fit**, the defaulton macOS and Linux, draws them at one scale, centred, so panels, logos and the map preview keep their shape;diff --git a/docs/porting/windows-impact.md b/docs/porting/windows-impact.mdindex 7d212d8e5..ccb9868ee 100644--- a/docs/porting/windows-impact.md+++ b/docs/porting/windows-impact.md@@ -427,6 +427,7 @@ Three things the checks found:| 2026-10-02 | The in-game art download on macOS and Linux removed | `Tools/fetch-art.sh`, `Tests/test_fetch_art.sh` (both removed); `Main/PosixMain.cpp`, `CMakeLists.txt` (`ZH_ART_URL` and the `fetch_art_check` test), `Tools/make-macos-app.sh`, `Tools/linux-portable.sh`, `Tools/linux-packages.sh`, `Tools/linux-packages/` (CMakeLists.txt, PKGBUILD, the Flatpak manifest and metainfo), `Tests/test_macos_app.sh`, `Tests/test_linux_portable.sh`, `PORTING.md` | The game no longer starts `fetch-art.sh` on macOS and Linux, and the packages no longer carry it; `--art-url` is gone from the packaging scripts. The art release it fetched from was never published. `<user data>/ReforgedArt` is still read as an overlay after a package's own, so whatever installs the art later puts it there. | none on Windows: `PosixMain.cpp` and the packaging scripts are not built or run there, and the `CMakeLists.txt` lines removed were inside the macOS and POSIX test blocks | none | **Windows: done** (build.bat Release test on this branch.) || 2026-10-02 | Windows ARM64 loads its textures: the port's own D3DX | `WW3D2/d3dx9runtime.cpp`/`.h`, new `WW3D2/d3dx9portable_texture.cpp`/`.h` and `WW3D2/d3dx9texturerules.h`, `WW3D2/d3dx9posix_texture.cpp`; `PosixDevice/Render/PosixImage.cpp`/`.h` (moved out of `PosixResources9`), `PosixImageOps.h`, `PosixPixelCodec.h`; `W3DDevice/GameClient/W3DDisplay.cpp` (one log line); `CMakeLists.txt`; `Tests/test_d3dx9portable_oracle.cpp`; `tree-check.ps1`; `PORTING.md`, `README.md`, `CHANGELOG.md` | Without `d3dx9_43.dll` (ARM64 always, x64 with `ZH_D3DX_PORTABLE=1`), `Bind_D3DX9_Runtime` binds the port's own bodies and returns true: D3DXCreateTexture with D3DX's sizes and format substitution, D3DXLoadSurfaceFromSurface and D3DXFilterTexture through PosixImageOps (the macOS and Linux surface code) over the real device, reading a surface that will not lock through GetRenderTargetData and writing one through UpdateSurface, and the assembler, compiler and disassembler from `d3dcompiler_47.dll`'s D3DAssemble, D3DCompile and D3DDisassemble. The log says which: `W3DDisplay::init - D3DX: d3dx9_43.dll` or `the port's own, shaders by d3dcompiler_47.dll`. D3DX_DEFAULT as a texture dimension is 256 now, on macOS and Linux too, as the DLL makes it. `tree-check.ps1` takes `-NewEnv` and `-Extra`, uses a user data folder of its own and ends only the game it started: it took another checkout's screenshot once, and ended other checkouts' games by name. | x64 without the variable binds the DLL exactly as before (the `#else` side of the old ARM64 branch is the same code). With it, a texture can differ from the DLL's by one step of its narrowest channel, two down a 5-bit mip chain; the cases where the port and the DLL part further (luminance destinations, D3DX_FILTER_TRIANGLE, a box over more than 2:1, DXT3/5 blocks with c0 <= c1 decoded on the CPU, image files) are paths no game call takes. | low | **Windows: PARTLY VERIFIED** (x64, 2026-10-02: `build.bat Release test` 58/58, 0 C4311/C4312, `replay-check.ps1` seeds 0 and 1 the same at frame 6000; `test_d3dx9portable_oracle` on the real device: 55 results, 28 byte-identical, the rest within one step, two on R5G6B5 mip level 3, shader tokens equal; `tree-check.ps1 -NewEnv ZH_D3DX_PORTABLE=1` against the same exe on the DLL, Direct3D 11: all 8 views within their limits on the third run (worst 1.13% of 1.2%), the two runs before each had one view over, a shot taken 9 or 10 frames apart under another checkout's games' load; `-Extra -d3d9`: all 8 within, worst 0.6%; the logs confirm the renderer and the binding of each side.) Left: an ARM64 build and run; this machine has no ARM64 toolset or hardware. || 2026-10-08 | The bridge decks' slope bias spelled without DWORD | `W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp` | 9cc0c0b0 passed the bias's bits as `*(const DWORD *)&bridgeSlopeBias`, and DWORD is not a type off Windows (bittype.h removed it on purpose), so every macOS and Linux build stopped there. It is now `*(const uint32 *)`, as `dx8wrapper.h`'s fog states are. | None: DWORD and uint32 are both 32-bit unsigned under MSVC, so the call takes the same value. | low | **Windows: OPEN** (a Windows build; nothing else can differ.) |+| 2026-10-13 | `-showHudOverlay` and `m_showHudOverlay` removed | `Common/GlobalData.cpp`/`.h`, `Common/CommandLine.cpp`, `Tests/test_gameengine.cpp`, `dx11-check.ps1`, `shadow-check.ps1`, `Tools/linux-packages-check.sh` | Since 8b859d61 the info strip is drawn by `ShowNetBox` alone, so the field, its default and the switch decided nothing. `ShowHudOverlay` stays in GameData's field table as an ignored key, because an unknown key throws. The 2026-09-29 row's packaging refusals are left in. | None: no reader of the field was left. | low | **Windows: checked** (`build.bat Release test`.) |## Standing itemsdiff --git a/dx11-check.ps1 b/dx11-check.ps1index 20ff058b6..c1b97c44b 100644--- a/dx11-check.ps1+++ b/dx11-check.ps1@@ -79,8 +79,7 @@ $cases = @(# switch went in twice.function Shoot($c, $tag, $switches) {Get-ChildItem "$shots\sshot*.bmp" -ErrorAction SilentlyContinue | Remove-Item -Force- # -showHudOverlay: off by default in Release, and every evidence picture shows the corner readout- $arguments = @('-win','-xres','1280','-yres','720','-quickstart','-noshellmap','-multiInstance','-showHudOverlay',+ $arguments = @('-win','-xres','1280','-yres','720','-quickstart','-noshellmap','-multiInstance','-msaa','0','-dx11post','off','-map',"`"Maps\$($c.map)\$($c.map).map`"",'-autoskirmish','4','-aidiff','easy','-seed','5','-maxframes',($c.f+80),'-screenshot',$c.f,'-camera',$c.x,$c.y,'-logPrefix',"dx11chk_$tag`_",'-turbo') + $switches + $Extradiff --git a/shadow-check.ps1 b/shadow-check.ps1index 3b82b9efe..2bab38f0f 100644--- a/shadow-check.ps1+++ b/shadow-check.ps1@@ -29,8 +29,7 @@ $cases = @(function Shoot($case, $tag, $extra) {Get-ChildItem "$shots\sshot*.bmp" -ErrorAction SilentlyContinue | Remove-Item -Force- # -showHudOverlay: off by default in Release, and every evidence picture shows the corner readout- $arguments = @('-win','-xres','1280','-yres','720','-quickstart','-noshellmap','-multiInstance','-showHudOverlay',+ $arguments = @('-win','-xres','1280','-yres','720','-quickstart','-noshellmap','-multiInstance','-msaa','0','-dx11post','off','-map',"`"Maps\$($case.map)\$($case.map).map`"",'-autoskirmish','4','-aidiff','easy','-seed','5','-maxframes',($case.f+80),'-screenshot',$case.f,'-camera',$case.x,$case.y,'-logPrefix',"shd_$tag`_",'-turbo')diff --git a/tree-check.ps1 b/tree-check.ps1index 2f46065d5..c7c8b0f0a 100644--- a/tree-check.ps1+++ b/tree-check.ps1@@ -67,7 +67,8 @@ $cases = @(# reference build from before that draws without it, so the bloom would be the difference counted.function Shoot($exe, $c, $tag) {Get-ChildItem "$shots\sshot*.bmp" -ErrorAction SilentlyContinue | Remove-Item -Force- # -showHudOverlay: off by default in Release, and every evidence picture shows the corner readout+ # -showHudOverlay is for a reference exe from before 8b859d61, whose corner readout was off in Release+ # without it; this build draws the info strip by ShowNetBox alone and skips the switch as unknown.$args = @('-win','-xres','1280','-yres','720','-quickstart','-noshellmap','-multiInstance','-showHudOverlay','-msaa','0','-dx11post','off','-map',"`"Maps\$($c.map)\$($c.map).map`"",'-autoskirmish','4','-aidiff','easy','-seed','5','-maxframes',($c.f+80),'-screenshot',$c.f,'-camera',$c.x,$c.y,'-logPrefix',"chk_$tag`_") + $pace + $Extra