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.

merge: generals icon and app id for the linux window

Olcay Seygan1381a0c3215f
diff --cc CHANGELOG.md
index 9adb55500,d00dcf861..821d43d5c
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -153,13 -23,12 +153,14 @@@ found and fixed — EA's own, not
- The game runs on Apple silicon Macs and on Linux, the Steam Deck included, as a program built for that machine. There is no Wine or Proton underneath. It draws through Metal on a Mac and through Vulkan on Linux, from the same Zero Hour files you already own.
- The first start finds your game. It looks in your Steam libraries, `~/Games`, `/Applications`, and CrossOver and Whisky bottles, and asks for the folder only when it comes up empty.
- One command builds it. `./build-macos.sh` leaves a Mac app ready to open and `./build-linux.sh` a folder ready to start, and each checks your machine first and names the package to install for anything missing. On Linux it can make an AppImage, a .deb, an .rpm, an Arch package and a Flatpak, none of them carrying EA's files, and the Flatpak has played a full check match on a Steam Deck.
+- No Windows needed to get the game's files onto a Mac or Linux either. `./extract-game.sh` takes a Zero Hour or Generals disc, an `.iso` of one, or a folder copied from a Windows install, and lays the two games out where the game finds them, Generals inside Zero Hour's folder. It asks before it writes to the default folder or over files already there, and says when a game is still missing.
- 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.
+- A German, French or other non-English Zero Hour on a Mac or Linux speaks its own language. Windows' installer writes the language into the registry, and nothing does that on a Mac or Linux, so the game took English and found it in the original Generals' files beside Zero Hour: the menus came up in Generals' English with Zero Hour's own lines missing, so it looked like plain Generals. With no language set it now takes the one your Zero Hour's own files are in. A language you set yourself still wins.
- 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.
+ - The Linux game has Generals' icon. The window carries it in the taskbar and in the window switcher, and `add-to-menu.sh` in the folder `./build-linux.sh` makes puts the game in the desktop's app menu with it, which is where GNOME takes a running game's icon from. It had none.
- Thanks to ilyasakin, whose port this is.
## Mods
diff --cc GeneralsMD/Code/Tools/build-posix.sh
index 8a4dc14a2,d851c746e..c1e4c9cea
--- a/GeneralsMD/Code/Tools/build-posix.sh
+++ b/GeneralsMD/Code/Tools/build-posix.sh
@@@ -187,9 -181,15 +187,16 @@@ els
package="$BUILD/ZeroHourReforged"
rm -rf "$package"
mkdir -p "$package/bin" "$package/share/zero-hour-reforged"
+ # Generals' icon and add-to-menu.sh, which puts the folder in the app menu with it
+ for size in 48 128; do
+ mkdir -p "$package/share/icons/hicolor/${size}x${size}/apps"
+ python3 "$SRC/Tools/generals-icon.py" png "$SRC/Main/Generals.ico" \
+ "$package/share/icons/hicolor/${size}x${size}/apps/zero-hour-reforged.png" $size || fail "cannot make the icon."
+ done
+ cp "$SRC/Tools/linux-menu-entry.sh" "$package/add-to-menu.sh"
cp "$BUILD/generals" "$package/bin/generals"
- ln -s ../../../overlay "$package/share/zero-hour-reforged/overlay"
+ # a copy, not a link into the build tree, so the folder runs from wherever it is moved
+ cp -R "$BUILD/overlay" "$package/share/zero-hour-reforged/overlay"
echo "[build] done: run $package/bin/generals"
fi
echo "[build] It finds your Zero Hour in the usual places, or asks for its folder on the first start: the one"