Public Member Functions | |
ResourceManager (const bool detectionMode=false) | |
void | init () |
void | addAppropriateSources () |
void | addAppropriateSourcesForDetection (const Common::FSList &fslist) |
Resource * | findResource (ResourceId id, bool lock) |
void | unlockResource (Resource *res) |
Resource * | testResource (const ResourceId &id) const |
Common::List< ResourceId > | listResources (ResourceType type, int mapNumber=-1) |
bool | hasResourceType (ResourceType type) |
void | setAudioLanguage (int language) |
int | getAudioLanguage () const |
void | changeAudioDirectory (const Common::Path &path) |
void | changeMacAudioDirectory (const Common::Path &path) |
bool | isGMTrackIncluded () |
bool | isSci11Mac () const |
ViewType | getViewType () const |
const char * | getMapVersionDesc () const |
const char * | getVolVersionDesc () const |
ResVersion | getVolVersion () const |
void | addNewGMPatch (SciGameId gameId) |
void | addNewD110Patch (SciGameId gameId) |
bool | detectFontExtended () |
bool | detectPaletteMergingSci11 () |
bool | detectEarlySound () |
Common::String | findSierraGameId () |
reg_t | findGameObject (const bool addSci11ScriptOffset) |
ResourceType | convertResType (byte type) |
Common::Path | getMacExecutableName () const |
bool | isKoreanMessageMap (ResourceSource *source) |
Protected Types | |
typedef Common::List< ResourceSource * > | SourcesList |
Protected Member Functions | |
ResourceSource * | addPatchDir (const Common::Path &path) |
ResourceSource * | findVolume (ResourceSource *map, int volume_nr) |
ResourceSource * | addSource (ResourceSource *source) |
ResourceSource * | addExternalMap (const Common::Path &filename, int volume_nr=0) |
ResourceSource * | addExternalMap (const Common::FSNode *mapFile, int volume_nr=0) |
void | scanNewSources () |
bool | addAudioSources () |
void | addScriptChunkSources () |
void | freeResourceSources () |
const char * | versionDescription (ResVersion version) const |
Common::SeekableReadStream * | getVolumeFile (ResourceSource *source) |
void | disposeVolumeFileStream (Common::SeekableReadStream *fileStream, ResourceSource *source) |
void | loadResource (Resource *res) |
void | freeOldResources () |
bool | validateResource (const ResourceId &resourceId, const Common::Path &sourceMapLocation, const Common::Path &sourceName, const uint32 offset, const uint32 size, const uint32 sourceSize) const |
Resource * | addResource (ResourceId resId, ResourceSource *src, uint32 offset, uint32 size=0, const Common::Path &sourceMapLocation=Common::Path("(no map location)")) |
Resource * | updateResource (ResourceId resId, ResourceSource *src, uint32 size, const Common::Path &sourceMapLocation=Common::Path("(no map location)")) |
Resource * | updateResource (ResourceId resId, ResourceSource *src, uint32 offset, uint32 size, const Common::Path &sourceMapLocation=Common::Path("(no map location)")) |
void | removeAudioResource (ResourceId resId) |
ResVersion | detectMapVersion () |
ResVersion | detectVolVersion () |
int | readResourceMapSCI0 (ResourceSource *map) |
int | readResourceMapSCI1 (ResourceSource *map) |
int | readAudioMapSCI11 (IntMapResourceSource *map) |
int | readAudioMapSCI1 (ResourceSource *map, bool unload=false) |
void | readResourcePatches () |
void | readResourcePatchesBase36 () |
bool | isBlacklistedPatch (const ResourceId &resId) const |
void | processPatch (ResourceSource *source, ResourceType resourceType, uint16 resourceNr, uint32 tuple=0) |
void | readWaveAudioPatches () |
void | processWavePatch (ResourceId resourceId, const Common::Path &name) |
bool | hasOldScriptHeader () |
void | addToLRU (Resource *res) |
void | removeFromLRU (Resource *res) |
ResourceCompression | getViewCompression () |
ViewType | detectViewType () |
bool | hasSci0Voc999 () |
bool | hasSci1Voc900 () |
bool | checkResourceDataForSignature (Resource *resource, const byte *signature) |
bool | checkResourceForSignatures (ResourceType resourceType, uint16 resourceNr, const byte *signature1, const byte *signature2) |
void | detectSciVersion () |
Protected Attributes | |
bool | _detectionMode |
int | _maxMemoryLRU |
ViewType | _viewType |
SourcesList | _sources |
int | _memoryLocked |
Amount of resource bytes in locked memory. | |
int | _memoryLRU |
Amount of resource bytes under LRU control. | |
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. | |
ResVersion | _volVersion |
resource.0xx version | |
ResVersion | _mapVersion |
resource.map version | |
bool | _isSci2Mac |
Sci::ResourceManager::ResourceManager | ( | const bool | detectionMode = false | ) |
Creates a new SCI resource manager.
void Sci::ResourceManager::init | ( | ) |
Initializes the resource manager.
void Sci::ResourceManager::addAppropriateSources | ( | ) |
Adds all of the resource files for a game
void Sci::ResourceManager::addAppropriateSourcesForDetection | ( | const Common::FSList & | fslist | ) |
Similar to the function above, only called from the fallback detector
Resource* Sci::ResourceManager::findResource | ( | ResourceId | id, |
bool | lock | ||
) |
Looks up a resource's data.
id | The resource type to look for |
lock | non-zero iff the resource should be locked |
void Sci::ResourceManager::unlockResource | ( | Resource * | res | ) |
Unlocks a previously locked resource.
res | The resource to free |
Resource* Sci::ResourceManager::testResource | ( | const ResourceId & | id | ) | const |
Tests whether a resource exists.
This function may often be much faster than finding the resource and should be preferred for simple tests. The resource object returned is, indeed, the resource in question, but it should be used with care, as it may be unallocated. Use scir_find_resource() if you want to use the data contained in the resource.
id | Id of the resource to check |
Common::List<ResourceId> Sci::ResourceManager::listResources | ( | ResourceType | type, |
int | mapNumber = -1 |
||
) |
Returns a list of all resources of the specified type.
type | The resource type to look for |
mapNumber | For audio36 and sync36, limit search to this map |
bool Sci::ResourceManager::hasResourceType | ( | ResourceType | type | ) |
Returns if there are any resources of the specified type.
void Sci::ResourceManager::addNewGMPatch | ( | SciGameId | gameId | ) |
Adds the appropriate GM patch from the Sierra MIDI utility as 4.pat, without requiring the user to rename the file to 4.pat. Thus, the original Sierra archive can be extracted in the extras directory, and the GM patches can be applied per game, if applicable.
Common::String Sci::ResourceManager::findSierraGameId | ( | ) |
Finds the internal Sierra ID of the current game from script 0.
reg_t Sci::ResourceManager::findGameObject | ( | const bool | addSci11ScriptOffset | ) |
Finds the location of the game object from script 0.
addSci11ScriptOffset | Adjust the return value for SCI1.1 and newer games. Needs to be false when the heap is accessed directly inside findSierraGameId(). |
ResourceType Sci::ResourceManager::convertResType | ( | byte | type | ) |
Converts a map resource type to our type
sciType | The type from the map/patch |
|
protected |
Add a path to the resource manager's list of sources.
|
protected |
Adds a source to the resource manager's list of sources.
source | The new source to add |
|
protected |
Add an external (i.e., separate file) map resource to the resource manager's list of sources.
filename | The name of the volume to add |
volume_nr | The volume number the map starts at, 0 for <SCI2.1 |
|
protected |
Scans newly registered resource sources for resources, earliest addition first.
detected_version | Pointer to the detected version number, used during startup. May be NULL. |
|
protected |
Returns a string describing a ResVersion.
version | The resource version |
|
protected |
All calls to getVolumeFile must be followed with a corresponding call to disposeVolumeFileStream once the stream is finished being used. Do NOT call delete directly on returned streams, as they may be cached.
|
protected |
— Resource map decoding functions —
|
protected |
Reads the SCI0 resource.map file from a local directory.
map | The map |
|
protected |
Reads the SCI1 resource.map file from a local directory.
map | The map |
|
protected |
Reads SCI1.1 audio map resources.
map | The map |
|
protected |
Reads SCI1 audio map files.
map | The map |
unload | Unload the map instead of loading it |
|
protected |
— Patch management functions — Reads patch files from a local directory.
|
protected |
Determines whether or not a patch file matching the given resource ID should be ignored when processing patches.
|
protected |
Process wave files as patches for Audio resources.
|
protected |
Process AIFF files as patches for Audio resources. Applies to all versions before 0.000.395 (i.e. KQ4 old, XMAS 1988 and LSL2). Old SCI versions used two word header for script blocks (first word equal to 0x82, meaning of the second one unknown). New SCI versions used one word header. Also, old SCI versions assign 120 degrees to left & right, and 60 to up and down. Later versions use an even 90 degree distribution.
Common::Path Sci::ResourceManager::getMacExecutableName | ( | ) | const |
Returns the file name of the game's Mac executable.