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): accept the local no-CD layout as proof of media
Olcay Seygan7500aacdfb9b
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cppindex 4c2f7eb7b..23253b496 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp@@ -266,6 +266,15 @@ Bool FileSystem::createDirectory(AsciiString directory)//============================================================================Bool FileSystem::areMusicFilesOnCD(){+ // No-CD layouts (Steam) ship the security big next to the exe instead of on+ // a disc; finding it there is the same proof of media this check wants, so+ // look locally first and never prompt for a CD the install cannot have.+ File *localSec = TheLocalFileSystem->openFile("genseczh.big");+ if (localSec) {+ localSec->close();+ return TRUE;+ }+if (!TheCDManager) {DEBUG_LOG(("FileSystem::areMusicFilesOnCD() - No CD Manager; returning false\n"));return FALSE;diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 2d1ff4ff1..bcd346065 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -427,3 +427,19 @@ TEST(crc_computecrc_leaves_the_callee_saved_registers_alone)crc.computeCRC( text, (Int)strlen( text ) );CHECK_EQ( crc.get(), expected );}++/* Skirmish's Play button (and campaign start) gate on IsFirstCDPresent, which+ is TheFileSystem->areMusicFilesOnCD(). A no-CD layout (Steam) has no disc+ to find but ships the security big next to the exe; the check accepts that+ as the same proof of media instead of prompting for a CD forever. */+TEST(are_music_files_on_cd_accepts_the_local_no_cd_layout)+{+ CHECK( bootOnce() );++ /* No local big and the test's CD manager is the NULL stub: no media. */+ CHECK_EQ( TheFileSystem->areMusicFilesOnCD(), FALSE );++ writeFile( "genseczh.big", "contents are irrelevant, presence is the proof" );+ CHECK_EQ( TheFileSystem->areMusicFilesOnCD(), TRUE );+ remove( "genseczh.big" );+}