ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

myst3/detection.cpp

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "engines/advancedDetector.h"
00024 
00025 #include "engines/myst3/database.h"
00026 #include "engines/myst3/gfx.h"
00027 #include "engines/myst3/state.h"
00028 
00029 #include "common/config-manager.h"
00030 #include "common/savefile.h"
00031 #include "common/translation.h"
00032 
00033 #include "graphics/scaler.h"
00034 
00035 namespace Myst3 {
00036 
00037 struct Myst3GameDescription {
00038     ADGameDescription desc;
00039     uint32 localizationType;
00040 };
00041 
00042 static const PlainGameDescriptor myst3Games[] = {
00043     { "myst3", "Myst III Exile" },
00044     { 0, 0 }
00045 };
00046 
00047 static const char *directoryGlobs[] = {
00048     "bin",
00049     "M3Data",
00050     "MYST3BIN",
00051     "TEXT",
00052     0
00053 };
00054 
00055 #define MYST3ENTRY(lang, langFile, md5lang, extra, flags)                       \
00056 {                                                                               \
00057     {                                                                           \
00058         "myst3",                                                                \
00059         extra,                                                                  \
00060         {                                                                       \
00061             { "RSRC.m3r", 0, "a2c8ed69800f60bf5667e5c76a88e481", 1223862 },     \
00062             { langFile, 0, md5lang, -1 },                                       \
00063         },                                                                      \
00064         lang,                                                                   \
00065         Common::kPlatformWindows,                                               \
00066         ADGF_NO_FLAGS,                                                          \
00067         GUIO_NONE                                                               \
00068     },                                                                          \
00069     flags                                                                       \
00070 },
00071 
00072 #define MYST3ENTRY_DVD(lang, langFile, md5lang, extra, flags)                   \
00073 {                                                                               \
00074     {                                                                           \
00075         "myst3",                                                                \
00076         extra,                                                                  \
00077         {                                                                       \
00078             { "RSRC.m3r",    0, "a2c8ed69800f60bf5667e5c76a88e481", 1223862 },  \
00079             { "ENGLISH.m3t", 0, "74726de866c0594d3f2a05ff754c973d", 3407120 },  \
00080             { langFile, 0, md5lang, -1 },                                       \
00081         },                                                                      \
00082         lang,                                                                   \
00083         Common::kPlatformWindows,                                               \
00084         ADGF_NO_FLAGS,                                                          \
00085         GUIO_NONE                                                               \
00086     },                                                                          \
00087     flags                                                                       \
00088 },
00089 
00090 #define MYST3ENTRY_XBOX(lang, langFile, md5lang)                                \
00091 {                                                                               \
00092     {                                                                           \
00093         "myst3",                                                                \
00094         0,                                                                      \
00095         {                                                                       \
00096             { "RSRC.m3r", 0, "3de23eb5a036a62819186105478f9dde", 1226192 },     \
00097             { langFile, 0, md5lang, -1 },                                       \
00098         },                                                                      \
00099         lang,                                                                   \
00100         Common::kPlatformXbox,                                                  \
00101         ADGF_UNSTABLE,                                                          \
00102         GUIO_NONE                                                               \
00103     },                                                                          \
00104     kLocMulti6                                                                  \
00105 },
00106 
00107 
00108 static const Myst3GameDescription gameDescriptions[] = {
00109     // Initial US release (English only)
00110     MYST3ENTRY(Common::EN_ANY, "ENGLISH.m3t",  "3ca92b097c4319a2ace7fd6e911d6b0f", 0, kLocMonolingual)
00111 
00112     // European releases (Country language + English) (1.2)
00113     MYST3ENTRY(Common::NL_NLD, "DUTCH.m3u",    "0e8019cfaeb58c2de00ac114cf122220", 0, kLocMulti2)
00114     MYST3ENTRY(Common::FR_FRA, "FRENCH.m3u",   "3a7e270c686806dfc31c2091e09c03ec", 0, kLocMulti2)
00115     MYST3ENTRY(Common::DE_DEU, "GERMAN.m3u",   "1b2fa162a951fa4ed65617dd3f0c8a53", 0, kLocMulti2) // #1323, andrews05
00116     MYST3ENTRY(Common::IT_ITA, "ITALIAN.m3u",  "906645a87ac1cbbd2b88c277c2b4fda2", 0, kLocMulti2) // #1323, andrews05
00117     MYST3ENTRY(Common::ES_ESP, "SPANISH.m3u",  "28003569d9536cbdf6020aee8e9bcd15", 0, kLocMulti2) // #1323, goodoldgeorge
00118     MYST3ENTRY(Common::PL_POL, "POLISH.m3u",   "8075e4e822e100ec79a5842a530dbe24", 0, kLocMulti2)
00119 
00120     // Russian release (Russian only) (1.2)
00121     MYST3ENTRY(Common::RU_RUS, "ENGLISH.m3t",  "57d36d8610043fda554a0708d71d2681", 0, kLocMonolingual)
00122 
00123     // Hebrew release (Hebrew only) (1.2 - Patched using the patch CD)
00124     MYST3ENTRY(Common::HE_ISR, "HEBREW.m3u",  "16fbbe420fed366249a8d44a759f966c", 0, kLocMonolingual) // #1348, BLooperZ
00125 
00126     // Japanese release (1.2)
00127     MYST3ENTRY(Common::JA_JPN, "JAPANESE.m3u", "21bbd040bcfadd13b9dc84360c3de01d", 0, kLocMulti2)
00128     MYST3ENTRY(Common::JA_JPN, "JAPANESE.m3u", "1e7c3156417978a1187fa6bc0e2cfafc", "Subtitles only", kLocMulti2)
00129 
00130     // Multilingual CD release (1.21)
00131     MYST3ENTRY(Common::EN_ANY, "ENGLISH.m3u",  "b62ca55aa17724cddbbcc78cba988337", 0, kLocMulti6)
00132     MYST3ENTRY(Common::FR_FRA, "FRENCH.m3u",   "73519070cba1c7bea599adbddeae304f", 0, kLocMulti6)
00133     MYST3ENTRY(Common::NL_NLD, "DUTCH.m3u",    "c4a8d8fb0eb3fecb9c435a8517bc1f9a", 0, kLocMulti6)
00134     MYST3ENTRY(Common::DE_DEU, "GERMAN.m3u",   "5b3be343dd20f03ebdf16381b873f035", 0, kLocMulti6)
00135     MYST3ENTRY(Common::IT_ITA, "ITALIAN.m3u",  "73db43aac3fe8671e2c4e227977fbb61", 0, kLocMulti6)
00136     MYST3ENTRY(Common::ES_ESP, "SPANISH.m3u",  "55ceb165dad02211ef2d25946c3aac8e", 0, kLocMulti6)
00137 
00138     // DVD releases (1.27)
00139     MYST3ENTRY_DVD(Common::EN_ANY, "ENGLISH.m3u",  "e200b416f43e70fee76148a80d195d5c", "DVD", kLocMulti6)
00140     MYST3ENTRY_DVD(Common::FR_FRA, "FRENCH.m3u",   "5679ce65c5e9af8899835ef9af398f1a", "DVD", kLocMulti6)
00141     MYST3ENTRY_DVD(Common::NL_NLD, "DUTCH.m3u",    "2997afdb4306c573153fdbb391ed2fff", "DVD", kLocMulti6)
00142     MYST3ENTRY_DVD(Common::DE_DEU, "GERMAN.m3u",   "09f32e6ceb414463e8fc22ca1a9564d3", "DVD", kLocMulti6)
00143     MYST3ENTRY_DVD(Common::IT_ITA, "ITALIAN.m3u",  "51fb02f6bf37dde811d7cde648365260", "DVD", kLocMulti6)
00144     MYST3ENTRY_DVD(Common::ES_ESP, "SPANISH.m3u",  "e27e610fe8ce35223a3239ff170a85ec", "DVD", kLocMulti6)
00145 
00146     // Myst 3 Xbox (PAL)
00147     MYST3ENTRY_XBOX(Common::EN_ANY, "ENGLISHX.m3t", "c4d012ab02b8ca7d0c7e79f4dbd4e676")
00148     MYST3ENTRY_XBOX(Common::FR_FRA, "FRENCHX.m3t",  "94c9dcdec8794751e4d773776552751a")
00149     MYST3ENTRY_XBOX(Common::DE_DEU, "GERMANX.m3t",  "b9b66fcd5d4fbb95ac2d7157577991a5")
00150     MYST3ENTRY_XBOX(Common::IT_ITA, "ITALIANX.m3t", "3ca266019eba68123f6b7cae57cfc200")
00151     MYST3ENTRY_XBOX(Common::ES_ESP, "SPANISHX.m3t", "a9aca36ccf6709164249f3fb6b1ef148")
00152 
00153     // Myst 3 Xbox (RUS)
00154     MYST3ENTRY_XBOX(Common::RU_RUS, "ENGLISHX.m3t", "18cb50f5c5317586a128ca9eb3e03279")
00155 
00156 //  {
00157 //      // Myst 3 PS2 (NTSC-U/C)
00158 //      {
00159 //          "myst3",
00160 //          0,
00161 //          AD_ENTRY1s("RSRC.m3r", "c60d37bfd3bb8b0bee143018447bb460", 346618151),
00162 //          Common::UNK_LANG,
00163 //          Common::kPlatformPS2,
00164 //          ADGF_UNSTABLE,
00165 //          GUIO_NONE
00166 //      },
00167 //      kFlagDVD
00168 //  },
00169 //
00170 //  {
00171 //      // Myst 3 PS2 (PAL)
00172 //      {
00173 //          "myst3",
00174 //          0,
00175 //          AD_ENTRY1s("RSRC.m3r", "f0e0c502f77157e6b5272686c661ea75", 91371793),
00176 //          Common::UNK_LANG,
00177 //          Common::kPlatformPS2,
00178 //          ADGF_UNSTABLE,
00179 //          GUIO_NONE
00180 //      },
00181 //      kFlagDVD
00182 //  },
00183 
00184     { AD_TABLE_END_MARKER, 0 }
00185 };
00186 
00187 #define GAMEOPTION_WIDESCREEN_MOD GUIO_GAMEOPTIONS1
00188 
00189 static const ADExtraGuiOptionsMap optionsList[] = {
00190     {
00191         GAMEOPTION_WIDESCREEN_MOD,
00192         {
00193             _s("Widescreen mod"),
00194             _s("Enable enable widescreen rendering in fullscreen mode."),
00195             "widescreen_mod",
00196             false
00197         }
00198     },
00199 
00200     AD_EXTRA_GUI_OPTIONS_TERMINATOR
00201 };
00202 
00203 class Myst3MetaEngine : public AdvancedMetaEngine {
00204 public:
00205     Myst3MetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(Myst3GameDescription), myst3Games, optionsList) {
00206         _singleId = "myst3";
00207         _guiOptions = GUIO5(GUIO_NOMIDI, GUIO_NOSFX, GUIO_NOSPEECH, GUIO_NOSUBTITLES, GAMEOPTION_WIDESCREEN_MOD);
00208         _maxScanDepth = 3;
00209         _directoryGlobs = directoryGlobs;
00210     }
00211 
00212     virtual const char *getName() const {
00213         return "Myst III Engine";
00214     }
00215 
00216     virtual const char *getOriginalCopyright() const {
00217         return "Myst III Exile (C) Presto Studios";
00218     }
00219 
00220     virtual bool hasFeature(MetaEngineFeature f) const {
00221         return
00222             (f == kSupportsListSaves) ||
00223             (f == kSupportsDeleteSave) ||
00224             (f == kSupportsLoadingDuringStartup) ||
00225             (f == kSavesSupportMetaInfo) ||
00226             (f == kSavesSupportThumbnail) ||
00227             (f == kSavesSupportCreationDate) ||
00228             (f == kSavesSupportPlayTime);
00229     }
00230 
00231     virtual SaveStateList listSaves(const char *target) const {
00232         Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", target));
00233         Common::StringArray filenames = Saves::list(g_system->getSavefileManager(), platform);
00234 
00235         SaveStateList saveList;
00236         for (uint32 i = 0; i < filenames.size(); i++)
00237             saveList.push_back(SaveStateDescriptor(i, filenames[i]));
00238 
00239         return saveList;
00240     }
00241 
00242     SaveStateDescriptor getSaveDescription(const char *target, int slot) const {
00243         SaveStateList saves = listSaves(target);
00244 
00245         SaveStateDescriptor description;
00246         for (uint32 i = 0; i < saves.size(); i++) {
00247             if (saves[i].getSaveSlot() == slot) {
00248                 description = saves[i];
00249             }
00250         }
00251 
00252         return description;
00253     }
00254 
00255     virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const {
00256         SaveStateDescriptor saveInfos = getSaveDescription(target, slot);
00257 
00258         if (saveInfos.getDescription().empty()) {
00259             // Unused slot
00260             return SaveStateDescriptor();
00261         }
00262 
00263         // Open save
00264         Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(saveInfos.getDescription());
00265 
00266         // Read state data
00267         Common::Serializer s = Common::Serializer(saveFile, 0);
00268         GameState::StateData data;
00269         data.syncWithSaveGame(s);
00270 
00271         // Read and resize the thumbnail
00272         Graphics::Surface *saveThumb = GameState::readThumbnail(saveFile);
00273         Graphics::Surface *guiThumb = GameState::resizeThumbnail(saveThumb, kThumbnailWidth, kThumbnailHeight1);
00274         saveThumb->free();
00275         delete saveThumb;
00276 
00277         // Set metadata
00278         saveInfos.setThumbnail(guiThumb);
00279         saveInfos.setPlayTime(data.secondsPlayed * 1000);
00280 
00281         if (data.saveYear != 0) {
00282             saveInfos.setSaveDate(data.saveYear, data.saveMonth, data.saveDay);
00283             saveInfos.setSaveTime(data.saveHour, data.saveMinute);
00284         }
00285 
00286         if (data.saveDescription != "")
00287             saveInfos.setDescription(data.saveDescription);
00288 
00289         delete saveFile;
00290 
00291         return saveInfos;
00292     }
00293 
00294     void removeSaveState(const char *target, int slot) const {
00295         SaveStateDescriptor saveInfos = getSaveDescription(target, slot);
00296         g_system->getSavefileManager()->removeSavefile(saveInfos.getDescription());
00297     }
00298 
00299     virtual int getMaximumSaveSlot() const {
00300         return 999;
00301     }
00302 
00303     virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
00304 };
00305 
00306 bool Myst3MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
00307     const Myst3GameDescription *gd = (const Myst3GameDescription *)desc;
00308     if (gd) {
00309         *engine = new Myst3Engine(syst, gd);
00310     }
00311     return gd != 0;
00312 }
00313 
00314 Common::Platform Myst3Engine::getPlatform() const {
00315     return _gameDescription->desc.platform;
00316 }
00317 
00318 Common::Language Myst3Engine::getGameLanguage() const {
00319     return _gameDescription->desc.language;
00320 }
00321 
00322 uint32 Myst3Engine::getGameLocalizationType() const {
00323     return _gameDescription->localizationType;
00324 }
00325 
00326 } // End of namespace Myst3
00327 
00328 #if PLUGIN_ENABLED_DYNAMIC(MYST3)
00329     REGISTER_PLUGIN_DYNAMIC(MYST3, PLUGIN_TYPE_ENGINE, Myst3::Myst3MetaEngine);
00330 #else
00331     REGISTER_PLUGIN_STATIC(MYST3, PLUGIN_TYPE_ENGINE, Myst3::Myst3MetaEngine);
00332 #endif


Generated on Sat Mar 16 2019 05:01:24 for ResidualVM by doxygen 1.7.1
curved edge   curved edge