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(w3ddevice): allocate the archive object after the file is known to be one
Olcay Seyganb74d225eb235
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex 77f1536f6..3e5fbdeb4 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -1172,6 +1172,16 @@ GlobalData::GlobalData()CreateDirectory(myDocumentsDirectory.str(), NULL);m_userDataDir = myDocumentsDirectory;}+ else+ {+ //+ // Saves, replays, the options file and the crash log all live under this. When the shell+ // cannot tell us where Documents is - a redirected folder whose path is longer than MAX_PATH is+ // the way it happens - the directory was simply left empty and every one of those writes went+ // somewhere else without a word. Say so; the tail of this log is what a bug report carries.+ //+ DEBUG_LOG(("Could not find the Documents folder: saves, replays and settings have nowhere of their own to go.\n"));+ }//-allAdvice feature//m_allAdvice = FALSE;diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cppindex 8181f8d80..e706a4735 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp@@ -112,8 +112,6 @@ ArchiveFile * Win32BIGFileSystem::openArchiveFile(const Char *filename) {Int archiveFileSize = 0;Int numLittleFiles = 0;- ArchiveFile *archiveFile = NEW Win32BIGFile;-DEBUG_LOG(("Win32BIGFileSystem::openArchiveFile - opening BIG file %s\n", filename));if (fp == NULL) {@@ -132,6 +130,11 @@ ArchiveFile * Win32BIGFileSystem::openArchiveFile(const Char *filename) {return NULL;}+ // Allocated after the checks above, not before them: both of those returns used to walk away+ // from a Win32BIGFile that had just been made. A directory of files that are not archives -+ // which is what a mod folder handed to -mod can be - leaked one per file.+ ArchiveFile *archiveFile = NEW Win32BIGFile;+// read in the file size.fp->read(&archiveFileSize, 4);