Permalink
Browse files

SCUMM: Add support for Steam versions of Indy 3, Indy 4, Loom and Dig

Many Thanks to Ben Castricum for the original patch
  • Loading branch information...
bluegr committed Jul 2, 2014
1 parent 5e78bee commit 902a140f3e8058c582496296c7c1e0c55b243dda
View
@@ -137,6 +137,8 @@ indy3 Indiana Jones and the Last Crusade
1dd7aa088e09f96d06818aa9a9deabe0 5361 en Mac No AdLib EGA v1.7, 8/17/90 Fingolfin
1875b90fade138c9253a8e967007031a 6295 en DOS VGA VGA IBM 256 color v2.0 from 3 May 90 Peter Eckerlein, Fingolfin
+ 7fbcff27c323499beaedd605e1ebd47d 561152 en Windows Steam Steam Steam Version Ben Castricum, Filippos Karapetis
+ a15d6e1e2c52bbd0ff7fa6b63ab7f796 680340 en Mac Steam Steam Steam Version Filippos Karapetis
399b217b0c8d65d0398076da486363a9 6295 de DOS VGA VGA VGA v1.02 from 7 Nov 91 Peter Eckerlein, Fingolfin
17b5d5e6af4ae89d62631641d66d5a05 -1 it DOS VGA VGA IBM 256 color v2.1 from 3 May 01 Andrea Petrucci, Peter Eckerlein
3cce1913a3bc586b51a75c3892ff18dd -1 ru DOS VGA VGA VGA
@@ -170,6 +172,8 @@ loom Loom
6f0be328c64d689bb606d22a389e1b0f 5748 en Mac No AdLib EGA v1.2 25 Jan 91 Fingolfin
5d88b9d6a88e6f8e90cded9d01b7f082 8307 en DOS VGA VGA CD Version v1.0 from 10. Feb 92 (Talkie) Peter Eckerlein, Fingolfin
+ 0354ee0d14cde1264ec762261c04c14a 585728 en Windows Steam Steam Steam Version Ben Castricum, Filippos Karapetis
+ b4a677bf27c010a747975705108ff1e6 393572 en Mac Steam Steam Steam Version Filippos Karapetis
c5d10e190d4b4d59114b824f2fdbd00e 7540 en FM-TOWNS FM-TOWNS - - dhewg, Andrea Petrucci
31b8fda4c8c7413fa6b39997e776eba4 -1 jp FM-TOWNS FM-TOWNS - - khalek, Andrea Petrucci
@@ -279,6 +283,8 @@ atlantis Indiana Jones and the Fate of Atlantis
d6dd0646404768a63e963891a96daadd 12035 en Mac Floppy Floppy two data files Fingolfin
182344899c2e2998fca0bebcd82aa81a 12035 en DOS - CD - Fingolfin
+ f3c5d9bf3f091bd1f18dc1013fba5396 638976 en Windows Steam Steam Steam Version Ben Castricum, Filippos Karapetis
+ 6a8133b63d46f6663fbcbb49d5a2edb1 520548 en Mac Steam Steam Steam Version Filippos Karapetis
1a6e5ae2777a6a33f06ffc0226210934 -1 en Mac - CD - Scott Summers
2d9d46f23cb07bbc90b8ad464d3e4ff8 -1 en Mac - CD Mac bundle Joachim Eberhard
8e9417564f33790815445b2136efa667 11915 jp Mac - CD - Petr Maruska
@@ -358,6 +364,8 @@ ft Full Throttle
dig The Dig
d8323015ecb8b10bf53474f6e6b0ae33 16304 All All - - - Fingolfin
+ aad201302286c1cfee92321cd406e427 811008 en Windows Steam Steam Steam Version Ben Castricum, Filippos Karapetis
+ d93cc8be628ed5d3b3a29188fc7105d3 1061296 en Mac Steam Steam Steam Version Filippos Karapetis
d62047a6729349ab36f7ee065bf26509 -1 ru All - - - sev
35a2d3040fa512f8232d9e443319d84d 659335495 en Mac - - Mac bundle Fingolfin
21a6592322f92550f144f68a8a4e685e -1 fr Mac - - Mac bundle kaminari
@@ -79,10 +79,12 @@ Common::String ScummEngine::generateFilename(const int room) const {
} else {
switch (_filenamePattern.genMethod) {
case kGenDiskNum:
+ case kGenDiskNumSteam:
result = Common::String::format(_filenamePattern.pattern, diskNumber);
break;
case kGenRoomNum:
+ case kGenRoomNumSteam:
result = Common::String::format(_filenamePattern.pattern, room);
break;
@@ -209,14 +211,30 @@ Common::String ScummEngine_v70he::generateFilename(const int room) const {
return result;
}
-static Common::String generateFilenameForDetection(const char *pattern, FilenameGenMethod genMethod) {
+static const char *getSteamExeNameFromPattern(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;
+ }
+
+ error("Unable to find Steam executable from detection pattern");
+ return "";
+}
+
+static Common::String generateFilenameForDetection(const char *pattern, FilenameGenMethod genMethod, Common::Platform platform) {
Common::String result;
+ Common::String patternStr = pattern;
switch (genMethod) {
case kGenDiskNum:
case kGenRoomNum:
result = Common::String::format(pattern, 0);
break;
+
+ case kGenDiskNumSteam:
+ case kGenRoomNumSteam:
+ result = getSteamExeNameFromPattern(pattern, platform);
+ break;
case kGenHEPC:
case kGenHEIOS:
@@ -528,7 +546,8 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
DetectorResult dr;
// Dive one level down since mac indy3/loom has its files split into directories. See Bug #1438631
- composeFileHashMap(fileMD5Map, fslist, 2, directoryGlobs);
+ // Dive two levels down for Mac Steam games
+ composeFileHashMap(fileMD5Map, fslist, 3, directoryGlobs);
// Iterate over all filename patterns.
for (const GameFilenamePattern *gfp = gameFilenamesTable; gfp->gameid; ++gfp) {
@@ -540,7 +559,7 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
// Generate the detectname corresponding to the gfp. If the file doesn't
// exist in the directory we are looking at, we can skip to the next
// one immediately.
- Common::String file(generateFilenameForDetection(gfp->pattern, gfp->genMethod));
+ Common::String file(generateFilenameForDetection(gfp->pattern, gfp->genMethod, gfp->platform));
if (!fileMD5Map.contains(file))
continue;
@@ -1025,7 +1044,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
Common::FSNode dir(ConfMan.get("path"));
if (!dir.isDirectory())
return Common::kPathNotDirectory;
- if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly))
+ if (!dir.getChildren(fslist, Common::FSNode::kListAll))
return Common::kNoGameDataFoundError;
// Invoke the detector, but fixed to the specified gameid.
@@ -1081,7 +1100,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
md5Warning += Common::String::format(" SCUMM gameid '%s', file '%s', MD5 '%s'\n\n",
res.game.gameid,
- generateFilenameForDetection(res.fp.pattern, res.fp.genMethod).c_str(),
+ generateFilenameForDetection(res.fp.pattern, res.fp.genMethod, Common::kPlatformUnknown).c_str(),
res.md5.c_str());
g_system->logMessage(LogMessageType::kWarning, md5Warning.c_str());
@@ -95,7 +95,9 @@ struct GameSettings {
enum FilenameGenMethod {
kGenDiskNum,
+ kGenDiskNumSteam,
kGenRoomNum,
+ kGenRoomNumSteam,
kGenHEMac,
kGenHEMacNoParens,
kGenHEPC,
@@ -52,6 +52,8 @@ namespace Scumm {
*/
static const char *const directoryGlobs[] = {
"rooms *", // Mac version of indy3/loom
+ "Contents", // Mac Steam versions
+ "MacOS", // Mac Steam versions
0
};
@@ -221,6 +223,7 @@ static const GameSettings gameVariantsTable[] = {
{"indy3", "EGA", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"indy3", "No AdLib", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"indy3", "VGA", "vga", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_OLD256 | GF_FEW_LOCALS, Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"indy3", "Steam", "steam", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_OLD256 | GF_FEW_LOCALS, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"indy3", "FM-TOWNS", 0, GID_INDY3, 3, 0, MDT_TOWNS, GF_OLD256 | GF_FEW_LOCALS | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
{"loom", "EGA", "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO1(GUIO_NOSPEECH)},
@@ -230,6 +233,7 @@ static const GameSettings gameVariantsTable[] = {
#endif
{"loom", "FM-TOWNS", 0, GID_LOOM, 3, 0, MDT_TOWNS, GF_AUDIOTRACKS | GF_OLD256, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
{"loom", "VGA", "vga", GID_LOOM, 4, 0, MDT_NONE, GF_AUDIOTRACKS, Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"loom", "Steam", "steam", GID_LOOM, 4, 0, MDT_NONE, GF_AUDIOTRACKS, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"pass", 0, 0, GID_PASS, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_16COLOR, Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
@@ -245,6 +249,7 @@ static const GameSettings gameVariantsTable[] = {
{"monkey2", "FM-TOWNS", 0, GID_MONKEY2, 5, 0, MDT_PCSPK | MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO5(GUIO_NOSPEECH, GUIO_MIDITOWNS, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_NOASPECT)},
{"atlantis", "", 0, GID_INDY4, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO0()},
+ {"atlantis", "Steam", "steam", GID_INDY4, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO0()},
{"atlantis", "Floppy", 0, GID_INDY4, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO1(GUIO_NOSPEECH)},
{"atlantis", "FM-TOWNS", 0, GID_INDY4, 5, 0, MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO4(GUIO_MIDITOWNS, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_NOASPECT)},
@@ -257,7 +262,8 @@ static const GameSettings gameVariantsTable[] = {
#ifdef ENABLE_SCUMM_7_8
{"ft", 0, 0, GID_FT, 7, 0, MDT_NONE, 0, UNK, GUIO1(GUIO_NOMIDI)},
- {"dig", 0, 0, GID_DIG, 7, 0, MDT_NONE, 0, UNK, GUIO1(GUIO_NOMIDI)},
+ {"dig", "", 0, GID_DIG, 7, 0, MDT_NONE, 0, UNK, GUIO1(GUIO_NOMIDI)},
+ {"dig", "Steam", "steam", GID_DIG, 7, 0, MDT_NONE, 0, UNK, GUIO1(GUIO_NOMIDI)},
{"comi", 0, 0, GID_CMI, 8, 0, MDT_NONE, 0, Common::kPlatformWindows, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)},
#endif
@@ -422,10 +428,10 @@ static const GameSettings gameVariantsTable[] = {
using Common::UNK_LANG;
// The following describes how Fingolfin thinks this table might be used one day;
-// this is work in progress, so read this with a salt of grain...
+// this is work in progress, so read this with a grain of salt...
//
// The following table maps gameids to possible filename variants for that game.
-// This information is used by the detector to determin possible "detect files".
+// This information is used by the detector to determine possible "detect files".
// It is also later used by the engine creation code to verify the game to be
// launched is present. Finally, the correct GameFilenamePattern entry is passed on
// to the engine which uses it to locate the files for the game.
@@ -451,13 +457,17 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "zak", "zak1.d64", kGenUnchanged, UNK_LANG, Common::kPlatformC64, "V1" }, // ... and zak2.d64
{ "indy3", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
+ { "indy3", "%02d.LFL", kGenRoomNumSteam, UNK_LANG, Common::kPlatformWindows, "Steam" },
+ { "indy3", "%02d.LFL", kGenRoomNumSteam, UNK_LANG, Common::kPlatformMacintosh, "Steam" },
{ "indyloom", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
{ "indyzak", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
{ "zakloom", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
{ "loom", "%02d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
{ "loom", "%03d.LFL", kGenRoomNum, UNK_LANG, UNK, "VGA" }, // Loom CD
+ { "loom", "%03d.LFL", kGenRoomNumSteam, UNK_LANG, Common::kPlatformWindows, "Steam" },
+ { "loom", "%03d.LFL", kGenRoomNumSteam, UNK_LANG, Common::kPlatformMacintosh, "Steam" },
{ "pass", "%03d.LFL", kGenRoomNum, UNK_LANG, UNK, 0 },
@@ -471,6 +481,8 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "monkey2", "mi2demo.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
{ "atlantis", "atlantis.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
+ { "atlantis", "atlantis.%03d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformWindows, "Steam" },
+ { "atlantis", "atlantis.%03d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformMacintosh, "Steam" },
{ "atlantis", "fate.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
{ "atlantis", "playfate.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
{ "atlantis", "indy4.%03d", kGenDiskNum, Common::JA_JPN, Common::kPlatformFMTowns, "FM-TOWNS" },
@@ -494,6 +506,8 @@ static const GameFilenamePattern gameFilenamesTable[] = {
#ifdef ENABLE_SCUMM_7_8
{ "dig", "dig.la%d", kGenDiskNum, UNK_LANG, UNK, 0 },
+ { "dig", "dig.la%d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformWindows, "Steam" },
+ { "dig", "dig.la%d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformMacintosh, "Steam" },
{ "dig", "thedig.la%d", kGenDiskNum, UNK_LANG, UNK, "Demo" }, // Used by an alternate version of the demo
{ "dig", "The Dig Data", kGenUnchanged, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "dig", "The Dig Demo Data", kGenUnchanged, UNK_LANG, Common::kPlatformMacintosh, "Demo" },
View
@@ -29,6 +29,22 @@
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 -
@@ -184,6 +200,29 @@ uint32 ScummFile::read(void *dataPtr, uint32 dataSize) {
return realLen;
}
+#pragma mark -
+#pragma mark --- ScummSteamFile ---
+#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);
+ }
+
+ // Regular non-bundled file
+ return ScummFile::open(filename);
+}
+
+bool ScummSteamFile::openWithSubRange(const Common::String &filename, int32 subFileStart, int32 subFileLen) {
+ if (ScummFile::open(filename)) {
+ _subFileStart = subFileStart;
+ _subFileLen = subFileLen;
+ seek(0, SEEK_SET);
+ return true;
+ } else
+ return false;
+}
+
#pragma mark -
#pragma mark --- ScummDiskImage ---
#pragma mark -
View
@@ -53,7 +53,7 @@ class BaseScummFile : public Common::File {
};
class ScummFile : public BaseScummFile {
-private:
+protected:
int32 _subFileStart;
int32 _subFileLen;
bool _myEos; // Have we read past the end of the subfile?
@@ -64,7 +64,7 @@ class ScummFile : public BaseScummFile {
public:
ScummFile();
- bool open(const Common::String &filename);
+ virtual bool open(const Common::String &filename);
bool openSubFile(const Common::String &filename);
void clearErr() { _myEos = false; BaseScummFile::clearErr(); }
@@ -76,6 +76,18 @@ class ScummFile : public BaseScummFile {
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;
@@ -120,6 +132,18 @@ class ScummDiskImage : public BaseScummFile {
uint32 read(void *dataPtr, uint32 dataSize);
};
+struct SteamIndexFile {
+ byte id;
+ Common::Platform platform;
+ const char *pattern;
+ const char *indexFileName;
+ const char *executableName;
+ int32 start;
+ int32 len;
+};
+
+extern const SteamIndexFile steamIndexFiles[];
+
} // End of namespace Scumm
#endif
Oops, something went wrong.

0 comments on commit 902a140

Please sign in to comment.