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


Generated on Sat Sep 26 2020 05:00:54 for ResidualVM by doxygen 1.7.1
curved edge   curved edge