diff options
Diffstat (limited to 'engines/composer/detection.cpp')
-rw-r--r-- | engines/composer/detection.cpp | 101 |
1 files changed, 97 insertions, 4 deletions
diff --git a/engines/composer/detection.cpp b/engines/composer/detection.cpp index e250996371..8de3b33134 100644 --- a/engines/composer/detection.cpp +++ b/engines/composer/detection.cpp @@ -21,6 +21,9 @@ */ #include "base/plugins.h" +#include "common/savefile.h" +#include "common/serializer.h" +#include "common/str-array.h" #include "engines/advancedDetector.h" #include "composer/composer.h" @@ -38,7 +41,7 @@ int ComposerEngine::getGameType() const { } const char *ComposerEngine::getGameId() const { - return _gameDescription->desc.gameid; + return _gameDescription->desc.gameId; } uint32 ComposerEngine::getFeatures() const { @@ -253,6 +256,36 @@ static const ComposerGameDescription gameDescriptions[] = { GType_ComposerV2 }, + { // Provided by WindlePoons, "100% Kids Darby & Gregor" Pack. Bugreport #6825 + { + "darby", + 0, + { + {"book.ini", 0, "285308372f7dddff2ca5a25c9192cf5c", 2545}, + {"page99.rsc", 0, "40b4879e9ba6a34d6aa2a9d2e30c5ef7", 1286480}, + AD_LISTEND + }, + Common::DE_DEU, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NOASPECT) + }, + GType_ComposerV2 + }, + + { // Provided by Niv Baehr, Bugreport #6878 + { + "darby", + 0, + AD_ENTRY1("page99.rsc", "183463d18c050563dcdec2d9f9670515"), + Common::HE_ISR, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NOASPECT) + }, + GType_ComposerV2 + }, + { { "gregory", @@ -296,6 +329,23 @@ static const ComposerGameDescription gameDescriptions[] = { GType_ComposerV2 }, + { // Provided by WindlePoons, "100% Kids Darby & Gregor" Pack. Bugreport #6825 + { + "gregory", + 0, + { + {"book.ini", 0, "e54fc5c00de5f94e908a969e445af5d0", 2234}, + {"page99.rsc", 0, "1ae6610de621a9901bf87b874fbf331f", 388644}, + AD_LISTEND + }, + Common::DE_DEU, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NOASPECT) + }, + GType_ComposerV2 + }, + { // Provided by sev { "princess", @@ -386,7 +436,7 @@ static const char *directoryGlobs[] = { class ComposerMetaEngine : public AdvancedMetaEngine { public: ComposerMetaEngine() : AdvancedMetaEngine(Composer::gameDescriptions, sizeof(Composer::ComposerGameDescription), composerGames) { - _singleid = "composer"; + _singleId = "composer"; _maxScanDepth = 2; _directoryGlobs = directoryGlobs; } @@ -401,6 +451,8 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual bool hasFeature(MetaEngineFeature f) const; + virtual int getMaximumSaveSlot() const; + virtual SaveStateList listSaves(const char* target) const; }; bool ComposerMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { @@ -412,11 +464,52 @@ bool ComposerMetaEngine::createInstance(OSystem *syst, Engine **engine, const AD } bool ComposerMetaEngine::hasFeature(MetaEngineFeature f) const { - return false; + return ((f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup)); +} + +Common::String getSaveName(Common::InSaveFile *in) { + Common::Serializer ser(in, NULL); + Common::String name; + uint32 tmp; + ser.syncAsUint32LE(tmp); + ser.syncAsUint32LE(tmp); + ser.syncString(name); + return name; +} +int ComposerMetaEngine::getMaximumSaveSlot() const { + return 99; +} +SaveStateList ComposerMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray filenames; + Common::String saveDesc; + Common::String pattern = Common::String::format("%s.??", target); + + filenames = saveFileMan->listSavefiles(pattern); + sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + SaveStateList saveList; + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + // Obtain the last 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 2); + + if (slotNum >= 0 && slotNum <= 99) { + Common::InSaveFile *in = saveFileMan->openForLoading(*file); + if (in) { + saveDesc = getSaveName(in); + saveList.push_back(SaveStateDescriptor(slotNum, saveDesc)); + delete in; + } + } + } + + return saveList; } bool Composer::ComposerEngine::hasFeature(EngineFeature f) const { - return (f == kSupportsRTL); + return (f == kSupportsRTL + || f == kSupportsSavingDuringRuntime + || f == kSupportsLoadingDuringRuntime); } #if PLUGIN_ENABLED_DYNAMIC(COMPOSER) |