aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/resource.h
diff options
context:
space:
mode:
authorWalter van Niftrik2009-06-09 19:18:48 +0000
committerWalter van Niftrik2009-06-09 19:18:48 +0000
commit5e68fbfe875686c6ab1fda0a85d2a878486656c2 (patch)
tree02856ec1adb966359a3779e75c69fe35cf9e9499 /engines/sci/resource.h
parent6f49d1576b54e333f8da9b87ecc0e8ce03c473e9 (diff)
downloadscummvm-rg350-5e68fbfe875686c6ab1fda0a85d2a878486656c2.tar.gz
scummvm-rg350-5e68fbfe875686c6ab1fda0a85d2a878486656c2.tar.bz2
scummvm-rg350-5e68fbfe875686c6ab1fda0a85d2a878486656c2.zip
SCI: Moved SCI1 audio map handling into the resource manager.
svn-id: r41408
Diffstat (limited to 'engines/sci/resource.h')
-rw-r--r--engines/sci/resource.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index fc3f37f25c..e1a7dda921 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -72,19 +72,14 @@ enum {
enum ResSourceType {
kSourceDirectory = 0,
- kSourcePatch = 1,
- kSourceVolume = 2,
- kSourceExtMap = 3,
- kSourceIntMap = 4,
- kSourceAudioVolume = 5,
- kSourceMask = 127
+ kSourcePatch,
+ kSourceVolume,
+ kSourceExtMap,
+ kSourceIntMap,
+ kSourceAudioVolume,
+ kSourceExtAudioMap
};
-#define RESSOURCE_ADDRESSING_BASIC 0
-#define RESSOURCE_ADDRESSING_EXTENDED 128
-#define RESSOURCE_ADDRESSING_MASK 128
-
-#define RESOURCE_HASH(type, number) (uint32)((type<<16) | number)
#define SCI0_RESMAP_ENTRIES_SIZE 6
#define SCI1_RESMAP_ENTRIES_SIZE 6
#define SCI11_RESMAP_ENTRIES_SIZE 5
@@ -136,7 +131,6 @@ struct ResourceSource {
Common::String location_name; // FIXME: Replace by FSNode ?
int volume_number;
ResourceSource *associated_map;
- ResourceSource *next;
};
class ResourceManager;
@@ -270,6 +264,8 @@ public:
*/
Common::List<ResourceId> *listResources(ResourceType type, int mapNumber = -1);
+ void setAudioLanguage(int language);
+
protected:
int _maxMemory; //!< Config option: Maximum total byte number allocated
Common::List<ResourceSource *> _sources;
@@ -278,6 +274,7 @@ protected:
Common::List<Resource *> _LRU; //!< Last Resource Used list
ResourceMap _resMap;
Common::List<Common::File *> _volumeFiles; //!< list of opened volume files
+ ResourceSource *_audioMapSCI1; //!< Currently loaded audio map for SCI1
/**
* Add a path to the resource manager's list of sources.
@@ -325,11 +322,13 @@ protected:
void loadResource(Resource *res);
bool loadPatch(Resource *res, Common::File &file);
bool loadFromPatchFile(Resource *res);
- bool loadFromAudioVolume(Resource *res, Common::File &file);
- void freeOldResources(int last_invulnerable);
+ bool loadFromAudioVolumeSCI1(Resource *res, Common::File &file);
+ bool loadFromAudioVolumeSCI11(Resource *res, Common::File &file);
+ void freeOldResources();
int decompress(Resource *res, Common::File *file);
int readResourceInfo(Resource *res, Common::File *file, uint32&szPacked, ResourceCompression &compression);
void addResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size = 0);
+ void removeAudioResource(ResourceId resId);
/**--- Resource map decoding functions ---*/
int detectMapVersion();
@@ -337,21 +336,32 @@ protected:
/**
* Reads the SCI0 resource.map file from a local directory.
+ * @param map The map
* @return 0 on success, an SCI_ERROR_* code otherwise
*/
int readResourceMapSCI0(ResourceSource *map);
/**
* Reads the SCI1 resource.map file from a local directory.
+ * @param map The map
* @return 0 on success, an SCI_ERROR_* code otherwise
*/
int readResourceMapSCI1(ResourceSource *map);
/**
- * Reads SCI1.1 MAP resources
+ * Reads SCI1.1 audio map resources
+ * @param map The map
* @return 0 on success, an SCI_ERROR_* code otherwise
*/
- int readMap(ResourceSource *map);
+ int readAudioMapSCI11(ResourceSource *map);
+
+ /**
+ * Reads SCI1 audio map files
+ * @param map The map
+ * @param unload Unload the map instead of loading it
+ * @return 0 on success, an SCI_ERROR_* code otherwise
+ */
+ int readAudioMapSCI1(ResourceSource *map, bool unload = false);
/**--- Patch management functions ---*/
@@ -393,10 +403,8 @@ protected:
class AudioResource {
public:
AudioResource(ResourceManager *resMgr, int sciVersion);
- ~AudioResource();
void setAudioRate(uint16 audioRate) { _audioRate = audioRate; }
- void setAudioLang(int16 lang);
Audio::SoundHandle* getAudioHandle() { return &_audioHandle; }
int getAudioPosition();
@@ -410,16 +418,8 @@ public:
private:
Audio::SoundHandle _audioHandle;
uint16 _audioRate;
- int16 _lang;
- byte *_audioMapSCI1;
- Resource *_audioMapSCI11;
ResourceManager *_resMgr;
int _sciVersion;
-
- bool findAudEntrySCI1(uint16 audioNumber, byte &volume, uint32 &offset, uint32 &size);
- bool findAudEntrySCI11(uint32 audioNumber, uint32 volume, uint32 &offset, bool getSync = false, uint32 *size = NULL);
- bool findAudEntrySCI11Late(uint32 audioNumber, uint32 &offset, bool getSync, uint32 *size);
- bool findAudEntrySCI11Early(uint32 audioNumber, uint32 &offset, bool getSync, uint32 *size);
};
} // End of namespace Sci