This repository was archived by the owner on Feb 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 511
/
Copy pathCDFILE.H
115 lines (98 loc) · 4.67 KB
/
CDFILE.H
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
/*
** Command & Conquer(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/>.
*/
/* $Header: F:\projects\c&c\vcs\code\cdfile.h_v 2.20 16 Oct 1995 16:45:58 JOE_BOSTIC $ */
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : Westwood LIbrary *
* *
* File Name : CDFILE.H *
* *
* Programmer : Joe L. Bostic *
* *
* Start Date : October 18, 1994 *
* *
* Last Update : October 18, 1994 [JLB] *
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef CDFILE_H
#define CDFILE_H
#include <dos.h>
#include "rawfile.h"
/*
** This class is derived from the raw file class. This class adds the functionality of searching
** across multiple directories or drives. It is designed for the typical case of a CD-ROM game
** were some data exists in the current directory (hard drive) and the rest exists on the CD-ROM.
** Searching for the file occurs by first examining the current directory. If the file does not
** exist there, then all the paths available are examined in turn until the file can be found.
** For opening files to write, only the current directory is examined. The directory search order
** is controlled by the path list as submitted to Set_Search_Drives(). The format of the path
** string is the same as the DOS path string.
*/
class CDFileClass : public RawFileClass
{
public:
CDFileClass(char const *filename);
CDFileClass(void);
virtual ~CDFileClass(void) {};
virtual char const * Set_Name(char const *filename);
virtual int Open(char const *filename, int rights=READ);
virtual int Open(int rights=READ);
void Searching(int on) {IsDisabled = !on;};
static bool Is_There_Search_Drives(void) {return(First != NULL);};
static int Set_Search_Drives(char * pathlist);
static void Add_Search_Drive(char *path);
static void Clear_Search_Drives(void);
static void Refresh_Search_Drives(void);
static void Set_CD_Drive(int drive);
static int Get_CD_Drive(void) {return(CurrentCDDrive);};
static int Get_Last_CD_Drive(void) {return(LastCDDrive);};
private:
/*
** Is multi-drive searching disabled for this file object?
*/
unsigned IsDisabled:1;
/*
** This is the control record for each of the drives specified in the search
** path. There can be many such search paths available.
*/
typedef struct {
void * Next; // Pointer to next search record.
char const * Path; // Pointer to path string.
} SearchDriveType;
/*
** This points to the first path record.
*/
static SearchDriveType * First;
/*
** This is a copy of the unparsed search path list
*/
static char RawPath[512];
/*
** The drive letter of the current cd drive
*/
static int CurrentCDDrive;
/*
** The drive letter of the last used CD drive
*/
static int LastCDDrive;
};
#endif