ScummVM API documentation
resource.h
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 modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (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, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef QUEEN_RESOURCE_H
23#define QUEEN_RESOURCE_H
24
25#include "common/file.h"
26#include "common/str-array.h"
27#include "common/language.h"
28#include "common/platform.h"
29#include "queen/defs.h"
30#include "queen/version.h"
31
32namespace Queen {
33
35 char filename[13];
36 uint8 bundle;
37 uint32 offset;
38 uint32 size;
39};
40
41class Resource {
42public:
43
44 Resource();
45 ~Resource();
46
48 uint8 *loadFile(const char *filename, uint32 skipBytes = 0, uint32 *size = NULL);
49
51 void loadTextFile(const char *filename, Common::StringArray &stringList);
52
54 bool fileExists(const char *filename) const { return resourceEntry(filename) != NULL; }
55
57 Common::File *findSound(const char *filename, uint32 *size);
58
59 bool isDemo() const { return (_version.features & GF_DEMO) != 0; }
60 bool isInterview() const { return (_version.features & GF_INTERVIEW) != 0; }
61 bool isFloppy() const { return (_version.features & GF_FLOPPY) != 0; }
62 bool isCD() const { return (_version.features & GF_TALKIE) != 0; }
63
65 uint8 getCompression() const { return _version.compression; }
66
68 const char *getJASVersion() const { return _version.str; }
69
71 Common::Language getLanguage() const { return _version.language; }
72
73 Common::Platform getPlatform() const { return _version.platform; }
74
75 enum {
76 JAS_VERSION_OFFSET_DEMO = 0x119A8,
77 JAS_VERSION_OFFSET_INTV = 0xCF8,
78 JAS_VERSION_OFFSET_PC = 0x12484
79 };
80
81protected:
82
83 Common::File _resourceFile;
84
85 int _currentResourceFileNum;
86
87 DetectedGameVersion _version;
88
91
92 ResourceEntry *_resourceTable;
93
96
98 ResourceEntry *resourceEntry(const char *filename) const;
99
101 void seekResourceFile(int num, uint32 offset);
102
104 void readTableFile(uint8 version, uint32 offset);
105
108
110 static const char *const _tableFilename;
111
114};
115
116} // End of namespace Queen
117
118#endif
Definition: file.h:47
Definition: resource.h:41
Common::File * findSound(const char *filename, uint32 *size)
returns a reference to a sound file
static ResourceEntry _resourceTablePEM10[]
resource table for english floppy version
Definition: resource.h:113
void loadTextFile(const char *filename, Common::StringArray &stringList)
loads a text file
const char * getJASVersion() const
returns JAS version string (contains language, platform and version information)
Definition: resource.h:68
void seekResourceFile(int num, uint32 offset)
seeks resource file to specific bundle and file offset
Common::Language getLanguage() const
returns the language of the game
Definition: resource.h:71
void checkJASVersion()
verify the version of the selected game
bool fileExists(const char *filename) const
returns true if the file is present in the resource
Definition: resource.h:54
static const char *const _tableFilename
resource table filename (queen.tbl)
Definition: resource.h:110
void readTableFile(uint8 version, uint32 offset)
extract the resource table for the specified game version
uint8 * loadFile(const char *filename, uint32 skipBytes=0, uint32 *size=NULL)
loads a binary file
uint32 _resourceEntries
number of entries in resource table
Definition: resource.h:90
void readTableEntries(Common::File *file)
read the resource table from the specified file
ResourceEntry * resourceEntry(const char *filename) const
returns a reference to the ReseourceEntry for the specified filename
uint8 getCompression() const
returns compression type for audio files
Definition: resource.h:65
Language
Definition: language.h:45
Platform
Definition: platform.h:93
Definition: bankman.h:28
Definition: resource.h:34