1 /* ResidualVM - A 3D game interpreter 2 * 3 * ResidualVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the AUTHORS 5 * file distributed with this source distribution. 6 * 7 * Additional copyright for this file: 8 * Copyright (C) 1999-2000 Revolution Software Ltd. 9 * This code is based on source code created by Revolution Software, 10 * used with permission. 11 * 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; either version 2 15 * of the License, or (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 * 26 */ 27 28 #ifndef ICB_CLUSTER_MANAGER_PC_H_INCLUDED 29 #define ICB_CLUSTER_MANAGER_PC_H_INCLUDED 30 31 namespace ICB { 32 33 // Global cluster controller declaration 34 class ClusterManager; 35 class MovieManager; 36 extern ClusterManager *g_theClusterManager; 37 extern MovieManager *g_while_u_wait_SequenceManager; 38 // Byte limit of filelists 39 #define MAX_BYTESIZE_OF_A_FILELIST (4 * 1024) 40 41 enum MISSION_ID { MISSION1 = 0, MISSION2 = 1, MISSION3 = 2, MISSION4 = 3, MISSION5 = 4, MISSION7 = 5, MISSION8 = 6, MISSION9 = 7, MISSION10 = 8 }; 42 43 #define NUMBER_OF_PROGRESS_BITS 32 44 45 typedef struct { 46 LRECT r; 47 int32 state; 48 } PROGRESS_BIT; 49 50 enum TLANGUAGE { T_ENGLISH, T_FRENCH, T_ITALIAN, T_GERMAN, T_SPANISH, T_RUSSIAN, T_POLISH }; 51 52 class ClusterManager { 53 private: 54 // Drive path of CD drives on installed system 55 char m_cdroot1[1024]; 56 char m_cdroot2[1024]; 57 bool8 m_multipleCDDrives; 58 int32 m_activeCDDrive; 59 60 // Working mission directory name (hashed) 61 char m_missionDir[8]; 62 63 // You guessed it 64 uint32 m_bytesFreeOnInstalledDrive; 65 66 // As cluster management is only necessary on minimum installs this 67 // acts as an on\off switch (state determined via VISE installer) 68 bool8 m_minimumInstall; 69 70 // Filelist handling 71 char m_theList[MAX_BYTESIZE_OF_A_FILELIST]; 72 uint32 m_filelistTotalBytes; 73 int32 m_filelistCursor; 74 int32 m_filelistSize; 75 76 // These are to handle the chunk copying 77 Common::SeekableReadStream *m_src_fp; 78 Common::WriteStream *m_dst_fp; 79 uint32 m_currentFileSize; 80 uint32 m_chunkCounter; 81 uint32 m_bytesDone; 82 bool8 m_installDone; 83 84 // Pointer to memory resident bink file 85 char *m_movieMemoryPointer; 86 87 // Progress bar structures and counter 88 PROGRESS_BIT m_progressBits[NUMBER_OF_PROGRESS_BITS]; 89 uint32 m_bitsDone; 90 91 // Used to control decay on progress bar 92 uint32 m_frameCounter; 93 94 TLANGUAGE m_currentLanguage; 95 96 public: 97 ClusterManager(); 98 ~ClusterManager(); 99 100 // Startup 101 void Initialise(); 102 103 // Useful methods for external modules AreWeRunningAMinimumInstall()104 bool8 AreWeRunningAMinimumInstall() { return m_minimumInstall; } 105 char *GetCDRoot(); 106 void CheckDiscInserted(MISSION_ID mission); 107 bool8 CheckDiscInsertedWithCancel(MISSION_ID mission); 108 void CheckAnyDiscInserted(); 109 110 // These handle the mission swapping 111 bool8 StartMissionInstall(MISSION_ID mission); 112 bool8 InstallMission(); 113 114 // Shutdown 115 void Shutdown(); 116 117 // Language enquirer (set in Initialise() function called at startup) GetLanguage()118 TLANGUAGE GetLanguage() { return m_currentLanguage; } 119 120 private: 121 // Administration functions 122 void InterrogateDrives(); 123 void CalculateFreeDiskSpace(); 124 void MinimumInstallCheck(); 125 bool8 IsMissionDataInstalled(MISSION_ID &m); 126 void CleanHardDisk(); 127 int32 WhichCD(MISSION_ID mission); 128 bool8 CheckForCD(int32 number); 129 void MissingCD(int32 number); 130 bool8 MissingCDWithCancel(int32 number); 131 132 // Filelist handling 133 void LoadFileList(MISSION_ID mission); 134 char *GetFileListEntry(); 135 136 // Visual update 137 bool8 DrawCoverFrame(); 138 139 // Progress bar management 140 void InitialiseProgressBits(); 141 void UpdateProgressBits(); 142 void DrawProgressBits(); 143 }; 144 145 } // End of namespace ICB 146 147 #endif 148