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

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         _guiOptions = GUIO5(GUIO_NOMIDI, GUIO_NOSFX, GUIO_NOSPEECH, GUIO_NOSUBTITLES, GAMEOPTION_WIDESCREEN_MOD);
00207         _maxScanDepth = 3;
00208         _directoryGlobs = directoryGlobs;
00209     }
00210 
00211     const char *getName() const override {
00212         return "Myst III";
00213     }
00214 
00215     const char *getEngineId() const override {
00216         return "myst3";
00217     }
00218 
00219     const char *getOriginalCopyright() const override {
00220         return "Myst III Exile (C) Presto Studios";
00221     }
00222 
00223     bool hasFeature(MetaEngineFeature f) const override {
00224         return
00225             (f == kSupportsListSaves) ||
00226             (f == kSupportsDeleteSave) ||
00227             (f == kSupportsLoadingDuringStartup) ||
00228             (f == kSavesSupportMetaInfo) ||
00229             (f == kSavesSupportThumbnail) ||
00230             (f == kSavesSupportCreationDate) ||
00231             (f == kSavesSupportPlayTime);
00232     }
00233 
00234     SaveStateList listSaves(const char *target) const override {
00235         Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", target));
00236         Common::StringArray filenames = Saves::list(g_system->getSavefileManager(), platform);
00237 
00238         SaveStateList saveList;
00239         for (uint32 i = 0; i < filenames.size(); i++)
00240             saveList.push_back(SaveStateDescriptor(i, filenames[i]));
00241 
00242         return saveList;
00243     }
00244 
00245     SaveStateDescriptor getSaveDescription(const char *target, int slot) const {
00246         SaveStateList saves = listSaves(target);
00247 
00248         SaveStateDescriptor description;
00249         for (uint32 i = 0; i < saves.size(); i++) {
00250             if (saves[i].getSaveSlot() == slot) {
00251                 description = saves[i];
00252             }
00253         }
00254 
00255         return description;
00256     }
00257 
00258     SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override {
00259         SaveStateDescriptor saveInfos = getSaveDescription(target, slot);
00260 
00261         if (saveInfos.getDescription().empty()) {
00262             // Unused slot
00263             return SaveStateDescriptor();
00264         }
00265 
00266         // Open save
00267         Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(saveInfos.getDescription());
00268         if (!saveFile) {
00269             warning("Unable to open file %s for reading, slot %d", saveInfos.getDescription().c_str(), slot);
00270             return SaveStateDescriptor();
00271         }
00272 
00273         // Read state data
00274         Common::Serializer s = Common::Serializer(saveFile, 0);
00275         GameState::StateData data;
00276         data.syncWithSaveGame(s);
00277 
00278         // Read and resize the thumbnail
00279         Graphics::Surface *saveThumb = GameState::readThumbnail(saveFile);
00280         Graphics::Surface *guiThumb = GameState::resizeThumbnail(saveThumb, kThumbnailWidth, kThumbnailHeight1);
00281         saveThumb->free();
00282         delete saveThumb;
00283 
00284         // Set metadata
00285         saveInfos.setThumbnail(guiThumb);
00286         saveInfos.setPlayTime(data.secondsPlayed * 1000);
00287 
00288         if (data.saveYear != 0) {
00289             saveInfos.setSaveDate(data.saveYear, data.saveMonth, data.saveDay);
00290             saveInfos.setSaveTime(data.saveHour, data.saveMinute);
00291         }
00292 
00293         if (data.saveDescription != "")
00294             saveInfos.setDescription(data.saveDescription);
00295 
00296         delete saveFile;
00297 
00298         return saveInfos;
00299     }
00300 
00301     void removeSaveState(const char *target, int slot) const override {
00302         SaveStateDescriptor saveInfos = getSaveDescription(target, slot);
00303         g_system->getSavefileManager()->removeSavefile(saveInfos.getDescription());
00304     }
00305 
00306     int getMaximumSaveSlot() const override {
00307         return 999;
00308     }
00309 
00310     bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
00311 };
00312 
00313 bool Myst3MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
00314     const Myst3GameDescription *gd = (const Myst3GameDescription *)desc;
00315     if (gd) {
00316         *engine = new Myst3Engine(syst, gd);
00317     }
00318     return gd != 0;
00319 }
00320 
00321 Common::Platform Myst3Engine::getPlatform() const {
00322     return _gameDescription->desc.platform;
00323 }
00324 
00325 Common::Language Myst3Engine::getGameLanguage() const {
00326     return _gameDescription->desc.language;
00327 }
00328 
00329 uint32 Myst3Engine::getGameLocalizationType() const {
00330     return _gameDescription->localizationType;
00331 }
00332 
00333 } // End of namespace Myst3
00334 
00335 #if PLUGIN_ENABLED_DYNAMIC(MYST3)
00336     REGISTER_PLUGIN_DYNAMIC(MYST3, PLUGIN_TYPE_ENGINE, Myst3::Myst3MetaEngine);
00337 #else
00338     REGISTER_PLUGIN_STATIC(MYST3, PLUGIN_TYPE_ENGINE, Myst3::Myst3MetaEngine);
00339 #endif


Generated on Sat Jan 18 2020 05:00:32 for ResidualVM by doxygen 1.7.1
curved edge   curved edge