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  */
22 #ifndef SLUDGE_FILESET_H
23 #define SLUDGE_FILESET_H
24 
25 #include "common/file.h"
26 
27 namespace Sludge {
28 
29 class ResourceManager {
30 
31 public:
32 	ResourceManager();
33 	~ResourceManager();
34 
35 	void init();
36 	void kill();
37 
38 	void setData(Common::File *readStream);
39 	void setFileIndices(uint, uint);
getData()40 	Common::SeekableReadStream *getData() { return _bigDataFile; }
41 
42 	uint openFileFromNum(int num);
43 	bool openSubSlice(int num);
44 	bool openObjectSlice(int num);
45 	Common::String getNumberedString(int value);
46 
47 	// Access control flag
48 	bool startAccess();
49 	void finishAccess();
50 
51 	// Resource names
52 	void readResourceNames(Common::SeekableReadStream *readStream);
53 	const Common::String resourceNameFromNum(int i);
hasResourceNames()54 	bool hasResourceNames() { return !_allResourceNames.empty(); }
55 
56 	void dumpFile(int num, const char *pattern);
57 
58 private:
59 	bool _sliceBusy;
60 	Common::File *_bigDataFile;
61 	uint32 _startOfDataIndex, _startOfTextIndex, _startOfSubIndex, _startOfObjectIndex;
62 	int32 _startIndex;
63 
64 	Common::Array<Common::String> _allResourceNames;
65 
66 private:
67 	static uint32 _cp1250ToUTF32[128];
68 	Common::String convertString(const Common::String &s);
69 };
70 
71 } // End of namespace Sludge
72 
73 #endif
74