diff options
author | Eugene Sandulenko | 2005-09-17 00:24:51 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2005-09-17 00:24:51 +0000 |
commit | a35366276e8be05bb1a5900e3e62838033685013 (patch) | |
tree | 980117b59dc97fcac1e0d014a804152b21a94c85 | |
parent | c01148b098558ae48de85515bbb5fa89ece5513f (diff) | |
download | scummvm-rg350-a35366276e8be05bb1a5900e3e62838033685013.tar.gz scummvm-rg350-a35366276e8be05bb1a5900e3e62838033685013.tar.bz2 scummvm-rg350-a35366276e8be05bb1a5900e3e62838033685013.zip |
Make Mac DOTT demo runnable.
svn-id: r18834
-rw-r--r-- | scumm/resource.cpp | 32 | ||||
-rw-r--r-- | scumm/scumm.cpp | 17 | ||||
-rw-r--r-- | scumm/scumm.h | 3 |
3 files changed, 46 insertions, 6 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 3cdbd48a18..7b4da92599 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -224,11 +224,41 @@ bool ScummEngine::openFile(BaseScummFile &file, const char *filename) { bool result = false; if (!_containerFile.isEmpty()) { + char name[128]; + char temp[128]; + file.close(); file.open(_containerFile.c_str()); assert(file.isOpen()); - result = file.openSubFile(filename); + strncpy(name, filename, 128); + + // Some Mac demos (i.e. DOTT) have bundled file names different + // from target name. dottdemo.000 vs tentacle.000. So we should + // substitute those names too + if (_substResFileNameIndexBundle == 0) { + int substLastIndex = 0; + + while (substLastIndex != -1) { + if (file.openSubFile(name)) + break; + + substLastIndex = generateSubstResFileName(filename, name, sizeof(name), substLastIndex + 1); + } + + if (substLastIndex == 0) + substLastIndex = -1; + + _substResFileNameIndexBundle = substLastIndex; + + if (substLastIndex != -1) + debug(5, "Generated substitute in Mac bundle: [%s -> %s]", filename, name); + } + + if (_substResFileNameIndexBundle != -1) + generateSubstResFileName(filename, name, sizeof(temp), _substResFileNameIndexBundle); + + result = file.openSubFile(name); } if (!result) { diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 6490170cb4..cbcd0f3f82 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -825,6 +825,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _features(gs.features), _platform(gs.platform), _substResFileNameIndex(substResFileNameIndex), + _substResFileNameIndexBundle(0), gdi(this), res(this), _pauseDialog(0), _mainMenuDialog(0), _versionDialog(0), @@ -917,7 +918,9 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS // The first step is to check whether one of them is present (we do that // here); the rest is handled by the ScummFile class and code in // openResourceFile() (and in the Sound class, for MONSTER.SOU handling). - if (_version >= 6 && _heversion == 0 && _substResFileNameIndex) { + if (_version >= 6 && _heversion == 0 && _substResFileNameIndex && + _platform == Common::kPlatformMacintosh && + substResFileNameTable[_substResFileNameIndex].genMethod == kGenAsIs) { if (_fileHandle->open(substResFileNameTable[_substResFileNameIndex].macName)) { _containerFile = substResFileNameTable[_substResFileNameIndex].macName; _substResFileNameIndex = 0; @@ -2647,8 +2650,11 @@ void ScummEngine::errorString(const char *buf1, char *buf2) { } } -int ScummEngine::generateSubstResFileName(const char *filename, char *buf, int bufsize) { - return generateSubstResFileName_(filename, buf, bufsize, _substResFileNameIndex); +int ScummEngine::generateSubstResFileName(const char *filename, char *buf, int bufsize, int index) { + if (index == -3) + index = _substResFileNameIndex; + + return generateSubstResFileName_(filename, buf, bufsize, index); } @@ -3056,8 +3062,11 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { substLastIndex = generateSubstResFileName_(tempName, detectName, sizeof(detectName), substLastIndex + 1); } - if (found) + if (found) { + if (substLastIndex != 0) + debug(5, "Generated filename substitute: %s -> %s", tempName, detectName); break; + } } // Unable to locate game data diff --git a/scumm/scumm.h b/scumm/scumm.h index 99072f8910..bfe32f7f36 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -536,8 +536,9 @@ public: int _roomResource; // FIXME - should be protected but Sound::pauseSounds uses it bool _egoPositioned; // Used by Actor::putActor, hence public - int generateSubstResFileName(const char *filename, char *buf, int bufsize); + int generateSubstResFileName(const char *filename, char *buf, int bufsize, int index = -3); int _substResFileNameIndex; + int _substResFileNameIndexBundle; // Used with Mac bundles protected: int _keyPressed; |