mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-21 09:21:08 +00:00
Make Mac DOTT demo runnable.
svn-id: r18834
This commit is contained in:
parent
c01148b098
commit
a35366276e
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user