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 #include "engines/stark/savemetadata.h"
00025 #include "engines/stark/stark.h"
00026 #include "engines/stark/services/stateprovider.h"
00027 
00028 #include "common/savefile.h"
00029 #include "common/system.h"
00030 #include "common/translation.h"
00031 
00032 namespace Stark {
00033 
00034 static const PlainGameDescriptor starkGames[] = {
00035     {"stark", "Stark Game"},
00036     {"tlj", "The Longest Journey"},
00037     {nullptr, nullptr}
00038 };
00039 
00040 static const ADGameDescription gameDescriptions[] = {
00041     // The Longest Journey
00042     // English DVD
00043     {
00044         "tlj", "DVD", {
00045             {"x.xarc", 0, "de8327850d7bba90b690b141eaa23f61", 3032},
00046             {"chapters.ini", 0, "5b5a1f1dd2297d9ce0d3d12216d5d2c5", 485},
00047             {nullptr, 0, nullptr, 0}
00048         },
00049         Common::EN_ANY,
00050         Common::kPlatformWindows,
00051         ADGF_UNSTABLE,
00052         GUIO_NONE
00053     },
00054 
00055     // The Longest Journey
00056     // GOG edition
00057     {
00058         "tlj", "GOG", {
00059             {"x.xarc", 0, "a0559457126caadab0cadac02d35f26f", 3032},
00060             {"chapters.ini", 0, "5b5a1f1dd2297d9ce0d3d12216d5d2c5", 485},
00061             {nullptr, 0, nullptr, 0}
00062         },
00063         Common::EN_ANY,
00064         Common::kPlatformWindows,
00065         ADGF_UNSTABLE,
00066         GUIO_NONE
00067     },
00068 
00069     // The Longest Journey
00070     // English Old Demo
00071     {
00072         "tlj", "Old Demo", {
00073             {"x.xarc", 0, "97abc1bb9239dee4c208e533f3c97e1c", 98},
00074             {"chapters.ini", 0, "5b5a1f1dd2297d9ce0d3d12216d5d2c5", 485},
00075             {nullptr, 0, nullptr, 0}
00076         },
00077         Common::EN_ANY,
00078         Common::kPlatformWindows,
00079         ADGF_DEMO | ADGF_UNSTABLE,
00080         GUIO_NONE
00081     },
00082 
00083     // The Longest Journey
00084     // English v1.61 Demo
00085     {
00086         "tlj", "v1.61 Demo", {
00087             {"x.xarc", 0, "61093bcd499b386ed5c0345c52f48909", 98},
00088             {"chapters.ini", 0, "5b5a1f1dd2297d9ce0d3d12216d5d2c5", 485},
00089             {nullptr, 0, nullptr, 0}
00090         },
00091         Common::EN_ANY,
00092         Common::kPlatformWindows,
00093         ADGF_DEMO | ADGF_UNSTABLE,
00094         GUIO_NONE
00095     },
00096 
00097     // The Longest Journey
00098     // French Demo
00099     {
00100         "tlj", "Demo", {
00101             {"x.xarc", 0, "97abc1bb9239dee4c208e533f3c97e1c", 98},
00102             {"chapters.ini", 0, "e54f6370dca06496069790840409cf95", 506},
00103             {nullptr, 0, nullptr, 0}
00104         },
00105         Common::FR_FRA,
00106         Common::kPlatformWindows,
00107         ADGF_DEMO | ADGF_UNSTABLE,
00108         GUIO_NONE
00109     },
00110 
00111     // The Longest Journey
00112     // Norwegian Demo
00113     {
00114         "tlj", "Demo", {
00115             {"x.xarc", 0, "97abc1bb9239dee4c208e533f3c97e1c", 98},
00116             {"chapters.ini", 0, "f358f604abd1aa1476ed05d6d271ac70", 473},
00117             {nullptr, 0, nullptr, 0}
00118         },
00119         Common::NB_NOR,
00120         Common::kPlatformWindows,
00121         ADGF_DEMO | ADGF_UNSTABLE,
00122         GUIO_NONE
00123     },
00124 
00125     // The Longest Journey
00126     // Norwegian 4 CD version - supplied by L0ngcat
00127     {
00128         "tlj", "4 CD", {
00129             {"x.xarc", 0, "a0559457126caadab0cadac02d35f26f", 3032},
00130             {"chapters.ini", 0, "f358f604abd1aa1476ed05d6d271ac70", 473},
00131             {nullptr, 0, nullptr, 0}
00132         },
00133         Common::NB_NOR,
00134         Common::kPlatformWindows,
00135         ADGF_UNSTABLE,
00136         GUIO_NONE
00137     },
00138 
00139     // The Longest Journey
00140     // Norwegian DLC-edition (DVD?)
00141     {
00142         "tlj", "DVD", {
00143             {"x.xarc", 0, "de8327850d7bba90b690b141eaa23f61", 3032},
00144             {"chapters.ini", 0, "f358f604abd1aa1476ed05d6d271ac70", 473},
00145             {nullptr, 0, nullptr, 0}
00146         },
00147         Common::NB_NOR,
00148         Common::kPlatformWindows,
00149         ADGF_UNSTABLE,
00150         GUIO_NONE
00151     },
00152 
00153     // The Longest Journey
00154     // German DVD version supplied by Vorph on the forums
00155     {
00156         "tlj", "DVD", {
00157             {"x.xarc", 0, "de8327850d7bba90b690b141eaa23f61", 3032},
00158             {"chapters.ini", 0, "e4611d143a87b263d8d7a54edc7e7cd7", 515},
00159             {nullptr, 0, nullptr, 0}
00160         },
00161         Common::DE_DEU,
00162         Common::kPlatformWindows,
00163         ADGF_UNSTABLE,
00164         GUIO_NONE
00165     },
00166 
00167     // The Longest Journey
00168     // German 4CD
00169     {
00170         "tlj", "4 CD", {
00171             {"x.xarc", 0, "a0559457126caadab0cadac02d35f26f", 3032},
00172             {"chapters.ini", 0, "e4611d143a87b263d8d7a54edc7e7cd7", 515},
00173             {nullptr, 0, nullptr, 0}
00174         },
00175         Common::DE_DEU,
00176         Common::kPlatformWindows,
00177         ADGF_UNSTABLE,
00178         GUIO_NONE
00179     },
00180     
00181     // The Longest Journey
00182     // Italian DVD version
00183     {
00184         "tlj", "DVD", {
00185             {"x.xarc", 0, "de8327850d7bba90b690b141eaa23f61", 3032},
00186             {"chapters.ini", 0, "9a81ea4e6f5b84511dd4e56d04a64e2e", 498},
00187             {nullptr, 0, nullptr, 0}
00188         },
00189         Common::IT_ITA,
00190         Common::kPlatformWindows,
00191         ADGF_UNSTABLE,
00192         GUIO_NONE
00193     },
00194 
00195     // The Longest Journey
00196     // Italian 4CD
00197     {
00198         "tlj", "4 CD", {
00199             {"x.xarc", 0, "a0559457126caadab0cadac02d35f26f", 3032},
00200             {"chapters.ini", 0, "9a81ea4e6f5b84511dd4e56d04a64e2e", 498},
00201             {nullptr, 0, nullptr, 0}
00202         },
00203         Common::IT_ITA,
00204         Common::kPlatformWindows,
00205         ADGF_UNSTABLE,
00206         GUIO_NONE
00207     },
00208 
00209     // The Longest Journey
00210     // Dutch 4CD
00211     {
00212         "tlj", "4 CD", {
00213             {"x.xarc", 0, "a0559457126caadab0cadac02d35f26f", 3032},
00214             {"chapters.ini", 0, "c8dadd9a3b41640734d6213e89cd5635", 508},
00215             {nullptr, 0, nullptr, 0}
00216         },
00217         Common::NL_NLD,
00218         Common::kPlatformWindows,
00219         ADGF_UNSTABLE,
00220         GUIO_NONE
00221     },
00222 
00223     // The Longest Journey
00224     // Spanish 4CD
00225     {
00226         "tlj", "4 CD", {
00227             {"x.xarc", 0, "a0559457126caadab0cadac02d35f26f", 3032},
00228             {"chapters.ini", 0, "3640df6d536b186bff228337284d9631", 525},
00229             {nullptr, 0, nullptr, 0}
00230         },
00231         Common::ES_ESP,
00232         Common::kPlatformWindows,
00233         ADGF_UNSTABLE,
00234         GUIO_NONE
00235     },
00236 
00237     // The Longest Journey
00238     // French 2CD
00239     {
00240         "tlj", "2 CD", {
00241             {"x.xarc", 0, "de8327850d7bba90b690b141eaa23f61", 3032},
00242             {"chapters.ini", 0, "e54f6370dca06496069790840409cf95", 506},
00243             {nullptr, 0, nullptr, 0}
00244         },
00245         Common::FR_FRA,
00246         Common::kPlatformWindows,
00247         ADGF_UNSTABLE,
00248         GUIO_NONE
00249     },
00250 
00251     // The Longest Journey
00252     // French 4CD
00253     {
00254         "tlj", "4 CD", {
00255             {"x.xarc", 0, "a0559457126caadab0cadac02d35f26f", 3032},
00256             {"chapters.ini", 0, "e54f6370dca06496069790840409cf95", 506},
00257             {nullptr, 0, nullptr, 0}
00258         },
00259         Common::FR_FRA,
00260         Common::kPlatformWindows,
00261         ADGF_UNSTABLE,
00262         GUIO_NONE
00263     },
00264 
00265     // The Longest Journey
00266     // Swedish Demo
00267     {
00268         "tlj", "Demo", {
00269             {"x.xarc", 0, "97abc1bb9239dee4c208e533f3c97e1c", 98},
00270             {"chapters.ini", 0, "f6a2007300209492b7b90b4c0467832d", 462},
00271             {nullptr, 0, nullptr, 0}
00272         },
00273         Common::SE_SWE,
00274         Common::kPlatformWindows,
00275         ADGF_DEMO | ADGF_UNSTABLE,
00276         GUIO_NONE
00277     },
00278 
00279     // The Longest Journey
00280     // Swedish 4CD
00281     {
00282         "tlj", "4 CD", {
00283             {"x.xarc", 0, "a0559457126caadab0cadac02d35f26f", 3032},
00284             {"chapters.ini", 0, "f6a2007300209492b7b90b4c0467832d", 462},
00285             {nullptr, 0, nullptr, 0}
00286         },
00287         Common::SE_SWE,
00288         Common::kPlatformWindows,
00289         ADGF_UNSTABLE,
00290         GUIO_NONE
00291     },
00292 
00293     // The Longest Journey
00294     // Swedish DVD Nordic Special Edition - supplied by L0ngcat
00295     {
00296         "tlj", "DVD", {
00297             {"x.xarc", 0, "de8327850d7bba90b690b141eaa23f61", 3032},
00298             {"chapters.ini", 0, "f6a2007300209492b7b90b4c0467832d", 462},
00299             {nullptr, 0, nullptr, 0}
00300         },
00301         Common::SE_SWE,
00302         Common::kPlatformWindows,
00303         ADGF_UNSTABLE,
00304         GUIO_NONE
00305     },
00306 
00307     // The Longest Journey
00308     // Polish 4CD
00309     {
00310         "tlj", "4 CD", {
00311             {"x.xarc", 0, "a0559457126caadab0cadac02d35f26f", 3032},
00312             {"chapters.ini", 0, "6abc5c38e6e31face4b675355b117620", 499},
00313             {nullptr, 0, nullptr, 0}
00314         },
00315         Common::PL_POL,
00316         Common::kPlatformWindows,
00317         ADGF_UNSTABLE,
00318         GUIO_NONE
00319     },
00320 
00321     // The Longest Journey
00322     // Russian 2CD by 1C
00323     {
00324         "tlj", "2 CD", {
00325             {"x.xarc", 0, "de8327850d7bba90b690b141eaa23f61", 3032},
00326             {"chapters.ini", 0, "740b97b94e97ed11f064f5fa125ebee1", 486},
00327             {nullptr, 0, nullptr, 0}
00328         },
00329         Common::RU_RUS,
00330         Common::kPlatformWindows,
00331         ADGF_UNSTABLE,
00332         GUIO_NONE
00333     },
00334 
00335     AD_TABLE_END_MARKER
00336 };
00337 
00338 #define GAMEOPTION_ASSETS_MOD       GUIO_GAMEOPTIONS1
00339 #define GAMEOPTION_LINEAR_FILTERING GUIO_GAMEOPTIONS2
00340 
00341 static const ADExtraGuiOptionsMap optionsList[] = {
00342     {
00343         GAMEOPTION_ASSETS_MOD,
00344         {
00345             _s("Load modded assets"),
00346             _s("Enable loading of external replacement assets."),
00347             "enable_assets_mod",
00348             true
00349         }
00350     },
00351     {
00352         GAMEOPTION_LINEAR_FILTERING,
00353         {
00354             _s("Enable linear filtering of the backgrounds images"),
00355             _s("When linear filtering is enabled the background graphics are smoother in full screen mode, at the cost of some details."),
00356             "use_linear_filtering",
00357             true
00358         }
00359     },
00360 
00361     AD_EXTRA_GUI_OPTIONS_TERMINATOR
00362 };
00363 
00364 class StarkMetaEngine : public AdvancedMetaEngine {
00365 public:
00366     StarkMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(ADGameDescription), starkGames, optionsList) {
00367         _singleId = "stark";
00368         _guiOptions = GUIO3(GUIO_NOMIDI, GAMEOPTION_ASSETS_MOD, GAMEOPTION_LINEAR_FILTERING);
00369     }
00370 
00371     const char *getName() const override {
00372         return "Stark Engine";
00373     }
00374 
00375     const char *getOriginalCopyright() const override {
00376         return "(C) Funcom";
00377     }
00378 
00379     bool hasFeature(MetaEngineFeature f) const override {
00380         return
00381             (f == kSupportsListSaves) ||
00382             (f == kSupportsLoadingDuringStartup) ||
00383             (f == kSupportsDeleteSave) ||
00384             (f == kSavesSupportThumbnail) ||
00385             (f == kSavesSupportMetaInfo) ||
00386             (f == kSavesSupportPlayTime) ||
00387             (f == kSavesSupportCreationDate);
00388     }
00389 
00390     int getMaximumSaveSlot() const override {
00391         return 999;
00392     }
00393 
00394     SaveStateList listSaves(const char *target) const override {
00395         Common::String pattern = Common::String::format("%s-###.tlj", target);
00396         Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
00397 
00398         int targetLen = strlen(target);
00399 
00400         SaveStateList saveList;
00401         for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
00402             // Extract the slot number from the filename
00403             char slot[4];
00404             slot[0] = (*filename)[targetLen + 1];
00405             slot[1] = (*filename)[targetLen + 2];
00406             slot[2] = (*filename)[targetLen + 3];
00407             slot[3] = '\0';
00408 
00409             // Read the description from the save
00410             Common::String description;
00411             Common::InSaveFile *save = g_system->getSavefileManager()->openForLoading(*filename);
00412             if (save) {
00413                 StateReadStream stream(save);
00414                 description = stream.readString();
00415             }
00416 
00417             saveList.push_back(SaveStateDescriptor(atoi(slot), description));
00418         }
00419 
00420         Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
00421         return saveList;
00422     }
00423 
00424     SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override {
00425         SaveStateDescriptor descriptor;
00426         if (slot == 0) {
00427             descriptor.setWriteProtectedFlag(true);
00428             descriptor.setDeletableFlag(false);
00429         }
00430 
00431         Common::String filename = StarkEngine::formatSaveName(target, slot);
00432         Common::InSaveFile *save = g_system->getSavefileManager()->openForLoading(filename);
00433         if (!save) {
00434             return descriptor;
00435         }
00436 
00437         SaveMetadata metadata;
00438         Common::ErrorCode readError = metadata.read(save, filename);
00439         if (readError != Common::kNoError) {
00440             delete save;
00441             return descriptor;
00442         }
00443 
00444         descriptor.setDescription(metadata.description);
00445 
00446         if (metadata.version >= 9) {
00447             Graphics::Surface *thumb = metadata.readGameScreenThumbnail(save);
00448             descriptor.setThumbnail(thumb);
00449             descriptor.setPlayTime(metadata.totalPlayTime);
00450             descriptor.setSaveDate(metadata.saveYear, metadata.saveMonth, metadata.saveDay);
00451             descriptor.setSaveTime(metadata.saveHour, metadata.saveMinute);
00452         }
00453 
00454         delete save;
00455 
00456         return descriptor;
00457     }
00458 
00459     void removeSaveState(const char *target, int slot) const override {
00460         Common::String filename = StarkEngine::formatSaveName(target, slot);
00461         g_system->getSavefileManager()->removeSavefile(filename);
00462     }
00463 
00464     bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override {
00465         if (desc)
00466             *engine = new StarkEngine(syst, desc);
00467 
00468         return desc != nullptr;
00469     }
00470 };
00471 
00472 } // End of namespace Stark
00473 
00474 #if PLUGIN_ENABLED_DYNAMIC(STARK)
00475     REGISTER_PLUGIN_DYNAMIC(STARK, PLUGIN_TYPE_ENGINE, Stark::StarkMetaEngine);
00476 #else
00477     REGISTER_PLUGIN_STATIC(STARK, PLUGIN_TYPE_ENGINE, Stark::StarkMetaEngine);
00478 #endif


Generated on Sat Jun 22 2019 05:00:44 for ResidualVM by doxygen 1.7.1
curved edge   curved edge