1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  * CD/drive handling functions
22  */
23 
24 #ifndef TINSEL_DRIVES_H
25 #define TINSEL_DRIVES_H
26 
27 #include "common/coroutines.h"
28 #include "common/stream.h"
29 #include "tinsel/dw.h"
30 
31 namespace Tinsel {
32 
33 // flags2
34 #define fCd1	0x00000001L
35 #define fCd2	0x00000002L
36 #define fCd3	0x00000004L
37 #define fCd4	0x00000008L
38 #define fCd5	0x00000010L
39 #define fCd6	0x00000020L
40 #define fCd7	0x00000040L
41 #define fCd8	0x00000080L
42 
43 #define fAllCds	(fCd1|fCd2|fCd3|fCd4|fCd5|fCd6|fCd7|fCd8)
44 
45 void DoCdChange();
46 
47 void CdCD(CORO_PARAM);
48 
49 int GetCurrentCD();
50 
51 void SetCD(int flags);
52 
53 int GetCD(int flags);
54 
55 void SetNextCD(int cdNumber);
56 
57 bool GotoCD();
58 
59 class TinselFile : public Common::SeekableReadStream, public Common::ReadStreamEndian {
60 private:
61 	static bool _warningShown;
62 	Common::SeekableReadStream *_stream;
63 	bool openInternal(const Common::String &filename);
64 public:
65 	TinselFile();
66 	~TinselFile();
67 	bool open(const Common::String &filename);
68 	void close();
69 	char getCdNumber();
70 
71 	bool err() const;
72 	void clearErr();
73 
74 	bool eos() const;
75 	uint32 read(void *dataPtr, uint32 dataSize);
76 
77 	int32 pos() const;
78 	int32 size() const;
79 	bool seek(int32 offset, int whence = SEEK_SET);
80 };
81 
82 
83 } // End of namespace Tinsel
84 
85 #endif /* TINSEL_DRIVES_H */
86