mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 04:01:23 +00:00
Defined some MetaEngineFeatures for the engines, the launcher uses these features to allow/disallow loading and deleting saves
svn-id: r33909
This commit is contained in:
parent
5bc5855ae9
commit
9d3cdcb2da
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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; };
|
||||
|
||||
//@}
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user