From 84054eb6590a341ae84ccdf5a9e55d703e0177aa Mon Sep 17 00:00:00 2001 From: Chapter5780 Date: Fri, 30 Jan 2026 17:18:41 +0100 Subject: [PATCH] feat: Remove CD management code The Pull Request #2203 made by @fbraz3 on the upstream repository inspired a deeper audit of the legacy CD requirements in the engine. Beyond merely skipping the startup prompt, it was discovered that large portions of the engine's CD-management infrastructure have become vestigial in modern execution environments. This commit implements a comprehensive modernization by pruning approximately 2,000 lines of dead code across the Core, Generals, and Zero Hour variants. This plan assumes the Music.big(zh) archive is located in the local game directory. If it is missing from the local folder, music will simply not play instead of prompting the user. Tested all parts (init, singleplayer, skirmish) where this code was active, didn't find any problems. --- Core/GameEngine/CMakeLists.txt | 2 - Core/GameEngine/Include/Common/FileSystem.h | 3 - Core/GameEngine/Include/Common/GameAudio.h | 2 - .../Source/Common/Audio/GameAudio.cpp | 31 +- .../Source/Common/System/FileSystem.cpp | 79 ----- Generals/Code/GameEngine/CMakeLists.txt | 3 - .../GameEngine/Include/Common/CDManager.h | 185 ----------- .../GameEngine/Include/GameClient/CDCheck.h | 35 --- .../GameEngine/Source/Common/GameEngine.cpp | 3 - .../Source/Common/System/CDManager.cpp | 294 ------------------ .../GUI/GUICallbacks/Menus/MainMenu.cpp | 39 +-- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 3 +- .../Menus/SkirmishGameOptionsMenu.cpp | 46 +-- Generals/Code/GameEngineDevice/CMakeLists.txt | 2 - .../Win32Device/Common/Win32CDManager.h | 102 ------ .../Win32Device/Common/Win32CDManager.cpp | 236 -------------- Generals/Code/Main/WinMain.cpp | 3 - .../Tools/WorldBuilder/src/WorldBuilder.cpp | 3 - GeneralsMD/Code/GameEngine/CMakeLists.txt | 3 - .../GameEngine/Include/Common/CDManager.h | 185 ----------- .../GameEngine/Include/GameClient/CDCheck.h | 35 --- .../GameEngine/Source/Common/GameEngine.cpp | 3 - .../Source/Common/System/CDManager.cpp | 294 ------------------ .../GUI/GUICallbacks/Menus/MainMenu.cpp | 39 +-- .../GUI/GUICallbacks/Menus/ScoreScreen.cpp | 3 +- .../Menus/SkirmishGameOptionsMenu.cpp | 46 +-- .../Code/GameEngineDevice/CMakeLists.txt | 2 - .../Win32Device/Common/Win32CDManager.h | 102 ------ .../Win32Device/Common/Win32CDManager.cpp | 236 -------------- GeneralsMD/Code/Main/WinMain.cpp | 3 - .../Tools/WorldBuilder/src/WorldBuilder.cpp | 3 - 31 files changed, 11 insertions(+), 2014 deletions(-) delete mode 100644 Generals/Code/GameEngine/Include/Common/CDManager.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/CDCheck.h delete mode 100644 Generals/Code/GameEngine/Source/Common/System/CDManager.cpp delete mode 100644 Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32CDManager.h delete mode 100644 Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp delete mode 100644 GeneralsMD/Code/GameEngine/Include/Common/CDManager.h delete mode 100644 GeneralsMD/Code/GameEngine/Include/GameClient/CDCheck.h delete mode 100644 GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp delete mode 100644 GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32CDManager.h delete mode 100644 GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index e30907d3acb..9cf234c3a29 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -19,7 +19,6 @@ set(GAMEENGINE_SRC # Include/Common/BitFlagsIO.h # Include/Common/BorderColors.h # Include/Common/BuildAssistant.h -# Include/Common/CDManager.h # Include/Common/ClientUpdateModule.h # Include/Common/CommandLine.h Include/Common/crc.h @@ -643,7 +642,6 @@ set(GAMEENGINE_SRC Source/Common/System/ArchiveFileSystem.cpp Source/Common/System/AsciiString.cpp # Source/Common/System/BuildAssistant.cpp -# Source/Common/System/CDManager.cpp # Source/Common/System/CriticalSection.cpp # Source/Common/System/DataChunk.cpp Source/Common/System/Debug.cpp diff --git a/Core/GameEngine/Include/Common/FileSystem.h b/Core/GameEngine/Include/Common/FileSystem.h index 51bf9153caa..0d533be4b66 100644 --- a/Core/GameEngine/Include/Common/FileSystem.h +++ b/Core/GameEngine/Include/Common/FileSystem.h @@ -155,9 +155,6 @@ class FileSystem : public SubsystemInterface Bool createDirectory(AsciiString directory); ///< create a directory of the given name. - Bool areMusicFilesOnCD(); - void loadMusicFilesFromCD(); - void unloadMusicFilesFromCD(); static AsciiString normalizePath(const AsciiString& path); ///< normalizes a file path. The path can refer to a directory. File path must be absolute, but does not need to exist. Returns an empty string on failure. static Bool isPathInDirectory(const AsciiString& testPath, const AsciiString& basePath); ///< determines if a file path is within a base path. Both paths must be absolute, but do not need to exist. diff --git a/Core/GameEngine/Include/Common/GameAudio.h b/Core/GameEngine/Include/Common/GameAudio.h index afa29245bb8..94f0f0ade94 100644 --- a/Core/GameEngine/Include/Common/GameAudio.h +++ b/Core/GameEngine/Include/Common/GameAudio.h @@ -287,7 +287,6 @@ class AudioManager : public SubsystemInterface virtual void closeAnySamplesUsingFile( const void *fileToClose ) = 0; virtual Bool isMusicAlreadyLoaded(void) const; - virtual Bool isMusicPlayingFromCD(void) const { return m_musicPlayingFromCD; } Bool getDisallowSpeech( void ) const { return m_disallowSpeech; } void setDisallowSpeech( Bool disallowSpeech ) { m_disallowSpeech = disallowSpeech; } @@ -370,7 +369,6 @@ class AudioManager : public SubsystemInterface Bool m_volumeHasChanged : 1; Bool m_hardwareAccel : 1; Bool m_surroundSpeakers : 1; - Bool m_musicPlayingFromCD : 1; // Next 8 Bool m_disallowSpeech : 1; diff --git a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp index 6f9e83de8f6..049dc951aec 100644 --- a/Core/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Core/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -149,8 +149,7 @@ AudioManager::AudioManager() : m_music(nullptr), m_sound(nullptr), m_surroundSpeakers(FALSE), - m_hardwareAccel(FALSE), - m_musicPlayingFromCD(FALSE) + m_hardwareAccel(FALSE) { m_adjustedVolumes.clear(); m_audioRequests.clear(); @@ -224,34 +223,6 @@ 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); - // 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()) - { - m_musicPlayingFromCD = TRUE; - while (TRUE) - { - // @todo Unload any files from CD first. - jkmcd - - TheFileSystem->loadMusicFilesFromCD(); - if (isMusicAlreadyLoaded()) - { - 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. - - if (OSDisplayWarningBox("GUI:InsertCDPrompt", "GUI:InsertCDMessage", OSDBT_OK | OSDBT_CANCEL, OSDOF_SYSTEMMODAL | OSDOF_EXCLAMATIONICON) == OSDBT_CANCEL) { - //TheGameEngine->setQuitting(TRUE); // Can't do this to WorldBuilder - break; - } - } -//#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..bcb4e5ce032 100644 --- a/Core/GameEngine/Source/Common/System/FileSystem.cpp +++ b/Core/GameEngine/Source/Common/System/FileSystem.cpp @@ -50,7 +50,6 @@ #include "Common/FileSystem.h" #include "Common/ArchiveFileSystem.h" -#include "Common/CDManager.h" #include "Common/GameAudio.h" #include "Common/LocalFileSystem.h" #include "Common/PerfTimer.h" @@ -330,84 +329,6 @@ Bool FileSystem::createDirectory(AsciiString directory) return FALSE; } -//============================================================================ -// FileSystem::areMusicFilesOnCD -//============================================================================ -Bool FileSystem::areMusicFilesOnCD() -{ -#if 1 - return TRUE; -#else - if (!TheCDManager) { - DEBUG_LOG(("FileSystem::areMusicFilesOnCD() - No CD Manager; returning false")); - return FALSE; - } - - AsciiString cdRoot; - Int dc = TheCDManager->driveCount(); - for (Int i = 0; i < dc; ++i) { - DEBUG_LOG(("FileSystem::areMusicFilesOnCD() - checking drive %d", i)); - CDDriveInterface *cdi = TheCDManager->getDrive(i); - if (!cdi) { - continue; - } - - cdRoot = cdi->getPath(); - if (!cdRoot.endsWith("\\")) - cdRoot.concat("\\"); -#if RTS_GENERALS - cdRoot.concat("gensec.big"); -#elif RTS_ZEROHOUR - cdRoot.concat("genseczh.big"); -#endif - DEBUG_LOG(("FileSystem::areMusicFilesOnCD() - checking for %s", cdRoot.str())); - File *musicBig = TheLocalFileSystem->openFile(cdRoot.str()); - if (musicBig) - { - DEBUG_LOG(("FileSystem::areMusicFilesOnCD() - found it!")); - musicBig->close(); - return TRUE; - } - } - return FALSE; -#endif -} -//============================================================================ -// FileSystem::loadMusicFilesFromCD -//============================================================================ -void FileSystem::loadMusicFilesFromCD() -{ - if (!TheCDManager) { - return; - } - - AsciiString cdRoot; - Int dc = TheCDManager->driveCount(); - for (Int i = 0; i < dc; ++i) { - CDDriveInterface *cdi = TheCDManager->getDrive(i); - if (!cdi) { - continue; - } - - cdRoot = cdi->getPath(); - if (TheArchiveFileSystem->loadBigFilesFromDirectory(cdRoot, MUSIC_BIG)) { - break; - } - } -} - -//============================================================================ -// FileSystem::unloadMusicFilesFromCD -//============================================================================ -void FileSystem::unloadMusicFilesFromCD() -{ - if (!(TheAudio && TheAudio->isMusicPlayingFromCD())) { - return; - } - - TheArchiveFileSystem->closeArchiveFile( MUSIC_BIG ); -} - //============================================================================ // FileSystem::normalizePath //============================================================================ diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 068df25e965..991e6a72698 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -16,7 +16,6 @@ set(GAMEENGINE_SRC Include/Common/BitFlags.h Include/Common/BitFlagsIO.h Include/Common/BuildAssistant.h - Include/Common/CDManager.h Include/Common/ClientUpdateModule.h Include/Common/CommandLine.h # Include/Common/crc.h @@ -134,7 +133,6 @@ set(GAMEENGINE_SRC Include/GameClient/AnimateWindowManager.h # Include/GameClient/ChallengeGenerals.h Include/GameClient/CampaignManager.h - Include/GameClient/CDCheck.h Include/GameClient/ClientInstance.h # Include/GameClient/ClientRandomValue.h Include/GameClient/Color.h @@ -592,7 +590,6 @@ set(GAMEENGINE_SRC # Source/Common/System/ArchiveFileSystem.cpp # Source/Common/System/AsciiString.cpp Source/Common/System/BuildAssistant.cpp - Source/Common/System/CDManager.cpp Source/Common/System/CriticalSection.cpp Source/Common/System/DataChunk.cpp # Source/Common/System/Debug.cpp diff --git a/Generals/Code/GameEngine/Include/Common/CDManager.h b/Generals/Code/GameEngine/Include/Common/CDManager.h deleted file mode 100644 index 2b5a60b1574..00000000000 --- a/Generals/Code/GameEngine/Include/Common/CDManager.h +++ /dev/null @@ -1,185 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Game Engine Common -// -// File name: Common/CDManager.h -// -// Created: 11/26/01 TR -// -//---------------------------------------------------------------------------- - -#pragma once - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "Common/List.h" -#include "Common/SubsystemInterface.h" -#include "Common/AsciiString.h" - - -//---------------------------------------------------------------------------- -// Forward References -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Type Defines -//---------------------------------------------------------------------------- - -namespace CD -{ - enum Disk - { - UNKNOWN_DISK = -3, - NO_DISK = -2, - ANY_DISK = -1, - DISK_1 = 0, - NUM_DISKS - }; -}; - -//=============================== -// CDDriveInterface -//=============================== -/** - * Interface to a CD ROM drive - */ -//=============================== - -class CDDriveInterface -{ - public: - - virtual ~CDDriveInterface() {}; - - virtual void refreshInfo( void ) = 0; ///< Update drive with least - - virtual AsciiString getDiskName( void ) = 0; ///< Returns the drive path for this drive - virtual AsciiString getPath( void ) = 0; ///< Returns the drive path for this drive - virtual CD::Disk getDisk( void ) = 0; ///< Returns ID of current disk in this drive - -}; - -//=============================== -// CDDrive -//=============================== - -class CDDrive : public CDDriveInterface -{ - friend class CDManager; - public: - - CDDrive(); - virtual ~CDDrive(); - - // CDDriveInterface operations - virtual AsciiString getPath( void ); ///< Returns the drive path for this drive - virtual AsciiString getDiskName( void ); ///< Returns the drive path for this drive - virtual CD::Disk getDisk( void ); ///< Returns ID of current disk in this drive - virtual void refreshInfo( void ); ///< Update drive with least - - // CDDrive operations - void setPath( const Char *path ); ///< Set the drive's path - - protected: - - LListNode m_node; ///< Link list node - AsciiString m_diskName; ///< disk's volume name - AsciiString m_drivePath; ///< drive's device path - CD::Disk m_disk; ///< ID of disk in drive -}; - - -//=============================== -// CDManagerInterface -//=============================== - -class CDManagerInterface : public SubsystemInterface -{ - public: - - virtual ~CDManagerInterface(){}; - - virtual Int driveCount( void ) = 0; ///< Number of CD drives detected - virtual CDDriveInterface* getDrive( Int index ) = 0; ///< Return the specified drive - virtual CDDriveInterface* newDrive( const Char *path ) = 0; ///< add new drive of specified path - virtual void refreshDrives( void ) = 0; ///< Refresh drive info - virtual void destroyAllDrives( void ) = 0; ///< Like it says, destroy all drives - - protected: - - virtual CDDriveInterface* createDrive( void ) = 0; -}; - -//=============================== -// CDManager -//=============================== - -class CDManager : public CDManagerInterface -{ - public: - - CDManager(); - virtual ~CDManager(); - - // sub system operations - virtual void init( void ); - virtual void update( void ); - virtual void reset( void ); - - // - virtual Int driveCount( void ); ///< Number of CD drives detected - virtual CDDriveInterface* getDrive( Int index ); ///< Return the specified drive - virtual CDDriveInterface* newDrive( const Char *path ); ///< add new drive of specified path - virtual void refreshDrives( void ); ///< Refresh drive info - virtual void destroyAllDrives( void ); ///< Like it says, destroy all drives - - - - protected: - - LList m_drives; ///< List of drives detected on this machine -}; - -//---------------------------------------------------------------------------- -// Inlining -//---------------------------------------------------------------------------- - -extern CDManagerInterface *TheCDManager; -CDManagerInterface* CreateCDManager( void ); diff --git a/Generals/Code/GameEngine/Include/GameClient/CDCheck.h b/Generals/Code/GameEngine/Include/GameClient/CDCheck.h deleted file mode 100644 index e5e3a8921ef..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/CDCheck.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: CDCheck.h //////////////////////////////////////////////////////////////////////////////// -// Author: Matt Campbell, January 2003 -// Description: check for CD, popping up an in-game message box at game start. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -typedef void (*gameStartCallback) (void); - -Bool IsFirstCDPresent(void); -void CheckForCDAtGameStart( gameStartCallback callback ); diff --git a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp index e429cebda68..1910546986f 100644 --- a/Generals/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/Generals/Code/GameEngine/Source/Common/GameEngine.cpp @@ -47,7 +47,6 @@ #include "Common/FileSystem.h" #include "Common/ArchiveFileSystem.h" #include "Common/LocalFileSystem.h" -#include "Common/CDManager.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" #include "Common/RandomValue.h" @@ -435,7 +434,6 @@ void GameEngine::init() initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads", "Data\\INI\\Roads"); initSubsystem(TheGlobalLanguageData,"TheGlobalLanguageData",MSGNEW("GameEngineSubsystem") GlobalLanguage, nullptr); // must be before the game text TheGlobalLanguageData->parseCustomDefinition(); - initSubsystem(TheCDManager,"TheCDManager", CreateCDManager(), nullptr); initSubsystem(TheAudio,"TheAudio", TheGlobalData->m_headless ? NEW AudioManagerDummy : createAudioManager(), nullptr); if (!TheAudio->isMusicAlreadyLoaded()) setQuitting(TRUE); @@ -731,7 +729,6 @@ void GameEngine::update( void ) TheNetwork->UPDATE(); } - TheCDManager->UPDATE(); } const Bool canUpdate = canUpdateGameLogic(); diff --git a/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp b/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp deleted file mode 100644 index 56d180e5175..00000000000 --- a/Generals/Code/GameEngine/Source/Common/System/CDManager.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Game Engine Common -// -// File name: CDManager.cpp -// -// Created: 11/26/01 TR -// -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/CDManager.h" -#include "GameLogic/GameLogic.h" - -//---------------------------------------------------------------------------- -// Externals -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Defines -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Types -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Data -//---------------------------------------------------------------------------- - -CDManagerInterface* TheCDManager = nullptr; - -//---------------------------------------------------------------------------- -// Private Prototypes -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Functions -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Functions -//---------------------------------------------------------------------------- - - -//============================================================================ -// CDDrive::CDDrive -//============================================================================ - -CDDrive::CDDrive() -: m_disk(CD::UNKNOWN_DISK) -{ - m_diskName.clear(); - m_drivePath.clear(); - -} - -//============================================================================ -// CDDrive::~CDDrive -//============================================================================ - -CDDrive::~CDDrive() -{ - -} - -//============================================================================ -// CDDrive::getPath -//============================================================================ - -AsciiString CDDrive::getPath( void ) -{ - return m_drivePath; -} - -//============================================================================ -// CDDrive::getDiskName -//============================================================================ - -AsciiString CDDrive::getDiskName( void ) -{ - return m_diskName; -} - -void CDDrive::refreshInfo( void ) -{ - // map disk names to disk ID - m_disk = CD::UNKNOWN_DISK; -} - -//============================================================================ -// CDDrive::getDisk -//============================================================================ - -CD::Disk CDDrive::getDisk( void ) -{ - return m_disk; -} - -//============================================================================ -// CDDrive::setPath -//============================================================================ - -void CDDrive::setPath( const Char *path ) -{ - m_drivePath = path; -} - -//============================================================================ -// CDManager::CDManager -//============================================================================ - -CDManager::CDManager() -{ - -} - -//============================================================================ -// CDManager::~CDManager -//============================================================================ - -CDManager::~CDManager() -{ - destroyAllDrives(); -} - -//============================================================================ -// CDManager::init -//============================================================================ - -void CDManager::init( void ) -{ - -} - -//============================================================================ -// CDManager::update -//============================================================================ - -void CDManager::update( void ) -{ - // Every so often, check to make sure the CD is still in the drive - if ((TheGameLogic->getFrame() % 300) == 299) { - refreshDrives(); - } -} - -//============================================================================ -// CDManager::reset -//============================================================================ - -void CDManager::reset( void ) -{ - -} - -//============================================================================ -// CDManager::driveCount -//============================================================================ - -Int CDManager::driveCount( void ) -{ - return m_drives.nodeCount(); -} - -//============================================================================ -// CDManager::getDrive -//============================================================================ - -CDDriveInterface* CDManager::getDrive( Int index ) -{ - CDDriveInterface *cd = nullptr; - LListNode *node = m_drives.getNode( index ); - - if ( node ) - { - cd = (CDDriveInterface*) node->item(); - } - - return cd; -} - -//============================================================================ -// CDManager::newDrive -//============================================================================ - -CDDriveInterface* CDManager::newDrive( const Char *path ) -{ - CDDrive *drive= (CDDrive*) createDrive(); - - if ( drive ) - { - drive->setPath( path ); - - drive->m_node.setItem( drive ); - m_drives.add( &drive->m_node ); - } - return drive; -} - -//============================================================================ -// CDManager::refreshDrives -//============================================================================ - -void CDManager::refreshDrives( void ) -{ - LListNode *node = m_drives.firstNode(); - - while ( node ) - { - CDDriveInterface *drive = (CDDriveInterface *) node->item(); - if ( drive ) - { - drive->refreshInfo(); - } - - node = node->next(); - } -} - - -//============================================================================ -// CDManager::destroyAllDrives -//============================================================================ - -void CDManager::destroyAllDrives( void ) -{ - LListNode *node; - - while ( (node = m_drives.firstNode() ) != nullptr ) - { - node->remove(); - CDDriveInterface *drive = (CDDriveInterface *) node->item(); - delete drive; - } -} - - - - - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index e2cfe319ee3..27806fc907c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -70,7 +70,6 @@ #include "GameNetwork/DownloadManager.h" #include "GameNetwork/GameSpy/MainMenuUtils.h" -#include "GameClient/CDCheck.h" #include "GameClient/InGameUI.h" @@ -264,24 +263,6 @@ void prepareCampaignGame(GameDifficulty diff) setupGameStart(TheCampaignManager->getCurrentMap(), diff ); } -static MessageBoxReturnType cancelStartBecauseOfNoCD( void *userData ) -{ - return MB_RETURN_CLOSE; -} - -static MessageBoxReturnType checkCDCallback( void *userData ) -{ - if (!IsFirstCDPresent()) - { - return MB_RETURN_KEEPOPEN; - } - else - { - prepareCampaignGame((GameDifficulty)(Int)(Int *)userData); - return MB_RETURN_CLOSE; - } -} - static void doGameStart( void ) { startGame = FALSE; @@ -299,20 +280,6 @@ static void doGameStart( void ) isShuttingDown = TRUE; } -static void checkCDBeforeCampaign(GameDifficulty diff) -{ - if (!IsFirstCDPresent()) - { - // popup a dialog asking for a CD - ExMessageBoxOkCancel(TheGameText->fetch("GUI:InsertCDPrompt"), TheGameText->fetch("GUI:InsertCDMessage"), - (void *)diff, checkCDCallback, cancelStartBecauseOfNoCD); - } - else - { - prepareCampaignGame(diff); - } -} - static void shutdownComplete( WindowLayout *layout ) { isShuttingDown = FALSE; @@ -1534,21 +1501,21 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, if(dontAllowTransitions) break; - checkCDBeforeCampaign(DIFFICULTY_EASY); + prepareCampaignGame(DIFFICULTY_EASY); } else if(controlID == buttonMediumID) { if(dontAllowTransitions) break; - checkCDBeforeCampaign(DIFFICULTY_NORMAL); + prepareCampaignGame(DIFFICULTY_NORMAL); } else if(controlID == buttonHardID) { if(dontAllowTransitions) break; - checkCDBeforeCampaign(DIFFICULTY_HARD); + prepareCampaignGame(DIFFICULTY_HARD); } else if(controlID == buttonDiffBackID) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index aaf601cff14..3741eea097c 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -72,7 +72,6 @@ #include "GameLogic/GameLogic.h" #include "GameLogic/ScriptEngine.h" #include "GameLogic/VictoryConditions.h" -#include "GameClient/CDCheck.h" #include "GameClient/Display.h" #include "GameClient/GUICallbacks.h" #include "GameClient/WindowLayout.h" @@ -480,7 +479,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, } else { - CheckForCDAtGameStart( startNextCampaignGame ); + startNextCampaignGame(); } } } 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..d650f701ae0 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -60,7 +60,6 @@ #include "Common/MultiplayerSettings.h" #include "GameClient/GameText.h" -#include "GameClient/CDCheck.h" #include "GameClient/ExtendedMessageBox.h" #include "GameClient/MessageBox.h" #include "GameNetwork/GameInfo.h" @@ -448,49 +447,6 @@ void reallyDoStart( void ) } } -static MessageBoxReturnType cancelStartBecauseOfNoCD( void *userData ) -{ - buttonPushed = FALSE; - return MB_RETURN_CLOSE; -} - -Bool IsFirstCDPresent(void) -{ -#if !defined(RTS_DEBUG) - return TheFileSystem->areMusicFilesOnCD(); -#else - return TRUE; -#endif -} - -static MessageBoxReturnType checkCDCallback( void *userData ) -{ - if (!IsFirstCDPresent()) - { - return (IsFirstCDPresent())?MB_RETURN_CLOSE:MB_RETURN_KEEPOPEN; - } - else - { - gameStartCallback callback = (gameStartCallback)userData; - if (callback) - callback(); - return MB_RETURN_CLOSE; - } -} - -void CheckForCDAtGameStart( gameStartCallback callback ) -{ - if (!IsFirstCDPresent()) - { - // popup a dialog asking for a CD - ExMessageBoxOkCancel(TheGameText->fetch("GUI:InsertCDPrompt"), TheGameText->fetch("GUI:InsertCDMessage"), - (void*)callback, checkCDCallback, cancelStartBecauseOfNoCD); - } - else - { - callback(); - } -} Bool sandboxOk = FALSE; static void startPressed(void) @@ -528,7 +484,7 @@ static void startPressed(void) if(isReady) { - CheckForCDAtGameStart( reallyDoStart ); + reallyDoStart(); } } diff --git a/Generals/Code/GameEngineDevice/CMakeLists.txt b/Generals/Code/GameEngineDevice/CMakeLists.txt index ca1022e3e61..14c8b911a78 100644 --- a/Generals/Code/GameEngineDevice/CMakeLists.txt +++ b/Generals/Code/GameEngineDevice/CMakeLists.txt @@ -72,7 +72,6 @@ set(GAMEENGINEDEVICE_SRC Include/W3DDevice/GameLogic/W3DTerrainLogic.h # Include/Win32Device/Common/Win32BIGFile.h # Include/Win32Device/Common/Win32BIGFileSystem.h - Include/Win32Device/Common/Win32CDManager.h Include/Win32Device/Common/Win32GameEngine.h # Include/Win32Device/Common/Win32LocalFile.h # Include/Win32Device/Common/Win32LocalFileSystem.h @@ -171,7 +170,6 @@ set(GAMEENGINEDEVICE_SRC Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp # Source/Win32Device/Common/Win32BIGFile.cpp # Source/Win32Device/Common/Win32BIGFileSystem.cpp - Source/Win32Device/Common/Win32CDManager.cpp Source/Win32Device/Common/Win32GameEngine.cpp # Source/Win32Device/Common/Win32LocalFile.cpp # Source/Win32Device/Common/Win32LocalFileSystem.cpp diff --git a/Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32CDManager.h b/Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32CDManager.h deleted file mode 100644 index fc7502898df..00000000000 --- a/Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32CDManager.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Game Engine DEvice Win32 Common -// -// File name: Win32Device/Common/Win32CDManager.h -// -// Created: 11/26/01 TR -// -//---------------------------------------------------------------------------- - -#pragma once - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "Common/CDManager.h" - - -//---------------------------------------------------------------------------- -// Forward References -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Type Defines -//---------------------------------------------------------------------------- - -//=============================== -// Win32CDDrive -//=============================== - -class Win32CDDrive : public CDDrive -{ - public: - - Win32CDDrive(); - virtual ~Win32CDDrive(); - - virtual void refreshInfo( void ); ///< Update drive with least - -}; - -//=============================== -// Win32CDManager -//=============================== - -class Win32CDManager : public CDManager -{ - public: - - Win32CDManager(); - virtual ~Win32CDManager(); - - // sub system operations - virtual void init( void ); - virtual void update( void ); - virtual void reset( void ); - virtual void refreshDrives( void ); ///< Refresh drive info - - protected: - - virtual CDDriveInterface* createDrive( void ); -}; - -//---------------------------------------------------------------------------- -// Inlining -//---------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp deleted file mode 100644 index e528e838a54..00000000000 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Game Engine Device Win32 Common -// -// File name: Win32CDManager.cpp -// -// Created: 11/26/01 TR -// -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "windows.h" - -#include "Common/GameMemory.h" -#include "Common/FileSystem.h" - -#include "Win32Device/Common/Win32CDManager.h" - -//---------------------------------------------------------------------------- -// Externals -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Defines -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Types -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Prototypes -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Functions -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Functions -//---------------------------------------------------------------------------- - - -CDManagerInterface* CreateCDManager( void ) -{ - return NEW Win32CDManager; -} - -//============================================================================ -// Win32CDDrive::Win32CDDrive -//============================================================================ - -Win32CDDrive::Win32CDDrive() -{ - -} - -//============================================================================ -// Win32CDDrive::~Win32CDDrive -//============================================================================ - -Win32CDDrive::~Win32CDDrive() -{ - -} - -//============================================================================ -// Win32CDDrive::refreshInfo -//============================================================================ - -void Win32CDDrive::refreshInfo( void ) -{ - Bool mayRequireUpdate = (m_disk != CD::NO_DISK); - Char volName[1024]; - // read the volume info - if ( GetVolumeInformation( m_drivePath.str(), volName, sizeof(volName) -1, nullptr, nullptr, nullptr, nullptr, 0 )) - { - m_diskName = volName; - m_disk = CD::UNKNOWN_DISK; - } - else - { - m_diskName.clear(); - m_disk = CD::NO_DISK; - - if (mayRequireUpdate) - TheFileSystem->unloadMusicFilesFromCD(); - } - - // This is an override, not an extension of CDDrive -} - -//============================================================================ -// Win32CDManager::Win32CDManager -//============================================================================ - -Win32CDManager::Win32CDManager() -{ - -} - -//============================================================================ -// Win32CDManager::~Win32CDManager -//============================================================================ - -Win32CDManager::~Win32CDManager() -{ - -} - -//============================================================================ -// Win32CDManager::init -//============================================================================ - -void Win32CDManager::init( void ) -{ - CDManager::init(); // init base classes - - destroyAllDrives(); - - // detect CD Drives - for ( Char driveLetter = 'a'; driveLetter <= 'z'; driveLetter++ ) - { - AsciiString drivePath; - drivePath.format( "%c:\\", driveLetter ); - - if ( GetDriveType( drivePath.str() ) == DRIVE_CDROM ) - { - newDrive( drivePath.str() ); - } - } - - refreshDrives(); -} - -//============================================================================ -// Win32CDManager::update -//============================================================================ - -void Win32CDManager::update( void ) -{ - CDManager::update(); - - -} - -//============================================================================ -// Win32CDManager::reset -//============================================================================ - -void Win32CDManager::reset( void ) -{ - CDManager::reset(); - -} - -//============================================================================ -// Win32CDManager::createDrive -//============================================================================ - -CDDriveInterface* Win32CDManager::createDrive( void ) -{ - return NEW Win32CDDrive; -} - - -//============================================================================ -// Win32CDManager::refreshDrives -//============================================================================ - -void Win32CDManager::refreshDrives( void ) -{ - CDManager::refreshDrives(); -} - - - - diff --git a/Generals/Code/Main/WinMain.cpp b/Generals/Code/Main/WinMain.cpp index 528b09dbdf5..8889c8297c7 100644 --- a/Generals/Code/Main/WinMain.cpp +++ b/Generals/Code/Main/WinMain.cpp @@ -628,9 +628,6 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, // its done. I hate Windows. - jkmcd DEV_BROADCAST_VOLUME *vol = (DEV_BROADCAST_VOLUME*) (hdr); - // @todo - Yikes. This could cause us all kinds of pain. I don't really want - // to even think about the stink this could cause us. - TheFileSystem->unloadMusicFilesFromCD(vol->dbcv_unitmask); return TRUE; } break; diff --git a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index 76ea0533cff..3a24ce73472 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -40,7 +40,6 @@ #include "Common/FileSystem.h" #include "Common/ArchiveFileSystem.h" #include "Common/LocalFileSystem.h" -#include "Common/CDManager.h" #include "Common/Debug.h" #include "Common/StackDump.h" #include "Common/GameMemory.h" @@ -375,8 +374,6 @@ BOOL CWorldBuilderApp::InitInstance() initSubsystem(TheScriptEngine, (ScriptEngine*)(new ScriptEngine())); - // need this before TheAudio in case we're running off of CD - TheAudio can try to open Music.big on the CD... - initSubsystem(TheCDManager, CreateCDManager(), nullptr); initSubsystem(TheAudio, (AudioManager*)new MilesAudioManager()); if (!TheAudio->isMusicAlreadyLoaded()) return FALSE; diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index 4cccb799075..e637d7c49ef 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -18,7 +18,6 @@ set(GAMEENGINE_SRC Include/Common/BitFlagsIO.h Include/Common/BorderColors.h Include/Common/BuildAssistant.h - Include/Common/CDManager.h Include/Common/ClientUpdateModule.h Include/Common/CommandLine.h # Include/Common/crc.h @@ -139,7 +138,6 @@ set(GAMEENGINE_SRC Include/GameClient/Anim2D.h Include/GameClient/AnimateWindowManager.h Include/GameClient/CampaignManager.h - Include/GameClient/CDCheck.h # Include/GameClient/ChallengeGenerals.h Include/GameClient/ClientInstance.h # Include/GameClient/ClientRandomValue.h @@ -633,7 +631,6 @@ set(GAMEENGINE_SRC # Source/Common/System/ArchiveFileSystem.cpp # Source/Common/System/AsciiString.cpp Source/Common/System/BuildAssistant.cpp - Source/Common/System/CDManager.cpp Source/Common/System/CriticalSection.cpp Source/Common/System/DataChunk.cpp # Source/Common/System/Debug.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/Common/CDManager.h b/GeneralsMD/Code/GameEngine/Include/Common/CDManager.h deleted file mode 100644 index 8cd22d55d10..00000000000 --- a/GeneralsMD/Code/GameEngine/Include/Common/CDManager.h +++ /dev/null @@ -1,185 +0,0 @@ -/* -** Command & Conquer Generals Zero Hour(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Game Engine Common -// -// File name: Common/CDManager.h -// -// Created: 11/26/01 TR -// -//---------------------------------------------------------------------------- - -#pragma once - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "Common/List.h" -#include "Common/SubsystemInterface.h" -#include "Common/AsciiString.h" - - -//---------------------------------------------------------------------------- -// Forward References -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Type Defines -//---------------------------------------------------------------------------- - -namespace CD -{ - enum Disk - { - UNKNOWN_DISK = -3, - NO_DISK = -2, - ANY_DISK = -1, - DISK_1 = 0, - NUM_DISKS - }; -}; - -//=============================== -// CDDriveInterface -//=============================== -/** - * Interface to a CD ROM drive - */ -//=============================== - -class CDDriveInterface -{ - public: - - virtual ~CDDriveInterface() {}; - - virtual void refreshInfo( void ) = 0; ///< Update drive with least - - virtual AsciiString getDiskName( void ) = 0; ///< Returns the drive path for this drive - virtual AsciiString getPath( void ) = 0; ///< Returns the drive path for this drive - virtual CD::Disk getDisk( void ) = 0; ///< Returns ID of current disk in this drive - -}; - -//=============================== -// CDDrive -//=============================== - -class CDDrive : public CDDriveInterface -{ - friend class CDManager; - public: - - CDDrive(); - virtual ~CDDrive(); - - // CDDriveInterface operations - virtual AsciiString getPath( void ); ///< Returns the drive path for this drive - virtual AsciiString getDiskName( void ); ///< Returns the drive path for this drive - virtual CD::Disk getDisk( void ); ///< Returns ID of current disk in this drive - virtual void refreshInfo( void ); ///< Update drive with least - - // CDDrive operations - void setPath( const Char *path ); ///< Set the drive's path - - protected: - - LListNode m_node; ///< Link list node - AsciiString m_diskName; ///< disk's volume name - AsciiString m_drivePath; ///< drive's device path - CD::Disk m_disk; ///< ID of disk in drive -}; - - -//=============================== -// CDManagerInterface -//=============================== - -class CDManagerInterface : public SubsystemInterface -{ - public: - - virtual ~CDManagerInterface(){}; - - virtual Int driveCount( void ) = 0; ///< Number of CD drives detected - virtual CDDriveInterface* getDrive( Int index ) = 0; ///< Return the specified drive - virtual CDDriveInterface* newDrive( const Char *path ) = 0; ///< add new drive of specified path - virtual void refreshDrives( void ) = 0; ///< Refresh drive info - virtual void destroyAllDrives( void ) = 0; ///< Like it says, destroy all drives - - protected: - - virtual CDDriveInterface* createDrive( void ) = 0; -}; - -//=============================== -// CDManager -//=============================== - -class CDManager : public CDManagerInterface -{ - public: - - CDManager(); - virtual ~CDManager(); - - // sub system operations - virtual void init( void ); - virtual void update( void ); - virtual void reset( void ); - - // - virtual Int driveCount( void ); ///< Number of CD drives detected - virtual CDDriveInterface* getDrive( Int index ); ///< Return the specified drive - virtual CDDriveInterface* newDrive( const Char *path ); ///< add new drive of specified path - virtual void refreshDrives( void ); ///< Refresh drive info - virtual void destroyAllDrives( void ); ///< Like it says, destroy all drives - - - - protected: - - LList m_drives; ///< List of drives detected on this machine -}; - -//---------------------------------------------------------------------------- -// Inlining -//---------------------------------------------------------------------------- - -extern CDManagerInterface *TheCDManager; -CDManagerInterface* CreateCDManager( void ); diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/CDCheck.h b/GeneralsMD/Code/GameEngine/Include/GameClient/CDCheck.h deleted file mode 100644 index 067a026f581..00000000000 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/CDCheck.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -** Command & Conquer Generals Zero Hour(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: CDCheck.h //////////////////////////////////////////////////////////////////////////////// -// Author: Matt Campbell, January 2003 -// Description: check for CD, popping up an in-game message box at game start. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -typedef void (*gameStartCallback) (void); - -Bool IsFirstCDPresent(void); -void CheckForCDAtGameStart( gameStartCallback callback ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index 5aa3a1e7b4d..8a838a34897 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -47,7 +47,6 @@ #include "Common/FileSystem.h" #include "Common/ArchiveFileSystem.h" #include "Common/LocalFileSystem.h" -#include "Common/CDManager.h" #include "Common/GlobalData.h" #include "Common/PerfTimer.h" #include "Common/RandomValue.h" @@ -515,7 +514,6 @@ void GameEngine::init() initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads", "Data\\INI\\Roads"); initSubsystem(TheGlobalLanguageData,"TheGlobalLanguageData",MSGNEW("GameEngineSubsystem") GlobalLanguage, nullptr); // must be before the game text TheGlobalLanguageData->parseCustomDefinition(); - initSubsystem(TheCDManager,"TheCDManager", CreateCDManager(), nullptr); #ifdef DUMP_PERF_STATS/////////////////////////////////////////////////////////////////////////// GetPrecisionTimer(&endTime64);////////////////////////////////////////////////////////////////// sprintf(Buf,"----------------------------------------------------------------------------After TheCDManager = %f seconds",((double)(endTime64-startTime64)/(double)(freq64))); @@ -898,7 +896,6 @@ void GameEngine::update( void ) TheNetwork->UPDATE(); } - TheCDManager->UPDATE(); } const Bool canUpdate = canUpdateGameLogic(); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp deleted file mode 100644 index f6610198ffe..00000000000 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/CDManager.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* -** Command & Conquer Generals Zero Hour(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Game Engine Common -// -// File name: CDManager.cpp -// -// Created: 11/26/01 TR -// -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/CDManager.h" -#include "GameLogic/GameLogic.h" - -//---------------------------------------------------------------------------- -// Externals -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Defines -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Types -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Data -//---------------------------------------------------------------------------- - -CDManagerInterface* TheCDManager = nullptr; - -//---------------------------------------------------------------------------- -// Private Prototypes -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Functions -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Functions -//---------------------------------------------------------------------------- - - -//============================================================================ -// CDDrive::CDDrive -//============================================================================ - -CDDrive::CDDrive() -: m_disk(CD::UNKNOWN_DISK) -{ - m_diskName.clear(); - m_drivePath.clear(); - -} - -//============================================================================ -// CDDrive::~CDDrive -//============================================================================ - -CDDrive::~CDDrive() -{ - -} - -//============================================================================ -// CDDrive::getPath -//============================================================================ - -AsciiString CDDrive::getPath( void ) -{ - return m_drivePath; -} - -//============================================================================ -// CDDrive::getDiskName -//============================================================================ - -AsciiString CDDrive::getDiskName( void ) -{ - return m_diskName; -} - -void CDDrive::refreshInfo( void ) -{ - // map disk names to disk ID - m_disk = CD::UNKNOWN_DISK; -} - -//============================================================================ -// CDDrive::getDisk -//============================================================================ - -CD::Disk CDDrive::getDisk( void ) -{ - return m_disk; -} - -//============================================================================ -// CDDrive::setPath -//============================================================================ - -void CDDrive::setPath( const Char *path ) -{ - m_drivePath = path; -} - -//============================================================================ -// CDManager::CDManager -//============================================================================ - -CDManager::CDManager() -{ - -} - -//============================================================================ -// CDManager::~CDManager -//============================================================================ - -CDManager::~CDManager() -{ - destroyAllDrives(); -} - -//============================================================================ -// CDManager::init -//============================================================================ - -void CDManager::init( void ) -{ - -} - -//============================================================================ -// CDManager::update -//============================================================================ - -void CDManager::update( void ) -{ - // Every so often, check to make sure the CD is still in the drive - if ((TheGameLogic->getFrame() % 300) == 299) { - refreshDrives(); - } -} - -//============================================================================ -// CDManager::reset -//============================================================================ - -void CDManager::reset( void ) -{ - -} - -//============================================================================ -// CDManager::driveCount -//============================================================================ - -Int CDManager::driveCount( void ) -{ - return m_drives.nodeCount(); -} - -//============================================================================ -// CDManager::getDrive -//============================================================================ - -CDDriveInterface* CDManager::getDrive( Int index ) -{ - CDDriveInterface *cd = nullptr; - LListNode *node = m_drives.getNode( index ); - - if ( node ) - { - cd = (CDDriveInterface*) node->item(); - } - - return cd; -} - -//============================================================================ -// CDManager::newDrive -//============================================================================ - -CDDriveInterface* CDManager::newDrive( const Char *path ) -{ - CDDrive *drive= (CDDrive*) createDrive(); - - if ( drive ) - { - drive->setPath( path ); - - drive->m_node.setItem( drive ); - m_drives.add( &drive->m_node ); - } - return drive; -} - -//============================================================================ -// CDManager::refreshDrives -//============================================================================ - -void CDManager::refreshDrives( void ) -{ - LListNode *node = m_drives.firstNode(); - - while ( node ) - { - CDDriveInterface *drive = (CDDriveInterface *) node->item(); - if ( drive ) - { - drive->refreshInfo(); - } - - node = node->next(); - } -} - - -//============================================================================ -// CDManager::destroyAllDrives -//============================================================================ - -void CDManager::destroyAllDrives( void ) -{ - LListNode *node; - - while ( (node = m_drives.firstNode() ) != nullptr ) - { - node->remove(); - CDDriveInterface *drive = (CDDriveInterface *) node->item(); - delete drive; - } -} - - - - - diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index e006099b62f..15ac092e9ac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -73,7 +73,6 @@ #include "GameNetwork/DownloadManager.h" #include "GameNetwork/GameSpy/MainMenuUtils.h" -#include "GameClient/CDCheck.h" #include "GameClient/InGameUI.h" @@ -299,24 +298,6 @@ void prepareCampaignGame(GameDifficulty diff) setupGameStart(TheCampaignManager->getCurrentMap(), diff ); } -static MessageBoxReturnType cancelStartBecauseOfNoCD( void *userData ) -{ - return MB_RETURN_CLOSE; -} - -static MessageBoxReturnType checkCDCallback( void *userData ) -{ - if (!IsFirstCDPresent()) - { - return MB_RETURN_KEEPOPEN; - } - else - { - prepareCampaignGame((GameDifficulty)(Int)(Int *)userData); - return MB_RETURN_CLOSE; - } -} - static void doGameStart( void ) { startGame = FALSE; @@ -334,20 +315,6 @@ static void doGameStart( void ) isShuttingDown = TRUE; } -static void checkCDBeforeCampaign(GameDifficulty diff) -{ - if (!IsFirstCDPresent()) - { - // popup a dialog asking for a CD - ExMessageBoxOkCancel(TheGameText->fetch("GUI:InsertCDPrompt"), TheGameText->fetch("GUI:InsertCDMessage"), - (void *)diff, checkCDCallback, cancelStartBecauseOfNoCD); - } - else - { - prepareCampaignGame(diff); - } -} - static void shutdownComplete( WindowLayout *layout ) { isShuttingDown = FALSE; @@ -1649,21 +1616,21 @@ WindowMsgHandledType MainMenuSystem( GameWindow *window, UnsignedInt msg, if(dontAllowTransitions) break; - checkCDBeforeCampaign(DIFFICULTY_EASY); + prepareCampaignGame(DIFFICULTY_EASY); } else if(controlID == buttonMediumID) { if(dontAllowTransitions) break; - checkCDBeforeCampaign(DIFFICULTY_NORMAL); + prepareCampaignGame(DIFFICULTY_NORMAL); } else if(controlID == buttonHardID) { if(dontAllowTransitions) break; - checkCDBeforeCampaign(DIFFICULTY_HARD); + prepareCampaignGame(DIFFICULTY_HARD); } else if(controlID == buttonDiffBackID) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp index 208af49523c..5e06baddf45 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp @@ -75,7 +75,6 @@ #include "GameLogic/GameLogic.h" #include "GameLogic/ScriptEngine.h" #include "GameLogic/VictoryConditions.h" -#include "GameClient/CDCheck.h" #include "GameClient/Display.h" #include "GameClient/GUICallbacks.h" #include "GameClient/WindowLayout.h" @@ -574,7 +573,7 @@ WindowMsgHandledType ScoreScreenSystem( GameWindow *window, UnsignedInt msg, } else { - CheckForCDAtGameStart( startNextCampaignGame ); + startNextCampaignGame(); } } } 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..0f0b476521f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -62,7 +62,6 @@ #include "Common/MultiplayerSettings.h" #include "GameClient/GameText.h" -#include "GameClient/CDCheck.h" #include "GameClient/ExtendedMessageBox.h" #include "GameClient/MessageBox.h" #include "GameNetwork/GameInfo.h" @@ -459,49 +458,6 @@ void reallyDoStart( void ) } } -static MessageBoxReturnType cancelStartBecauseOfNoCD( void *userData ) -{ - buttonPushed = FALSE; - return MB_RETURN_CLOSE; -} - -Bool IsFirstCDPresent(void) -{ -#if !defined(RTS_DEBUG) - return TheFileSystem->areMusicFilesOnCD(); -#else - return TRUE; -#endif -} - -static MessageBoxReturnType checkCDCallback( void *userData ) -{ - if (!IsFirstCDPresent()) - { - return (IsFirstCDPresent())?MB_RETURN_CLOSE:MB_RETURN_KEEPOPEN; - } - else - { - gameStartCallback callback = (gameStartCallback)userData; - if (callback) - callback(); - return MB_RETURN_CLOSE; - } -} - -void CheckForCDAtGameStart( gameStartCallback callback ) -{ - if (!IsFirstCDPresent()) - { - // popup a dialog asking for a CD - ExMessageBoxOkCancel(TheGameText->fetch("GUI:InsertCDPrompt"), TheGameText->fetch("GUI:InsertCDMessage"), - (void*)callback, checkCDCallback, cancelStartBecauseOfNoCD); - } - else - { - callback(); - } -} Bool sandboxOk = FALSE; static void startPressed(void) @@ -539,7 +495,7 @@ static void startPressed(void) if(isReady) { - CheckForCDAtGameStart( reallyDoStart ); + reallyDoStart(); } } diff --git a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt index db9be4f3cdc..46ec159242b 100644 --- a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt @@ -83,7 +83,6 @@ set(GAMEENGINEDEVICE_SRC Include/W3DDevice/GameLogic/W3DTerrainLogic.h # Include/Win32Device/Common/Win32BIGFile.h # Include/Win32Device/Common/Win32BIGFileSystem.h - Include/Win32Device/Common/Win32CDManager.h Include/Win32Device/Common/Win32GameEngine.h # Include/Win32Device/Common/Win32LocalFile.h # Include/Win32Device/Common/Win32LocalFileSystem.h @@ -184,7 +183,6 @@ set(GAMEENGINEDEVICE_SRC Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp # Source/Win32Device/Common/Win32BIGFile.cpp # Source/Win32Device/Common/Win32BIGFileSystem.cpp - Source/Win32Device/Common/Win32CDManager.cpp Source/Win32Device/Common/Win32GameEngine.cpp # Source/Win32Device/Common/Win32LocalFile.cpp # Source/Win32Device/Common/Win32LocalFileSystem.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32CDManager.h b/GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32CDManager.h deleted file mode 100644 index beb4401ae20..00000000000 --- a/GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32CDManager.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -** Command & Conquer Generals Zero Hour(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Game Engine DEvice Win32 Common -// -// File name: Win32Device/Common/Win32CDManager.h -// -// Created: 11/26/01 TR -// -//---------------------------------------------------------------------------- - -#pragma once - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "Common/CDManager.h" - - -//---------------------------------------------------------------------------- -// Forward References -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Type Defines -//---------------------------------------------------------------------------- - -//=============================== -// Win32CDDrive -//=============================== - -class Win32CDDrive : public CDDrive -{ - public: - - Win32CDDrive(); - virtual ~Win32CDDrive(); - - virtual void refreshInfo( void ); ///< Update drive with least - -}; - -//=============================== -// Win32CDManager -//=============================== - -class Win32CDManager : public CDManager -{ - public: - - Win32CDManager(); - virtual ~Win32CDManager(); - - // sub system operations - virtual void init( void ); - virtual void update( void ); - virtual void reset( void ); - virtual void refreshDrives( void ); ///< Refresh drive info - - protected: - - virtual CDDriveInterface* createDrive( void ); -}; - -//---------------------------------------------------------------------------- -// Inlining -//---------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp deleted file mode 100644 index 75e0fb827da..00000000000 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32CDManager.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* -** Command & Conquer Generals Zero Hour(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Game Engine Device Win32 Common -// -// File name: Win32CDManager.cpp -// -// Created: 11/26/01 TR -// -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "windows.h" - -#include "Common/GameMemory.h" -#include "Common/FileSystem.h" - -#include "Win32Device/Common/Win32CDManager.h" - -//---------------------------------------------------------------------------- -// Externals -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Defines -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Types -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Prototypes -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Functions -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Functions -//---------------------------------------------------------------------------- - - -CDManagerInterface* CreateCDManager( void ) -{ - return NEW Win32CDManager; -} - -//============================================================================ -// Win32CDDrive::Win32CDDrive -//============================================================================ - -Win32CDDrive::Win32CDDrive() -{ - -} - -//============================================================================ -// Win32CDDrive::~Win32CDDrive -//============================================================================ - -Win32CDDrive::~Win32CDDrive() -{ - -} - -//============================================================================ -// Win32CDDrive::refreshInfo -//============================================================================ - -void Win32CDDrive::refreshInfo( void ) -{ - Bool mayRequireUpdate = (m_disk != CD::NO_DISK); - Char volName[1024]; - // read the volume info - if ( GetVolumeInformation( m_drivePath.str(), volName, sizeof(volName) -1, nullptr, nullptr, nullptr, nullptr, 0 )) - { - m_diskName = volName; - m_disk = CD::UNKNOWN_DISK; - } - else - { - m_diskName.clear(); - m_disk = CD::NO_DISK; - - if (mayRequireUpdate) - TheFileSystem->unloadMusicFilesFromCD(); - } - - // This is an override, not an extension of CDDrive -} - -//============================================================================ -// Win32CDManager::Win32CDManager -//============================================================================ - -Win32CDManager::Win32CDManager() -{ - -} - -//============================================================================ -// Win32CDManager::~Win32CDManager -//============================================================================ - -Win32CDManager::~Win32CDManager() -{ - -} - -//============================================================================ -// Win32CDManager::init -//============================================================================ - -void Win32CDManager::init( void ) -{ - CDManager::init(); // init base classes - - destroyAllDrives(); - - // detect CD Drives - for ( Char driveLetter = 'a'; driveLetter <= 'z'; driveLetter++ ) - { - AsciiString drivePath; - drivePath.format( "%c:\\", driveLetter ); - - if ( GetDriveType( drivePath.str() ) == DRIVE_CDROM ) - { - newDrive( drivePath.str() ); - } - } - - refreshDrives(); -} - -//============================================================================ -// Win32CDManager::update -//============================================================================ - -void Win32CDManager::update( void ) -{ - CDManager::update(); - - -} - -//============================================================================ -// Win32CDManager::reset -//============================================================================ - -void Win32CDManager::reset( void ) -{ - CDManager::reset(); - -} - -//============================================================================ -// Win32CDManager::createDrive -//============================================================================ - -CDDriveInterface* Win32CDManager::createDrive( void ) -{ - return NEW Win32CDDrive; -} - - -//============================================================================ -// Win32CDManager::refreshDrives -//============================================================================ - -void Win32CDManager::refreshDrives( void ) -{ - CDManager::refreshDrives(); -} - - - - diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cpp index c26688a081b..d2aae7c10e8 100644 --- a/GeneralsMD/Code/Main/WinMain.cpp +++ b/GeneralsMD/Code/Main/WinMain.cpp @@ -650,9 +650,6 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, // its done. I hate Windows. - jkmcd DEV_BROADCAST_VOLUME *vol = (DEV_BROADCAST_VOLUME*) (hdr); - // @todo - Yikes. This could cause us all kinds of pain. I don't really want - // to even think about the stink this could cause us. - TheFileSystem->unloadMusicFilesFromCD(vol->dbcv_unitmask); return TRUE; } break; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp index de45c06efc0..c6d203de2a6 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp @@ -40,7 +40,6 @@ #include "Common/FileSystem.h" #include "Common/ArchiveFileSystem.h" #include "Common/LocalFileSystem.h" -#include "Common/CDManager.h" #include "Common/Debug.h" #include "Common/StackDump.h" #include "Common/GameMemory.h" @@ -393,8 +392,6 @@ BOOL CWorldBuilderApp::InitInstance() // [2/11/2003] ini.loadFileDirectory( "Data\\Scripts\\Scripts", INI_LOAD_OVERWRITE, nullptr ); - // need this before TheAudio in case we're running off of CD - TheAudio can try to open Music.big on the CD... - initSubsystem(TheCDManager, CreateCDManager(), nullptr); initSubsystem(TheAudio, (AudioManager*)new MilesAudioManager()); if (!TheAudio->isMusicAlreadyLoaded()) return FALSE;