diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index 6f9e83de8f6..8969a744c14 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -224,6 +224,7 @@ void AudioManager::init() // do the miscellaneous sound files last so that we find the AudioEventRTS associated with the events. ini.loadFileDirectory( "Data\\INI\\MiscAudio", INI_LOAD_OVERWRITE, nullptr); +#if RTS_CD_SUPPORT // determine if one of the music tracks exists. Since their now BIGd, one implies all. // If they don't exist, then attempt to load them from the CD. if (!TheGlobalData->m_headless && !isMusicAlreadyLoaded()) @@ -239,7 +240,7 @@ void AudioManager::init() break; } // We loop infinitely on the splash screen if we don't allow breaking out of this loop. -//#if !defined( RTS_DEBUG ) + else { // Display the warning. @@ -249,9 +250,9 @@ void AudioManager::init() break; } } -//#endif } } +#endif m_music = NEW MusicManager; m_sound = NEW SoundManager; diff --git a/Core/GameEngine/Source/Common/System/FileSystem.cpp b/Core/GameEngine/Source/Common/System/FileSystem.cpp index ac180b0a335..2ea603ee133 100644 --- a/Core/GameEngine/Source/Common/System/FileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/FileSystem.cpp @@ -335,9 +335,6 @@ Bool FileSystem::createDirectory(AsciiString directory) //============================================================================ Bool FileSystem::areMusicFilesOnCD() { -#if 1 - return TRUE; -#else if (!TheCDManager) { DEBUG_LOG(("FileSystem::areMusicFilesOnCD() - No CD Manager; returning false")); return FALSE; @@ -370,7 +367,6 @@ Bool FileSystem::areMusicFilesOnCD() } } return FALSE; -#endif } //============================================================================ // FileSystem::loadMusicFilesFromCD diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index e429cebda68..c84c46853f9 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -437,8 +437,10 @@ void GameEngine::init() TheGlobalLanguageData->parseCustomDefinition(); initSubsystem(TheCDManager,"TheCDManager", CreateCDManager(), nullptr); initSubsystem(TheAudio,"TheAudio", TheGlobalData->m_headless ? NEW AudioManagerDummy : createAudioManager(), nullptr); +#if RTS_CD_SUPPORT if (!TheAudio->isMusicAlreadyLoaded()) setQuitting(TRUE); +#endif initSubsystem(TheFunctionLexicon,"TheFunctionLexicon", createFunctionLexicon(), nullptr); initSubsystem(TheModuleFactory,"TheModuleFactory", createModuleFactory(), nullptr); initSubsystem(TheMessageStream,"TheMessageStream", createMessageStream(), nullptr); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index 3cda3f62dee..c95a081b057 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -456,9 +456,14 @@ static MessageBoxReturnType cancelStartBecauseOfNoCD( void *userData ) Bool IsFirstCDPresent(void) { -#if !defined(RTS_DEBUG) - return TheFileSystem->areMusicFilesOnCD(); +#if RTS_CD_SUPPORT + #if defined(RTS_DEBUG) + return TRUE; + #else + return TheFileSystem->areMusicFilesOnCD(); + #endif #else + // CD support disabled: always assume CD is not needed return TRUE; #endif } diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp index e528e838a54..a918d132421 100644 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp @@ -176,6 +176,7 @@ void Win32CDManager::init( void ) destroyAllDrives(); +#if RTS_CD_SUPPORT // detect CD Drives for ( Char driveLetter = 'a'; driveLetter <= 'z'; driveLetter++ ) { @@ -187,6 +188,7 @@ void Win32CDManager::init( void ) newDrive( drivePath.str() ); } } +#endif refreshDrives(); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 5aa3a1e7b4d..f2cc35b0363 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -523,8 +523,10 @@ void GameEngine::init() DEBUG_LOG(("%s", Buf));//////////////////////////////////////////////////////////////////////////// #endif///////////////////////////////////////////////////////////////////////////////////////////// initSubsystem(TheAudio,"TheAudio", TheGlobalData->m_headless ? NEW AudioManagerDummy : createAudioManager(), nullptr); +#if RTS_CD_SUPPORT if (!TheAudio->isMusicAlreadyLoaded()) setQuitting(TRUE); +#endif #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// GetPrecisionTimer(&endTime64);////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index a72d2c29990..5d63e292947 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -467,9 +467,14 @@ static MessageBoxReturnType cancelStartBecauseOfNoCD( void *userData ) Bool IsFirstCDPresent(void) { -#if !defined(RTS_DEBUG) - return TheFileSystem->areMusicFilesOnCD(); +#if RTS_CD_SUPPORT + #if defined(RTS_DEBUG) + return TRUE; + #else + return TheFileSystem->areMusicFilesOnCD(); + #endif #else + // CD support disabled: always assume CD is not needed return TRUE; #endif } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp index 75e0fb827da..7387004e773 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp @@ -176,6 +176,7 @@ void Win32CDManager::init( void ) destroyAllDrives(); +#if RTS_CD_SUPPORT // detect CD Drives for ( Char driveLetter = 'a'; driveLetter <= 'z'; driveLetter++ ) { @@ -187,6 +188,7 @@ void Win32CDManager::init( void ) newDrive( drivePath.str() ); } } +#endif refreshDrives(); } diff --git a/cmake/config-build.cmake b/cmake/config-build.cmake index 6401c458be0..89927501500 100644 --- a/cmake/config-build.cmake +++ b/cmake/config-build.cmake @@ -8,6 +8,7 @@ option(RTS_BUILD_OPTION_DEBUG "Build code with the \"Debug\" configuration." OFF option(RTS_BUILD_OPTION_ASAN "Build code with Address Sanitizer." OFF) option(RTS_BUILD_OPTION_VC6_FULL_DEBUG "Build VC6 with full debug info." OFF) option(RTS_BUILD_OPTION_FFMPEG "Enable FFmpeg support" OFF) +option(RTS_CD_SUPPORT "Enable CD detection and checks (legacy copy-protection)" OFF) if(NOT RTS_BUILD_ZEROHOUR AND NOT RTS_BUILD_GENERALS) set(RTS_BUILD_ZEROHOUR TRUE) @@ -23,6 +24,7 @@ add_feature_info(DebugBuild RTS_BUILD_OPTION_DEBUG "Building as a \"Debug\" buil add_feature_info(AddressSanitizer RTS_BUILD_OPTION_ASAN "Building with address sanitizer") add_feature_info(Vc6FullDebug RTS_BUILD_OPTION_VC6_FULL_DEBUG "Building VC6 with full debug info") add_feature_info(FFmpegSupport RTS_BUILD_OPTION_FFMPEG "Building with FFmpeg support") +add_feature_info(CDSupport RTS_CD_SUPPORT "CD detection and legacy copy-protection checks") if(RTS_BUILD_ZEROHOUR) option(RTS_BUILD_ZEROHOUR_TOOLS "Build tools for Zero Hour" ON) @@ -73,3 +75,9 @@ endif() if(RTS_BUILD_OPTION_PROFILE) target_compile_definitions(core_config INTERFACE RTS_PROFILE) endif() + +if(RTS_CD_SUPPORT) + target_compile_definitions(core_config INTERFACE RTS_CD_SUPPORT=1) +else() + target_compile_definitions(core_config INTERFACE RTS_CD_SUPPORT=0) +endif()