forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathCDManager.h
More file actions
185 lines (143 loc) · 5.48 KB
/
CDManager.h
File metadata and controls
185 lines (143 loc) · 5.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/*
** 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 <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (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 );