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(gameengine): find base game archives past a stale registry path
Olcay Seygan6ddb9a39377a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 49e5893e6..a0efdecac 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -802,6 +802,7 @@ found and fixed — EA's own, not port damage.**- A long chat message or an unusual map name could kill the process.- A map name the game cannot make sense of is refused as you start, instead of taking the game down later. A path with a space in it and no quotes around it left the loader walking the same step of that path forever, growing a string until it ran out of room, and the game then went on starting with half of itself missing. What you saw was a crash a second later, in the part of the game that runs a match, naming nothing that had anything to do with it. Any failure during start-up now stops the game there and says which one it was.- Starting the game from the folder the zip was unpacked to says what is wrong. None of Zero Hour's own files are in that folder, so the first one the game asked for was missing, and the box that came up blamed viruses and overheated hardware. It now names the folder it looked in and tells you to run install.bat.+- A machine that once had Generals installed from a disc or The First Decade, and later removed it, no longer loses the original game's files. The old install leaves its address behind in Windows, the game trusted it over the copy Steam keeps beside Zero Hour, and the main menu came up over magenta water and black hills. A folder that turns out to be empty is passed over now, and when the original game's files are nowhere at all, a box says so and points you at Steam's file check instead of starting.- Nor can a map handed to you over the network, however long a name the other machine gives it.- An order too big for one packet arrives in pieces, and a piece that claims to belong outside the order is dropped instead of landing there.- A chat line too long for a packet is dropped rather than arriving as a different, shorter line.diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cppindex 7a822865e..63a78a1d3 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp@@ -710,6 +710,17 @@ void GameEngine::init( int argc, char *argv[] )_exit(1);}+ // The water and most of the ground are the base game's, in its Textures.big and Terrain.big.+ // Without them the game still starts, onto a shell map of magenta water and black hills.+ if (!TheFileSystem->doesFileExist("Art\\Textures\\TWWater01.dds"))+ {+ DEBUG_LOG(("GameEngine::init - Art\\Textures\\TWWater01.dds is in no archive, the base game's are missing\n"));++ extern int MessageBoxWrapper( LPCSTR lpText, LPCSTR lpCaption, UINT uType );+ MessageBoxWrapper( "The original Generals game files are missing.\n\nZero Hour needs them next to it: a Steam install keeps them in the ZH_Generals folder beside generals.exe, with Textures.big and Terrain.big among them. Verify the game's files in Steam, or reinstall Command & Conquer Generals.", "Command & Conquer Generals Zero Hour", MB_OK | MB_TASKMODAL | MB_ICONERROR );+ _exit(1);+ }+initSubsystem(TheWritableGlobalData, "TheWritableGlobalData", MSGNEW("GameEngineSubsystem") GlobalData(), &xferCRC, "Data\\INI\\Default\\GameData.ini", "Data\\INI\\GameData.ini");diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cppindex 1a3454eac..baf180578 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp@@ -83,16 +83,22 @@ void Win32BIGFileSystem::init() {// GeneralsZH...DEBUG_ASSERTCRASH(installPath != "", ("Be 1337! Go install Generals!"));#endif- if (installPath=="")+ // Zero Hour is not standalone: the base game's bigs carry most of the art,+ // audio and the music tracks, and the CD check in AudioManager::init spins+ // on a "Missing CD" prompt without them. A retail install registers the+ // key above; the Steam build does not, it ships the base game's bigs in a+ // ZH_Generals subdirectory next to the exe instead. Fall back to that+ // layout so a copied-over Steam install works with no registry writes.+ //+ // A registered folder that holds no Textures.big gets the same fallback. An uninstalled+ // retail or First Decade copy leaves its key behind, and trusting it loaded no base archive+ // at all: the water and the ground came up magenta and black on the shell map.+ AsciiString baseTextures = installPath;+ baseTextures.concat("Textures.big");+ if (installPath=="" || !TheLocalFileSystem->doesFileExist(baseTextures.str())){- // Zero Hour is not standalone: the base game's bigs carry most of the art,- // audio and the music tracks, and the CD check in AudioManager::init spins- // on a "Missing CD" prompt without them. A retail install registers the- // key above; the Steam build does not, it ships the base game's bigs in a- // ZH_Generals subdirectory next to the exe instead. Fall back to that- // layout so a copied-over Steam install works with no registry writes.+ DEBUG_LOG(("Win32BIGFileSystem::init - no base game archives in the registered folder '%s', trying ZH_Generals\\\n", installPath.str()));installPath = "ZH_Generals\\";- DEBUG_LOG(("Win32BIGFileSystem::init - no Generals install registered, trying %s\n", installPath.str()));}// Loaded second on purpose: loadIntoDirectoryTree does not overwrite, so the// Zero Hour bigs already in the tree win over the base game's copies.