[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.333,1.334 scumm.cpp,1.582,1.583 scumm.h,1.640,1.641
Eugene Sandulenko
sev at users.sourceforge.net
Fri Sep 16 17:26:55 CEST 2005
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31949
Modified Files:
resource.cpp scumm.cpp scumm.h
Log Message:
Make Mac DOTT demo runnable.
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.333
retrieving revision 1.334
diff -u -d -r1.333 -r1.334
--- resource.cpp 14 Aug 2005 20:46:02 -0000 1.333
+++ resource.cpp 17 Sep 2005 00:24:50 -0000 1.334
@@ -224,11 +224,41 @@
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) {
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.582
retrieving revision 1.583
diff -u -d -r1.582 -r1.583
--- scumm.cpp 16 Sep 2005 23:45:33 -0000 1.582
+++ scumm.cpp 17 Sep 2005 00:24:51 -0000 1.583
@@ -825,6 +825,7 @@
_features(gs.features),
_platform(gs.platform),
_substResFileNameIndex(substResFileNameIndex),
+ _substResFileNameIndexBundle(0),
gdi(this),
res(this),
_pauseDialog(0), _mainMenuDialog(0), _versionDialog(0),
@@ -917,7 +918,9 @@
// 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 @@
}
}
-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 @@
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
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.640
retrieving revision 1.641
diff -u -d -r1.640 -r1.641
--- scumm.h 14 Sep 2005 08:20:37 -0000 1.640
+++ scumm.h 17 Sep 2005 00:24:51 -0000 1.641
@@ -536,8 +536,9 @@
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;
More information about the Scummvm-git-logs
mailing list