ScummVM API documentation
Common::MacResManager Class Reference

#include <macresman.h>

Classes

struct  MacVers
 

Public Member Functions

bool open (const Path &fileName)
 
bool open (const Path &fileName, Archive &archive)
 
void close ()
 
bool hasResFork () const
 
SeekableReadStreamgetResource (uint32 typeID, uint16 resID)
 
SeekableReadStreamgetResource (const String &filename)
 
SeekableReadStreamgetResource (uint32 typeID, const String &filename)
 
String getResName (uint32 typeID, uint16 resID) const
 
uint32 getResLength (uint32 typeID, uint16 resID)
 
uint32 getResForkDataSize () const
 
String computeResForkMD5AsString (uint32 length=0, bool tail=false) const
 
Path getBaseFileName () const
 
void setBaseFileName (Common::Path str)
 
MacResIDArray getResIDArray (uint32 typeID)
 
MacResTagArray getResTagArray ()
 
bool loadFromMacBinary (SeekableReadStream *stream)
 
void dumpRaw ()
 

Static Public Member Functions

static SeekableReadStreamopenFileOrDataFork (const Path &fileName, Archive &archive)
 
static SeekableReadStreamopenFileOrDataFork (const Path &fileName)
 
static SeekableReadStreamopenDataForkFromMacBinary (SeekableReadStream *inStream, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::NO)
 
static bool exists (const Path &fileName)
 
static bool getFileFinderInfo (const Path &fileName, Archive &archive, MacFinderInfo &outFinderInfo)
 
static bool getFileFinderInfo (const Path &fileName, Archive &archive, MacFinderInfo &outFinderInfo, MacFinderExtendedInfo &outFinderExtendedInfo)
 
static bool getFileFinderInfo (const Path &fileName, MacFinderInfo &outFinderInfo)
 
static bool getFileFinderInfo (const Path &fileName, MacFinderInfo &outFinderInfo, MacFinderExtendedInfo &outFinderExtendedInfo)
 
static void listFiles (Array< Path > &files, const Path &pattern)
 
static int getDataForkOffset ()
 
static bool isMacBinary (SeekableReadStream &stream)
 
static MacVersparseVers (SeekableReadStream *vvers)
 

Detailed Description

Class for handling Mac data and resource forks. It can read from raw, MacBinary, and AppleDouble formats.

Member Function Documentation

◆ open() [1/2]

bool Common::MacResManager::open ( const Path fileName)

Open a Mac data/resource fork pair.

This uses SearchMan to find the data/resource forks. This should only be used from inside an engine.

Parameters
fileNameThe base file name of the file
Note
This will check for the raw resource fork, MacBinary, and AppleDouble formats.
Returns
True on success

◆ open() [2/2]

bool Common::MacResManager::open ( const Path fileName,
Archive archive 
)

Open a Mac data/resource fork pair from within the given archive.

Parameters
pathThe path that holds the forks
fileNameThe base file name of the file
Note
This will check for the raw resource fork, MacBinary, and AppleDouble formats.
Returns
True on success

◆ openFileOrDataFork()

static SeekableReadStream* Common::MacResManager::openFileOrDataFork ( const Path fileName,
Archive archive 
)
static

Opens file named fileName or data fork extracted as macbin

Returns
The stream if found, 0 otherwise

◆ openDataForkFromMacBinary()

static SeekableReadStream* Common::MacResManager::openDataForkFromMacBinary ( SeekableReadStream inStream,
DisposeAfterUse::Flag  disposeAfterUse = DisposeAfterUse::NO 
)
static

Open data fork of macbinary.

Returns
The stream if found, 0 otherwise

◆ exists()

static bool Common::MacResManager::exists ( const Path fileName)
static

See if a Mac data/resource fork pair exists.

Parameters
fileNameThe base file name of the file
Returns
True if either a data fork or resource fork with this name exists

◆ getFileFinderInfo()

