2010-06-15 12:08:40 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SCI_RESOURCE_INTERN_H
|
|
|
|
#define SCI_RESOURCE_INTERN_H
|
|
|
|
|
|
|
|
#include "sci/resource.h"
|
|
|
|
|
2010-06-15 12:09:30 +00:00
|
|
|
namespace Common {
|
|
|
|
class MacResManager;
|
|
|
|
}
|
|
|
|
|
2010-06-15 12:08:40 +00:00
|
|
|
namespace Sci {
|
|
|
|
|
2010-06-15 12:11:04 +00:00
|
|
|
enum ResSourceType {
|
|
|
|
kSourceDirectory = 0,
|
|
|
|
kSourcePatch,
|
|
|
|
kSourceVolume,
|
|
|
|
kSourceExtMap,
|
|
|
|
kSourceIntMap,
|
|
|
|
kSourceAudioVolume,
|
|
|
|
kSourceExtAudioMap,
|
|
|
|
kSourceWave,
|
|
|
|
kSourceMacResourceFork
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-06-15 12:09:51 +00:00
|
|
|
class ResourceSource {
|
|
|
|
protected:
|
2010-06-15 12:09:30 +00:00
|
|
|
const ResSourceType _sourceType;
|
2010-06-15 12:09:51 +00:00
|
|
|
const Common::String _name;
|
|
|
|
|
|
|
|
public:
|
2010-06-15 12:15:05 +00:00
|
|
|
bool _scanned;
|
2010-06-15 12:16:17 +00:00
|
|
|
const Common::FSNode * const _resourceFile;
|
2010-06-15 12:15:05 +00:00
|
|
|
const int _volumeNumber;
|
|
|
|
ResourceSource *_associatedMap; // TODO: Move to VolumeResourceSource
|
|
|
|
uint32 _audioCompressionType; // TODO: Move to AudioVolumeResourceSource
|
|
|
|
int32 *_audioCompressionOffsetMapping; // TODO: Move to AudioVolumeResourceSource
|
2010-06-15 12:09:30 +00:00
|
|
|
|
2010-06-15 12:11:04 +00:00
|
|
|
protected:
|
2010-06-15 12:16:17 +00:00
|
|
|
ResourceSource(ResSourceType type, const Common::String &name, int volNum = 0, const Common::FSNode *resFile = 0);
|
2010-06-15 12:11:04 +00:00
|
|
|
public:
|
2010-06-15 12:10:41 +00:00
|
|
|
virtual ~ResourceSource();
|
2010-06-15 12:09:30 +00:00
|
|
|
|
|
|
|
ResSourceType getSourceType() const { return _sourceType; }
|
2010-06-15 12:09:51 +00:00
|
|
|
const Common::String &getLocationName() const { return _name; }
|
2010-06-15 12:11:56 +00:00
|
|
|
|
2010-06-15 12:14:15 +00:00
|
|
|
// Auxiliary method, used by loadResource implementations.
|
2010-06-15 12:17:05 +00:00
|
|
|
Common::SeekableReadStream *getVolumeFile(Resource *res);
|
2010-06-15 12:14:15 +00:00
|
|
|
|
2010-06-15 12:13:29 +00:00
|
|
|
/**
|
|
|
|
* TODO: Document this
|
|
|
|
*/
|
2010-06-15 12:14:39 +00:00
|
|
|
virtual ResourceSource *findVolume(ResourceSource *map, int volNum) {
|
2010-06-15 12:11:56 +00:00
|
|
|
return NULL;
|
|
|
|
};
|
2010-06-15 12:12:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Scan this source for TODO.
|
|
|
|
*/
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void scanSource() {}
|
2010-06-15 12:13:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load a resource.
|
|
|
|
*/
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void loadResource(Resource *res);
|
2010-06-15 12:08:40 +00:00
|
|
|
};
|
|
|
|
|
2010-06-15 12:10:41 +00:00
|
|
|
class DirectoryResourceSource : public ResourceSource {
|
|
|
|
public:
|
|
|
|
DirectoryResourceSource(const Common::String &name) : ResourceSource(kSourceDirectory, name) {}
|
2010-06-15 12:12:21 +00:00
|
|
|
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void scanSource();
|
2010-06-15 12:10:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class PatchResourceSource : public ResourceSource {
|
|
|
|
public:
|
|
|
|
PatchResourceSource(const Common::String &name) : ResourceSource(kSourcePatch, name) {}
|
2010-06-15 12:13:52 +00:00
|
|
|
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void loadResource(Resource *res);
|
2010-06-15 12:10:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class VolumeResourceSource : public ResourceSource {
|
|
|
|
public:
|
2010-06-15 12:14:39 +00:00
|
|
|
VolumeResourceSource(const Common::String &name, ResourceSource *map, int volNum, ResSourceType type = kSourceVolume)
|
|
|
|
: ResourceSource(type, name, volNum) {
|
2010-06-15 12:15:05 +00:00
|
|
|
_associatedMap = map;
|
2010-06-15 12:11:30 +00:00
|
|
|
}
|
2010-06-15 12:11:56 +00:00
|
|
|
|
2010-06-15 12:16:17 +00:00
|
|
|
VolumeResourceSource(const Common::String &name, ResourceSource *map, int volNum, const Common::FSNode *resFile)
|
|
|
|
: ResourceSource(kSourceVolume, name, volNum, resFile) {
|
|
|
|
_associatedMap = map;
|
|
|
|
}
|
|
|
|
|
2010-06-15 12:14:39 +00:00
|
|
|
virtual ResourceSource *findVolume(ResourceSource *map, int volNum) {
|
2010-06-15 12:15:05 +00:00
|
|
|
if (_associatedMap == map && _volumeNumber == volNum)
|
2010-06-15 12:11:56 +00:00
|
|
|
return this;
|
|
|
|
return NULL;
|
|
|
|
};
|
2010-06-15 12:10:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ExtMapResourceSource : public ResourceSource {
|
|
|
|
public:
|
2010-06-15 12:16:17 +00:00
|
|
|
ExtMapResourceSource(const Common::String &name, int volNum, const Common::FSNode *resFile = 0)
|
|
|
|
: ResourceSource(kSourceExtMap, name, volNum, resFile) {
|
2010-06-15 12:14:39 +00:00
|
|
|
}
|
2010-06-15 12:12:21 +00:00
|
|
|
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void scanSource();
|
2010-06-15 12:10:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IntMapResourceSource : public ResourceSource {
|
|
|
|
public:
|
2010-06-15 12:14:39 +00:00
|
|
|
IntMapResourceSource(const Common::String &name, int volNum)
|
|
|
|
: ResourceSource(kSourceIntMap, name, volNum) {
|
|
|
|
}
|
2010-06-15 12:12:21 +00:00
|
|
|
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void scanSource();
|
2010-06-15 12:10:41 +00:00
|
|
|
};
|
|
|
|
|
2010-06-15 12:11:30 +00:00
|
|
|
class AudioVolumeResourceSource : public VolumeResourceSource {
|
2010-06-15 12:10:41 +00:00
|
|
|
public:
|
2010-06-15 12:14:39 +00:00
|
|
|
AudioVolumeResourceSource(const Common::String &name, ResourceSource *map, int volNum);
|
2010-06-15 12:13:52 +00:00
|
|
|
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void loadResource(Resource *res);
|
2010-06-15 12:10:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ExtAudioMapResourceSource : public ResourceSource {
|
|
|
|
public:
|
2010-06-15 12:14:39 +00:00
|
|
|
ExtAudioMapResourceSource(const Common::String &name, int volNum)
|
|
|
|
: ResourceSource(kSourceExtAudioMap, name, volNum) {
|
|
|
|
}
|
2010-06-15 12:12:21 +00:00
|
|
|
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void scanSource();
|
2010-06-15 12:10:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class WaveResourceSource : public ResourceSource {
|
|
|
|
public:
|
|
|
|
WaveResourceSource(const Common::String &name) : ResourceSource(kSourceWave, name) {}
|
2010-06-15 12:13:52 +00:00
|
|
|
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void loadResource(Resource *res);
|
2010-06-15 12:10:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MacResourceForkResourceSource : public ResourceSource {
|
2010-06-15 12:13:52 +00:00
|
|
|
protected:
|
|
|
|
Common::MacResManager *_macResMan;
|
|
|
|
|
2010-06-15 12:10:41 +00:00
|
|
|
public:
|
2010-06-15 12:14:39 +00:00
|
|
|
MacResourceForkResourceSource(const Common::String &name, int volNum);
|
2010-06-15 12:13:29 +00:00
|
|
|
~MacResourceForkResourceSource();
|
2010-06-15 12:12:21 +00:00
|
|
|
|
2010-06-15 12:12:44 +00:00
|
|
|
/**
|
|
|
|
* Reads the SCI1.1+ resource file from a Mac resource fork.
|
|
|
|
*/
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void scanSource();
|
2010-06-15 12:13:52 +00:00
|
|
|
|
2010-06-15 12:17:05 +00:00
|
|
|
virtual void loadResource(Resource *res);
|
2010-06-15 12:10:41 +00:00
|
|
|
};
|
|
|
|
|
2010-06-15 12:08:40 +00:00
|
|
|
} // End of namespace Sci
|
|
|
|
|
|
|
|
#endif // SCI_RESOURCE_INTERN_H
|