diff options
author | Filippos Karapetis | 2008-11-09 16:13:34 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-11-09 16:13:34 +0000 |
commit | f5729a4a8b1b30c66cf3a9553ffb0002c8d7b158 (patch) | |
tree | ea7abac525899eacaf581c4107353eb284d863de | |
parent | 08eecfd3e55a7a52f523ce3ead18e0e846d7ab2f (diff) | |
download | scummvm-rg350-f5729a4a8b1b30c66cf3a9553ffb0002c8d7b158.tar.gz scummvm-rg350-f5729a4a8b1b30c66cf3a9553ffb0002c8d7b158.tar.bz2 scummvm-rg350-f5729a4a8b1b30c66cf3a9553ffb0002c8d7b158.zip |
- The GMM save dialog is now working for all engines which support the appropriate features
- Added a new method to the MetaEngine class, getMaximumSaveSlot(), and implemented it in all engines for which the listSavefiles() method is implemented (it goes together with the listSavefiles method). It is used to fill the unused save slots in the save/load dialogs of each engine, so that the user can create new save games in empty slots
- Unified the save/load dialog list numbering in the GMM load/save screens and in the load screen of the main menu (before a game is started)
svn-id: r34963
-rw-r--r-- | engines/agi/detection.cpp | 3 | ||||
-rw-r--r-- | engines/agos/detection.cpp | 3 | ||||
-rw-r--r-- | engines/cine/detection.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/detection.cpp | 3 | ||||
-rw-r--r-- | engines/lure/detection.cpp | 3 | ||||
-rw-r--r-- | engines/metaengine.h | 7 | ||||
-rw-r--r-- | engines/parallaction/detection.cpp | 3 | ||||
-rw-r--r-- | engines/saga/detection.cpp | 13 | ||||
-rw-r--r-- | engines/scumm/detection.cpp | 3 | ||||
-rw-r--r-- | engines/tinsel/detection.cpp | 2 | ||||
-rw-r--r-- | engines/touche/detection.cpp | 3 | ||||
-rw-r--r-- | gui/launcher.cpp | 12 |
12 files changed, 46 insertions, 12 deletions
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 27b1e799bb..bcc2b60d74 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -2125,6 +2125,7 @@ public: 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; + virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; const Common::ADGameDescription *fallbackDetect(const Common::FSList &fslist) const; @@ -2193,6 +2194,8 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const { return saveList; } +int AgiMetaEngine::getMaximumSaveSlot() const { return 999; } + void AgiMetaEngine::removeSaveState(const char *target, int slot) const { char extension[6]; snprintf(extension, sizeof(extension), ".%03d", slot); diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index b00267368f..5ca640d96c 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -114,6 +114,7 @@ public: 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; + virtual int getMaximumSaveSlot() const; }; bool AgosMetaEngine::hasFeature(MetaEngineFeature f) const { @@ -191,6 +192,8 @@ SaveStateList AgosMetaEngine::listSaves(const char *target) const { return saveList; } +int AgosMetaEngine::getMaximumSaveSlot() const { return 999; } + #if PLUGIN_ENABLED_DYNAMIC(AGOS) REGISTER_PLUGIN_DYNAMIC(AGOS, PLUGIN_TYPE_ENGINE, AgosMetaEngine); #else diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index ca47e5028b..eefd60e26c 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -536,6 +536,7 @@ 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; + virtual int getMaximumSaveSlot() const; }; bool CineMetaEngine::hasFeature(MetaEngineFeature f) const { @@ -601,6 +602,8 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const { return saveList; } +int CineMetaEngine::getMaximumSaveSlot() const { return 9; } + #if PLUGIN_ENABLED_DYNAMIC(CINE) REGISTER_PLUGIN_DYNAMIC(CINE, PLUGIN_TYPE_ENGINE, CineMetaEngine); #else diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 59d7edf2fb..20a78260a7 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -1067,6 +1067,7 @@ public: bool hasFeature(MetaEngineFeature f) const; bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; SaveStateList listSaves(const char *target) const; + virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; @@ -1162,6 +1163,8 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const { return saveList; } +int KyraMetaEngine::getMaximumSaveSlot() const { return 999; } + void KyraMetaEngine::removeSaveState(const char *target, int slot) const { // Slot 0 can't be deleted, it's for restarting the game(s) if (slot == 0) diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 863cb7fec0..5749e96bde 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -188,6 +188,7 @@ public: 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; + virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -239,6 +240,8 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const { return saveList; } +int LureMetaEngine::getMaximumSaveSlot() const { return 999; } + void LureMetaEngine::removeSaveState(const char *target, int slot) const { char extension[6]; snprintf(extension, sizeof(extension), ".%03d", slot); diff --git a/engines/metaengine.h b/engines/metaengine.h index fb4c5c2938..6658a00bd7 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -125,6 +125,13 @@ public: return SaveStateDescriptor(); } + /** + * Gets the maximum save slot that the engine supports + */ + virtual int getMaximumSaveSlot() const { + return 0; + } + /** @name MetaEngineFeature flags */ //@{ diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp index 626aba6569..10882662d1 100644 --- a/engines/parallaction/detection.cpp +++ b/engines/parallaction/detection.cpp @@ -247,6 +247,7 @@ public: 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; + virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -308,6 +309,8 @@ SaveStateList ParallactionMetaEngine::listSaves(const char *target) const { return saveList; } +int ParallactionMetaEngine::getMaximumSaveSlot() const { return 99; } + void ParallactionMetaEngine::removeSaveState(const char *target, int slot) const { char extension[6]; snprintf(extension, sizeof(extension), ".0%02d", slot); diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index b7503278e7..f114fa31b7 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -151,6 +151,7 @@ public: 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; + virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -200,23 +201,15 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const { in->read(saveDesc, SAVE_TITLE_SIZE); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc)); delete in; - } else { - // handle gaps - *saveDesc = 0; - saveList.push_back(SaveStateDescriptor(slotNum, saveDesc)); } } } - // Fill the rest of the list with empty slots - *saveDesc = 0; - for (int i = slotNum + 1; i <= 99; i++) { - saveList.push_back(SaveStateDescriptor(i, saveDesc)); - } - return saveList; } +int SagaMetaEngine::getMaximumSaveSlot() const { return 99; } + void SagaMetaEngine::removeSaveState(const char *target, int slot) const { char extension[6]; snprintf(extension, sizeof(extension), ".s%02d", slot); diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index e4694cf68b..5a82373c0b 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -685,6 +685,7 @@ public: virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; virtual SaveStateList listSaves(const char *target) const; + virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; @@ -961,6 +962,8 @@ namespace Scumm { extern bool getSavegameName(Common::InSaveFile *in, Common::String &desc, int heversion); } +int ScummMetaEngine::getMaximumSaveSlot() const { return 99; } + SaveStateList ScummMetaEngine::listSaves(const char *target) const { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::StringList filenames; diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index a52a6c9c1e..45cd903552 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -343,6 +343,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; + virtual int getMaximumSaveSlot() const; }; bool TinselMetaEngine::hasFeature(MetaEngineFeature f) const { @@ -367,6 +368,7 @@ SaveStateList TinselMetaEngine::listSaves(const char *target) const { return saveList; } +int TinselMetaEngine::getMaximumSaveSlot() const { return 999; } bool TinselMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const { const Tinsel::TinselGameDescription *gd = (const Tinsel::TinselGameDescription *)desc; diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp index 2b9f3b49fa..d37bd0775e 100644 --- a/engines/touche/detection.cpp +++ b/engines/touche/detection.cpp @@ -140,6 +140,7 @@ public: 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; + virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -214,6 +215,8 @@ SaveStateList ToucheMetaEngine::listSaves(const char *target) const { return saveList; } +int ToucheMetaEngine::getMaximumSaveSlot() const { return 99; } + void ToucheMetaEngine::removeSaveState(const char *target, int slot) const { char extension[5]; snprintf(extension, sizeof(extension), ".%d", slot); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 4a8211e03c..b4802b06e8 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -483,7 +483,7 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) // Add choice list _list = new GUI::ListWidget(this, "ScummSaveLoad.List"); - _list->setNumberingMode(GUI::kListNumberingOff); + setSaveMode(false); _gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10); @@ -541,7 +541,7 @@ const Common::String &SaveLoadChooser::getResultString() const { void SaveLoadChooser::setSaveMode(bool saveMode) { _list->setEditable(saveMode); - _list->setNumberingMode(saveMode ? GUI::kListNumberingOne : GUI::kListNumberingZero); + _list->setNumberingMode(GUI::kListNumberingOne); } void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { @@ -738,10 +738,18 @@ void SaveLoadChooser::close() { void SaveLoadChooser::updateSaveList() { _saveList = (*_plugin)->listSaves(_target.c_str()); + int curSlot = 0; StringList saveNames; for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) { saveNames.push_back(x->description()); + curSlot++; } + + // Fill the rest of the save slots with empty saves + Common::String emptyDesc; + for (int i = curSlot + 1; i <= (*_plugin)->getMaximumSaveSlot(); i++) + saveNames.push_back(emptyDesc); + _list->setList(saveNames); } |