static bool Common::MacResManager::getFileFinderInfo ( const Path fileName,
Archive archive,
MacFinderInfo outFinderInfo 
)
static

Attempt to read the Mac Finder info metadata for a file path.

Parameters
fileNameThe base file name of the file
archiveThe archive to search in
outFinderInfoThe loaded and parsed Finder info
outFinderExtendedInfoThe loaded and parsed Finder extended info
Returns
True if finder info was available for a path, false if not

◆ listFiles()

static void Common::MacResManager::listFiles ( Array< Path > &  files,
const Path pattern 
)
static

List all filenames matching pattern for opening with open().

Parameters
filesArray containing all matching filenames discovered. Only adds to the list.
patternPattern to match against. Taking String::matchPattern's format.

◆ close()

void Common::MacResManager::close ( )

Close the Mac data/resource fork pair.

◆ hasResFork()

bool Common::MacResManager::hasResFork ( ) const

Query whether or not we have a data fork present.

Returns
True if the resource fork is present

◆ getResource() [1/3]

SeekableReadStream* Common::MacResManager::getResource ( uint32  typeID,
uint16  resID 
)

Read resource from the MacBinary file

Parameters
typeIDFourCC of the type
resIDResource ID to fetch
Returns
Pointer to a SeekableReadStream with loaded resource

◆ getResource() [2/3]

SeekableReadStream* Common::MacResManager::getResource ( const String filename)

Read resource from the MacBinary file

Note
This will take the first resource that matches this name, regardless of type
Parameters
filenamefile name of the resource
Returns
Pointer to a SeekableReadStream with loaded resource

◆ getResource() [3/3]

SeekableReadStream* Common::MacResManager::getResource ( uint32  typeID,
const String filename 
)

Read resource from the MacBinary file

Parameters
typeIDFourCC of the type
filenamefile name of the resource
Returns
Pointer to a SeekableReadStream with loaded resource

◆ getResName()

String Common::MacResManager::getResName ( uint32  typeID,
uint16  resID 
) const

Get the name of a given resource

Parameters
typeIDFourCC of the type
resIDResource ID to fetch
Returns
The name of a given resource and an empty string if not present

◆ getResLength()

uint32 Common::MacResManager::getResLength ( uint32  typeID,
uint16  resID 
)

Get the length in bytes of a given resource

Parameters
typeIDFourCC of the type
resIDResource ID to fetch
Returns
The length in bytes of a given resource

◆ getResForkDataSize()

uint32 Common::MacResManager::getResForkDataSize ( ) const

Get the size of the data portion of the resource fork

Returns
The size of the data portion of the resource fork

◆ computeResForkMD5AsString()

String Common::MacResManager::computeResForkMD5AsString ( uint32  length = 0,
bool  tail = false 
) const

Calculate the MD5 checksum of the resource fork

Parameters
lengthThe maximum length to compute for
tailCalculate length from the tail
Returns
The MD5 checksum of the resource fork

◆ getBaseFileName()

Path Common::MacResManager::getBaseFileName ( ) const
inline

Get the base file name of the data/resource fork pair

Returns
The base file name of the data/resource fork pair

◆ getResIDArray()

MacResIDArray Common::MacResManager::getResIDArray ( uint32  typeID)

Return list of resource IDs with specified type ID

◆ getResTagArray()

MacResTagArray Common::MacResManager::getResTagArray ( )

Return list of resource tags

◆ loadFromMacBinary()

bool Common::MacResManager::loadFromMacBinary ( SeekableReadStream stream)

Load from stream in MacBinary format

◆ dumpRaw()

void Common::MacResManager::dumpRaw ( )

Dump contents of the archive to ./dumps directory

◆ isMacBinary()

static bool Common::MacResManager::isMacBinary ( SeekableReadStream stream)
static

Check if the given stream is in the MacBinary format.

Parameters
streamThe stream we're checking

The documentation for this class was generated from the following file: