Skip to content

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.

fix(gameengine): build on macos and linux again

Olcay Seygan5ae700257614
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 56995d96c..cadb83354 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -139,7 +139,7 @@ found and fixed — EA's own, not port damage.**
- One game on every machine. A replay recorded on a Mac plays back on Linux and on Windows to the same checksum, and the other way round, and a Mac and a Linux PC have played a LAN match together without once disagreeing. A Mac or Linux game could not join a Windows one: the check every machine runs before a network game failed, because the Mac and Linux copies of the game's data files ended each line differently from Windows'. They agree now. A match between Windows and a Mac has not been played yet.
- Text on the Linux menus is as wide as on Windows. Linux has no Arial, and the font standing in for it reports a wider average letter, so every menu font the game sets to a fixed width came out a quarter narrower than it should, the "Generals" lettering and the menu buttons among them. Each is measured against Arial's own figure now, and lands within one percent of Windows.
- The game no longer crashes on some Linux PCs as its window opens. The game hands out memory its own way, and on Linux the graphics driver gets its memory from the game too. Some drivers, AMD's on Debian 12 among them, need every piece lined up on a 16-byte boundary, and the game's lined up on 4, so the start died or went through depending on where the pieces happened to fall. On Linux everything outside the game's own pools now comes from the system, which lines it up as the driver expects.
-- `./build-linux.sh` stopped on Linux Mint and Arch after the centred Classic interface went in: the new code compared layout names with a Windows-only spelling that GCC on Linux has never heard of. It uses the name every platform knows now, and so do the two debug-build spots with the same habit. Nobody has rebuilt on Linux since, so whether anything else stands in the way is not known yet.
+- `./build-linux.sh` stopped on Linux Mint and Arch after the centred Classic interface went in: the new code compared layout names with a Windows-only spelling that GCC on Linux has never heard of. It uses the name every platform knows now, and so do the two debug-build spots with the same habit. From 3.0.0 on, `./build-macos.sh` and `./build-linux.sh` stopped again, on another Windows-only spelling in the mod code and, on Linux, a file name written in the wrong case, which Windows does not mind. The log blamed the audio library because it was the last file the build had started; the real error sat higher up. Both are fixed, after Andreas Berger found them.
- Windows on Arm laptops, the Snapdragon ones, get a build made for them. Microsoft never shipped those machines the library the game loads its textures and shaders through, so the game brings its own, the texture code the Mac and Linux versions already run. Switched on in place of Microsoft's library on an ordinary Windows PC, it draws the same battlefields, with no tree, house or patch of ground going missing. Nobody has played it on a Snapdragon laptop yet.
- Thanks to ilyasakin, whose port this is.
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
index 2e6013e65..bbfe8fead 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
@@ -664,7 +664,7 @@ void ModNamespace::finishScan( Int mod )
{
Bool reserved = FALSE;
for (size_t i = 0; i < ARRAY_SIZE( Reserved ) && !reserved; ++i)
- reserved = stricmp( it->c_str(), Reserved[ i ] ) == 0;
+ reserved = strcasecmp( it->c_str(), Reserved[ i ] ) == 0;
if (reserved)
it = names.all.erase( it );
else
@@ -740,7 +740,7 @@ Bool ModNamespace::isAssetField( const std::string &field )
};
for (size_t i = 0; i < ARRAY_SIZE( AssetFields ); ++i)
{
- if (stricmp( field.c_str(), AssetFields[ i ] ) == 0)
+ if (strcasecmp( field.c_str(), AssetFields[ i ] ) == 0)
return TRUE;
}
return FALSE;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
index 9db1dead8..c00ada0bd 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
@@ -31,7 +31,7 @@
#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine
#include "Common/FileSystem.h"
-#include "Common/File.h"
+#include "Common/file.h"
#include "Common/GlobalData.h"
#include "Common/PlayerTemplate.h"
#include "Common/Registry.h"
diff --git a/GeneralsMD/Code/Tests/test_bigfilesystem_stubs.cpp b/GeneralsMD/Code/Tests/test_bigfilesystem_stubs.cpp
index 1b18215d4..4a0a9113d 100644
--- a/GeneralsMD/Code/Tests/test_bigfilesystem_stubs.cpp
+++ b/GeneralsMD/Code/Tests/test_bigfilesystem_stubs.cpp
@@ -65,6 +65,9 @@ void INI::load(AsciiString, INILoadType, Xfer *) { unreachable("INI::load"); }
FileSystem *TheFileSystem = NULL;
File *FileSystem::openFile(const Char *, Int) { unreachable("FileSystem::openFile"); return NULL; }
+// ArchiveFileSystem asks these only of a mod's archives; nothing loads mods here.
+Bool FileSystem::isMapPath(const AsciiString &) { unreachable("FileSystem::isMapPath"); return FALSE; }
+Bool FileSystem::isForkUIPath(const AsciiString &) { unreachable("FileSystem::isForkUIPath"); return FALSE; }
// GameDataGone (Common/Debug.h): an archive read failed because its drive went away. Every archive this
// test opens is on the local install and stays there, so that never happens here.
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 637d59b11..1c9cd4e18 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -11,15 +11,16 @@
* plain CRT _open/_read and does live in gameengine.
*/
/* crc.h pulls winsock2.h, so it has to come before anything that drags in
- windows.h (and with it winsock.h) - otherwise ws2def.h redefines sockaddr. */
-#include "Common/crc.h"
-
-#include "test_harness.h"
-
+ windows.h (and with it winsock.h) - otherwise ws2def.h redefines sockaddr.
+ <filesystem> goes first again: GCC 15's pulls <locale>, which BaseType.h's min/max macros break. */
#include <filesystem>
#include <limits>
#include <string>
+#include "Common/crc.h"
+
+#include "test_harness.h"
+
#include "Common/AsciiString.h"
#include "Common/CommandLine.h"
#include "Common/UnicodeString.h"