[Scummvm-cvs-logs] scummvm master -> 21de3fe7074c3e22d7717c738da369c4e8c97919
lordhoto
lordhoto at gmail.com
Sat Jul 5 14:16:49 CEST 2014
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c44c46a4fb SCUMM: Simplify index file handling for Steam versions.
21de3fe707 SCUMM: Cleanup.
Commit: c44c46a4fbd778d32b522d5a004167c5847e7778
https://github.com/scummvm/scummvm/commit/c44c46a4fbd778d32b522d5a004167c5847e7778
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-07-05T14:16:20+02:00
Commit Message:
SCUMM: Simplify index file handling for Steam versions.
This also makes sure that all extra needed detection data for the Steam
releases is located inside detection.cpp.
Changed paths:
engines/scumm/detection.cpp
engines/scumm/file.cpp
engines/scumm/file.h
engines/scumm/scumm.cpp
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index e77047d..87c1aa1 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -211,14 +211,29 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const {
return result;
}
-static const char *getSteamExeNameFromPattern(Common::String pattern, Common::Platform platform) {
+// The following table includes all the index files, which are embedded in the
+// main game executables in Steam versions.
+static const SteamIndexFile steamIndexFiles[] = {
+ { GID_INDY3, Common::kPlatformWindows, "%02d.LFL", "00.LFL", "Indiana Jones and the Last Crusade.exe", 162056, 6295 },
+ { GID_INDY3, Common::kPlatformMacintosh, "%02d.LFL", "00.LFL", "The Last Crusade", 150368, 6295 },
+ { GID_INDY4, Common::kPlatformWindows, "atlantis.%03d", "ATLANTIS.000", "Indiana Jones and the Fate of Atlantis.exe", 224336, 12035 },
+ { GID_INDY4, Common::kPlatformMacintosh, "atlantis.%03d", "ATLANTIS.000", "The Fate of Atlantis", 260224, 12035 },
+ { GID_LOOM, Common::kPlatformWindows, "%03d.LFL", "000.LFL", "Loom.exe", 187248, 8307 },
+ { GID_LOOM, Common::kPlatformMacintosh, "%03d.LFL", "000.LFL", "Loom", 170464, 8307 },
+#ifdef ENABLE_SCUMM_7_8
+ { GID_DIG, Common::kPlatformWindows, "dig.la%d", "DIG.LA0", "The Dig.exe", 340632, 16304 },
+ { GID_DIG, Common::kPlatformMacintosh, "dig.la%d", "DIG.LA0", "The Dig", 339744, 16304 },
+#endif
+ { 0, Common::kPlatformUnknown, "", "", "", 0, 0 }
+};
+
+const SteamIndexFile *lookUpSteamIndexFile(Common::String pattern, Common::Platform platform) {
for (const SteamIndexFile *indexFile = steamIndexFiles; indexFile->len; ++indexFile) {
if (platform == indexFile->platform && pattern.equalsIgnoreCase(indexFile->pattern))
- return indexFile->executableName;
+ return indexFile;
}
- error("Unable to find Steam executable from detection pattern");
- return "";
+ return nullptr;
}
static Common::String generateFilenameForDetection(const char *pattern, FilenameGenMethod genMethod, Common::Platform platform) {
@@ -231,9 +246,14 @@ static Common::String generateFilenameForDetection(const char *pattern, Filename
break;
case kGenDiskNumSteam:
- case kGenRoomNumSteam:
- result = getSteamExeNameFromPattern(pattern, platform);
- break;
+ case kGenRoomNumSteam: {
+ const SteamIndexFile *indexFile = lookUpSteamIndexFile(pattern, platform);
+ if (!indexFile) {
+ error("Unable to find Steam executable from detection pattern");
+ } else {
+ result = indexFile->executableName;
+ }
+ } break;
case kGenHEPC:
case kGenHEIOS:
diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp
index 8f6fdbe..475ffa3 100644
--- a/engines/scumm/file.cpp
+++ b/engines/scumm/file.cpp
@@ -29,22 +29,6 @@
namespace Scumm {
-// The following table includes all the index files, which are embedded in the
-// main game executables in Steam versions.
-const SteamIndexFile steamIndexFiles[] = {
- { GID_INDY3, Common::kPlatformWindows, "%02d.LFL", "00.LFL", "Indiana Jones and the Last Crusade.exe", 162056, 6295 },
- { GID_INDY3, Common::kPlatformMacintosh, "%02d.LFL", "00.LFL", "The Last Crusade", 150368, 6295 },
- { GID_INDY4, Common::kPlatformWindows, "atlantis.%03d", "ATLANTIS.000", "Indiana Jones and the Fate of Atlantis.exe", 224336, 12035 },
- { GID_INDY4, Common::kPlatformMacintosh, "atlantis.%03d", "ATLANTIS.000", "The Fate of Atlantis", 260224, 12035 },
- { GID_LOOM, Common::kPlatformWindows, "%03d.LFL", "000.LFL", "Loom.exe", 187248, 8307 },
- { GID_LOOM, Common::kPlatformMacintosh, "%03d.LFL", "000.LFL", "Loom", 170464, 8307 },
-#ifdef ENABLE_SCUMM_7_8
- { GID_DIG, Common::kPlatformWindows, "dig.la%d", "DIG.LA0", "The Dig.exe", 340632, 16304 },
- { GID_DIG, Common::kPlatformMacintosh, "dig.la%d", "DIG.LA0", "The Dig", 339744, 16304 },
-#endif
- { 0, Common::kPlatformUnknown, "", "", "", 0, 0 }
-};
-
#pragma mark -
#pragma mark --- ScummFile ---
#pragma mark -
@@ -205,13 +189,12 @@ uint32 ScummFile::read(void *dataPtr, uint32 dataSize) {
#pragma mark -
bool ScummSteamFile::open(const Common::String &filename) {
- for (const SteamIndexFile *indexFile = steamIndexFiles; indexFile->len; ++indexFile) {
- if (indexFile->id == _steamGame.id && indexFile->platform == _steamGame.platform && filename.equalsIgnoreCase(indexFile->indexFileName))
- return openWithSubRange(indexFile->executableName, indexFile->start, indexFile->len);
+ if (filename.equalsIgnoreCase(_indexFile.indexFileName)) {
+ return openWithSubRange(_indexFile.executableName, _indexFile.start, _indexFile.len);
+ } else {
+ // Regular non-bundled file
+ return ScummFile::open(filename);
}
-
- // Regular non-bundled file
- return ScummFile::open(filename);
}
bool ScummSteamFile::openWithSubRange(const Common::String &filename, int32 subFileStart, int32 subFileLen) {
diff --git a/engines/scumm/file.h b/engines/scumm/file.h
index f3eaac5..e7c1eb6 100644
--- a/engines/scumm/file.h
+++ b/engines/scumm/file.h
@@ -76,18 +76,6 @@ public:
uint32 read(void *dataPtr, uint32 dataSize);
};
-class ScummSteamFile : public ScummFile {
-private:
- GameSettings _steamGame;
-
- bool openWithSubRange(const Common::String &filename, int32 subFileStart, int32 subFileLen);
-
-public:
- ScummSteamFile(GameSettings game) : ScummFile(), _steamGame(game) {}
-
- bool open(const Common::String &filename);
-};
-
class ScummDiskImage : public BaseScummFile {
private:
Common::SeekableReadStream *_stream;
@@ -142,7 +130,18 @@ struct SteamIndexFile {
int32 len;
};
-extern const SteamIndexFile steamIndexFiles[];
+const SteamIndexFile *lookUpSteamIndexFile(Common::String pattern, Common::Platform platform);
+
+class ScummSteamFile : public ScummFile {
+private:
+ const SteamIndexFile &_indexFile;
+
+ bool openWithSubRange(const Common::String &filename, int32 subFileStart, int32 subFileLen);
+public:
+ ScummSteamFile(const SteamIndexFile &indexFile) : ScummFile(), _indexFile(indexFile) {}
+
+ bool open(const Common::String &filename);
+};
} // End of namespace Scumm
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 8c03259..73776ba 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1161,7 +1161,12 @@ Common::Error ScummEngine::init() {
} else {
if (_filenamePattern.genMethod == kGenDiskNumSteam || _filenamePattern.genMethod == kGenRoomNumSteam) {
// Steam game versions have the index file embedded in the main executable
- _fileHandle = new ScummSteamFile(_game);
+ const SteamIndexFile *indexFile = lookUpSteamIndexFile(_filenamePattern.pattern, _game.platform);
+ if (!indexFile || indexFile->id != _game.id) {
+ error("Couldn't find index file description for Steam version");
+ } else {
+ _fileHandle = new ScummSteamFile(*indexFile);
+ }
} else {
// Regular access, no container file involved
_fileHandle = new ScummFile();
Commit: 21de3fe7074c3e22d7717c738da369c4e8c97919
https://github.com/scummvm/scummvm/commit/21de3fe7074c3e22d7717c738da369c4e8c97919
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-07-05T14:16:20+02:00
Commit Message:
SCUMM: Cleanup.
Changed paths:
engines/scumm/detection.cpp
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 87c1aa1..7cd50e1 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -214,8 +214,8 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const {
// The following table includes all the index files, which are embedded in the
// main game executables in Steam versions.
static const SteamIndexFile steamIndexFiles[] = {
- { GID_INDY3, Common::kPlatformWindows, "%02d.LFL", "00.LFL", "Indiana Jones and the Last Crusade.exe", 162056, 6295 },
- { GID_INDY3, Common::kPlatformMacintosh, "%02d.LFL", "00.LFL", "The Last Crusade", 150368, 6295 },
+ { GID_INDY3, Common::kPlatformWindows, "%02d.LFL", "00.LFL", "Indiana Jones and the Last Crusade.exe", 162056, 6295 },
+ { GID_INDY3, Common::kPlatformMacintosh, "%02d.LFL", "00.LFL", "The Last Crusade", 150368, 6295 },
{ GID_INDY4, Common::kPlatformWindows, "atlantis.%03d", "ATLANTIS.000", "Indiana Jones and the Fate of Atlantis.exe", 224336, 12035 },
{ GID_INDY4, Common::kPlatformMacintosh, "atlantis.%03d", "ATLANTIS.000", "The Fate of Atlantis", 260224, 12035 },
{ GID_LOOM, Common::kPlatformWindows, "%03d.LFL", "000.LFL", "Loom.exe", 187248, 8307 },
@@ -224,7 +224,7 @@ static const SteamIndexFile steamIndexFiles[] = {
{ GID_DIG, Common::kPlatformWindows, "dig.la%d", "DIG.LA0", "The Dig.exe", 340632, 16304 },
{ GID_DIG, Common::kPlatformMacintosh, "dig.la%d", "DIG.LA0", "The Dig", 339744, 16304 },
#endif
- { 0, Common::kPlatformUnknown, "", "", "", 0, 0 }
+ { 0, Common::kPlatformUnknown, nullptr, nullptr, nullptr, 0, 0 }
};
const SteamIndexFile *lookUpSteamIndexFile(Common::String pattern, Common::Platform platform) {
More information about the Scummvm-git-logs
mailing list