GameList SwordMetaEngine::detectGames(const Common::FSList &fslist) const { int i, j; GameList detectedGames; bool filesFound[NUM_FILES_TO_CHECK]; for (i = 0; i < NUM_FILES_TO_CHECK; i++) filesFound[i] = false; Sword1CheckDirectory(fslist, filesFound); bool mainFilesFound = true; bool pcFilesFound = true; bool macFilesFound = true; bool demoFilesFound = true; bool macDemoFilesFound = true; bool psxFilesFound = true; bool psxDemoFilesFound = true; for (i = 0; i < NUM_COMMON_FILES_TO_CHECK; i++) if (!filesFound[i]) mainFilesFound = false; for (j = 0; j < NUM_PC_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) pcFilesFound = false; for (j = 0; j < NUM_MAC_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) macFilesFound = false; for (j = 0; j < NUM_DEMO_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) demoFilesFound = false; for (j = 0; j < NUM_DEMO_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) macDemoFilesFound = false; for (j = 0; j < NUM_PSX_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) psxFilesFound = false; for (j = 0; j < NUM_PSX_DEMO_FILES_TO_CHECK; i++, j++) if (!filesFound[i] || psxFilesFound) psxDemoFilesFound = false; if (mainFilesFound && pcFilesFound && demoFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1DemoSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && pcFilesFound && psxFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1PSXSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && pcFilesFound && psxDemoFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1PSXDemoSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && pcFilesFound && !psxFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1FullSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && macFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1MacFullSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); else if (mainFilesFound && macDemoFilesFound) detectedGames.push_back(GameDescriptor(getEngineID(), sword1MacDemoSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); return detectedGames; }
WageMetaEngine() : AdvancedMetaEngine(Wage::gameDescriptions, sizeof(ADGameDescription), wageGames) { _md5Bytes = 50000; _singleId = "wage"; _guiOptions = GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI); }
namespace Groovie { #define GAMEOPTION_T7G_FAST_MOVIE_SPEED GUIO_GAMEOPTIONS1 static const PlainGameDescriptor groovieGames[] = { // Games {"t7g", "The 7th Guest"}, #ifdef ENABLE_GROOVIE2 {"11h", "The 11th Hour: The Sequel to The 7th Guest"}, {"clandestiny", "Clandestiny"}, {"unclehenry", "Uncle Henry's Playhouse"}, {"tlc", "Tender Loving Care"}, #endif {0, 0} }; static const GroovieGameDescription gameDescriptions[] = { // The 7th Guest DOS English { { "t7g", "", AD_ENTRY1s("script.grv", "d1b8033b40aa67c076039881eccce90d", 16659), Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT, GAMEOPTION_T7G_FAST_MOVIE_SPEED) }, kGroovieT7G, 0 }, // The 7th Guest Mac English { { "t7g", "", AD_ENTRY1s("T7GMac", "acdc4a58dd3f007f65e99b99d78e0bce", 1814029), Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT, GAMEOPTION_T7G_FAST_MOVIE_SPEED) }, kGroovieT7G, 0 }, #if 0 // These entries should now be identical to the first T7G Mac entry after // changing the app to only use the data part of the resource fork. They // are left disabled here as a reference. // The 7th Guest Mac English (Aztec single disc) { { "t7g", "", AD_ENTRY1s("T7GMac", "6bdee8d0f9eef6d58d02fcd7deec3fb2", 1830783), Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT, GAMEOPTION_T7G_FAST_MOVIE_SPEED) }, kGroovieT7G, 0 }, // The 7th Guest Mac English (Aztec bundle, provided by Thefinaleofseem) { { "t7g", "", AD_ENTRY1s("T7GMac", "0d595d4b44ae1814082938d051e5174e", 1830783), Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT, GAMEOPTION_T7G_FAST_MOVIE_SPEED) }, kGroovieT7G, 0 }, #endif // The 7th Guest DOS Russian (Akella) { { "t7g", "", { { "script.grv", 0, "d1b8033b40aa67c076039881eccce90d", 16659}, { "intro.gjd", 0, NULL, 31711554}, { NULL, 0, NULL, 0} }, Common::RU_RUS, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO5(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT, GAMEOPTION_T7G_FAST_MOVIE_SPEED) }, kGroovieT7G, 0 }, { { "t7g", "", { { "script.grv", 0, "d1b8033b40aa67c076039881eccce90d", 16659}, { "SeventhGuest", 0, NULL, -1}, { NULL, 0, NULL, 0} }, Common::EN_ANY, Common::kPlatformIOS, ADGF_NO_FLAGS, GUIO3(GUIO_NOMIDI, GUIO_NOASPECT, GAMEOPTION_T7G_FAST_MOVIE_SPEED) }, kGroovieT7G, 0 }, #ifdef ENABLE_GROOVIE2 // The 11th Hour DOS English { { "11h", "", AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227), Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT) }, kGroovieV2, 1 }, // The 11th Hour Macintosh English { { "11h", "", { { "disk.1", 0, "5c0428cd3659fc7bbcd0aa16485ed5da", 227 }, { "The 11th Hour Installer", 0, "bcdb4040b27f15b18f39fb9e496d384a", 1002987 }, { 0, 0, 0, 0 } }, Common::EN_ANY, Common::kPlatformMacintosh, ADGF_UNSTABLE, GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT) }, kGroovieV2, 1 }, // The 11th Hour Macintosh English (Installed) { { "11h", "Installed", { { "disk.1", 0, "5c0428cd3659fc7bbcd0aa16485ed5da", 227 }, { "el01.mov", 0, "70f42dfc25b1488a08011dc45bb5145d", 6039 }, { 0, 0, 0, 0 } }, Common::EN_ANY, Common::kPlatformMacintosh, ADGF_UNSTABLE, GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT) }, kGroovieV2, 1 }, // The 11th Hour DOS Demo English { { "11h", "Demo", AD_ENTRY1s("disk.1", "aacb32ce07e0df2894bd83a3dee40c12", 70), Common::EN_ANY, Common::kPlatformDOS, ADGF_DEMO | ADGF_UNSTABLE, GUIO5(GUIO_NOLAUNCHLOAD, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT) }, kGroovieV2, 1 }, // The Making of The 11th Hour DOS English { { "11h", "Making Of", AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227), Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO3(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD, GUIO_NOASPECT) }, kGroovieV2, 2 }, // The Making of The 11th Hour Macintosh English { { "11h", "Making Of", { { "disk.1", 0, "5c0428cd3659fc7bbcd0aa16485ed5da", 227 }, { "The 11th Hour Installer", 0, "bcdb4040b27f15b18f39fb9e496d384a", 1002987 }, { 0, 0, 0, 0 } }, Common::EN_ANY, Common::kPlatformMacintosh, ADGF_UNSTABLE, GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT) }, kGroovieV2, 2 }, // The Making of The 11th Hour Macintosh English (Installed) { { "11h", "Making Of (Installed)", { { "disk.1", 0, "5c0428cd3659fc7bbcd0aa16485ed5da", 227 }, { "el01.mov", 0, "70f42dfc25b1488a08011dc45bb5145d", 6039 }, { 0, 0, 0, 0 } }, Common::EN_ANY, Common::kPlatformMacintosh, ADGF_UNSTABLE, GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT) }, kGroovieV2, 2 }, // Clandestiny Trailer DOS English { { "clandestiny", "Trailer", AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227), Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO3(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD, GUIO_NOASPECT) }, kGroovieV2, 3 }, // Clandestiny Trailer Macintosh English { { "clandestiny", "Trailer", { { "disk.1", 0, "5c0428cd3659fc7bbcd0aa16485ed5da", 227 }, { "The 11th Hour Installer", 0, "bcdb4040b27f15b18f39fb9e496d384a", 1002987 }, { 0, 0, 0, 0 } }, Common::EN_ANY, Common::kPlatformMacintosh, ADGF_UNSTABLE, GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT) }, kGroovieV2, 3 }, // Clandestiny Trailer Macintosh English (Installed) { { "clandestiny", "Trailer (Installed)", { { "disk.1", 0, "5c0428cd3659fc7bbcd0aa16485ed5da", 227 }, { "el01.mov", 0, "70f42dfc25b1488a08011dc45bb5145d", 6039 }, { 0, 0, 0, 0 } }, Common::EN_ANY, Common::kPlatformMacintosh, ADGF_UNSTABLE, GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT) }, kGroovieV2, 3 }, // Clandestiny DOS English { { "clandestiny", "", AD_ENTRY1s("disk.1", "f79fc1515174540fef6a34132efc4c53", 76), Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT) }, kGroovieV2, 1 }, // Uncle Henry's Playhouse PC English { { "unclehenry", "", AD_ENTRY1s("disk.1", "0e1b1d3cecc4fc7efa62a968844d1f7a", 72), Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT) }, kGroovieV2, 1 }, // Tender Loving Care PC English { { "tlc", "", AD_ENTRY1s("disk.1", "32a1afa68478f1f9d2b25eeea427f2e3", 84), Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT) }, kGroovieV2, 1 }, #endif {AD_TABLE_END_MARKER, kGroovieT7G, 0} }; static const char *directoryGlobs[] = { "MIDI", 0 }; static const ADExtraGuiOptionsMap optionsList[] = { { GAMEOPTION_T7G_FAST_MOVIE_SPEED, { _s("Fast movie speed"), _s("Play movies at an increased speed"), "fast_movie_speed", false } }, AD_EXTRA_GUI_OPTIONS_TERMINATOR }; class GroovieMetaEngine : public AdvancedMetaEngine { public: GroovieMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(GroovieGameDescription), groovieGames, optionsList) { // Use kADFlagUseExtraAsHint in order to distinguish the 11th hour from // its "Making of" as well as the Clandestiny Trailer; they all share // the same MD5. // TODO: Is this the only reason, or are there others (like the three // potentially sharing a single directory) ? In the former case, then // perhaps a better solution would be to add additional files // to the detection entries. In the latter case, this TODO should be // replaced with an according explanation. _flags = kADFlagUseExtraAsHint; _guioptions = GUIO3(GUIO_NOSUBTITLES, GUIO_NOSFX, GUIO_NOASPECT); // Need MIDI directory to detect 11H Mac Installed _maxScanDepth = 2; _directoryGlobs = directoryGlobs; } const char *getEngineID() const { return "groovie"; } const char *getName() const { return "Groovie"; } const char *getOriginalCopyright() const { return "Groovie Engine (C) 1990-1996 Trilobyte"; } bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; bool hasFeature(MetaEngineFeature f) const; SaveStateList listSaves(const char *target) const; int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; bool GroovieMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { if (gd) { *engine = new GroovieEngine(syst, (const GroovieGameDescription *)gd); } return gd != 0; } bool GroovieMetaEngine::hasFeature(MetaEngineFeature f) const { return (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo); } SaveStateList GroovieMetaEngine::listSaves(const char *target) const { return SaveLoad::listValidSaves(target); } int GroovieMetaEngine::getMaximumSaveSlot() const { return SaveLoad::getMaximumSlot(); } void GroovieMetaEngine::removeSaveState(const char *target, int slot) const { if (!SaveLoad::isSlotValid(slot)) { // Invalid slot, do nothing return; } Common::String filename = SaveLoad::getSlotSaveName(target, slot); g_system->getSavefileManager()->removeSavefile(filename); } SaveStateDescriptor GroovieMetaEngine::querySaveMetaInfos(const char *target, int slot) const { SaveStateDescriptor desc; Common::InSaveFile *savefile = SaveLoad::openForLoading(target, slot, &desc); delete savefile; return desc; } } // End of namespace Groovie
NeverhoodMetaEngine() : AdvancedMetaEngine(Neverhood::gameDescriptions, sizeof(Neverhood::NeverhoodGameDescription), neverhoodGames) { _singleid = "neverhood"; _guioptions = GUIO2(GUIO_NOSUBTITLES, GUIO_NOMIDI); }
DetectedGames SwordMetaEngine::detectGames(const Common::FSList &fslist) const { int i, j; DetectedGames detectedGames; bool filesFound[NUM_FILES_TO_CHECK]; for (i = 0; i < NUM_FILES_TO_CHECK; i++) filesFound[i] = false; Sword1CheckDirectory(fslist, filesFound); bool mainFilesFound = true; bool pcFilesFound = true; bool macFilesFound = true; bool demoFilesFound = true; bool macDemoFilesFound = true; bool psxFilesFound = true; bool psxDemoFilesFound = true; for (i = 0; i < NUM_COMMON_FILES_TO_CHECK; i++) if (!filesFound[i]) mainFilesFound = false; for (j = 0; j < NUM_PC_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) pcFilesFound = false; for (j = 0; j < NUM_MAC_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) macFilesFound = false; for (j = 0; j < NUM_DEMO_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) demoFilesFound = false; for (j = 0; j < NUM_DEMO_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) macDemoFilesFound = false; for (j = 0; j < NUM_PSX_FILES_TO_CHECK; i++, j++) if (!filesFound[i]) psxFilesFound = false; for (j = 0; j < NUM_PSX_DEMO_FILES_TO_CHECK; i++, j++) if (!filesFound[i] || psxFilesFound) psxDemoFilesFound = false; DetectedGame game; if (mainFilesFound && pcFilesFound && demoFilesFound) game = DetectedGame(sword1DemoSettings); else if (mainFilesFound && pcFilesFound && psxFilesFound) game = DetectedGame(sword1PSXSettings); else if (mainFilesFound && pcFilesFound && psxDemoFilesFound) game = DetectedGame(sword1PSXDemoSettings); else if (mainFilesFound && pcFilesFound && !psxFilesFound) game = DetectedGame(sword1FullSettings); else if (mainFilesFound && macFilesFound) game = DetectedGame(sword1MacFullSettings); else if (mainFilesFound && macDemoFilesFound) game = DetectedGame(sword1MacDemoSettings); else return detectedGames; game.setGUIOptions(GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)); game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::EN_ANY)); game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::DE_DEU)); game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::FR_FRA)); game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::IT_ITA)); game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::ES_ESP)); game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::PT_BRA)); game.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(Common::CZ_CZE)); detectedGames.push_back(game); return detectedGames; }
GameList detectGamesImpl(const Common::FSList &fslist, bool recursion = false) { GameList detectedGames; const Sword2::GameSettings *g; Common::FSList::const_iterator file; bool isFullVersion = isFullGame(fslist); for (g = Sword2::sword2_settings; g->gameid; ++g) { // Iterate over all files in the given directory for (file = fslist.begin(); file != fslist.end(); ++file) { if (!file->isDirectory()) { // The required game data files can be located in the game directory, or in // a subdirectory called "clusters". In the latter case, we don't want to // detect the game in that subdirectory, as this will detect the game twice // when mass add is searching inside a directory. In this case, the first // result (the game directory) will be correct, but the second result (the // clusters subdirectory) will be wrong, as the optional speech, music and // video data files will be ignored. Note that this fix will skip the game // data files if the user has placed them inside a "clusters" subdirectory, // or if he/she points ScummVM directly to the "clusters" directory of the // game CD. Fixes bug #3049336. Common::String directory = file->getParent().getName(); directory.toLowercase(); if (directory.hasPrefix("clusters") && directory.size() <= 9 && !recursion) continue; if (file->getName().equalsIgnoreCase(g->detectname)) { // Make sure that the sword2 demo is not mixed up with the // full version, since they use the same filename for detection if ((g->features == Sword2::GF_DEMO && isFullVersion) || (g->features == 0 && !isFullVersion)) continue; // Match found, add to list of candidates, then abort inner loop. detectedGames.push_back(GameDescriptor(g->gameid, g->description, Common::UNK_LANG, Common::kPlatformUnknown, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT))); break; } } } } if (detectedGames.empty()) { // Nothing found -- try to recurse into the 'clusters' subdirectory, // present e.g. if the user copied the data straight from CD. for (file = fslist.begin(); file != fslist.end(); ++file) { if (file->isDirectory()) { if (file->getName().equalsIgnoreCase("clusters")) { Common::FSList recList; if (file->getChildren(recList, Common::FSNode::kListAll)) { GameList recGames(detectGamesImpl(recList, true)); if (!recGames.empty()) { detectedGames.push_back(recGames); break; } } } } } } return detectedGames; }
CineMetaEngine() : AdvancedMetaEngine(Cine::gameDescriptions, sizeof(Cine::CINEGameDescription), cineGames) { _singleid = "cine"; _guioptions = GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI); }
DrasculaMetaEngine() : AdvancedMetaEngine(Drascula::gameDescriptions, sizeof(Drascula::DrasculaGameDescription), drasculaGames) { _singleid = "drascula"; _guioptions = GUIO2(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD); }
CineMetaEngine() : AdvancedMetaEngine(Cine::gameDescriptions, sizeof(Cine::CINEGameDescription), cineGames, optionsList) { _singleId = "cine"; _guiOptions = GUIO2(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVELOAD); }
namespace Adl { // Mystery House was designed for monochrome display, so we default to // monochrome mode there. All the other games default to color mode. #define GAMEOPTION_COLOR_DEFAULT_OFF GUIO_GAMEOPTIONS1 #define GAMEOPTION_SCANLINES GUIO_GAMEOPTIONS2 #define GAMEOPTION_COLOR_DEFAULT_ON GUIO_GAMEOPTIONS3 static const ADExtraGuiOptionsMap optionsList[] = { { GAMEOPTION_COLOR_DEFAULT_OFF, { _s("Color mode"), _s("Use color graphics"), "color", false } }, { GAMEOPTION_COLOR_DEFAULT_ON, { _s("Color mode"), _s("Use color graphics"), "color", true } }, { GAMEOPTION_SCANLINES, { _s("Scanlines"), _s("Show scanlines"), "scanlines", false } }, AD_EXTRA_GUI_OPTIONS_TERMINATOR }; static const PlainGameDescriptor adlGames[] = { { "hires0", "Hi-Res Adventure #0: Mission Asteroid" }, { "hires1", "Hi-Res Adventure #1: Mystery House" }, { "hires2", "Hi-Res Adventure #2: Wizard and the Princess" }, { "hires4", "Hi-Res Adventure #4: Ulysses and the Golden Fleece" }, { "hires5", "Hi-Res Adventure #5: Time Zone" }, { "hires6", "Hi-Res Adventure #6: The Dark Crystal" }, { 0, 0 } }; static const AdlGameDescription gameDescriptions[] = { { // Hi-Res Adventure #1: Mystery House - Apple II - 1987 PD release - Plain files { "hires1", 0, { { "ADVENTURE", 0, "22d9e63a11d69fa033ba1738715ad09a", 29952 }, { "AUTO LOAD OBJ", 0, "23bfccfe9fcff9b22cf6c41bde9078ac", 12291 }, { "MYSTERY.HELLO", 0, "2289b7fea300b506e902a4c597968369", 836 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES1 }, { // Hi-Res Adventure #1: Mystery House - Apple II - 1987 PD release - .DSK format { "hires1", 0, { { "MYSTHOUS.DSK", 0, "34ba05e62bf51404c4475c349ca48921", 143360 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES1 }, { // Hi-Res Adventure #2: Wizard and the Princess - Apple II - Roberta Williams Anthology { "hires2", 0, { { "WIZARD.DSK", 0, "816fdfc35e25496213c8db40ecf26569", 143360 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES2 }, { // Hi-Res Adventure #0: Mission Asteroid - Apple II - Roberta Williams Anthology { "hires0", 0, { { "MISSION.NIB", 0, "b158f6f79681d4edd651e1932f9e01d7", 232960 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES0 }, { // Hi-Res Adventure #4: Ulysses and the Golden Fleece - Atari 8-bit - Re-release { "hires4", 0, { { "ULYS1A.XFD", 0, "26365d2b06509fd21e7a7919e33f7199", 92160 }, { "ULYS1B.XFD", 0, "37919c72a4103e6f897ee7daa8261d1d", 92160 }, // Load 'N' Go Software release XAG-0646 appears to be missing the second disk { "ULYS2C.XFD", 0, "ff33830246e65dc71c954acb7fd5621a", 92160 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformAtari8Bit, ADGF_UNSTABLE, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES4 }, { // Hi-Res Adventure #5: Time Zone - Apple II - Version 1.1 - Roberta Williams Anthology { "hires5", 0, { { "TZONE1A.NIB", 0, "475dedb7396fdcea81c1a2a4046caebe", 232960 }, { "TZONE1B.NIB", 0, "f8aaea094ebbe41cf4354d9fe2c30d9a", 232960 }, { "TZONE2C.NIB", 0, "b351a367dc48e776bf08e42a3f50ae74", 232960 }, { "TZONE2D.NIB", 0, "9583b287a5c95960f5335878102bb8b1", 232960 }, { "TZONE3E.NIB", 0, "502e42a0cb69ffe4a48cd51c1ff210cf", 232960 }, { "TZONE3F.NIB", 0, "3d6e0aae15f590b72b6759535b6b7d3c", 232960 }, { "TZONE4G.NIB", 0, "ede4113a9c9e17745faf71d099808a18", 232960 }, { "TZONE4H.NIB", 0, "f95dae4aae1155a27f7120230464d4e1", 232960 }, { "TZONE5I.NIB", 0, "92b3b376877f81a7b7ae426bf1e65456", 232960 }, { "TZONE5J.NIB", 0, "c9ef796fa596548dbf8f085901f0bac3", 232960 }, { "TZONE6K.NIB", 0, "2e5323be637002efce1d4c813ae20a3f", 232960 }, { "TZONE6L.NIB", 0, "7c9268f0ea2d02120c77a46337b3d975", 232960 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_UNSTABLE, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES5 }, { // Hi-Res Adventure #6: The Dark Crystal - Apple II - Roberta Williams Anthology { "hires6", 0, { { "DARK1A.DSK", 0, "00c2646d6943d1405717332a6f42d493", 143360 }, { "DARK2A.NIB", 0, "271eb92db107e8d5829437f8ba77991e", 232960 }, { "DARK1B.NIB", 0, "dbedd736617343ade0e6bead8bf2b10c", 232960 }, { "DARK2B.NIB", 0, "cb72044a9b391c4285f4752f746bea2e", 232960 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_UNSTABLE, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES6 }, { AD_TABLE_END_MARKER, GAME_TYPE_NONE } }; class AdlMetaEngine : public AdvancedMetaEngine { public: AdlMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(AdlGameDescription), adlGames, optionsList) { } const char *getName() const { return "ADL"; } const char *getOriginalCopyright() const { return "Copyright (C) Sierra On-Line"; } bool hasFeature(MetaEngineFeature f) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; int getMaximumSaveSlot() const { return 'O' - 'A'; } SaveStateList listSaves(const char *target) const; void removeSaveState(const char *target, int slot) const; bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; }; bool AdlMetaEngine::hasFeature(MetaEngineFeature f) const { switch(f) { case kSupportsListSaves: case kSupportsLoadingDuringStartup: case kSupportsDeleteSave: case kSavesSupportMetaInfo: case kSavesSupportThumbnail: case kSavesSupportCreationDate: case kSavesSupportPlayTime: case kSimpleSavesNames: return true; default: return false; } } SaveStateDescriptor AdlMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.s%02d", target, slot); Common::InSaveFile *inFile = g_system->getSavefileManager()->openForLoading(fileName); if (!inFile) return SaveStateDescriptor(); if (inFile->readUint32BE() != MKTAG('A', 'D', 'L', ':')) { delete inFile; return SaveStateDescriptor(); } byte saveVersion = inFile->readByte(); if (saveVersion != SAVEGAME_VERSION) { delete inFile; return SaveStateDescriptor(); } char name[SAVEGAME_NAME_LEN] = { }; inFile->read(name, sizeof(name) - 1); inFile->readByte(); if (inFile->eos() || inFile->err()) { delete inFile; return SaveStateDescriptor(); } SaveStateDescriptor sd(slot, name); int year = inFile->readUint16BE(); int month = inFile->readByte(); int day = inFile->readByte(); sd.setSaveDate(year + 1900, month + 1, day); int hour = inFile->readByte(); int minutes = inFile->readByte(); sd.setSaveTime(hour, minutes); uint32 playTime = inFile->readUint32BE(); sd.setPlayTime(playTime); if (inFile->eos() || inFile->err()) { delete inFile; return SaveStateDescriptor(); } Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*inFile); sd.setThumbnail(thumbnail); delete inFile; return sd; } SaveStateList AdlMetaEngine::listSaves(const char *target) const { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::StringArray files = saveFileMan->listSavefiles(Common::String(target) + ".s##"); SaveStateList saveList; for (uint i = 0; i < files.size(); ++i) { const Common::String &fileName = files[i]; Common::InSaveFile *inFile = saveFileMan->openForLoading(fileName); if (!inFile) { warning("Cannot open save file '%s'", fileName.c_str()); continue; } if (inFile->readUint32BE() != MKTAG('A', 'D', 'L', ':')) { warning("No header found in '%s'", fileName.c_str()); delete inFile; continue; } byte saveVersion = inFile->readByte(); if (saveVersion != SAVEGAME_VERSION) { warning("Unsupported save game version %i found in '%s'", saveVersion, fileName.c_str()); delete inFile; continue; } char name[SAVEGAME_NAME_LEN] = { }; inFile->read(name, sizeof(name) - 1); delete inFile; int slotNum = atoi(fileName.c_str() + fileName.size() - 2); SaveStateDescriptor sd(slotNum, name); saveList.push_back(sd); } // Sort saves based on slot number. Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator()); return saveList; } void AdlMetaEngine::removeSaveState(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.s%02d", target, slot); g_system->getSavefileManager()->removeSavefile(fileName); } Engine *HiRes1Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes2Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes0Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes4Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes5Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes6Engine_create(OSystem *syst, const AdlGameDescription *gd); bool AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { if (!gd) return false; const AdlGameDescription *adlGd = (const AdlGameDescription *)gd; switch (adlGd->gameType) { case GAME_TYPE_HIRES1: *engine = HiRes1Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES2: *engine = HiRes2Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES0: *engine = HiRes0Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES4: *engine = HiRes4Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES5: *engine = HiRes5Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES6: *engine = HiRes6Engine_create(syst, adlGd); break; default: error("Unknown GameType"); } return true; } } // End of namespace Adl
WintermuteMetaEngine() : AdvancedMetaEngine(Wintermute::gameDescriptions, sizeof(WMEGameDescription), Wintermute::wintermuteGames, gameGuiOptions) { _guioptions = GUIO2(GUIO_NOMIDI, GAMEOPTION_SHOW_FPS); _maxScanDepth = 2; _directoryGlobs = directoryGlobs; }
LastExpressMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(ADGameDescription), lastExpressGames) { _singleId = "lastexpress"; _guiOptions = GUIO2(GUIO_NOSUBTITLES, GUIO_NOSFX); }
namespace Adl { // Mystery House was designed for monochrome display, so we default to // monochrome mode there. All the other games default to color mode. #define GAMEOPTION_COLOR_DEFAULT_OFF GUIO_GAMEOPTIONS1 #define GAMEOPTION_SCANLINES GUIO_GAMEOPTIONS2 #define GAMEOPTION_COLOR_DEFAULT_ON GUIO_GAMEOPTIONS3 static const ADExtraGuiOptionsMap optionsList[] = { { GAMEOPTION_COLOR_DEFAULT_OFF, { _s("Color mode"), _s("Use color graphics"), "color", false } }, { GAMEOPTION_COLOR_DEFAULT_ON, { _s("Color mode"), _s("Use color graphics"), "color", true } }, { GAMEOPTION_SCANLINES, { _s("Scanlines"), _s("Show scanlines"), "scanlines", false } }, AD_EXTRA_GUI_OPTIONS_TERMINATOR }; static const PlainGameDescriptor adlGames[] = { { "hires0", "Hi-Res Adventure #0: Mission Asteroid" }, { "hires1", "Hi-Res Adventure #1: Mystery House" }, { "hires2", "Hi-Res Adventure #2: Wizard and the Princess" }, { "hires3", "Hi-Res Adventure #3: Cranston Manor" }, { "hires4", "Hi-Res Adventure #4: Ulysses and the Golden Fleece" }, { "hires5", "Hi-Res Adventure #5: Time Zone" }, { "hires6", "Hi-Res Adventure #6: The Dark Crystal" }, { 0, 0 } }; struct AdlGameDescription { ADGameDescription desc; GameType gameType; GameVersion version; }; static const AdlGameDescription gameFileDescriptions[] = { { // Hi-Res Adventure #1: Mystery House - Apple II - Contains Simi Valley address { "hires1", 0, { { "ADVENTURE", 0, "22d9e63a11d69fa033ba1738715ad09a", 29952 }, { "AUTO LOAD OBJ", 0, "a2ab7be25842e1fa9f1343b0894a8b6f", 4095 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES1, GAME_VER_HR1_SIMI }, { // Hi-Res Adventure #1: Mystery House - Apple II - Contains Coarsegold address { "hires1", 0, { { "ADVENTURE", 0, "22d9e63a11d69fa033ba1738715ad09a", 29952 }, { "AUTO LOAD OBJ", 0, "f6a6ac60c04c6ba6dff68b92cc279ba2", 12291 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES1, GAME_VER_HR1_COARSE }, { // Hi-Res Adventure #1: Mystery House - Apple II - Roberta Williams Anthology { "hires1", 0, { { "ADVENTURE", 0, "22d9e63a11d69fa033ba1738715ad09a", 29952 }, { "AUTO LOAD OBJ", 0, "23bfccfe9fcff9b22cf6c41bde9078ac", 12291 }, { "MYSTERY.HELLO", 0, "2289b7fea300b506e902a4c597968369", 836 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES1, GAME_VER_HR1_PD }, { AD_TABLE_END_MARKER, GAME_TYPE_NONE, GAME_VER_NONE } }; static const AdlGameDescription gameDiskDescriptions[] = { { // Hi-Res Adventure #1: Mystery House - Apple II - Contains Coarsegold address { "hires1", 0, { { "mysthous", 0, "8df0b3b3e609a2e40237e2419c1cb767", 116480 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES1, GAME_VER_HR1_COARSE }, { // Hi-Res Adventure #1: Mystery House - Apple II - Roberta Williams Anthology { "hires1", 0, { { "mysthous", 0, "54d20eb1ef0084ac3c2d16c31c5b7eb7", 143360 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES1, GAME_VER_HR1_PD }, { // Hi-Res Adventure #2: Wizard and the Princess - Apple II - Roberta Williams Anthology { "hires2", 0, { { "wizard", 0, "72b114bf8f94fafe5672daac2a70c765", 143360 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES2, GAME_VER_NONE }, { // Hi-Res Adventure #0: Mission Asteroid - Apple II - Roberta Williams Anthology { "hires0", 0, { { "mission", 0, "6bc53f51a3c8ee65c020af55fb8bd875", 116480 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES0, GAME_VER_NONE }, { // Hi-Res Adventure #3: Cranston Manor - Apple II { "hires3", 0, { { "cranston", 0, "e4d35440791a36e55299c7be1ccd2b04", 116480 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES3, GAME_VER_NONE }, { // Hi-Res Adventure #4: Ulysses and the Golden Fleece - Apple II - Load 'N' Go { "hires4", 0, { { "ulyssesa", 0, "1eaeb2f1a773ce2d1cb9f16b2ef09049", 143360 }, { "ulyssesb", 1, "9fa8552255ae651b252844168b8b6617", 143360 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES4, GAME_VER_NONE }, { // Hi-Res Adventure #4: Ulysses and the Golden Fleece - Atari 8-bit - Re-release { "hires4", 0, { { "ulys1b", 0, "bb6aab9a35b41d160b6eefa088165f56", 92160 }, { "ulys1a", 0, "c227eeee34d0bacd62b2d6231c409204", 92160 }, // Load 'N' Go Software release XAG-0646 appears to be missing the second disk { "ulys2c", 0, "8c6a76d1767e4ffa2f0118c9c56c0e90", 92160 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformAtari8Bit, ADGF_UNSTABLE, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES4, GAME_VER_NONE }, { // Hi-Res Adventure #5: Time Zone - Apple II - Version 1.1 - Roberta Williams Anthology { "hires5", 0, { { "tzone1a", 2, "731844b1d19c2801e3a5bc61d109af54", 143360 }, { "tzone1b", 3, "4eaf8d790e3f93097cca9ddbe863df50", 143360 }, { "tzone2c", 4, "e3aa4f56e727339b1ec00978ce9d435b", 143360 }, { "tzone2d", 5, "77b8219a380410015c986fa192d4c3bf", 143360 }, { "tzone3e", 6, "f7acc03edd8d8aecb90711cd5f9e5593", 143360 }, { "tzone3f", 7, "ed74c056976ecea2eab07448c8a72eb8", 143360 }, { "tzone4g", 8, "de7bda8a641169fc2dedd8a7b0b7e7de", 143360 }, { "tzone4h", 9, "21cf76d97505ff09fff5d5e4711bc47c", 143360 }, { "tzone5i", 10, "d665df374e594cd0978b73c3490e5de2", 143360 }, { "tzone5j", 11, "5095be23d13201d0897b9169c4e473df", 143360 }, { "tzone6k", 12, "bef044503f21af5f0a4088e99aa778b1", 143360 }, { "tzone6l", 13, "84801b7c2ab6c09e62a2a0809b94d16a", 143360 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES5, GAME_VER_NONE }, { // Hi-Res Adventure #6: The Dark Crystal - Apple II - Roberta Williams Anthology / SierraVenture { "hires6", 0, { { "dark1a", 0, "9a5968a8f378c84454d88f4cd4e143a9", 143360 }, { "dark1b", 3, "1271ff9c3e1bdb4942301dd37dd0ef87", 143360 }, { "dark2a", 4, "090e77563add7b4c9ab25f444d727316", 143360 }, { "dark2b", 5, "f2db96af0955324900b800505af4d91f", 143360 }, AD_LISTEND }, Common::EN_ANY, Common::kPlatformApple2, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES6, GAME_VER_NONE }, { AD_TABLE_END_MARKER, GAME_TYPE_NONE, GAME_VER_NONE } }; struct DiskImageExt { Common::Platform platform; const char *extension; }; const DiskImageExt diskImageExts[] = { { Common::kPlatformApple2, ".nib" }, { Common::kPlatformApple2, ".dsk" }, { Common::kPlatformApple2, ".d13" }, { Common::kPlatformAtari8Bit, ".xfd" } }; class AdlMetaEngine : public AdvancedMetaEngine { public: AdlMetaEngine() : AdvancedMetaEngine(gameFileDescriptions, sizeof(AdlGameDescription), adlGames, optionsList) { } const char *getName() const { return "ADL"; } const char *getOriginalCopyright() const { return "Copyright (C) Sierra On-Line"; } bool hasFeature(MetaEngineFeature f) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; int getMaximumSaveSlot() const { return 'O' - 'A'; } SaveStateList listSaves(const char *target) const; void removeSaveState(const char *target, int slot) const; ADDetectedGames detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const override; bool addFileProps(const FileMap &allFiles, Common::String fname, FilePropertiesMap &filePropsMap) const; bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; }; bool AdlMetaEngine::hasFeature(MetaEngineFeature f) const { switch(f) { case kSupportsListSaves: case kSupportsLoadingDuringStartup: case kSupportsDeleteSave: case kSavesSupportMetaInfo: case kSavesSupportThumbnail: case kSavesSupportCreationDate: case kSavesSupportPlayTime: case kSimpleSavesNames: return true; default: return false; } } SaveStateDescriptor AdlMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.s%02d", target, slot); Common::InSaveFile *inFile = g_system->getSavefileManager()->openForLoading(fileName); if (!inFile) return SaveStateDescriptor(); if (inFile->readUint32BE() != MKTAG('A', 'D', 'L', ':')) { delete inFile; return SaveStateDescriptor(); } byte saveVersion = inFile->readByte(); if (saveVersion != SAVEGAME_VERSION) { delete inFile; return SaveStateDescriptor(); } char name[SAVEGAME_NAME_LEN] = { }; inFile->read(name, sizeof(name) - 1); inFile->readByte(); if (inFile->eos() || inFile->err()) { delete inFile; return SaveStateDescriptor(); } SaveStateDescriptor sd(slot, name); int year = inFile->readUint16BE(); int month = inFile->readByte(); int day = inFile->readByte(); sd.setSaveDate(year + 1900, month + 1, day); int hour = inFile->readByte(); int minutes = inFile->readByte(); sd.setSaveTime(hour, minutes); uint32 playTime = inFile->readUint32BE(); sd.setPlayTime(playTime); if (inFile->eos() || inFile->err()) { delete inFile; return SaveStateDescriptor(); } Graphics::Surface *thumbnail; if (!Graphics::loadThumbnail(*inFile, thumbnail)) { delete inFile; return SaveStateDescriptor(); } sd.setThumbnail(thumbnail); delete inFile; return sd; } SaveStateList AdlMetaEngine::listSaves(const char *target) const { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::StringArray files = saveFileMan->listSavefiles(Common::String(target) + ".s##"); SaveStateList saveList; for (uint i = 0; i < files.size(); ++i) { const Common::String &fileName = files[i]; Common::InSaveFile *inFile = saveFileMan->openForLoading(fileName); if (!inFile) { warning("Cannot open save file '%s'", fileName.c_str()); continue; } if (inFile->readUint32BE() != MKTAG('A', 'D', 'L', ':')) { warning("No header found in '%s'", fileName.c_str()); delete inFile; continue; } byte saveVersion = inFile->readByte(); if (saveVersion != SAVEGAME_VERSION) { warning("Unsupported save game version %i found in '%s'", saveVersion, fileName.c_str()); delete inFile; continue; } char name[SAVEGAME_NAME_LEN] = { }; inFile->read(name, sizeof(name) - 1); delete inFile; int slotNum = atoi(fileName.c_str() + fileName.size() - 2); SaveStateDescriptor sd(slotNum, name); saveList.push_back(sd); } // Sort saves based on slot number. Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator()); return saveList; } void AdlMetaEngine::removeSaveState(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.s%02d", target, slot); g_system->getSavefileManager()->removeSavefile(fileName); } Common::String getDiskImageName(const AdlGameDescription &adlDesc, byte volume) { const ADGameDescription &desc = adlDesc.desc; for (uint i = 0; desc.filesDescriptions[i].fileName; ++i) { const ADGameFileDescription &fDesc = desc.filesDescriptions[i]; if (fDesc.fileType == volume) { for (uint e = 0; e < ARRAYSIZE(diskImageExts); ++e) { if (diskImageExts[e].platform == desc.platform) { Common::String testFileName(fDesc.fileName); testFileName += diskImageExts[e].extension; if (Common::File::exists(testFileName)) return testFileName; } } error("Failed to find disk image '%s'", fDesc.fileName); } } error("Disk volume %d not found", volume); } GameType getGameType(const AdlGameDescription &adlDesc) { return adlDesc.gameType; } GameVersion getGameVersion(const AdlGameDescription &adlDesc) { return adlDesc.version; } Common::Platform getPlatform(const AdlGameDescription &adlDesc) { return adlDesc.desc.platform; } bool AdlMetaEngine::addFileProps(const FileMap &allFiles, Common::String fname, FilePropertiesMap &filePropsMap) const { if (filePropsMap.contains(fname)) return true; if (!allFiles.contains(fname)) return false; FileProperties fileProps; fileProps.size = computeMD5(allFiles[fname], fileProps.md5, 16384); if (fileProps.size != -1) { debug(3, "> '%s': '%s'", fname.c_str(), fileProps.md5.c_str()); filePropsMap[fname] = fileProps; } return true; } // Based on AdvancedMetaEngine::detectGame ADDetectedGames AdlMetaEngine::detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const { // We run the file-based detector first and then add to the returned list ADDetectedGames matched = AdvancedMetaEngine::detectGame(parent, allFiles, language, platform, extra); debug(3, "Starting disk image detection in dir '%s'", parent.getPath().c_str()); FilePropertiesMap filesProps; bool gotAnyMatchesWithAllFiles = false; for (uint g = 0; gameDiskDescriptions[g].desc.gameId != 0; ++g) { ADDetectedGame game(&gameDiskDescriptions[g].desc); // Skip games that don't meet the language/platform/extra criteria if (language != Common::UNK_LANG && game.desc->language != Common::UNK_LANG) { if (game.desc->language != language && !(language == Common::EN_ANY && (game.desc->flags & ADGF_ADDENGLISH))) continue; } if (platform != Common::kPlatformUnknown && game.desc->platform != Common::kPlatformUnknown && game.desc->platform != platform) continue; if ((_flags & kADFlagUseExtraAsHint) && !extra.empty() && game.desc->extra != extra) continue; bool allFilesPresent = true; for (uint f = 0; game.desc->filesDescriptions[f].fileName; ++f) { const ADGameFileDescription &fDesc = game.desc->filesDescriptions[f]; Common::String fileName; bool foundDiskImage = false; for (uint e = 0; e < ARRAYSIZE(diskImageExts); ++e) { if (diskImageExts[e].platform == game.desc->platform) { Common::String testFileName(fDesc.fileName); testFileName += diskImageExts[e].extension; if (addFileProps(allFiles, testFileName, filesProps)) { if (foundDiskImage) { warning("Ignoring '%s' (already found '%s')", testFileName.c_str(), fileName.c_str()); filesProps.erase(testFileName); } else { foundDiskImage = true; fileName = testFileName; } } } } if (!foundDiskImage) { allFilesPresent = false; break; } game.matchedFiles[fileName] = filesProps[fileName]; if (game.hasUnknownFiles) continue; if (fDesc.md5 && fDesc.md5 != filesProps[fileName].md5) { debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fDesc.md5, filesProps[fileName].md5.c_str()); game.hasUnknownFiles = true; continue; } if (fDesc.fileSize != -1 && fDesc.fileSize != filesProps[fileName].size) { debug(3, "Size Mismatch. Skipping"); game.hasUnknownFiles = true; continue; } debug(3, "Matched file: %s", fileName.c_str()); } if (allFilesPresent && !game.hasUnknownFiles) { debug(2, "Found game: %s (%s/%s) (%d)", game.desc->gameId, getPlatformDescription(game.desc->platform), getLanguageDescription(game.desc->language), g); gotAnyMatchesWithAllFiles = true; matched.push_back(game); } else { if (allFilesPresent && !gotAnyMatchesWithAllFiles) { if (matched.empty() || strcmp(matched.back().desc->gameId, game.desc->gameId) != 0) matched.push_back(game); } debug(5, "Skipping game: %s (%s/%s) (%d)", game.desc->gameId, getPlatformDescription(game.desc->platform), getLanguageDescription(game.desc->language), g); } } return matched; } Engine *HiRes1Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes2Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes0Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes3Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes4Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes5Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes6Engine_create(OSystem *syst, const AdlGameDescription *gd); bool AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { if (!gd) return false; const AdlGameDescription *adlGd = (const AdlGameDescription *)gd; switch (adlGd->gameType) { case GAME_TYPE_HIRES1: *engine = HiRes1Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES2: *engine = HiRes2Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES0: *engine = HiRes0Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES3: *engine = HiRes3Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES4: *engine = HiRes4Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES5: *engine = HiRes5Engine_create(syst, adlGd); break; case GAME_TYPE_HIRES6: *engine = HiRes6Engine_create(syst, adlGd); break; default: error("Unknown GameType"); } return true; } } // End of namespace Adl