aboutsummaryrefslogtreecommitdiff
path: root/engines/director/director.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2012-11-14 21:57:39 -0500
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commitd870127ddb766be5d599b054ab1e4102aa9632ff (patch)
tree887f05f541c411b10b0eb0fe7e3b1d121281d417 /engines/director/director.cpp
parent9a9df86fded26b253e8d1c02a5a048839084f0e7 (diff)
downloadscummvm-rg350-d870127ddb766be5d599b054ab1e4102aa9632ff.tar.gz
scummvm-rg350-d870127ddb766be5d599b054ab1e4102aa9632ff.tar.bz2
scummvm-rg350-d870127ddb766be5d599b054ab1e4102aa9632ff.zip
DIRECTOR: Mac v3 games just use the resource fork of the executable to start
Diffstat (limited to 'engines/director/director.cpp')
-rw-r--r--engines/director/director.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 5cb5f2089c..0b6b626cfe 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -148,31 +148,37 @@ void DirectorEngine::loadEXERIFX(Common::SeekableReadStream *stream, uint32 offs
}
void DirectorEngine::loadMac() {
- if (getVersion() < 4)
- error("Unhandled pre-v4 Mac version");
+ if (getVersion() < 4) {
+ // The data is part of the resource fork of the executable
+ _mainArchive = new MacArchive();
- _macBinary = new Common::MacResManager();
+ if (!_mainArchive->openFile(getEXEName()))
+ error("Failed to open Mac binary '%s'", getEXEName().c_str());
+ } else {
+ // The RIFX is located in the data fork of the executable
+ _macBinary = new Common::MacResManager();
- if (!_macBinary->open(getEXEName()) || !_macBinary->hasDataFork())
- error("Failed to open Mac binary '%s'", getEXEName().c_str());
+ if (!_macBinary->open(getEXEName()) || !_macBinary->hasDataFork())
+ error("Failed to open Mac binary '%s'", getEXEName().c_str());
- Common::SeekableReadStream *dataFork = _macBinary->getDataFork();
- _mainArchive = new RIFXArchive();
+ Common::SeekableReadStream *dataFork = _macBinary->getDataFork();
+ _mainArchive = new RIFXArchive();
- // First we need to detect PPC vs. 68k
+ // First we need to detect PPC vs. 68k
- uint32 tag = dataFork->readUint32LE();
+ uint32 tag = dataFork->readUint32LE();
- if (tag == MKTAG('P', 'J', '9', '3')) {
- // PPC: The RIFX shares the data fork with the binary
- dataFork->seek(dataFork->readUint32BE());
- } else {
- // 68k: The RIFX is the only thing in the data fork
- dataFork->seek(0);
- }
+ if (tag == MKTAG('P', 'J', '9', '3')) {
+ // PPC: The RIFX shares the data fork with the binary
+ dataFork->seek(dataFork->readUint32BE());
+ } else {
+ // 68k: The RIFX is the only thing in the data fork
+ dataFork->seek(0);
+ }
- if (!_mainArchive->openStream(dataFork))
- error("Failed to load RIFX from Mac binary");
+ if (!_mainArchive->openStream(dataFork))
+ error("Failed to load RIFX from Mac binary");
+ }
}
Common::String DirectorEngine::readPascalString(Common::SeekableReadStream &stream) {