aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agi/detection.cpp10
-rw-r--r--engines/cine/detection.cpp7
-rw-r--r--engines/kyra/detection.cpp13
-rw-r--r--engines/lure/detection.cpp8
-rw-r--r--engines/metaengine.h2
-rw-r--r--engines/parallaction/detection.cpp8
-rw-r--r--engines/queen/queen.cpp8
-rw-r--r--engines/saga/detection.cpp8
-rw-r--r--engines/scumm/detection.cpp18
-rw-r--r--engines/sky/sky.cpp9
-rw-r--r--engines/sword1/sword1.cpp7
-rw-r--r--engines/sword2/sword2.cpp8
-rw-r--r--engines/touche/detection.cpp8
-rw-r--r--gui/launcher.cpp59
14 files changed, 135 insertions, 38 deletions
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 8ddeae1b17..5427879f20 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -2122,11 +2122,21 @@ public:
return "Sierra AGI Engine (C) Sierra On-Line Software";
}
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
virtual SaveStateList listSaves(const char *target) const;
+
const Common::ADGameDescription *fallbackDetect(const FSList *fslist) const;
};
+bool AgiMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad) ||
+ (f == kSupportsDeleteSave);
+}
+
+
bool AgiMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
const Agi::AGIGameDescription *gd = (const Agi::AGIGameDescription *)desc;
bool res = true;
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index 1dc6f89c49..28a8404d28 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -533,9 +533,16 @@ public:
}
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual SaveStateList listSaves(const char *target) const;
};
+bool CineMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad);
+}
+
bool CineMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
const Cine::CINEGameDescription *gd = (const Cine::CINEGameDescription *)desc;
if (gd) {
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index f8aa44be63..5ed556cc27 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -931,11 +931,18 @@ public:
return "The Legend of Kyrandia (C) Westwood Studios";
}
- bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
-
- SaveStateList listSaves(const char *target) const;
+ virtual bool hasFeature(MetaEngineFeature f) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
+ virtual SaveStateList listSaves(const char *target) const;
};
+bool KyraMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad) ||
+ (f == kSupportsDeleteSave);
+}
+
bool KyraMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
const KYRAGameDescription *gd = (const KYRAGameDescription *)desc;
bool res = true;
diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp
index 8ed2e62760..dc23e4ad89 100644
--- a/engines/lure/detection.cpp
+++ b/engines/lure/detection.cpp
@@ -185,10 +185,18 @@ public:
return "Lure of the Temptress (C) Revolution";
}
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
virtual SaveStateList listSaves(const char *target) const;
};
+bool LureMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad) ||
+ (f == kSupportsDeleteSave);
+}
+
bool LureMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
const Lure::LureGameDescription *gd = (const Lure::LureGameDescription *)desc;
if (gd) {
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 0d8a4a15c9..15024ff661 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -126,7 +126,7 @@ public:
/**
* Determine whether the engine supports the specified feature
*/
- virtual bool hasFeature(MetaEngineFeature f) { return false; };
+ virtual bool hasFeature(MetaEngineFeature f) const { return false; };
//@}
};
diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp
index 531bd8ee16..a65fc05b95 100644
--- a/engines/parallaction/detection.cpp
+++ b/engines/parallaction/detection.cpp
@@ -243,10 +243,18 @@ public:
return "Nippon Safes Inc. (C) Dynabyte";
}
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
virtual SaveStateList listSaves(const char *target) const;
};
+bool ParallactionMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad) ||
+ (f == kSupportsDeleteSave);
+}
+
bool ParallactionMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
const Parallaction::PARALLACTIONGameDescription *gd = (const Parallaction::PARALLACTIONGameDescription *)desc;
bool res = true;
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp
index 593597ce12..801a1c630a 100644
--- a/engines/queen/queen.cpp
+++ b/engines/queen/queen.cpp
@@ -60,6 +60,7 @@ public:
virtual const char *getName() const;
virtual const char *getCopyright() const;
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const;
virtual GameDescriptor findGame(const char *gameid) const;
virtual GameList detectGames(const FSList &fslist) const;
@@ -76,6 +77,13 @@ const char *QueenMetaEngine::getCopyright() const {
return "Flight of the Amazon Queen (C) John Passfield and Steve Stamatiadis";
}
+bool QueenMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad) ||
+ (f == kSupportsDeleteSave);
+}
+
GameList QueenMetaEngine::getSupportedGames() const {
GameList games;
games.push_back(queenGameDescriptor);
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index 3ed3882b06..16ac3d7fb4 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -147,10 +147,18 @@ public:
return "Inherit the Earth (C) Wyrmkeep Entertainment";
}
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
virtual SaveStateList listSaves(const char *target) const;
};
+bool SagaMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad) ||
+ (f == kSupportsDeleteSave);
+}
+
bool SagaMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
const Saga::SAGAGameDescription *gd = (const Saga::SAGAGameDescription *)desc;
if (gd) {
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 716a456c90..8d93b04a14 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -674,16 +674,23 @@ public:
virtual const char *getName() const;
virtual const char *getCopyright() const;
+ virtual bool hasFeature(MetaEngineFeature f) const;
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;
virtual SaveStateList listSaves(const char *target) const;
};
+bool ScummMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad) ||
+ (f == kSupportsDeleteSave);
+}
+
GameList ScummMetaEngine::getSupportedGames() const {
return GameList(gameDescriptions);
}
@@ -692,13 +699,6 @@ 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;
Common::List<DetectorResult> results;
diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp
index bcdc9f5130..88f7f93d75 100644
--- a/engines/sky/sky.cpp
+++ b/engines/sky/sky.cpp
@@ -110,9 +110,10 @@ public:
virtual const char *getName() const;
virtual const char *getCopyright() const;
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const;
virtual GameDescriptor findGame(const char *gameid) const;
- virtual GameList detectGames(const FSList &fslist) const;
+ virtual GameList detectGames(const FSList &fslist) const;
virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
@@ -127,6 +128,12 @@ const char *SkyMetaEngine::getCopyright() const {
return "Beneath a Steel Sky (C) Revolution";
}
+bool SkyMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad);
+}
+
GameList SkyMetaEngine::getSupportedGames() const {
GameList games;
games.push_back(skySetting);
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 8bfb5d8698..de346a42dc 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -95,6 +95,7 @@ public:
return "Broken Sword Games (C) Revolution";
}
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const;
virtual GameDescriptor findGame(const char *gameid) const;
virtual GameList detectGames(const FSList &fslist) const;
@@ -103,6 +104,12 @@ public:
virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
};
+bool SwordMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad);
+}
+
GameList SwordMetaEngine::getSupportedGames() const {
GameList games;
games.push_back(sword1FullSettings);
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index 3b6f51050b..110d881c1d 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -80,6 +80,7 @@ public:
return "Broken Sword Games (C) Revolution";
}
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const;
virtual GameDescriptor findGame(const char *gameid) const;
virtual GameList detectGames(const FSList &fslist) const;
@@ -88,6 +89,13 @@ public:
virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
};
+bool Sword2MetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad) ||
+ (f == kSupportsDeleteSave);
+}
+
GameList Sword2MetaEngine::getSupportedGames() const {
const Sword2::GameSettings *g = Sword2::sword2_settings;
GameList games;
diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp
index 63d2a3a078..c4c428ba8d 100644
--- a/engines/touche/detection.cpp
+++ b/engines/touche/detection.cpp
@@ -136,10 +136,18 @@ public:
return "Touche: The Adventures of the 5th Musketeer (C) Clipper Software";
}
+ virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
virtual SaveStateList listSaves(const char *target) const;
};
+bool ToucheMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad) ||
+ (f == kSupportsDeleteSave);
+}
+
bool ToucheMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
const Common::ADGameDescription *gd = desc;
if (gd) {
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index dc3c2ee1d5..733ecc4275 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -477,6 +477,7 @@ class SaveLoadChooser : public GUI::Dialog {
typedef Common::StringList StringList;
protected:
bool _delSave;
+ bool _delSupport;
GUI::ListWidget *_list;
GUI::ButtonWidget *_chooseButton;
GUI::ButtonWidget *_deleteButton;
@@ -493,7 +494,7 @@ public:
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
const String &getResultString() const;
void setList(const StringList& list);
- int runModal();
+ int runModal(bool delSupport);
virtual void reflowLayout();
@@ -501,7 +502,7 @@ public:
};
SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel)
- : Dialog("scummsaveload"), _delSave(0), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) {
+ : Dialog("scummsaveload"), _delSave(0), _delSupport(0), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) {
_drawingHints |= GUI::THEME_HINT_SPECIAL_COLOR;
@@ -536,10 +537,11 @@ void SaveLoadChooser::setList(const StringList& list) {
_list->setList(list);
}
-int SaveLoadChooser::runModal() {
+int SaveLoadChooser::runModal(bool delSupport) {
if (_gfxWidget)
_gfxWidget->setGfx(0);
_delSave = false;
+ _delSupport = delSupport;
int ret = Dialog::runModal();
return ret;
}
@@ -571,7 +573,8 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
// list item is selected.
_chooseButton->setEnabled(selItem >= 0 && (!getResultString().empty()));
_chooseButton->draw();
- _deleteButton->setEnabled(selItem >= 0 && (!getResultString().empty()));
+ // Delete will always be disabled if the engine doesn't support it.
+ _deleteButton->setEnabled(_delSupport && (selItem >= 0) && (!getResultString().empty()));
_deleteButton->draw();
} break;
case kDelCmd:
@@ -950,29 +953,37 @@ void LauncherDialog::loadGame(int item) {
int idx;
if (plugin) {
- do {
- Common::StringList saveNames = generateSavegameList(item, plugin);
- _loadDialog->setList(saveNames);
- SaveStateList saveList = (*plugin)->listSaves(description.c_str());
- idx = _loadDialog->runModal();
- if (idx >= 0) {
- // Delete the savegame
- if (_loadDialog->delSave()) {
- String filename = saveList[idx].filename();
- printf("Deleting file: %s\n", filename.c_str());
- //saveFileMan->removeSavefile(filename.c_str());
- }
- // Load the savegame
- else {
- int slot = atoi(saveList[idx].save_slot().c_str());
- printf("Loading slot: %d\n", slot);
- ConfMan.setInt("save_slot", slot);
- ConfMan.setActiveDomain(_domains[item]);
- close();
+ bool delSupport = (*plugin)->hasFeature(MetaEngine::kSupportsDeleteSave);
+
+ if ((*plugin)->hasFeature(MetaEngine::kSupportsListSaves)) {
+ do {
+ Common::StringList saveNames = generateSavegameList(item, plugin);
+ _loadDialog->setList(saveNames);
+ SaveStateList saveList = (*plugin)->listSaves(description.c_str());
+ idx = _loadDialog->runModal(delSupport);
+ if (idx >= 0) {
+ // Delete the savegame
+ if (_loadDialog->delSave()) {
+ String filename = saveList[idx].filename();
+ printf("Deleting file: %s\n", filename.c_str());
+ //saveFileMan->removeSavefile(filename.c_str());
+ }
+ // Load the savegame
+ else {
+ int slot = atoi(saveList[idx].save_slot().c_str());
+ printf("Loading slot: %d\n", slot);
+ ConfMan.setInt("save_slot", slot);
+ ConfMan.setActiveDomain(_domains[item]);
+ close();
+ }
}
}
+ while (_loadDialog->delSave());
+ } else {
+ MessageDialog dialog
+ ("Sorry, this game does not yet support loading games from the launcher.", "OK");
+ dialog.runModal();
}
- while (_loadDialog->delSave());
} else {
MessageDialog dialog("ScummVM could not find any engine capable of running the selected game!", "OK");
dialog.runModal();