From 5bc5855ae9148672b242bd99f3faf5e7ede93ac8 Mon Sep 17 00:00:00 2001 From: Christopher Page Date: Fri, 15 Aug 2008 07:10:23 +0000 Subject: Added some MetaEngineFeatures, defined MEFs for the Scumm engine svn-id: r33893 --- engines/metaengine.h | 38 ++++++++++++++++++++++++++++++++++++++ engines/scumm/detection.cpp | 7 +++++++ gui/launcher.cpp | 5 +++-- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/engines/metaengine.h b/engines/metaengine.h index aef860e0f9..0d8a4a15c9 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -91,6 +91,44 @@ public: virtual SaveStateList listSaves(const char *target) const { return SaveStateList(); } + + /** + * Remove the specified save state. + * + * For most engines this just involves a call removeSaveFile(). + * Engines which keep an index file will also update it accordingly. + * + * @param slot slot number of the save state to be removed + * @param saveNames a list of all the save state description names + */ + virtual void removeSaveState(int slot, Common::StringList saveNames) const {}; + + + /** @name MetaEngineFeature flags */ + //@{ + + /** + * A feature in this context means an ability of the engine which can be + * either on or off. Examples include: + * - Listing Save States (--list-saves) + * - Loading from the Launcher (-x) + * - Deleting Saves from the Launcher + * + * These determine whether the features will be available to the engine + * in the launcher. + */ + enum MetaEngineFeature { + kSupportsListSaves, + kSupportsDirectLoad, + kSupportsDeleteSave + }; + + /** + * Determine whether the engine supports the specified feature + */ + virtual bool hasFeature(MetaEngineFeature f) { return false; }; + + //@} }; diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 68d3010199..716a456c90 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -677,6 +677,7 @@ public: virtual GameList getSupportedGames() const; virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const FSList &fslist) const; + virtual bool hasFeature(MetaEngineFeature f); virtual PluginError createInstance(OSystem *syst, Engine **engine) const; @@ -691,6 +692,12 @@ GameDescriptor ScummMetaEngine::findGame(const char *gameid) const { return Common::AdvancedDetector::findGameID(gameid, gameDescriptions, obsoleteGameIDsTable); } +bool ScummMetaEngine::hasFeature(MetaEngineFeature f) { + return + (f == kSupportsListSaves) || + (f == kSupportsDirectLoad) || + (f == kSupportsDeleteSave); +} GameList ScummMetaEngine::detectGames(const FSList &fslist) const { GameList detectedGames; diff --git a/gui/launcher.cpp b/gui/launcher.cpp index bcf4709e78..dc3c2ee1d5 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -951,7 +951,8 @@ void LauncherDialog::loadGame(int item) { int idx; if (plugin) { do { - _loadDialog->setList(generateSavegameList(item, plugin)); + Common::StringList saveNames = generateSavegameList(item, plugin); + _loadDialog->setList(saveNames); SaveStateList saveList = (*plugin)->listSaves(description.c_str()); idx = _loadDialog->runModal(); if (idx >= 0) { @@ -959,7 +960,7 @@ void LauncherDialog::loadGame(int item) { if (_loadDialog->delSave()) { String filename = saveList[idx].filename(); printf("Deleting file: %s\n", filename.c_str()); - saveFileMan->removeSavefile(filename.c_str()); + //saveFileMan->removeSavefile(filename.c_str()); } // Load the savegame else { -- cgit v1.2.3