From f1a56eaf3666a6535ff0d1654e4e014249933452 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 6 Jun 2016 12:22:22 +0600 Subject: GUI: Show "locked" saves during sync --- engines/cge/detection.cpp | 5 +++++ engines/metaengine.h | 10 ++++++++++ engines/savestate.cpp | 4 ++-- engines/savestate.h | 23 +++++++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index 82d27f8d54..0c79be51d9 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -131,6 +131,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; + virtual Common::String getSavefilesPattern(Common::String &target) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -239,6 +240,10 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const { return saveList; } +Common::String CGEMetaEngine::getSavefilesPattern(Common::String &target) const { + return target + ".###"; +} + SaveStateDescriptor CGEMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/metaengine.h b/engines/metaengine.h index e7bfebab71..913f61d280 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -115,6 +115,16 @@ public: return SaveStateList(); } + /** + * Return a common pattern which all engine's save filenames should match. + * + * @param target name of a config manager target + * @return a pattern for filenames + */ + virtual Common::String getSavefilesPattern(Common::String &target) const { + return target + ".s##"; + } + /** * Return a list of extra GUI options for the specified target. * If no target is specified, all of the available custom GUI options are diff --git a/engines/savestate.cpp b/engines/savestate.cpp index 186d7bc5f2..7366aa6a61 100644 --- a/engines/savestate.cpp +++ b/engines/savestate.cpp @@ -27,12 +27,12 @@ SaveStateDescriptor::SaveStateDescriptor() // FIXME: default to 0 (first slot) or to -1 (invalid slot) ? : _slot(-1), _description(), _isDeletable(true), _isWriteProtected(false), - _saveDate(), _saveTime(), _playTime(), _thumbnail() { + _isLocked(false), _saveDate(), _saveTime(), _playTime(), _thumbnail() { } SaveStateDescriptor::SaveStateDescriptor(int s, const Common::String &d) : _slot(s), _description(d), _isDeletable(true), _isWriteProtected(false), - _saveDate(), _saveTime(), _playTime(), _thumbnail() { + _isLocked(false), _saveDate(), _saveTime(), _playTime(), _thumbnail() { } void SaveStateDescriptor::setThumbnail(Graphics::Surface *t) { diff --git a/engines/savestate.h b/engines/savestate.h index 21ade602fa..3244d61fdb 100644 --- a/engines/savestate.h +++ b/engines/savestate.h @@ -89,6 +89,24 @@ public: */ bool getWriteProtectedFlag() const { return _isWriteProtected; } + /** + * Defines whether the save state is "locked" because is being synced. + */ + void setLocked(bool state) { + _isLocked = state; + + //just in case: + if (state) { + setDeletableFlag(false); + setWriteProtectedFlag(true); + } + } + + /** + * Queries whether the save state is "locked" because is being synced. + */ + bool getLocked() const { return _isLocked; } + /** * Return a thumbnail graphics surface representing the savestate visually. * This is usually a scaled down version of the game graphics. The size @@ -179,6 +197,11 @@ private: */ bool _isWriteProtected; + /** + * Whether the save state is "locked" because is being synced. + */ + bool _isLocked; + /** * Human readable description of the date the save state was created. */ -- cgit v1.2.3 From ab1d160ec8f99e472667b83aa4bdd7697b702f3a Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Tue, 7 Jun 2016 19:33:00 +0600 Subject: ALL: Add MetaEngine::simpleSaveNames() Engines with "simple" savenames would support "Run in background" in save/load dialog and gradual save slots unlocking. Other engines save/load feature would be locked until save sync is over. --- engines/access/detection.cpp | 3 +++ engines/adl/detection.cpp | 3 +++ engines/agi/detection.cpp | 3 +++ engines/agos/detection.cpp | 3 +++ engines/avalanche/detection.cpp | 3 +++ engines/bbvs/detection.cpp | 3 +++ engines/cge/detection.cpp | 6 ++---- engines/cge2/detection.cpp | 3 +++ engines/cine/detection.cpp | 3 +++ engines/cruise/detection.cpp | 3 +++ engines/draci/detection.cpp | 3 +++ engines/drascula/detection.cpp | 3 +++ engines/dreamweb/detection.cpp | 3 +++ engines/fullpipe/detection.cpp | 3 +++ engines/gnap/detection.cpp | 3 +++ engines/groovie/detection.cpp | 3 +++ engines/hopkins/detection.cpp | 3 +++ engines/hugo/detection.cpp | 3 +++ engines/kyra/detection.cpp | 3 +++ engines/lab/detection.cpp | 3 +++ engines/lure/detection.cpp | 3 +++ engines/mads/detection.cpp | 3 +++ engines/metaengine.h | 16 ++++++++++------ engines/mohawk/detection.cpp | 3 +++ engines/mortevielle/detection.cpp | 3 +++ engines/neverhood/detection.cpp | 3 +++ engines/parallaction/detection.cpp | 3 +++ engines/pegasus/detection.cpp | 3 +++ engines/prince/detection.h | 1 + engines/prince/saveload.cpp | 2 ++ engines/queen/detection.cpp | 3 +++ engines/saga/detection.cpp | 3 +++ engines/sci/detection.cpp | 3 +++ engines/scumm/detection.cpp | 3 +++ engines/sherlock/detection.cpp | 4 ++++ engines/sky/detection.cpp | 5 ++++- engines/sword1/detection.cpp | 3 +++ engines/sword2/sword2.cpp | 3 +++ engines/sword25/detection.cpp | 3 +++ engines/teenagent/detection.cpp | 2 ++ engines/tinsel/detection.cpp | 3 +++ engines/toltecs/detection.cpp | 3 +++ engines/tony/detection.cpp | 3 +++ engines/toon/detection.cpp | 3 +++ engines/touche/detection.cpp | 3 +++ engines/tsage/detection.cpp | 2 ++ engines/tucker/detection.cpp | 2 ++ engines/voyeur/detection.cpp | 3 +++ engines/wage/detection.cpp | 3 +++ engines/wintermute/detection.cpp | 2 ++ engines/zvision/detection.cpp | 3 +++ 51 files changed, 154 insertions(+), 11 deletions(-) (limited to 'engines') diff --git a/engines/access/detection.cpp b/engines/access/detection.cpp index 368753f117..435f0d1118 100644 --- a/engines/access/detection.cpp +++ b/engines/access/detection.cpp @@ -100,6 +100,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -171,6 +172,8 @@ SaveStateList AccessMetaEngine::listSaves(const char *target) const { return saveList; } +bool AccessMetaEngine::simpleSaveNames() const { return true; } + int AccessMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES; } diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp index 4bdb722af3..7031a58ec4 100644 --- a/engines/adl/detection.cpp +++ b/engines/adl/detection.cpp @@ -175,6 +175,7 @@ public: SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; int getMaximumSaveSlot() const { return 'O' - 'A'; } SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; void removeSaveState(const char *target, int slot) const; bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; @@ -289,6 +290,8 @@ SaveStateList AdlMetaEngine::listSaves(const char *target) const { return saveList; } +bool AdlMetaEngine::simpleSaveNames() const { return true; } + void AdlMetaEngine::removeSaveState(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.s%02d", target, slot); g_system->getSavefileManager()->removeSavefile(fileName); diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 9f66d78d80..dc0dbbdddf 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -216,6 +216,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -323,6 +324,8 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const { return saveList; } +bool AgiMetaEngine::simpleSaveNames() const { return true; } + int AgiMetaEngine::getMaximumSaveSlot() const { return 999; } void AgiMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index 2c89522089..dc96eb6ef6 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -120,6 +120,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; }; @@ -207,6 +208,8 @@ SaveStateList AgosMetaEngine::listSaves(const char *target) const { return saveList; } +bool AgosMetaEngine::simpleSaveNames() const { return true; } + int AgosMetaEngine::getMaximumSaveSlot() const { return 999; } #if PLUGIN_ENABLED_DYNAMIC(AGOS) diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index e35c5d2cac..392d0a027f 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -83,6 +83,7 @@ public: int getMaximumSaveSlot() const { return 99; } SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; @@ -156,6 +157,8 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { return saveList; } +bool AvalancheMetaEngine::simpleSaveNames() const { return true; } + void AvalancheMetaEngine::removeSaveState(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); g_system->getSavefileManager()->removeSavefile(fileName); diff --git a/engines/bbvs/detection.cpp b/engines/bbvs/detection.cpp index 7c0045ee73..9aca719648 100644 --- a/engines/bbvs/detection.cpp +++ b/engines/bbvs/detection.cpp @@ -86,6 +86,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -135,6 +136,8 @@ SaveStateList BbvsMetaEngine::listSaves(const char *target) const { return saveList; } +bool BbvsMetaEngine::simpleSaveNames() const { return true; } + SaveStateDescriptor BbvsMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String filename = Bbvs::BbvsEngine::getSavegameFilename(target, slot); Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index 0c79be51d9..eb88b6cd79 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -131,7 +131,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; - virtual Common::String getSavefilesPattern(Common::String &target) const; + virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -240,9 +240,7 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const { return saveList; } -Common::String CGEMetaEngine::getSavefilesPattern(Common::String &target) const { - return target + ".###"; -} +bool CGEMetaEngine::simpleSaveNames() const { return true; } SaveStateDescriptor CGEMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); diff --git a/engines/cge2/detection.cpp b/engines/cge2/detection.cpp index 2b84d167c7..d980f82b0d 100644 --- a/engines/cge2/detection.cpp +++ b/engines/cge2/detection.cpp @@ -127,6 +127,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -239,6 +240,8 @@ SaveStateList CGE2MetaEngine::listSaves(const char *target) const { return saveList; } +bool CGE2MetaEngine::simpleSaveNames() const { return true; } + SaveStateDescriptor CGE2MetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index ec01e8734d..2d10b81473 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -104,6 +104,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -173,6 +174,8 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const { return saveList; } +bool CineMetaEngine::simpleSaveNames() const { return false; } + int CineMetaEngine::getMaximumSaveSlot() const { return 9; } void CineMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp index 6f5d236173..9e3ebb5dd5 100644 --- a/engines/cruise/detection.cpp +++ b/engines/cruise/detection.cpp @@ -211,6 +211,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const { return 99; } virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; @@ -254,6 +255,8 @@ SaveStateList CruiseMetaEngine::listSaves(const char *target) const { return saveList; } +bool CruiseMetaEngine::simpleSaveNames() const { return false; } + void CruiseMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(Cruise::CruiseEngine::getSavegameFile(slot)); } diff --git a/engines/draci/detection.cpp b/engines/draci/detection.cpp index 65427bd8cd..8a67981696 100644 --- a/engines/draci/detection.cpp +++ b/engines/draci/detection.cpp @@ -98,6 +98,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const { return 99; } virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; @@ -147,6 +148,8 @@ SaveStateList DraciMetaEngine::listSaves(const char *target) const { return saveList; } +bool DraciMetaEngine::simpleSaveNames() const { return false; } + void DraciMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(Draci::DraciEngine::getSavegameFile(slot)); } diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp index ffec393a0a..863ea98786 100644 --- a/engines/drascula/detection.cpp +++ b/engines/drascula/detection.cpp @@ -326,6 +326,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -382,6 +383,8 @@ SaveStateList DrasculaMetaEngine::listSaves(const char *target) const { return saveList; } +bool DrasculaMetaEngine::simpleSaveNames() const { return true; } + SaveStateDescriptor DrasculaMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp index 8e24c44702..abe1198233 100644 --- a/engines/dreamweb/detection.cpp +++ b/engines/dreamweb/detection.cpp @@ -86,6 +86,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -151,6 +152,8 @@ SaveStateList DreamWebMetaEngine::listSaves(const char *target) const { return saveList; } +bool DreamWebMetaEngine::simpleSaveNames() const { return false; } + int DreamWebMetaEngine::getMaximumSaveSlot() const { return 99; } void DreamWebMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/fullpipe/detection.cpp b/engines/fullpipe/detection.cpp index 6f92f19f24..a183be8a83 100644 --- a/engines/fullpipe/detection.cpp +++ b/engines/fullpipe/detection.cpp @@ -90,6 +90,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const { return 8; } virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; @@ -134,6 +135,8 @@ SaveStateList FullpipeMetaEngine::listSaves(const char *target) const { return saveList; } +bool FullpipeMetaEngine::simpleSaveNames() const { return false; } + void FullpipeMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(Fullpipe::getSavegameFile(slot)); } diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index 7e4ab56d1f..523a8b6d1c 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -78,6 +78,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -141,6 +142,8 @@ SaveStateList GnapMetaEngine::listSaves(const char *target) const { return saveList; } +bool GnapMetaEngine::simpleSaveNames() const { return true; } + SaveStateDescriptor GnapMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp index b12e264a57..22ced10b8a 100644 --- a/engines/groovie/detection.cpp +++ b/engines/groovie/detection.cpp @@ -352,6 +352,7 @@ public: bool hasFeature(MetaEngineFeature f) const; SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -376,6 +377,8 @@ SaveStateList GroovieMetaEngine::listSaves(const char *target) const { return SaveLoad::listValidSaves(target); } +bool GroovieMetaEngine::simpleSaveNames() const { return false; } + int GroovieMetaEngine::getMaximumSaveSlot() const { return SaveLoad::getMaximumSlot(); } diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index cfdbf8030c..84af4fcdf3 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -117,6 +117,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -182,6 +183,8 @@ SaveStateList HopkinsMetaEngine::listSaves(const char *target) const { return saveList; } +bool HopkinsMetaEngine::simpleSaveNames() const { return true; } + int HopkinsMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES; } diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index 4e4746c002..ed67eae416 100644 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -149,6 +149,7 @@ public: int getMaximumSaveSlot() const; SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; void removeSaveState(const char *target, int slot) const; }; @@ -221,6 +222,8 @@ SaveStateList HugoMetaEngine::listSaves(const char *target) const { return saveList; } +bool HugoMetaEngine::simpleSaveNames() const { return false; } + SaveStateDescriptor HugoMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 989a45b420..1dcfd08435 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -162,6 +162,7 @@ public: bool hasFeature(MetaEngineFeature f) const; bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -273,6 +274,8 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const { return saveList; } +bool KyraMetaEngine::simpleSaveNames() const { return true; } + int KyraMetaEngine::getMaximumSaveSlot() const { return 999; } diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 30890b5acf..2b2e57df22 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -138,6 +138,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -191,6 +192,8 @@ SaveStateList LabMetaEngine::listSaves(const char *target) const { return saveList; } +bool LabMetaEngine::simpleSaveNames() const { return true; } + int LabMetaEngine::getMaximumSaveSlot() const { return 999; } diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 690a358bc3..808cea4422 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -212,6 +212,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -266,6 +267,8 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const { return saveList; } +bool LureMetaEngine::simpleSaveNames() const { return false; } + int LureMetaEngine::getMaximumSaveSlot() const { return 999; } void LureMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp index 4736503a38..d5354c4883 100644 --- a/engines/mads/detection.cpp +++ b/engines/mads/detection.cpp @@ -155,6 +155,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -217,6 +218,8 @@ SaveStateList MADSMetaEngine::listSaves(const char *target) const { return saveList; } +bool MADSMetaEngine::simpleSaveNames() const { return true; } + int MADSMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES; } diff --git a/engines/metaengine.h b/engines/metaengine.h index 913f61d280..6afb122580 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -116,14 +116,18 @@ public: } /** - * Return a common pattern which all engine's save filenames should match. + * Return whether engine's saves could be detected with + * ".###" pattern and "###" corresponds to slot + * number. * - * @param target name of a config manager target - * @return a pattern for filenames + * If that's not true or engine is using some unusual way + * of detecting saves and slot numbers, this should return + * false. In that case Save/Load dialog would be unavailable + * during cloud saves sync. + * + * @return true, if ".###" is OK for this engine */ - virtual Common::String getSavefilesPattern(Common::String &target) const { - return target + ".s##"; - } + virtual bool simpleSaveNames() const { return false; } /** * Return a list of extra GUI options for the specified target. diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp index 246d3ec3c1..d3c44a8944 100644 --- a/engines/mohawk/detection.cpp +++ b/engines/mohawk/detection.cpp @@ -200,6 +200,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; SaveStateList listSavesForPrefix(const char *prefix, const char *extension) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const { return 999; } virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -272,6 +273,8 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const { return saveList; } +bool MohawkMetaEngine::simpleSaveNames() const { return false; } + void MohawkMetaEngine::removeSaveState(const char *target, int slot) const { // Removing saved games is only supported in Myst/Riven currently. diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index 6791707dd5..2f5a790486 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -72,6 +72,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; @@ -102,6 +103,8 @@ SaveStateList MortevielleMetaEngine::listSaves(const char *target) const { return Mortevielle::SavegameManager::listSaves(target); } +bool MortevielleMetaEngine::simpleSaveNames() const { return true; } + SaveStateDescriptor MortevielleMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String filename = Mortevielle::MortevielleEngine::generateSaveFilename(target, slot); return Mortevielle::SavegameManager::querySaveMetaInfos(filename); diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp index 0f409a6435..903c4377e0 100644 --- a/engines/neverhood/detection.cpp +++ b/engines/neverhood/detection.cpp @@ -214,6 +214,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -283,6 +284,8 @@ SaveStateList NeverhoodMetaEngine::listSaves(const char *target) const { return saveList; } +bool NeverhoodMetaEngine::simpleSaveNames() const { return true; } + int NeverhoodMetaEngine::getMaximumSaveSlot() const { return 999; } diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp index 4c52990874..989fc9dfc8 100644 --- a/engines/parallaction/detection.cpp +++ b/engines/parallaction/detection.cpp @@ -234,6 +234,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -294,6 +295,8 @@ SaveStateList ParallactionMetaEngine::listSaves(const char *target) const { return saveList; } +bool ParallactionMetaEngine::simpleSaveNames() const { return false; } + int ParallactionMetaEngine::getMaximumSaveSlot() const { return 99; } void ParallactionMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/pegasus/detection.cpp b/engines/pegasus/detection.cpp index 161a133c8b..54cb4ca525 100644 --- a/engines/pegasus/detection.cpp +++ b/engines/pegasus/detection.cpp @@ -148,6 +148,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const { return 999; } virtual void removeSaveState(const char *target, int slot) const; }; @@ -178,6 +179,8 @@ SaveStateList PegasusMetaEngine::listSaves(const char *target) const { return saveList; } +bool PegasusMetaEngine::simpleSaveNames() const { return false; } + void PegasusMetaEngine::removeSaveState(const char *target, int slot) const { // See listSaves() for info on the pattern Common::StringArray fileNames = Pegasus::PegasusEngine::listSaveFiles(); diff --git a/engines/prince/detection.h b/engines/prince/detection.h index 3076253cf5..39cfdd96e7 100644 --- a/engines/prince/detection.h +++ b/engines/prince/detection.h @@ -121,6 +121,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; diff --git a/engines/prince/saveload.cpp b/engines/prince/saveload.cpp index d3360badd1..2855bdc4bd 100644 --- a/engines/prince/saveload.cpp +++ b/engines/prince/saveload.cpp @@ -105,6 +105,8 @@ SaveStateList PrinceMetaEngine::listSaves(const char *target) const { return saveList; } +bool PrinceMetaEngine::simpleSaveNames() const { return true; } + SaveStateDescriptor PrinceMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/queen/detection.cpp b/engines/queen/detection.cpp index aed8b7dcb1..3f8b97ed6a 100644 --- a/engines/queen/detection.cpp +++ b/engines/queen/detection.cpp @@ -444,6 +444,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const { return 99; } virtual void removeSaveState(const char *target, int slot) const; @@ -529,6 +530,8 @@ SaveStateList QueenMetaEngine::listSaves(const char *target) const { return saveList; } +bool QueenMetaEngine::simpleSaveNames() const { return false; } + void QueenMetaEngine::removeSaveState(const char *target, int slot) const { Common::String filename = Common::String::format("queen.s%02d", slot); diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index 0677e84d67..7f6e0a2485 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -144,6 +144,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -207,6 +208,8 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const { return saveList; } +bool SagaMetaEngine::simpleSaveNames() const { return true; } + int SagaMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES - 1; } void SagaMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index ad2b0f31a5..08794a0872 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -518,6 +518,7 @@ public: const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const; virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -790,6 +791,8 @@ SaveStateList SciMetaEngine::listSaves(const char *target) const { return saveList; } +bool SciMetaEngine::simpleSaveNames() const { return true; } + SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int slotNr) const { Common::String fileName = Common::String::format("%s.%03d", target, slotNr); Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 4c9d1221aa..67344e8008 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -960,6 +960,7 @@ public: virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -1299,6 +1300,8 @@ SaveStateList ScummMetaEngine::listSaves(const char *target) const { return saveList; } +bool ScummMetaEngine::simpleSaveNames() const { return true; } + void ScummMetaEngine::removeSaveState(const char *target, int slot) const { Common::String filename = ScummEngine::makeSavegameName(target, slot, false); g_system->getSavefileManager()->removeSavefile(filename); diff --git a/engines/sherlock/detection.cpp b/engines/sherlock/detection.cpp index 5a94b3485f..f54c6db952 100644 --- a/engines/sherlock/detection.cpp +++ b/engines/sherlock/detection.cpp @@ -159,6 +159,8 @@ public: */ virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; + /** * Returns the maximum number of allowed save slots */ @@ -217,6 +219,8 @@ SaveStateList SherlockMetaEngine::listSaves(const char *target) const { return Sherlock::SaveManager::getSavegameList(target); } +bool SherlockMetaEngine::simpleSaveNames() const { return true; } + int SherlockMetaEngine::getMaximumSaveSlot() const { return MAX_SAVEGAME_SLOTS; } diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp index 4b91f50a61..802687b461 100644 --- a/engines/sky/detection.cpp +++ b/engines/sky/detection.cpp @@ -78,12 +78,13 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual GameList getSupportedGames() const; virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; - virtual GameDescriptor findGame(const char *gameid) const; + virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const Common::FSList &fslist) const; virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -247,6 +248,8 @@ SaveStateList SkyMetaEngine::listSaves(const char *target) const { return saveList; } +bool SkyMetaEngine::simpleSaveNames() const { return false; } + int SkyMetaEngine::getMaximumSaveSlot() const { return MAX_SAVE_GAMES; } void SkyMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 0edf856125..d9cc3cda7f 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -91,6 +91,7 @@ public: virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const Common::FSList &fslist) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -263,6 +264,8 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const { return saveList; } +bool SwordMetaEngine::simpleSaveNames() const { return false; } + int SwordMetaEngine::getMaximumSaveSlot() const { return 999; } void SwordMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 44371bf6cf..3213a26e4c 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -97,6 +97,7 @@ public: virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const Common::FSList &fslist) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; @@ -256,6 +257,8 @@ SaveStateList Sword2MetaEngine::listSaves(const char *target) const { return saveList; } +bool Sword2MetaEngine::simpleSaveNames() const { return true; } + int Sword2MetaEngine::getMaximumSaveSlot() const { return 999; } void Sword2MetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/sword25/detection.cpp b/engines/sword25/detection.cpp index c5f55b5a26..1c4544c76a 100644 --- a/engines/sword25/detection.cpp +++ b/engines/sword25/detection.cpp @@ -69,6 +69,7 @@ public: virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; virtual int getMaximumSaveSlot() const { return Sword25::PersistenceService::getSlotCount(); } virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; }; bool Sword25MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { @@ -109,6 +110,8 @@ SaveStateList Sword25MetaEngine::listSaves(const char *target) const { return saveList; } +bool Sword25MetaEngine::simpleSaveNames() const { return false; } + #if PLUGIN_ENABLED_DYNAMIC(SWORD25) REGISTER_PLUGIN_DYNAMIC(SWORD25, PLUGIN_TYPE_ENGINE, Sword25MetaEngine); #else diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp index caa7bdbec9..a8d32e89d4 100644 --- a/engines/teenagent/detection.cpp +++ b/engines/teenagent/detection.cpp @@ -149,6 +149,8 @@ public: return saveList; } + virtual bool simpleSaveNames() const { return false; } + virtual int getMaximumSaveSlot() const { return MAX_SAVES - 1; } diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index c44f1f4ef3..7d8b54e5db 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -101,6 +101,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -164,6 +165,8 @@ SaveStateList TinselMetaEngine::listSaves(const char *target) const { return saveList; } +bool TinselMetaEngine::simpleSaveNames() const { return true; } + bool TinselMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { const Tinsel::TinselGameDescription *gd = (const Tinsel::TinselGameDescription *)desc; if (gd) { diff --git a/engines/toltecs/detection.cpp b/engines/toltecs/detection.cpp index 7c707895e6..8da9106931 100644 --- a/engines/toltecs/detection.cpp +++ b/engines/toltecs/detection.cpp @@ -221,6 +221,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -288,6 +289,8 @@ SaveStateList ToltecsMetaEngine::listSaves(const char *target) const { return saveList; } +bool ToltecsMetaEngine::simpleSaveNames() const { return true; } + int ToltecsMetaEngine::getMaximumSaveSlot() const { return 999; } diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index ec0b3e186b..5dda4c7caf 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -82,6 +82,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -141,6 +142,8 @@ SaveStateList TonyMetaEngine::listSaves(const char *target) const { return saveList; } +bool TonyMetaEngine::simpleSaveNames() const { return false; } + int TonyMetaEngine::getMaximumSaveSlot() const { return 99; } diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp index 5d2e0a9bca..eac91a5595 100644 --- a/engines/toon/detection.cpp +++ b/engines/toon/detection.cpp @@ -148,6 +148,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -212,6 +213,8 @@ SaveStateList ToonMetaEngine::listSaves(const char *target) const { return saveList; } +bool ToonMetaEngine::simpleSaveNames() const { return true; } + SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp index dcb58ffae6..e2737d4f2c 100644 --- a/engines/touche/detection.cpp +++ b/engines/touche/detection.cpp @@ -155,6 +155,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -210,6 +211,8 @@ SaveStateList ToucheMetaEngine::listSaves(const char *target) const { return saveList; } +bool ToucheMetaEngine::simpleSaveNames() const { return false; } + int ToucheMetaEngine::getMaximumSaveSlot() const { return Touche::kMaxSaveStates - 1; } diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp index 584ad87742..716ac4af53 100644 --- a/engines/tsage/detection.cpp +++ b/engines/tsage/detection.cpp @@ -145,6 +145,8 @@ public: return saveList; } + virtual bool simpleSaveNames() const { return true; } + virtual int getMaximumSaveSlot() const { return MAX_SAVES - 1; } diff --git a/engines/tucker/detection.cpp b/engines/tucker/detection.cpp index 2447e15d6b..227924cd28 100644 --- a/engines/tucker/detection.cpp +++ b/engines/tucker/detection.cpp @@ -187,6 +187,8 @@ public: return saveList; } + virtual bool simpleSaveNames() const { return false; } + virtual int getMaximumSaveSlot() const { return Tucker::kLastSaveSlot; } diff --git a/engines/voyeur/detection.cpp b/engines/voyeur/detection.cpp index 7b9fa6722e..76668eb370 100644 --- a/engines/voyeur/detection.cpp +++ b/engines/voyeur/detection.cpp @@ -81,6 +81,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -143,6 +144,8 @@ SaveStateList VoyeurMetaEngine::listSaves(const char *target) const { return saveList; } +bool VoyeurMetaEngine::simpleSaveNames() const { return true; } + int VoyeurMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES; } diff --git a/engines/wage/detection.cpp b/engines/wage/detection.cpp index a27bfd7fde..1069d740f6 100644 --- a/engines/wage/detection.cpp +++ b/engines/wage/detection.cpp @@ -70,6 +70,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -136,6 +137,8 @@ SaveStateList WageMetaEngine::listSaves(const char *target) const { return saveList; } +bool WageMetaEngine::simpleSaveNames() const { return true; } + int WageMetaEngine::getMaximumSaveSlot() const { return 999; } void WageMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp index 4e8eab505f..f225cd3930 100644 --- a/engines/wintermute/detection.cpp +++ b/engines/wintermute/detection.cpp @@ -164,6 +164,8 @@ public: return saves; } + virtual bool simpleSaveNames() const { return false; } + int getMaximumSaveSlot() const { return 100; } diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index cc967070d9..05dfb8b8d0 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -75,6 +75,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; SaveStateList listSaves(const char *target) const; + virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -159,6 +160,8 @@ SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { return saveList; } +bool ZVisionMetaEngine::simpleSaveNames() const { return true; } + int ZVisionMetaEngine::getMaximumSaveSlot() const { return 999; } -- cgit v1.2.3 From aee713141b3a401f08e63cd9ccf5ce3dfe1cb06e Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Sat, 18 Jun 2016 18:49:46 +0600 Subject: CLOUD: Make OutSaveFile start saves sync It had to become a proxy class in order to do that. finalize() starts the saves sync. --- engines/kyra/saveload_eob.cpp | 4 ++-- engines/kyra/saveload_hof.cpp | 2 +- engines/kyra/saveload_lok.cpp | 2 +- engines/kyra/saveload_lol.cpp | 2 +- engines/kyra/saveload_mr.cpp | 2 +- engines/tsage/stP1kAlM | Bin 0 -> 24604948 bytes 6 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 engines/tsage/stP1kAlM (limited to 'engines') diff --git a/engines/kyra/saveload_eob.cpp b/engines/kyra/saveload_eob.cpp index cca8f3a0a4..6fdff0fc80 100644 --- a/engines/kyra/saveload_eob.cpp +++ b/engines/kyra/saveload_eob.cpp @@ -328,7 +328,7 @@ Common::Error EoBCoreEngine::saveGameStateIntern(int slot, const char *saveName, fileName = getSavegameFilename(slot); } - Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumbnail); + Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumbnail)); if (!out) return _saveFileMan->getError(); @@ -995,7 +995,7 @@ bool EoBCoreEngine::saveAsOriginalSaveFile(int slot) { return false; Common::FSNode nf = nd.getChild(_flags.gameID == GI_EOB1 ? "EOBDATA.SAV" : Common::String::format("EOBDATA%d.SAV", slot)); - Common::WriteStream *out = nf.createWriteStream(); + Common::OutSaveFile *out = new Common::OutSaveFile(nf.createWriteStream()); if (_flags.gameID == GI_EOB2) { static const char tempStr[20] = "SCUMMVM EXPORT "; diff --git a/engines/kyra/saveload_hof.cpp b/engines/kyra/saveload_hof.cpp index e8e76143bd..60ceebd28d 100644 --- a/engines/kyra/saveload_hof.cpp +++ b/engines/kyra/saveload_hof.cpp @@ -34,7 +34,7 @@ namespace Kyra { Common::Error KyraEngine_HoF::saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumb) { const char *fileName = getSavegameFilename(slot); - Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb); + Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumb)); if (!out) return _saveFileMan->getError(); diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp index 1d729d0103..cb2124a537 100644 --- a/engines/kyra/saveload_lok.cpp +++ b/engines/kyra/saveload_lok.cpp @@ -241,7 +241,7 @@ Common::Error KyraEngine_LoK::saveGameStateIntern(int slot, const char *saveName if (shouldQuit()) return Common::kNoError; - Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb); + Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumb)); if (!out) return _saveFileMan->getError(); diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp index e02b8fb22c..a5ecd3b248 100644 --- a/engines/kyra/saveload_lol.cpp +++ b/engines/kyra/saveload_lol.cpp @@ -335,7 +335,7 @@ Common::Error LoLEngine::loadGameState(int slot) { Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail) { const char *fileName = getSavegameFilename(slot); - Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumbnail); + Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumbnail)); if (!out) return _saveFileMan->getError(); diff --git a/engines/kyra/saveload_mr.cpp b/engines/kyra/saveload_mr.cpp index a938003a07..3c225e6d50 100644 --- a/engines/kyra/saveload_mr.cpp +++ b/engines/kyra/saveload_mr.cpp @@ -33,7 +33,7 @@ namespace Kyra { Common::Error KyraEngine_MR::saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumb) { const char *fileName = getSavegameFilename(slot); - Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb); + Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumb)); if (!out) return _saveFileMan->getError(); diff --git a/engines/tsage/stP1kAlM b/engines/tsage/stP1kAlM new file mode 100644 index 0000000000..dfbb3b9786 Binary files /dev/null and b/engines/tsage/stP1kAlM differ -- cgit v1.2.3 From 2d3cfffa84f80578dfc0bd3c72b83587f9b8dae5 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Sun, 19 Jun 2016 12:58:02 +0600 Subject: KYRA: Fix openSaveForWriting() to return OutSaveFile --- engines/kyra/kyra_v1.h | 3 ++- engines/kyra/saveload.cpp | 4 ++-- engines/kyra/saveload_eob.cpp | 2 +- engines/kyra/saveload_hof.cpp | 2 +- engines/kyra/saveload_lok.cpp | 2 +- engines/kyra/saveload_lol.cpp | 2 +- engines/kyra/saveload_mr.cpp | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index c801829855..4de7494510 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -38,6 +38,7 @@ #include "kyra/item.h" namespace Common { +class OutSaveFile; class SeekableReadStream; class WriteStream; } // End of namespace Common @@ -423,7 +424,7 @@ protected: virtual Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail) = 0; Common::SeekableReadStream *openSaveForReading(const char *filename, SaveHeader &header, bool checkID = true); - Common::WriteStream *openSaveForWriting(const char *filename, const char *saveName, const Graphics::Surface *thumbnail) const; + Common::OutSaveFile *openSaveForWriting(const char *filename, const char *saveName, const Graphics::Surface *thumbnail) const; // TODO: Consider moving this to Screen virtual Graphics::Surface *generateSaveThumbnail() const { return 0; } diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index 2ae6420bd7..81ea796fe9 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -184,7 +184,7 @@ Common::SeekableReadStream *KyraEngine_v1::openSaveForReading(const char *filena return in; } -Common::WriteStream *KyraEngine_v1::openSaveForWriting(const char *filename, const char *saveName, const Graphics::Surface *thumbnail) const { +Common::OutSaveFile *KyraEngine_v1::openSaveForWriting(const char *filename, const char *saveName, const Graphics::Surface *thumbnail) const { if (shouldQuit()) return 0; @@ -226,7 +226,7 @@ Common::WriteStream *KyraEngine_v1::openSaveForWriting(const char *filename, con delete genThumbnail; } - return out; + return new Common::OutSaveFile(out); } const char *KyraEngine_v1::getSavegameFilename(int num) { diff --git a/engines/kyra/saveload_eob.cpp b/engines/kyra/saveload_eob.cpp index 6fdff0fc80..9329d14255 100644 --- a/engines/kyra/saveload_eob.cpp +++ b/engines/kyra/saveload_eob.cpp @@ -328,7 +328,7 @@ Common::Error EoBCoreEngine::saveGameStateIntern(int slot, const char *saveName, fileName = getSavegameFilename(slot); } - Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumbnail)); + Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumbnail); if (!out) return _saveFileMan->getError(); diff --git a/engines/kyra/saveload_hof.cpp b/engines/kyra/saveload_hof.cpp index 60ceebd28d..e8e76143bd 100644 --- a/engines/kyra/saveload_hof.cpp +++ b/engines/kyra/saveload_hof.cpp @@ -34,7 +34,7 @@ namespace Kyra { Common::Error KyraEngine_HoF::saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumb) { const char *fileName = getSavegameFilename(slot); - Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumb)); + Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb); if (!out) return _saveFileMan->getError(); diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp index cb2124a537..1d729d0103 100644 --- a/engines/kyra/saveload_lok.cpp +++ b/engines/kyra/saveload_lok.cpp @@ -241,7 +241,7 @@ Common::Error KyraEngine_LoK::saveGameStateIntern(int slot, const char *saveName if (shouldQuit()) return Common::kNoError; - Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumb)); + Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb); if (!out) return _saveFileMan->getError(); diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp index a5ecd3b248..e02b8fb22c 100644 --- a/engines/kyra/saveload_lol.cpp +++ b/engines/kyra/saveload_lol.cpp @@ -335,7 +335,7 @@ Common::Error LoLEngine::loadGameState(int slot) { Common::Error LoLEngine::saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail) { const char *fileName = getSavegameFilename(slot); - Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumbnail)); + Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumbnail); if (!out) return _saveFileMan->getError(); diff --git a/engines/kyra/saveload_mr.cpp b/engines/kyra/saveload_mr.cpp index 3c225e6d50..a938003a07 100644 --- a/engines/kyra/saveload_mr.cpp +++ b/engines/kyra/saveload_mr.cpp @@ -33,7 +33,7 @@ namespace Kyra { Common::Error KyraEngine_MR::saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumb) { const char *fileName = getSavegameFilename(slot); - Common::OutSaveFile *out = new Common::OutSaveFile(openSaveForWriting(fileName, saveName, thumb)); + Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb); if (!out) return _saveFileMan->getError(); -- cgit v1.2.3 From 4a0a5af52ef4a9c184f8aa49b191e78ed24b5b92 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 12:42:57 +0600 Subject: TESTBED: Add first Cloud tests Adding tests for: * Storage::info(); * Storage::listDirectory(); * Storage::createDirectory(). --- engines/testbed/cloud.cpp | 284 ++++++++++++++++++++++++++++++++++++++++ engines/testbed/cloud.h | 73 +++++++++++ engines/testbed/config-params.h | 12 ++ engines/testbed/module.mk | 5 + engines/testbed/testbed.cpp | 8 ++ 5 files changed, 382 insertions(+) create mode 100644 engines/testbed/cloud.cpp create mode 100644 engines/testbed/cloud.h (limited to 'engines') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp new file mode 100644 index 0000000000..655e2f72bc --- /dev/null +++ b/engines/testbed/cloud.cpp @@ -0,0 +1,284 @@ +/* ScummVM - Graphic Adventure Engine +* +* ScummVM is the legal property of its developers, whose names +* are too numerous to list here. Please refer to the COPYRIGHT +* file distributed with this source distribution. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +*/ + +#include "common/config-manager.h" +#include "common/stream.h" +#include "common/util.h" + +#include "testbed/cloud.h" +#include + +namespace Testbed { + +CloudTestSuite::CloudTestSuite() { + // Cloud tests depend on CloudMan. + // If there is no Storage connected to it, disable this test suite. + if (CloudMan.getCurrentStorage() == nullptr) { + logPrintf("WARNING! : No Storage connected to CloudMan found. Skipping Cloud tests\n"); + Testsuite::enable(false); + } + + addTest("UserInfo", &CloudTests::testInfo, true); + addTest("ListDirectory", &CloudTests::testDirectoryListing, true); + addTest("CreateDirectory", &CloudTests::testDirectoryCreating, true); +} + +/* +void CloudTestSuite::enable(bool flag) { + Testsuite::enable(ConfParams.isGameDataFound() ? flag : false); +} +*/ + +///// TESTS GO HERE ///// + +bool CloudTests::waitForCallback() { + const int TIMEOUT = 30; + + Common::Point pt; + pt.x = 10; pt.y = 10; + Testsuite::writeOnScreen("Waiting for callback...", pt); + + int left = TIMEOUT; + while (--left) { + if (ConfParams.isCloudTestCallbackCalled()) return true; + if (ConfParams.isCloudTestErrorCallbackCalled()) return true; + g_system->delayMillis(1000); + } + return false; +} + +void CloudTests::infoCallback(Cloud::Storage::StorageInfoResponse response) { + ConfParams.setCloudTestCallbackCalled(true); + Testsuite::logPrintf("Info! User's ID: %s\n", response.value.uid().c_str()); + Testsuite::logPrintf("Info! User's email: %s\n", response.value.email().c_str()); + Testsuite::logPrintf("Info! User's name: %s\n", response.value.name().c_str()); + Testsuite::logPrintf("Info! User's quota: %lu bytes used / %lu bytes available\n", response.value.used(), response.value.available()); +} + +void CloudTests::directoryListedCallback(Cloud::Storage::FileArrayResponse response) { + ConfParams.setCloudTestCallbackCalled(true); + if (response.value.size() == 0) { + Testsuite::logPrintf("Warning! Directory is empty!\n"); + return; + } + + Common::String directory, file; + uint32 directories = 0, files = 0; + for (uint32 i = 0; i < response.value.size(); ++i) { + if (response.value[i].isDirectory()) { + if (++directories == 1) directory = response.value[i].path(); + } else { + if (++files == 1) file = response.value[i].name(); + } + } + + if (directories == 0) { + Testsuite::logPrintf("Info! %u files listed, first one is '%s'\n", files, file.c_str()); + } else if (files == 0) { + Testsuite::logPrintf("Info! %u directories listed, first one is '%s'\n", directories, directory.c_str()); + } else { + Testsuite::logPrintf("Info! %u directories and %u files listed\n", directories, files); + Testsuite::logPrintf("Info! First directory is '%u' and first file is '%s'\n", directory.c_str(), file.c_str()); + } +} + +void CloudTests::directoryCreatedCallback(Cloud::Storage::BoolResponse response) { + ConfParams.setCloudTestCallbackCalled(true); + if (response.value) { + Testsuite::logPrintf("Info! Directory created!\n"); + } else { + Testsuite::logPrintf("Info! Such directory already exists!\n"); + } +} + +void CloudTests::errorCallback(Networking::ErrorResponse response) { + ConfParams.setCloudTestErrorCallbackCalled(true); + Testsuite::logPrintf("Info! Error Callback was called\n"); + Testsuite::logPrintf("Info! code = %ld, message = %s\n", response.httpResponseCode, response.response.c_str()); +} + +/** This test calls Storage::info(). */ + +TestExitStatus CloudTests::testInfo() { + ConfParams.setCloudTestCallbackCalled(false); + ConfParams.setCloudTestErrorCallbackCalled(false); + + if (CloudMan.getCurrentStorage() == nullptr) { + Testsuite::logPrintf("Couldn't find connected Storage\n"); + return kTestFailed; + } + + Common::String info = Common::String::format( + "Welcome to the Cloud test suite!\n" + "We're going to use the %s cloud storage which is connected right now.\n\n" + "Testing Cloud Storage API info() method.\n" + "In this test we'll try to list user infomation.", + CloudMan.getCurrentStorage()->name().c_str() + ); + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : info()\n"); + return kTestSkipped; + } + + if (CloudMan.info( + new Common::GlobalFunctionCallback(&infoCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + + waitForCallback(); + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Info was displayed\n"); + return kTestPassed; +} + +TestExitStatus CloudTests::testDirectoryListing() { + ConfParams.setCloudTestCallbackCalled(false); + ConfParams.setCloudTestErrorCallbackCalled(false); + + if (CloudMan.getCurrentStorage() == nullptr) { + Testsuite::logPrintf("Couldn't find connected Storage\n"); + return kTestFailed; + } + + Common::String info = "Testing Cloud Storage API listDirectory() method.\n" + "In this test we'll try to list root directory."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : listDirectory()\n"); + return kTestSkipped; + } + + if (CloudMan.listDirectory( + "", + new Common::GlobalFunctionCallback(&directoryListedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + + waitForCallback(); + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Directory was listed\n"); + return kTestPassed; +} + +TestExitStatus CloudTests::testDirectoryCreating() { + ConfParams.setCloudTestCallbackCalled(false); + ConfParams.setCloudTestErrorCallbackCalled(false); + + if (CloudMan.getCurrentStorage() == nullptr) { + Testsuite::logPrintf("Couldn't find connected Storage\n"); + return kTestFailed; + } + + Common::String info = "Testing Cloud Storage API createDirectory() method.\n" + "In this test we'll try to create a 'testbed' directory."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : createDirectory()\n"); + return kTestSkipped; + } + + Common::String info2 = "We'd list the root directory, create the directory and the list it again.\n" + "If all goes smoothly, you'd notice that there are more directories now."; + Testsuite::displayMessage(info2); + + // list root directory + if (CloudMan.listDirectory( + "", + new Common::GlobalFunctionCallback(&directoryListedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + + waitForCallback(); + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + + ConfParams.setCloudTestCallbackCalled(false); + + // create 'testbed' + if (CloudMan.getCurrentStorage()->createDirectory( + "/testbed", + new Common::GlobalFunctionCallback(&directoryCreatedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + + waitForCallback(); + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + + ConfParams.setCloudTestCallbackCalled(false); + + // list it again + if (CloudMan.listDirectory( + "", + new Common::GlobalFunctionCallback(&directoryListedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + + waitForCallback(); + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + + if (Testsuite::handleInteractiveInput("Was the CloudMan able to create a 'testbed' directory?", "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! Directory was not created!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Directory was created\n"); + return kTestPassed; +} + +} // End of namespace Testbed diff --git a/engines/testbed/cloud.h b/engines/testbed/cloud.h new file mode 100644 index 0000000000..827b231ea5 --- /dev/null +++ b/engines/testbed/cloud.h @@ -0,0 +1,73 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TESTBED_CLOUD_H +#define TESTBED_CLOUD_H + +#include "testbed/testsuite.h" +#include + +// This file can be used as template for header files of other newer testsuites. + +namespace Testbed { + +namespace CloudTests { + +// Helper functions for Cloud tests + +bool waitForCallback(); +void infoCallback(Cloud::Storage::StorageInfoResponse response); +void directoryListedCallback(Cloud::Storage::FileArrayResponse response); +void directoryCreatedCallback(Cloud::Storage::BoolResponse response); +void errorCallback(Networking::ErrorResponse response); + +TestExitStatus testInfo(); +TestExitStatus testDirectoryListing(); +TestExitStatus testDirectoryCreating(); + +} // End of namespace CloudTests + +class CloudTestSuite : public Testsuite { +public: + /** + * The constructor for the CloudTestSuite + * For every test to be executed one must: + * 1) Create a function that would invoke the test + * 2) Add that test to list by executing addTest() + * + * @see addTest() + */ + CloudTestSuite(); + ~CloudTestSuite() {} + const char *getName() const { + return "Cloud"; + } + + const char *getDescription() const { + return "CloudMan, Storage API tests"; + } + +}; + +} // End of namespace Testbed + +#endif // TESTBED_TEMPLATE_H diff --git a/engines/testbed/config-params.h b/engines/testbed/config-params.h index 89aae199b6..57fd099bf4 100644 --- a/engines/testbed/config-params.h +++ b/engines/testbed/config-params.h @@ -54,6 +54,10 @@ private: */ bool _isInteractive; bool _isGameDataFound; +#ifdef USE_LIBCURL + bool _isCloudTestCallbackCalled; + bool _isCloudTestErrorCallbackCalled; +#endif bool _rerunTests; TestbedConfigManager *_testbedConfMan; @@ -68,6 +72,14 @@ public: bool isGameDataFound() { return _isGameDataFound; } void setGameDataFound(bool status) { _isGameDataFound = status; } +#ifdef USE_LIBCURL + bool isCloudTestCallbackCalled() const { return _isCloudTestCallbackCalled; } + void setCloudTestCallbackCalled(bool status) { _isCloudTestCallbackCalled = status; } + + bool isCloudTestErrorCallbackCalled() const { return _isCloudTestErrorCallbackCalled; } + void setCloudTestErrorCallbackCalled(bool status) { _isCloudTestErrorCallbackCalled = status; } +#endif + TestbedConfigManager *getTestbedConfigManager() { return _testbedConfMan; } void setTestbedConfigManager(TestbedConfigManager* confMan) { _testbedConfMan = confMan; } diff --git a/engines/testbed/module.mk b/engines/testbed/module.mk index ce78a48bc5..3a7eb2ebfb 100644 --- a/engines/testbed/module.mk +++ b/engines/testbed/module.mk @@ -14,6 +14,11 @@ MODULE_OBJS := \ testbed.o \ testsuite.o +ifdef USE_LIBCURL +MODULE_OBJS += \ + cloud.o +endif + MODULE_DIRS += \ engines/testbed diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp index 885429cafd..a2f9aad16c 100644 --- a/engines/testbed/testbed.cpp +++ b/engines/testbed/testbed.cpp @@ -39,6 +39,9 @@ #include "testbed/savegame.h" #include "testbed/sound.h" #include "testbed/testbed.h" +#ifdef USE_LIBCURL +#include "testbed/cloud.h" +#endif namespace Testbed { @@ -134,6 +137,11 @@ TestbedEngine::TestbedEngine(OSystem *syst) // Midi ts = new MidiTestSuite(); _testsuiteList.push_back(ts); +#ifdef USE_LIBCURL + // Cloud + ts = new CloudTestSuite(); + _testsuiteList.push_back(ts); +#endif } TestbedEngine::~TestbedEngine() { -- cgit v1.2.3 From 721ee9527e9ff8d028aa0ba70fb4e4c80f7e6060 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 13:05:24 +0600 Subject: TESTBED: Fix CloudTests to ask users whether to wait Callbacks might be slow (like in SyncSaves), but they also could hang forever, so users now are being asked whether they want to wait or to skip the test. --- engines/testbed/cloud.cpp | 21 ++++++++++++++++----- engines/testbed/cloud.h | 1 + 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp index 655e2f72bc..73b0b8b5c1 100644 --- a/engines/testbed/cloud.cpp +++ b/engines/testbed/cloud.cpp @@ -66,6 +66,17 @@ bool CloudTests::waitForCallback() { return false; } +bool CloudTests::waitForCallbackMore() { + while (!waitForCallback()) { + Common::String info = "It takes more time than expected. Do you want to skip the test or wait more?"; + if (Testsuite::handleInteractiveInput(info, "Wait", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : info()\n"); + return false; + } + } + return true; +} + void CloudTests::infoCallback(Cloud::Storage::StorageInfoResponse response) { ConfParams.setCloudTestCallbackCalled(true); Testsuite::logPrintf("Info! User's ID: %s\n", response.value.uid().c_str()); @@ -147,7 +158,7 @@ TestExitStatus CloudTests::testInfo() { Testsuite::logPrintf("Warning! No Request is returned!\n"); } - waitForCallback(); + if (!waitForCallbackMore()) return kTestSkipped; Testsuite::clearScreen(); if (ConfParams.isCloudTestErrorCallbackCalled()) { @@ -184,7 +195,7 @@ TestExitStatus CloudTests::testDirectoryListing() { Testsuite::logPrintf("Warning! No Request is returned!\n"); } - waitForCallback(); + if (!waitForCallbackMore()) return kTestSkipped; Testsuite::clearScreen(); if (ConfParams.isCloudTestErrorCallbackCalled()) { @@ -226,7 +237,7 @@ TestExitStatus CloudTests::testDirectoryCreating() { Testsuite::logPrintf("Warning! No Request is returned!\n"); } - waitForCallback(); + if (!waitForCallbackMore()) return kTestSkipped; Testsuite::clearScreen(); if (ConfParams.isCloudTestErrorCallbackCalled()) { @@ -245,7 +256,7 @@ TestExitStatus CloudTests::testDirectoryCreating() { Testsuite::logPrintf("Warning! No Request is returned!\n"); } - waitForCallback(); + if (!waitForCallbackMore()) return kTestSkipped; Testsuite::clearScreen(); if (ConfParams.isCloudTestErrorCallbackCalled()) { @@ -264,7 +275,7 @@ TestExitStatus CloudTests::testDirectoryCreating() { Testsuite::logPrintf("Warning! No Request is returned!\n"); } - waitForCallback(); + if (!waitForCallbackMore()) return kTestSkipped; Testsuite::clearScreen(); if (ConfParams.isCloudTestErrorCallbackCalled()) { diff --git a/engines/testbed/cloud.h b/engines/testbed/cloud.h index 827b231ea5..17bc0938c9 100644 --- a/engines/testbed/cloud.h +++ b/engines/testbed/cloud.h @@ -35,6 +35,7 @@ namespace CloudTests { // Helper functions for Cloud tests bool waitForCallback(); +bool waitForCallbackMore(); void infoCallback(Cloud::Storage::StorageInfoResponse response); void directoryListedCallback(Cloud::Storage::FileArrayResponse response); void directoryCreatedCallback(Cloud::Storage::BoolResponse response); -- cgit v1.2.3 From 6d227a437a6b52f6bc0e75f459d79e22e3d8fb2d Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 13:54:06 +0600 Subject: TESTBED: Add CloudTests::testUploading() --- engines/testbed/cloud.cpp | 103 ++++++++++++++++++++++++++++++++++++++++++++-- engines/testbed/cloud.h | 2 + 2 files changed, 101 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp index 73b0b8b5c1..5138454bd8 100644 --- a/engines/testbed/cloud.cpp +++ b/engines/testbed/cloud.cpp @@ -23,7 +23,7 @@ #include "common/config-manager.h" #include "common/stream.h" #include "common/util.h" - +#include "testbed/fs.h" #include "testbed/cloud.h" #include @@ -40,6 +40,7 @@ CloudTestSuite::CloudTestSuite() { addTest("UserInfo", &CloudTests::testInfo, true); addTest("ListDirectory", &CloudTests::testDirectoryListing, true); addTest("CreateDirectory", &CloudTests::testDirectoryCreating, true); + addTest("FileUpload", &CloudTests::testUploading, true); } /* @@ -121,6 +122,12 @@ void CloudTests::directoryCreatedCallback(Cloud::Storage::BoolResponse response) } } +void CloudTests::fileUploadedCallback(Cloud::Storage::UploadResponse response) { + ConfParams.setCloudTestCallbackCalled(true); + Testsuite::logPrintf("Info! Uploaded file into '%s'\n", response.value.path().c_str()); + Testsuite::logPrintf("Info! It's id = '%s' and size = '%lu'\n", response.value.id().c_str(), response.value.size()); +} + void CloudTests::errorCallback(Networking::ErrorResponse response) { ConfParams.setCloudTestErrorCallbackCalled(true); Testsuite::logPrintf("Info! Error Callback was called\n"); @@ -268,9 +275,9 @@ TestExitStatus CloudTests::testDirectoryCreating() { // list it again if (CloudMan.listDirectory( - "", - new Common::GlobalFunctionCallback(&directoryListedCallback), - new Common::GlobalFunctionCallback(&errorCallback) + "", + new Common::GlobalFunctionCallback(&directoryListedCallback), + new Common::GlobalFunctionCallback(&errorCallback) ) == nullptr) { Testsuite::logPrintf("Warning! No Request is returned!\n"); } @@ -292,4 +299,92 @@ TestExitStatus CloudTests::testDirectoryCreating() { return kTestPassed; } +TestExitStatus CloudTests::testUploading() { + ConfParams.setCloudTestCallbackCalled(false); + ConfParams.setCloudTestErrorCallbackCalled(false); + + if (CloudMan.getCurrentStorage() == nullptr) { + Testsuite::logPrintf("Couldn't find connected Storage\n"); + return kTestFailed; + } + + Common::String info = "Testing Cloud Storage API upload() method.\n" + "In this test we'll try to upload a 'test1/file.txt' file."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : upload()\n"); + return kTestSkipped; + } + + if (!ConfParams.isGameDataFound()) { + Testsuite::logPrintf("Info! Couldn't find the game data, so skipping test : upload()\n"); + return kTestSkipped; + } + + const Common::String &path = ConfMan.get("path"); + Common::FSDirectory gameRoot(path); + Common::FSDirectory *directory = gameRoot.getSubDirectory("test1"); + Common::FSNode node = directory->getFSNode().getChild("file.txt"); + delete directory; + + if (CloudMan.getCurrentStorage()->uploadStreamSupported()) { + if (CloudMan.getCurrentStorage()->upload( + "/testbed/testfile.txt", + node.createReadStream(), + new Common::GlobalFunctionCallback(&fileUploadedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + } else { + Common::String filepath = node.getPath(); + if (CloudMan.getCurrentStorage()->upload( + "/testbed/testfile.txt", + filepath.c_str(), + new Common::GlobalFunctionCallback(&fileUploadedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + } + + if (!waitForCallbackMore()) return kTestSkipped; + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + + Common::String info2 = "upload() is finished. Do you want to list '/testbed' directory?"; + + if (!Testsuite::handleInteractiveInput(info2, "Yes", "No", kOptionRight)) { + ConfParams.setCloudTestCallbackCalled(false); + + if (CloudMan.listDirectory( + "/testbed/", + new Common::GlobalFunctionCallback(&directoryListedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + + if (!waitForCallbackMore()) return kTestSkipped; + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + } + + if (Testsuite::handleInteractiveInput("Was the CloudMan able to upload into 'testbed/testfile.txt' file?", "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! File was not uploaded!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("File was uploaded\n"); + return kTestPassed; +} + } // End of namespace Testbed diff --git a/engines/testbed/cloud.h b/engines/testbed/cloud.h index 17bc0938c9..177ac740a9 100644 --- a/engines/testbed/cloud.h +++ b/engines/testbed/cloud.h @@ -39,11 +39,13 @@ bool waitForCallbackMore(); void infoCallback(Cloud::Storage::StorageInfoResponse response); void directoryListedCallback(Cloud::Storage::FileArrayResponse response); void directoryCreatedCallback(Cloud::Storage::BoolResponse response); +void fileUploadedCallback(Cloud::Storage::UploadResponse response); void errorCallback(Networking::ErrorResponse response); TestExitStatus testInfo(); TestExitStatus testDirectoryListing(); TestExitStatus testDirectoryCreating(); +TestExitStatus testUploading(); } // End of namespace CloudTests -- cgit v1.2.3 From 7a34abe39e7fc5dc7ece81db5be84701599d4be2 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 14:16:53 +0600 Subject: TESTBED: Add CloudTests::testDownloading() --- engines/testbed/cloud.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++ engines/testbed/cloud.h | 2 ++ 2 files changed, 59 insertions(+) (limited to 'engines') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp index 5138454bd8..293fb79175 100644 --- a/engines/testbed/cloud.cpp +++ b/engines/testbed/cloud.cpp @@ -41,6 +41,7 @@ CloudTestSuite::CloudTestSuite() { addTest("ListDirectory", &CloudTests::testDirectoryListing, true); addTest("CreateDirectory", &CloudTests::testDirectoryCreating, true); addTest("FileUpload", &CloudTests::testUploading, true); + addTest("FileDownload", &CloudTests::testDownloading, true); } /* @@ -128,6 +129,15 @@ void CloudTests::fileUploadedCallback(Cloud::Storage::UploadResponse response) { Testsuite::logPrintf("Info! It's id = '%s' and size = '%lu'\n", response.value.id().c_str(), response.value.size()); } +void CloudTests::fileDownloadedCallback(Cloud::Storage::BoolResponse response) { + ConfParams.setCloudTestCallbackCalled(true); + if (response.value) { + Testsuite::logPrintf("Info! File downloaded!\n"); + } else { + Testsuite::logPrintf("Info! Failed to download the file!\n"); + } +} + void CloudTests::errorCallback(Networking::ErrorResponse response) { ConfParams.setCloudTestErrorCallbackCalled(true); Testsuite::logPrintf("Info! Error Callback was called\n"); @@ -387,4 +397,51 @@ TestExitStatus CloudTests::testUploading() { return kTestPassed; } +TestExitStatus CloudTests::testDownloading() { + ConfParams.setCloudTestCallbackCalled(false); + ConfParams.setCloudTestErrorCallbackCalled(false); + + if (CloudMan.getCurrentStorage() == nullptr) { + Testsuite::logPrintf("Couldn't find connected Storage\n"); + return kTestFailed; + } + + Common::String info = "Testing Cloud Storage API download() method.\n" + "In this test we'll try to download that 'testbed/testfile.txt' file."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : download()\n"); + return kTestSkipped; + } + + const Common::String &path = ConfMan.get("path"); + Common::FSDirectory gameRoot(path); + Common::FSNode node = gameRoot.getFSNode().getChild("downloaded_file.txt"); + Common::String filepath = node.getPath(); + if (CloudMan.getCurrentStorage()->download( + "/testbed/testfile.txt", + filepath.c_str(), + new Common::GlobalFunctionCallback(&fileDownloadedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + + if (!waitForCallbackMore()) return kTestSkipped; + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + + if (Testsuite::handleInteractiveInput("Was the CloudMan able to download into 'testbed/downloaded_file.txt' file?", "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! File was not downloaded!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("File was downloaded\n"); + return kTestPassed; +} + } // End of namespace Testbed diff --git a/engines/testbed/cloud.h b/engines/testbed/cloud.h index 177ac740a9..266bd32437 100644 --- a/engines/testbed/cloud.h +++ b/engines/testbed/cloud.h @@ -40,12 +40,14 @@ void infoCallback(Cloud::Storage::StorageInfoResponse response); void directoryListedCallback(Cloud::Storage::FileArrayResponse response); void directoryCreatedCallback(Cloud::Storage::BoolResponse response); void fileUploadedCallback(Cloud::Storage::UploadResponse response); +void fileDownloadedCallback(Cloud::Storage::BoolResponse response); void errorCallback(Networking::ErrorResponse response); TestExitStatus testInfo(); TestExitStatus testDirectoryListing(); TestExitStatus testDirectoryCreating(); TestExitStatus testUploading(); +TestExitStatus testDownloading(); } // End of namespace CloudTests -- cgit v1.2.3 From 4e2725135674515821247307ab8358069d1db48c Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 14:34:17 +0600 Subject: TESTBED: Add CloudTests::testFolderDownloading() --- engines/testbed/cloud.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++ engines/testbed/cloud.h | 2 ++ 2 files changed, 59 insertions(+) (limited to 'engines') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp index 293fb79175..9c6563c292 100644 --- a/engines/testbed/cloud.cpp +++ b/engines/testbed/cloud.cpp @@ -42,6 +42,7 @@ CloudTestSuite::CloudTestSuite() { addTest("CreateDirectory", &CloudTests::testDirectoryCreating, true); addTest("FileUpload", &CloudTests::testUploading, true); addTest("FileDownload", &CloudTests::testDownloading, true); + addTest("FolderDownload", &CloudTests::testFolderDownloading, true); } /* @@ -138,6 +139,15 @@ void CloudTests::fileDownloadedCallback(Cloud::Storage::BoolResponse response) { } } +void CloudTests::directoryDownloadedCallback(Cloud::Storage::FileArrayResponse response) { + ConfParams.setCloudTestCallbackCalled(true); + if (response.value.size() == 0) { + Testsuite::logPrintf("Info! Directory is downloaded successfully!\n"); + } else { + Testsuite::logPrintf("Warning! %lu files were not downloaded during folder downloading!\n", response.value.size()); + } +} + void CloudTests::errorCallback(Networking::ErrorResponse response) { ConfParams.setCloudTestErrorCallbackCalled(true); Testsuite::logPrintf("Info! Error Callback was called\n"); @@ -444,4 +454,51 @@ TestExitStatus CloudTests::testDownloading() { return kTestPassed; } +TestExitStatus CloudTests::testFolderDownloading() { + ConfParams.setCloudTestCallbackCalled(false); + ConfParams.setCloudTestErrorCallbackCalled(false); + + if (CloudMan.getCurrentStorage() == nullptr) { + Testsuite::logPrintf("Couldn't find connected Storage\n"); + return kTestFailed; + } + + Common::String info = "Testing Cloud Storage API downloadFolder() method.\n" + "In this test we'll try to download remote 'testbed/' directory."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : downloadFolder()\n"); + return kTestSkipped; + } + + const Common::String &path = ConfMan.get("path"); + Common::FSDirectory gameRoot(path); + Common::FSNode node = gameRoot.getFSNode().getChild("downloaded_directory"); + Common::String filepath = node.getPath(); + if (CloudMan.downloadFolder( + "/testbed/", + filepath.c_str(), + new Common::GlobalFunctionCallback(&directoryDownloadedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + + if (!waitForCallbackMore()) return kTestSkipped; + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + + if (Testsuite::handleInteractiveInput("Was the CloudMan able to download into 'testbed/downloaded_directory'?", "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! Directory was not downloaded!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Directory was downloaded\n"); + return kTestPassed; +} + } // End of namespace Testbed diff --git a/engines/testbed/cloud.h b/engines/testbed/cloud.h index 266bd32437..e9df51c27b 100644 --- a/engines/testbed/cloud.h +++ b/engines/testbed/cloud.h @@ -41,6 +41,7 @@ void directoryListedCallback(Cloud::Storage::FileArrayResponse response); void directoryCreatedCallback(Cloud::Storage::BoolResponse response); void fileUploadedCallback(Cloud::Storage::UploadResponse response); void fileDownloadedCallback(Cloud::Storage::BoolResponse response); +void directoryDownloadedCallback(Cloud::Storage::FileArrayResponse response); void errorCallback(Networking::ErrorResponse response); TestExitStatus testInfo(); @@ -48,6 +49,7 @@ TestExitStatus testDirectoryListing(); TestExitStatus testDirectoryCreating(); TestExitStatus testUploading(); TestExitStatus testDownloading(); +TestExitStatus testFolderDownloading(); } // End of namespace CloudTests -- cgit v1.2.3 From 04888cf454fb3243e82d424d46af1e2ca74d0b8c Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 14:58:10 +0600 Subject: TESTBED: Add CloudTests::testSavesSync() --- engines/testbed/cloud.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++ engines/testbed/cloud.h | 2 ++ 2 files changed, 57 insertions(+) (limited to 'engines') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp index 9c6563c292..9d10d7d051 100644 --- a/engines/testbed/cloud.cpp +++ b/engines/testbed/cloud.cpp @@ -43,6 +43,7 @@ CloudTestSuite::CloudTestSuite() { addTest("FileUpload", &CloudTests::testUploading, true); addTest("FileDownload", &CloudTests::testDownloading, true); addTest("FolderDownload", &CloudTests::testFolderDownloading, true); + addTest("SyncSaves", &CloudTests::testSavesSync, true); } /* @@ -148,6 +149,15 @@ void CloudTests::directoryDownloadedCallback(Cloud::Storage::FileArrayResponse r } } +void CloudTests::savesSyncedCallback(Cloud::Storage::BoolResponse response) { + ConfParams.setCloudTestCallbackCalled(true); + if (response.value) { + Testsuite::logPrintf("Info! Saves are synced successfully!\n"); + } else { + Testsuite::logPrintf("Warning! Saves were not synced!\n"); + } +} + void CloudTests::errorCallback(Networking::ErrorResponse response) { ConfParams.setCloudTestErrorCallbackCalled(true); Testsuite::logPrintf("Info! Error Callback was called\n"); @@ -501,4 +511,49 @@ TestExitStatus CloudTests::testFolderDownloading() { return kTestPassed; } +TestExitStatus CloudTests::testSavesSync() { + ConfParams.setCloudTestCallbackCalled(false); + ConfParams.setCloudTestErrorCallbackCalled(false); + + if (CloudMan.getCurrentStorage() == nullptr) { + Testsuite::logPrintf("Couldn't find connected Storage\n"); + return kTestFailed; + } + + Common::String info = "Testing Cloud Storage API syncSaves() method.\n" + "In this test we'll try to sync your saves."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : syncSaves()\n"); + return kTestSkipped; + } + + const Common::String &path = ConfMan.get("path"); + Common::FSDirectory gameRoot(path); + Common::FSNode node = gameRoot.getFSNode().getChild("downloaded_directory"); + Common::String filepath = node.getPath(); + if (CloudMan.syncSaves( + new Common::GlobalFunctionCallback(&savesSyncedCallback), + new Common::GlobalFunctionCallback(&errorCallback) + ) == nullptr) { + Testsuite::logPrintf("Warning! No Request is returned!\n"); + } + + if (!waitForCallbackMore()) return kTestSkipped; + Testsuite::clearScreen(); + + if (ConfParams.isCloudTestErrorCallbackCalled()) { + Testsuite::logPrintf("Error callback was called\n"); + return kTestFailed; + } + + if (Testsuite::handleInteractiveInput("Was the CloudMan able to sync saves?", "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! Saves were not synced!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Saves were synced successfully\n"); + return kTestPassed; +} + } // End of namespace Testbed diff --git a/engines/testbed/cloud.h b/engines/testbed/cloud.h index e9df51c27b..aa6ed8706e 100644 --- a/engines/testbed/cloud.h +++ b/engines/testbed/cloud.h @@ -42,6 +42,7 @@ void directoryCreatedCallback(Cloud::Storage::BoolResponse response); void fileUploadedCallback(Cloud::Storage::UploadResponse response); void fileDownloadedCallback(Cloud::Storage::BoolResponse response); void directoryDownloadedCallback(Cloud::Storage::FileArrayResponse response); +void savesSyncedCallback(Cloud::Storage::BoolResponse response); void errorCallback(Networking::ErrorResponse response); TestExitStatus testInfo(); @@ -50,6 +51,7 @@ TestExitStatus testDirectoryCreating(); TestExitStatus testUploading(); TestExitStatus testDownloading(); TestExitStatus testFolderDownloading(); +TestExitStatus testSavesSync(); } // End of namespace CloudTests -- cgit v1.2.3 From dcf904192630d1c180d60ff7989e3629ca5fc1b7 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 15:50:41 +0600 Subject: TESTBED: Fix CloudTests Now work with all available Storages. --- engines/testbed/cloud.cpp | 28 +++++++++++++++++----------- engines/testbed/cloud.h | 1 + 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'engines') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp index 9d10d7d051..775ae1037c 100644 --- a/engines/testbed/cloud.cpp +++ b/engines/testbed/cloud.cpp @@ -81,6 +81,12 @@ bool CloudTests::waitForCallbackMore() { return true; } +const char *CloudTests::getRemoteTestPath() { + if (CloudMan.getStorageIndex() == Cloud::kStorageDropboxId) + return "/testbed"; + return "testbed"; +} + void CloudTests::infoCallback(Cloud::Storage::StorageInfoResponse response) { ConfParams.setCloudTestCallbackCalled(true); Testsuite::logPrintf("Info! User's ID: %s\n", response.value.uid().c_str()); @@ -286,7 +292,7 @@ TestExitStatus CloudTests::testDirectoryCreating() { // create 'testbed' if (CloudMan.getCurrentStorage()->createDirectory( - "/testbed", + getRemoteTestPath(), new Common::GlobalFunctionCallback(&directoryCreatedCallback), new Common::GlobalFunctionCallback(&errorCallback) ) == nullptr) { @@ -359,7 +365,7 @@ TestExitStatus CloudTests::testUploading() { if (CloudMan.getCurrentStorage()->uploadStreamSupported()) { if (CloudMan.getCurrentStorage()->upload( - "/testbed/testfile.txt", + Common::String(getRemoteTestPath()) + "/testfile.txt", node.createReadStream(), new Common::GlobalFunctionCallback(&fileUploadedCallback), new Common::GlobalFunctionCallback(&errorCallback) @@ -369,10 +375,10 @@ TestExitStatus CloudTests::testUploading() { } else { Common::String filepath = node.getPath(); if (CloudMan.getCurrentStorage()->upload( - "/testbed/testfile.txt", - filepath.c_str(), - new Common::GlobalFunctionCallback(&fileUploadedCallback), - new Common::GlobalFunctionCallback(&errorCallback) + Common::String(getRemoteTestPath()) + "/testfile.txt", + filepath.c_str(), + new Common::GlobalFunctionCallback(&fileUploadedCallback), + new Common::GlobalFunctionCallback(&errorCallback) ) == nullptr) { Testsuite::logPrintf("Warning! No Request is returned!\n"); } @@ -392,9 +398,9 @@ TestExitStatus CloudTests::testUploading() { ConfParams.setCloudTestCallbackCalled(false); if (CloudMan.listDirectory( - "/testbed/", - new Common::GlobalFunctionCallback(&directoryListedCallback), - new Common::GlobalFunctionCallback(&errorCallback) + getRemoteTestPath(), + new Common::GlobalFunctionCallback(&directoryListedCallback), + new Common::GlobalFunctionCallback(&errorCallback) ) == nullptr) { Testsuite::logPrintf("Warning! No Request is returned!\n"); } @@ -439,7 +445,7 @@ TestExitStatus CloudTests::testDownloading() { Common::FSNode node = gameRoot.getFSNode().getChild("downloaded_file.txt"); Common::String filepath = node.getPath(); if (CloudMan.getCurrentStorage()->download( - "/testbed/testfile.txt", + Common::String(getRemoteTestPath()) + "/testfile.txt", filepath.c_str(), new Common::GlobalFunctionCallback(&fileDownloadedCallback), new Common::GlobalFunctionCallback(&errorCallback) @@ -486,7 +492,7 @@ TestExitStatus CloudTests::testFolderDownloading() { Common::FSNode node = gameRoot.getFSNode().getChild("downloaded_directory"); Common::String filepath = node.getPath(); if (CloudMan.downloadFolder( - "/testbed/", + getRemoteTestPath(), filepath.c_str(), new Common::GlobalFunctionCallback(&directoryDownloadedCallback), new Common::GlobalFunctionCallback(&errorCallback) diff --git a/engines/testbed/cloud.h b/engines/testbed/cloud.h index aa6ed8706e..ed27d7da82 100644 --- a/engines/testbed/cloud.h +++ b/engines/testbed/cloud.h @@ -36,6 +36,7 @@ namespace CloudTests { bool waitForCallback(); bool waitForCallbackMore(); +const char *getRemoteTestPath(); void infoCallback(Cloud::Storage::StorageInfoResponse response); void directoryListedCallback(Cloud::Storage::FileArrayResponse response); void directoryCreatedCallback(Cloud::Storage::BoolResponse response); -- cgit v1.2.3 From 830c7b578caaec95594e190d6727892b1973df62 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 16:47:37 +0600 Subject: TESTBED: Add Webserver test suite Two tests now: IP resolving and index page check. --- engines/testbed/module.mk | 5 +++ engines/testbed/testbed.cpp | 8 ++++ engines/testbed/webserver.cpp | 102 ++++++++++++++++++++++++++++++++++++++++++ engines/testbed/webserver.h | 64 ++++++++++++++++++++++++++ 4 files changed, 179 insertions(+) create mode 100644 engines/testbed/webserver.cpp create mode 100644 engines/testbed/webserver.h (limited to 'engines') diff --git a/engines/testbed/module.mk b/engines/testbed/module.mk index 3a7eb2ebfb..99e6157cde 100644 --- a/engines/testbed/module.mk +++ b/engines/testbed/module.mk @@ -19,6 +19,11 @@ MODULE_OBJS += \ cloud.o endif +ifdef USE_SDL_NET +MODULE_OBJS += \ + webserver.o +endif + MODULE_DIRS += \ engines/testbed diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp index a2f9aad16c..5943d47c58 100644 --- a/engines/testbed/testbed.cpp +++ b/engines/testbed/testbed.cpp @@ -42,6 +42,9 @@ #ifdef USE_LIBCURL #include "testbed/cloud.h" #endif +#ifdef USE_SDL_NET +#include "testbed/webserver.h" +#endif namespace Testbed { @@ -142,6 +145,11 @@ TestbedEngine::TestbedEngine(OSystem *syst) ts = new CloudTestSuite(); _testsuiteList.push_back(ts); #endif +#ifdef USE_SDL_NET + // Webserver + ts = new WebserverTestSuite(); + _testsuiteList.push_back(ts); +#endif } TestbedEngine::~TestbedEngine() { diff --git a/engines/testbed/webserver.cpp b/engines/testbed/webserver.cpp new file mode 100644 index 0000000000..f17b5a6f8c --- /dev/null +++ b/engines/testbed/webserver.cpp @@ -0,0 +1,102 @@ +/* ScummVM - Graphic Adventure Engine +* +* ScummVM is the legal property of its developers, whose names +* are too numerous to list here. Please refer to the COPYRIGHT +* file distributed with this source distribution. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +*/ + +#include "testbed/webserver.h" +#include "backends/networking/sdl_net/localwebserver.h" +#include "common/config-manager.h" +#include + +namespace Testbed { + +WebserverTestSuite::WebserverTestSuite() { + addTest("ResolveIP", &WebserverTests::testIP, true); + addTest("IndexPage", &WebserverTests::testIndexPage, true); +} + +///// TESTS GO HERE ///// + +/** This test calls Storage::info(). */ + +bool WebserverTests::startServer() { + Common::Point pt; + pt.x = 10; pt.y = 10; + Testsuite::writeOnScreen("Starting webserver...", pt); + LocalServer.start(); + g_system->delayMillis(500); + Testsuite::clearScreen(); + return LocalServer.isRunning(); +} + +TestExitStatus WebserverTests::testIP() { + if (!startServer()) { + Testsuite::logPrintf("Error! Can't start local webserver!\n"); + return kTestFailed; + } + + Common::String info = "Welcome to the Webserver test suite!\n" + "You would be visiting different server's pages and saying whether they work like they should.\n\n" + "Testing Webserver's IP resolving.\n" + "In this test we'll try to resolve server's IP."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : IP resolving\n"); + return kTestSkipped; + } + + if (Testsuite::handleInteractiveInput( + Common::String::format("Is this your machine's IP?\n%s", LocalServer.getAddress().c_str()), + "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! IP was not resolved!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("IP was resolved\n"); + return kTestPassed; +} + +TestExitStatus WebserverTests::testIndexPage() { + if (!startServer()) { + Testsuite::logPrintf("Error! Can't start local webserver!\n"); + return kTestFailed; + } + + Common::String info = "Testing Webserver's index page.\n" + "In this test we'll try to open server's index page."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : index page\n"); + return kTestSkipped; + } + + Networking::Browser::openUrl(LocalServer.getAddress()); + if (Testsuite::handleInteractiveInput( + Common::String::format("The %s page opens well?", LocalServer.getAddress().c_str()), + "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! Couldn't open server's index page!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Server's index page is OK\n"); + return kTestPassed; +} + +} // End of namespace Testbed diff --git a/engines/testbed/webserver.h b/engines/testbed/webserver.h new file mode 100644 index 0000000000..bdb37400b5 --- /dev/null +++ b/engines/testbed/webserver.h @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TESTBED_WEBSERVER_H +#define TESTBED_WEBSERVER_H + +#include "testbed/testsuite.h" + +namespace Testbed { + +namespace WebserverTests { + +// Helper functions for Webserver tests + +bool startServer(); +TestExitStatus testIP(); +TestExitStatus testIndexPage(); + +} // End of namespace WebserverTests + +class WebserverTestSuite : public Testsuite { +public: + /** + * The constructor for the WebserverTestSuite + * For every test to be executed one must: + * 1) Create a function that would invoke the test + * 2) Add that test to list by executing addTest() + * + * @see addTest() + */ + WebserverTestSuite(); + ~WebserverTestSuite() {} + const char *getName() const { + return "Webserver"; + } + + const char *getDescription() const { + return "Webserver tests"; + } + +}; + +} // End of namespace Testbed + +#endif // TESTBED_TEMPLATE_H -- cgit v1.2.3 From 817d831255ad37f82c21ba7f00c4795a536d33fb Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 17:06:09 +0600 Subject: TESTBED: Add more Webserver tests --- engines/testbed/webserver.cpp | 135 ++++++++++++++++++++++++++++++++++++++++++ engines/testbed/webserver.h | 5 ++ 2 files changed, 140 insertions(+) (limited to 'engines') diff --git a/engines/testbed/webserver.cpp b/engines/testbed/webserver.cpp index f17b5a6f8c..feb2911704 100644 --- a/engines/testbed/webserver.cpp +++ b/engines/testbed/webserver.cpp @@ -30,6 +30,11 @@ namespace Testbed { WebserverTestSuite::WebserverTestSuite() { addTest("ResolveIP", &WebserverTests::testIP, true); addTest("IndexPage", &WebserverTests::testIndexPage, true); + addTest("FilesPage", &WebserverTests::testFilesPageInvalidParameterValue, true); + addTest("CreateDirectory", &WebserverTests::testFilesPageCreateDirectory, true); + addTest("UploadFile", &WebserverTests::testFilesPageUploadFile, true); + addTest("UploadDirectory", &WebserverTests::testFilesPageUploadDirectory, true); + addTest("DownloadFile", &WebserverTests::testFilesPageDownloadFile, true); } ///// TESTS GO HERE ///// @@ -99,4 +104,134 @@ TestExitStatus WebserverTests::testIndexPage() { return kTestPassed; } +TestExitStatus WebserverTests::testFilesPageInvalidParameterValue() { + if (!startServer()) { + Testsuite::logPrintf("Error! Can't start local webserver!\n"); + return kTestFailed; + } + + Common::String info = "Testing Webserver's files page.\n" + "In this test we'll try to pass invalid parameter to files page."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : files page (invalid parameter)\n"); + return kTestSkipped; + } + + Networking::Browser::openUrl(LocalServer.getAddress()+"files?path=error"); + if (Testsuite::handleInteractiveInput( + Common::String::format("The %sfiles?path=error page displays error message?", LocalServer.getAddress().c_str()), + "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! No error message on invalid parameter in '/files'!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Server's files page detects invalid paramters fine\n"); + return kTestPassed; +} + +TestExitStatus WebserverTests::testFilesPageCreateDirectory() { + if (!startServer()) { + Testsuite::logPrintf("Error! Can't start local webserver!\n"); + return kTestFailed; + } + + Common::String info = "Testing Webserver's files page Create Directory feature.\n" + "In this test you'll try to create directory."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : files page create directory\n"); + return kTestSkipped; + } + + Networking::Browser::openUrl(LocalServer.getAddress() + "files?path=/root/"); + if (Testsuite::handleInteractiveInput( + Common::String::format("You could go to %sfiles page, navigate to some directory with write access and create a directory there?", LocalServer.getAddress().c_str()), + "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! Create Directory is not working!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Create Directory is OK\n"); + return kTestPassed; +} + +TestExitStatus WebserverTests::testFilesPageUploadFile() { + if (!startServer()) { + Testsuite::logPrintf("Error! Can't start local webserver!\n"); + return kTestFailed; + } + + Common::String info = "Testing Webserver's files page Upload Files feature.\n" + "In this test you'll try to upload a file."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : files page file upload\n"); + return kTestSkipped; + } + + Networking::Browser::openUrl(LocalServer.getAddress() + "files?path=/root/"); + if (Testsuite::handleInteractiveInput( + Common::String::format("You're able to upload a file in some directory with write access through %sfiles page?", LocalServer.getAddress().c_str()), + "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! Upload Files is not working!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Upload Files is OK\n"); + return kTestPassed; +} + +TestExitStatus WebserverTests::testFilesPageUploadDirectory() { + if (!startServer()) { + Testsuite::logPrintf("Error! Can't start local webserver!\n"); + return kTestFailed; + } + + Common::String info = "Testing Webserver's files page Upload Directory feature.\n" + "In this test you'll try to upload a directory (works in Chrome only)."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : files page directory upload\n"); + return kTestSkipped; + } + + Networking::Browser::openUrl(LocalServer.getAddress() + "files?path=/root/"); + if (Testsuite::handleInteractiveInput( + Common::String::format("You're able to upload a directory into some directory with write access through %sfiles page using Chrome?", LocalServer.getAddress().c_str()), + "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! Upload Directory is not working!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Upload Directory is OK\n"); + return kTestPassed; +} + +TestExitStatus WebserverTests::testFilesPageDownloadFile() { + if (!startServer()) { + Testsuite::logPrintf("Error! Can't start local webserver!\n"); + return kTestFailed; + } + + Common::String info = "Testing Webserver's files downloading feature.\n" + "In this test you'll try to download a file."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : files page download\n"); + return kTestSkipped; + } + + Networking::Browser::openUrl(LocalServer.getAddress() + "files?path=/root/"); + if (Testsuite::handleInteractiveInput( + Common::String::format("You're able to download a file through %sfiles page?", LocalServer.getAddress().c_str()), + "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! Files downloading is not working!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("Files downloading is OK\n"); + return kTestPassed; +} + } // End of namespace Testbed diff --git a/engines/testbed/webserver.h b/engines/testbed/webserver.h index bdb37400b5..3f3083469e 100644 --- a/engines/testbed/webserver.h +++ b/engines/testbed/webserver.h @@ -34,6 +34,11 @@ namespace WebserverTests { bool startServer(); TestExitStatus testIP(); TestExitStatus testIndexPage(); +TestExitStatus testFilesPageInvalidParameterValue(); +TestExitStatus testFilesPageCreateDirectory(); +TestExitStatus testFilesPageUploadFile(); +TestExitStatus testFilesPageUploadDirectory(); +TestExitStatus testFilesPageDownloadFile(); } // End of namespace WebserverTests -- cgit v1.2.3 From 737dc91e64c75e7b282e21d278f29705d74ce449 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 18 Jul 2016 17:14:50 +0600 Subject: TESTBED: Add openUrl test in MiscTests --- engines/testbed/misc.cpp | 25 +++++++++++++++++++++++++ engines/testbed/misc.h | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/testbed/misc.cpp b/engines/testbed/misc.cpp index 5847a8d2e4..3dde71e919 100644 --- a/engines/testbed/misc.cpp +++ b/engines/testbed/misc.cpp @@ -22,6 +22,7 @@ #include "testbed/misc.h" #include "common/timer.h" +#include namespace Testbed { @@ -160,10 +161,34 @@ TestExitStatus MiscTests::testMutexes() { return kTestFailed; } +TestExitStatus MiscTests::testOpenUrl() { + Common::String info = "Testing openUrl() method.\n" + "In this test we'll try to open scummvm.org in your default browser."; + + if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) { + Testsuite::logPrintf("Info! Skipping test : openUrl()\n"); + return kTestSkipped; + } + + if (!Networking::Browser::openUrl("http://scummvm.org/")) { + Testsuite::logPrintf("Info! openUrl() says it couldn't open the url (probably not supported on this platform)\n"); + return kTestFailed; + } + + if (Testsuite::handleInteractiveInput("Was ScummVM able to open 'http://scummvm.org/' in your default browser?", "Yes", "No", kOptionRight)) { + Testsuite::logDetailedPrintf("Error! openUrl() is not working!\n"); + return kTestFailed; + } + + Testsuite::logDetailedPrintf("openUrl() is OK\n"); + return kTestPassed; +} + MiscTestSuite::MiscTestSuite() { addTest("Datetime", &MiscTests::testDateTime, false); addTest("Timers", &MiscTests::testTimers, false); addTest("Mutexes", &MiscTests::testMutexes, false); + addTest("openUrl", &MiscTests::testOpenUrl, true); } } // End of namespace Testbed diff --git a/engines/testbed/misc.h b/engines/testbed/misc.h index 23e303d676..adfc322d9f 100644 --- a/engines/testbed/misc.h +++ b/engines/testbed/misc.h @@ -49,6 +49,7 @@ void criticalSection(void *arg); TestExitStatus testDateTime(); TestExitStatus testTimers(); TestExitStatus testMutexes(); +TestExitStatus testOpenUrl(); // add more here } // End of namespace MiscTests @@ -69,7 +70,7 @@ public: return "Misc"; } const char *getDescription() const { - return "Miscellaneous: Timers/Mutexes/Datetime"; + return "Miscellaneous: Timers/Mutexes/Datetime/openUrl"; } }; -- cgit v1.2.3 From 438ba985a4a97a8695a6e6fdda6930694976c07b Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Thu, 21 Jul 2016 11:44:36 +0600 Subject: JANITORIAL: Remove spaces at the end of the line I knew there were some, but I wanted to fix them once, instead of doing it all the time. --- engines/testbed/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/testbed/misc.cpp b/engines/testbed/misc.cpp index 3dde71e919..20651e76e6 100644 --- a/engines/testbed/misc.cpp +++ b/engines/testbed/misc.cpp @@ -174,7 +174,7 @@ TestExitStatus MiscTests::testOpenUrl() { Testsuite::logPrintf("Info! openUrl() says it couldn't open the url (probably not supported on this platform)\n"); return kTestFailed; } - + if (Testsuite::handleInteractiveInput("Was ScummVM able to open 'http://scummvm.org/' in your default browser?", "Yes", "No", kOptionRight)) { Testsuite::logDetailedPrintf("Error! openUrl() is not working!\n"); return kTestFailed; -- cgit v1.2.3 From b8fae56c6733cdb5f6e4f64266ca61105eb3155d Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 25 Jul 2016 13:37:40 +0600 Subject: TESTBED: Fix a few Cloud warnings --- engines/testbed/cloud.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/testbed/cloud.cpp b/engines/testbed/cloud.cpp index 775ae1037c..a2d62733be 100644 --- a/engines/testbed/cloud.cpp +++ b/engines/testbed/cloud.cpp @@ -118,7 +118,7 @@ void CloudTests::directoryListedCallback(Cloud::Storage::FileArrayResponse respo Testsuite::logPrintf("Info! %u directories listed, first one is '%s'\n", directories, directory.c_str()); } else { Testsuite::logPrintf("Info! %u directories and %u files listed\n", directories, files); - Testsuite::logPrintf("Info! First directory is '%u' and first file is '%s'\n", directory.c_str(), file.c_str()); + Testsuite::logPrintf("Info! First directory is '%s' and first file is '%s'\n", directory.c_str(), file.c_str()); } } @@ -134,7 +134,7 @@ void CloudTests::directoryCreatedCallback(Cloud::Storage::BoolResponse response) void CloudTests::fileUploadedCallback(Cloud::Storage::UploadResponse response) { ConfParams.setCloudTestCallbackCalled(true); Testsuite::logPrintf("Info! Uploaded file into '%s'\n", response.value.path().c_str()); - Testsuite::logPrintf("Info! It's id = '%s' and size = '%lu'\n", response.value.id().c_str(), response.value.size()); + Testsuite::logPrintf("Info! It's id = '%s' and size = '%u'\n", response.value.id().c_str(), response.value.size()); } void CloudTests::fileDownloadedCallback(Cloud::Storage::BoolResponse response) { @@ -151,7 +151,7 @@ void CloudTests::directoryDownloadedCallback(Cloud::Storage::FileArrayResponse r if (response.value.size() == 0) { Testsuite::logPrintf("Info! Directory is downloaded successfully!\n"); } else { - Testsuite::logPrintf("Warning! %lu files were not downloaded during folder downloading!\n", response.value.size()); + Testsuite::logPrintf("Warning! %u files were not downloaded during folder downloading!\n", response.value.size()); } } -- cgit v1.2.3 From b665fc933d7d1c9e32820e5a3f24d0e3456a0ff7 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 25 Jul 2016 14:32:04 +0600 Subject: ALL: Make simpleSaveNames() a MetaEngineFeature Added it into hasFeature() of all engines which returned `true` in simpleSaveNames() before. As mentioned in #788, SCI is not always using simple names, so it doesn't have such feature now. --- engines/access/detection.cpp | 6 ++---- engines/adl/detection.cpp | 4 +--- engines/agi/detection.cpp | 6 ++---- engines/agos/detection.cpp | 6 ++---- engines/avalanche/detection.cpp | 6 ++---- engines/bbvs/detection.cpp | 6 ++---- engines/cge/detection.cpp | 6 ++---- engines/cge2/detection.cpp | 6 ++---- engines/cine/detection.cpp | 3 --- engines/cruise/detection.cpp | 3 --- engines/draci/detection.cpp | 3 --- engines/drascula/detection.cpp | 6 ++---- engines/dreamweb/detection.cpp | 3 --- engines/fullpipe/detection.cpp | 3 --- engines/gnap/detection.cpp | 6 ++---- engines/groovie/detection.cpp | 3 --- engines/hopkins/detection.cpp | 6 ++---- engines/hugo/detection.cpp | 3 --- engines/kyra/detection.cpp | 6 ++---- engines/lab/detection.cpp | 6 ++---- engines/lure/detection.cpp | 3 --- engines/mads/detection.cpp | 6 ++---- engines/metaengine.h | 28 +++++++++++++--------------- engines/mohawk/detection.cpp | 3 --- engines/mortevielle/detection.cpp | 4 +--- engines/neverhood/detection.cpp | 6 ++---- engines/parallaction/detection.cpp | 3 --- engines/pegasus/detection.cpp | 3 --- engines/prince/detection.cpp | 3 ++- engines/prince/detection.h | 1 - engines/prince/saveload.cpp | 2 -- engines/queen/detection.cpp | 3 --- engines/saga/detection.cpp | 6 ++---- engines/sci/detection.cpp | 3 --- engines/scumm/detection.cpp | 6 ++---- engines/sherlock/detection.cpp | 7 ++----- engines/sky/detection.cpp | 3 --- engines/sword1/detection.cpp | 3 --- engines/sword2/sword2.cpp | 6 ++---- engines/sword25/detection.cpp | 3 --- engines/teenagent/detection.cpp | 2 -- engines/tinsel/detection.cpp | 6 ++---- engines/toltecs/detection.cpp | 6 ++---- engines/tony/detection.cpp | 3 --- engines/toon/detection.cpp | 6 ++---- engines/touche/detection.cpp | 3 --- engines/tsage/detection.cpp | 3 +-- engines/tucker/detection.cpp | 2 -- engines/voyeur/detection.cpp | 6 ++---- engines/wage/detection.cpp | 6 ++---- engines/wintermute/detection.cpp | 2 -- engines/zvision/detection.cpp | 6 ++---- 52 files changed, 66 insertions(+), 184 deletions(-) (limited to 'engines') diff --git a/engines/access/detection.cpp b/engines/access/detection.cpp index 435f0d1118..3e70de3635 100644 --- a/engines/access/detection.cpp +++ b/engines/access/detection.cpp @@ -100,7 +100,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -112,7 +111,8 @@ bool AccessMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail); + (f == kSavesSupportThumbnail) || + (f == kSimpleSavesNames); } bool Access::AccessEngine::hasFeature(EngineFeature f) const { @@ -172,8 +172,6 @@ SaveStateList AccessMetaEngine::listSaves(const char *target) const { return saveList; } -bool AccessMetaEngine::simpleSaveNames() const { return true; } - int AccessMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES; } diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp index 7031a58ec4..af51f95fe7 100644 --- a/engines/adl/detection.cpp +++ b/engines/adl/detection.cpp @@ -175,7 +175,6 @@ public: SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; int getMaximumSaveSlot() const { return 'O' - 'A'; } SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; void removeSaveState(const char *target, int slot) const; bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const; @@ -190,6 +189,7 @@ bool AdlMetaEngine::hasFeature(MetaEngineFeature f) const { case kSavesSupportThumbnail: case kSavesSupportCreationDate: case kSavesSupportPlayTime: + case kSimpleSavesNames: return true; default: return false; @@ -290,8 +290,6 @@ SaveStateList AdlMetaEngine::listSaves(const char *target) const { return saveList; } -bool AdlMetaEngine::simpleSaveNames() const { return true; } - void AdlMetaEngine::removeSaveState(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.s%02d", target, slot); g_system->getSavefileManager()->removeSavefile(fileName); diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index dc0dbbdddf..5cb239f8d8 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -216,7 +216,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -232,7 +231,8 @@ bool AgiMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); + (f == kSavesSupportPlayTime) || + (f == kSimpleSavesNames); } bool AgiBase::hasFeature(EngineFeature f) const { @@ -324,8 +324,6 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const { return saveList; } -bool AgiMetaEngine::simpleSaveNames() const { return true; } - int AgiMetaEngine::getMaximumSaveSlot() const { return 999; } void AgiMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index dc96eb6ef6..dbc4ee9145 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -120,13 +120,13 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; }; bool AgosMetaEngine::hasFeature(MetaEngineFeature f) const { return - (f == kSupportsListSaves); + (f == kSupportsListSaves) || + (f == kSimpleSavesNames); } bool AGOS::AGOSEngine::hasFeature(EngineFeature f) const { @@ -208,8 +208,6 @@ SaveStateList AgosMetaEngine::listSaves(const char *target) const { return saveList; } -bool AgosMetaEngine::simpleSaveNames() const { return true; } - int AgosMetaEngine::getMaximumSaveSlot() const { return 999; } #if PLUGIN_ENABLED_DYNAMIC(AGOS) diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp index 392d0a027f..def395b77f 100644 --- a/engines/avalanche/detection.cpp +++ b/engines/avalanche/detection.cpp @@ -83,7 +83,6 @@ public: int getMaximumSaveSlot() const { return 99; } SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; @@ -100,7 +99,8 @@ bool AvalancheMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsDeleteSave) || (f == kSupportsLoadingDuringStartup) || (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail); + (f == kSavesSupportThumbnail) || + (f == kSimpleSavesNames); } SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { @@ -157,8 +157,6 @@ SaveStateList AvalancheMetaEngine::listSaves(const char *target) const { return saveList; } -bool AvalancheMetaEngine::simpleSaveNames() const { return true; } - void AvalancheMetaEngine::removeSaveState(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); g_system->getSavefileManager()->removeSavefile(fileName); diff --git a/engines/bbvs/detection.cpp b/engines/bbvs/detection.cpp index 9aca719648..fa735c9ec3 100644 --- a/engines/bbvs/detection.cpp +++ b/engines/bbvs/detection.cpp @@ -86,7 +86,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -98,7 +97,8 @@ bool BbvsMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsLoadingDuringStartup) || (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate); + (f == kSavesSupportCreationDate) || + (f == kSimpleSavesNames); } void BbvsMetaEngine::removeSaveState(const char *target, int slot) const { @@ -136,8 +136,6 @@ SaveStateList BbvsMetaEngine::listSaves(const char *target) const { return saveList; } -bool BbvsMetaEngine::simpleSaveNames() const { return true; } - SaveStateDescriptor BbvsMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String filename = Bbvs::BbvsEngine::getSavegameFilename(target, slot); Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index eb88b6cd79..0df1e8711e 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -131,7 +131,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -181,7 +180,8 @@ bool CGEMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate); + (f == kSavesSupportCreationDate) || + (f == kSimpleSavesNames); } void CGEMetaEngine::removeSaveState(const char *target, int slot) const { @@ -240,8 +240,6 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const { return saveList; } -bool CGEMetaEngine::simpleSaveNames() const { return true; } - SaveStateDescriptor CGEMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/cge2/detection.cpp b/engines/cge2/detection.cpp index d980f82b0d..3701baa40f 100644 --- a/engines/cge2/detection.cpp +++ b/engines/cge2/detection.cpp @@ -127,7 +127,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -186,7 +185,8 @@ bool CGE2MetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup); + (f == kSupportsLoadingDuringStartup) || + (f == kSimpleSavesNames); } int CGE2MetaEngine::getMaximumSaveSlot() const { @@ -240,8 +240,6 @@ SaveStateList CGE2MetaEngine::listSaves(const char *target) const { return saveList; } -bool CGE2MetaEngine::simpleSaveNames() const { return true; } - SaveStateDescriptor CGE2MetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index 2d10b81473..ec01e8734d 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -104,7 +104,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -174,8 +173,6 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const { return saveList; } -bool CineMetaEngine::simpleSaveNames() const { return false; } - int CineMetaEngine::getMaximumSaveSlot() const { return 9; } void CineMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp index 9e3ebb5dd5..6f5d236173 100644 --- a/engines/cruise/detection.cpp +++ b/engines/cruise/detection.cpp @@ -211,7 +211,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const { return 99; } virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; @@ -255,8 +254,6 @@ SaveStateList CruiseMetaEngine::listSaves(const char *target) const { return saveList; } -bool CruiseMetaEngine::simpleSaveNames() const { return false; } - void CruiseMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(Cruise::CruiseEngine::getSavegameFile(slot)); } diff --git a/engines/draci/detection.cpp b/engines/draci/detection.cpp index 8a67981696..65427bd8cd 100644 --- a/engines/draci/detection.cpp +++ b/engines/draci/detection.cpp @@ -98,7 +98,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const { return 99; } virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; @@ -148,8 +147,6 @@ SaveStateList DraciMetaEngine::listSaves(const char *target) const { return saveList; } -bool DraciMetaEngine::simpleSaveNames() const { return false; } - void DraciMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(Draci::DraciEngine::getSavegameFile(slot)); } diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp index 863ea98786..3bc8069b76 100644 --- a/engines/drascula/detection.cpp +++ b/engines/drascula/detection.cpp @@ -326,7 +326,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -340,7 +339,8 @@ bool DrasculaMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); + (f == kSavesSupportPlayTime) || + (f == kSimpleSavesNames); } const ExtraGuiOptions DrasculaMetaEngine::getExtraGuiOptions(const Common::String &target) const { @@ -383,8 +383,6 @@ SaveStateList DrasculaMetaEngine::listSaves(const char *target) const { return saveList; } -bool DrasculaMetaEngine::simpleSaveNames() const { return true; } - SaveStateDescriptor DrasculaMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp index abe1198233..8e24c44702 100644 --- a/engines/dreamweb/detection.cpp +++ b/engines/dreamweb/detection.cpp @@ -86,7 +86,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -152,8 +151,6 @@ SaveStateList DreamWebMetaEngine::listSaves(const char *target) const { return saveList; } -bool DreamWebMetaEngine::simpleSaveNames() const { return false; } - int DreamWebMetaEngine::getMaximumSaveSlot() const { return 99; } void DreamWebMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/fullpipe/detection.cpp b/engines/fullpipe/detection.cpp index a183be8a83..6f92f19f24 100644 --- a/engines/fullpipe/detection.cpp +++ b/engines/fullpipe/detection.cpp @@ -90,7 +90,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const { return 8; } virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; @@ -135,8 +134,6 @@ SaveStateList FullpipeMetaEngine::listSaves(const char *target) const { return saveList; } -bool FullpipeMetaEngine::simpleSaveNames() const { return false; } - void FullpipeMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(Fullpipe::getSavegameFile(slot)); } diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index 523a8b6d1c..d92a037232 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -78,7 +78,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -90,7 +89,8 @@ bool GnapMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate); + (f == kSavesSupportCreationDate) || + (f == kSimpleSavesNames); } bool Gnap::GnapEngine::hasFeature(EngineFeature f) const { @@ -142,8 +142,6 @@ SaveStateList GnapMetaEngine::listSaves(const char *target) const { return saveList; } -bool GnapMetaEngine::simpleSaveNames() const { return true; } - SaveStateDescriptor GnapMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp index 22ced10b8a..b12e264a57 100644 --- a/engines/groovie/detection.cpp +++ b/engines/groovie/detection.cpp @@ -352,7 +352,6 @@ public: bool hasFeature(MetaEngineFeature f) const; SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -377,8 +376,6 @@ SaveStateList GroovieMetaEngine::listSaves(const char *target) const { return SaveLoad::listValidSaves(target); } -bool GroovieMetaEngine::simpleSaveNames() const { return false; } - int GroovieMetaEngine::getMaximumSaveSlot() const { return SaveLoad::getMaximumSlot(); } diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 84af4fcdf3..041afecaa8 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -117,7 +117,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -129,7 +128,8 @@ bool HopkinsMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail); + (f == kSavesSupportThumbnail) || + (f == kSimpleSavesNames); } bool Hopkins::HopkinsEngine::hasFeature(EngineFeature f) const { @@ -183,8 +183,6 @@ SaveStateList HopkinsMetaEngine::listSaves(const char *target) const { return saveList; } -bool HopkinsMetaEngine::simpleSaveNames() const { return true; } - int HopkinsMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES; } diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index ed67eae416..4e4746c002 100644 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -149,7 +149,6 @@ public: int getMaximumSaveSlot() const; SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; void removeSaveState(const char *target, int slot) const; }; @@ -222,8 +221,6 @@ SaveStateList HugoMetaEngine::listSaves(const char *target) const { return saveList; } -bool HugoMetaEngine::simpleSaveNames() const { return false; } - SaveStateDescriptor HugoMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s-%02d.SAV", target, slot); Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 1dcfd08435..70c7e7c93c 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -162,7 +162,6 @@ public: bool hasFeature(MetaEngineFeature f) const; bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -174,7 +173,8 @@ bool KyraMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail); + (f == kSavesSupportThumbnail) || + (f == kSimpleSavesNames); } bool Kyra::KyraEngine_v1::hasFeature(EngineFeature f) const { @@ -274,8 +274,6 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const { return saveList; } -bool KyraMetaEngine::simpleSaveNames() const { return true; } - int KyraMetaEngine::getMaximumSaveSlot() const { return 999; } diff --git a/engines/lab/detection.cpp b/engines/lab/detection.cpp index 2b2e57df22..bf6d4563b5 100644 --- a/engines/lab/detection.cpp +++ b/engines/lab/detection.cpp @@ -138,7 +138,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -152,7 +151,8 @@ bool LabMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); + (f == kSavesSupportPlayTime) || + (f == kSimpleSavesNames); } bool Lab::LabEngine::hasFeature(EngineFeature f) const { @@ -192,8 +192,6 @@ SaveStateList LabMetaEngine::listSaves(const char *target) const { return saveList; } -bool LabMetaEngine::simpleSaveNames() const { return true; } - int LabMetaEngine::getMaximumSaveSlot() const { return 999; } diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 808cea4422..690a358bc3 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -212,7 +212,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -267,8 +266,6 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const { return saveList; } -bool LureMetaEngine::simpleSaveNames() const { return false; } - int LureMetaEngine::getMaximumSaveSlot() const { return 999; } void LureMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp index d5354c4883..4fb8b82eb3 100644 --- a/engines/mads/detection.cpp +++ b/engines/mads/detection.cpp @@ -155,7 +155,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -167,7 +166,8 @@ bool MADSMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail); + (f == kSavesSupportThumbnail) || + (f == kSimpleSavesNames); } bool MADS::MADSEngine::hasFeature(EngineFeature f) const { @@ -218,8 +218,6 @@ SaveStateList MADSMetaEngine::listSaves(const char *target) const { return saveList; } -bool MADSMetaEngine::simpleSaveNames() const { return true; } - int MADSMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES; } diff --git a/engines/metaengine.h b/engines/metaengine.h index 6afb122580..568b66ac51 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -115,20 +115,6 @@ public: return SaveStateList(); } - /** - * Return whether engine's saves could be detected with - * ".###" pattern and "###" corresponds to slot - * number. - * - * If that's not true or engine is using some unusual way - * of detecting saves and slot numbers, this should return - * false. In that case Save/Load dialog would be unavailable - * during cloud saves sync. - * - * @return true, if ".###" is OK for this engine - */ - virtual bool simpleSaveNames() const { return false; } - /** * Return a list of extra GUI options for the specified target. * If no target is specified, all of the available custom GUI options are @@ -250,7 +236,19 @@ public: * the game till the save. * This flag may only be set when 'kSavesSupportMetaInfo' is set. */ - kSavesSupportPlayTime + kSavesSupportPlayTime, + + /** + * Feature is available if engine's saves could be detected + * with ".###" pattern and "###" corresponds to slot + * number. + * + * If that's not true or engine is using some unusual way + * of detecting saves and slot numbers, this should be + * unavailable. In that case Save/Load dialog for engine's + * games is locked during cloud saves sync. + */ + kSimpleSavesNames }; /** diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp index d3c44a8944..246d3ec3c1 100644 --- a/engines/mohawk/detection.cpp +++ b/engines/mohawk/detection.cpp @@ -200,7 +200,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; SaveStateList listSavesForPrefix(const char *prefix, const char *extension) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const { return 999; } virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -273,8 +272,6 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const { return saveList; } -bool MohawkMetaEngine::simpleSaveNames() const { return false; } - void MohawkMetaEngine::removeSaveState(const char *target, int slot) const { // Removing saved games is only supported in Myst/Riven currently. diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp index 2f5a790486..7bc5339179 100644 --- a/engines/mortevielle/detection.cpp +++ b/engines/mortevielle/detection.cpp @@ -72,7 +72,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; }; @@ -91,6 +90,7 @@ bool MortevielleMetaEngine::hasFeature(MetaEngineFeature f) const { case kSavesSupportMetaInfo: case kSavesSupportThumbnail: case kSavesSupportCreationDate: + case kSimpleSavesNames: return true; default: return false; @@ -103,8 +103,6 @@ SaveStateList MortevielleMetaEngine::listSaves(const char *target) const { return Mortevielle::SavegameManager::listSaves(target); } -bool MortevielleMetaEngine::simpleSaveNames() const { return true; } - SaveStateDescriptor MortevielleMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String filename = Mortevielle::MortevielleEngine::generateSaveFilename(target, slot); return Mortevielle::SavegameManager::querySaveMetaInfos(filename); diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp index 903c4377e0..0c0347ef13 100644 --- a/engines/neverhood/detection.cpp +++ b/engines/neverhood/detection.cpp @@ -214,7 +214,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -229,7 +228,8 @@ bool NeverhoodMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); + (f == kSavesSupportPlayTime) || + (f == kSimpleSavesNames); } bool Neverhood::NeverhoodEngine::hasFeature(EngineFeature f) const { @@ -284,8 +284,6 @@ SaveStateList NeverhoodMetaEngine::listSaves(const char *target) const { return saveList; } -bool NeverhoodMetaEngine::simpleSaveNames() const { return true; } - int NeverhoodMetaEngine::getMaximumSaveSlot() const { return 999; } diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp index 989fc9dfc8..4c52990874 100644 --- a/engines/parallaction/detection.cpp +++ b/engines/parallaction/detection.cpp @@ -234,7 +234,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -295,8 +294,6 @@ SaveStateList ParallactionMetaEngine::listSaves(const char *target) const { return saveList; } -bool ParallactionMetaEngine::simpleSaveNames() const { return false; } - int ParallactionMetaEngine::getMaximumSaveSlot() const { return 99; } void ParallactionMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/pegasus/detection.cpp b/engines/pegasus/detection.cpp index 54cb4ca525..161a133c8b 100644 --- a/engines/pegasus/detection.cpp +++ b/engines/pegasus/detection.cpp @@ -148,7 +148,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const { return 999; } virtual void removeSaveState(const char *target, int slot) const; }; @@ -179,8 +178,6 @@ SaveStateList PegasusMetaEngine::listSaves(const char *target) const { return saveList; } -bool PegasusMetaEngine::simpleSaveNames() const { return false; } - void PegasusMetaEngine::removeSaveState(const char *target, int slot) const { // See listSaves() for info on the pattern Common::StringArray fileNames = Pegasus::PegasusEngine::listSaveFiles(); diff --git a/engines/prince/detection.cpp b/engines/prince/detection.cpp index 1c6f63aff3..ad759823d8 100644 --- a/engines/prince/detection.cpp +++ b/engines/prince/detection.cpp @@ -56,7 +56,8 @@ bool PrinceMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup); + (f == kSupportsLoadingDuringStartup) || + (f == kSimpleSavesNames); } bool Prince::PrinceEngine::hasFeature(EngineFeature f) const { diff --git a/engines/prince/detection.h b/engines/prince/detection.h index 39cfdd96e7..3076253cf5 100644 --- a/engines/prince/detection.h +++ b/engines/prince/detection.h @@ -121,7 +121,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; diff --git a/engines/prince/saveload.cpp b/engines/prince/saveload.cpp index 2855bdc4bd..d3360badd1 100644 --- a/engines/prince/saveload.cpp +++ b/engines/prince/saveload.cpp @@ -105,8 +105,6 @@ SaveStateList PrinceMetaEngine::listSaves(const char *target) const { return saveList; } -bool PrinceMetaEngine::simpleSaveNames() const { return true; } - SaveStateDescriptor PrinceMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/queen/detection.cpp b/engines/queen/detection.cpp index 3f8b97ed6a..aed8b7dcb1 100644 --- a/engines/queen/detection.cpp +++ b/engines/queen/detection.cpp @@ -444,7 +444,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const { return 99; } virtual void removeSaveState(const char *target, int slot) const; @@ -530,8 +529,6 @@ SaveStateList QueenMetaEngine::listSaves(const char *target) const { return saveList; } -bool QueenMetaEngine::simpleSaveNames() const { return false; } - void QueenMetaEngine::removeSaveState(const char *target, int slot) const { Common::String filename = Common::String::format("queen.s%02d", slot); diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index 7f6e0a2485..6fe4277c27 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -144,7 +144,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -158,7 +157,8 @@ bool SagaMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); + (f == kSavesSupportPlayTime) || + (f == kSimpleSavesNames); } bool Saga::SagaEngine::hasFeature(EngineFeature f) const { @@ -208,8 +208,6 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const { return saveList; } -bool SagaMetaEngine::simpleSaveNames() const { return true; } - int SagaMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES - 1; } void SagaMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 08794a0872..ad2b0f31a5 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -518,7 +518,6 @@ public: const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const; virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -791,8 +790,6 @@ SaveStateList SciMetaEngine::listSaves(const char *target) const { return saveList; } -bool SciMetaEngine::simpleSaveNames() const { return true; } - SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int slotNr) const { Common::String fileName = Common::String::format("%s.%03d", target, slotNr); Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 67344e8008..e6740df482 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -960,7 +960,6 @@ public: virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -975,7 +974,8 @@ bool ScummMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); + (f == kSavesSupportPlayTime) || + (f == kSimpleSavesNames); } bool ScummEngine::hasFeature(EngineFeature f) const { @@ -1300,8 +1300,6 @@ SaveStateList ScummMetaEngine::listSaves(const char *target) const { return saveList; } -bool ScummMetaEngine::simpleSaveNames() const { return true; } - void ScummMetaEngine::removeSaveState(const char *target, int slot) const { Common::String filename = ScummEngine::makeSavegameName(target, slot, false); g_system->getSavefileManager()->removeSavefile(filename); diff --git a/engines/sherlock/detection.cpp b/engines/sherlock/detection.cpp index f54c6db952..c6e632f999 100644 --- a/engines/sherlock/detection.cpp +++ b/engines/sherlock/detection.cpp @@ -159,8 +159,6 @@ public: */ virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; - /** * Returns the maximum number of allowed save slots */ @@ -201,7 +199,8 @@ bool SherlockMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail); + (f == kSavesSupportThumbnail) || + (f == kSimpleSavesNames); } bool Sherlock::SherlockEngine::hasFeature(EngineFeature f) const { @@ -219,8 +218,6 @@ SaveStateList SherlockMetaEngine::listSaves(const char *target) const { return Sherlock::SaveManager::getSavegameList(target); } -bool SherlockMetaEngine::simpleSaveNames() const { return true; } - int SherlockMetaEngine::getMaximumSaveSlot() const { return MAX_SAVEGAME_SLOTS; } diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp index 802687b461..d86689e5d7 100644 --- a/engines/sky/detection.cpp +++ b/engines/sky/detection.cpp @@ -84,7 +84,6 @@ public: virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -248,8 +247,6 @@ SaveStateList SkyMetaEngine::listSaves(const char *target) const { return saveList; } -bool SkyMetaEngine::simpleSaveNames() const { return false; } - int SkyMetaEngine::getMaximumSaveSlot() const { return MAX_SAVE_GAMES; } void SkyMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index d9cc3cda7f..0edf856125 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -91,7 +91,6 @@ public: virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const Common::FSList &fslist) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -264,8 +263,6 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const { return saveList; } -bool SwordMetaEngine::simpleSaveNames() const { return false; } - int SwordMetaEngine::getMaximumSaveSlot() const { return 999; } void SwordMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 3213a26e4c..4f3caa437e 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -97,7 +97,6 @@ public: virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const Common::FSList &fslist) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; @@ -108,7 +107,8 @@ bool Sword2MetaEngine::hasFeature(MetaEngineFeature f) const { return (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave); + (f == kSupportsDeleteSave) || + (f == kSimpleSavesNames); } bool Sword2::Sword2Engine::hasFeature(EngineFeature f) const { @@ -257,8 +257,6 @@ SaveStateList Sword2MetaEngine::listSaves(const char *target) const { return saveList; } -bool Sword2MetaEngine::simpleSaveNames() const { return true; } - int Sword2MetaEngine::getMaximumSaveSlot() const { return 999; } void Sword2MetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/sword25/detection.cpp b/engines/sword25/detection.cpp index 1c4544c76a..c5f55b5a26 100644 --- a/engines/sword25/detection.cpp +++ b/engines/sword25/detection.cpp @@ -69,7 +69,6 @@ public: virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; virtual int getMaximumSaveSlot() const { return Sword25::PersistenceService::getSlotCount(); } virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; }; bool Sword25MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { @@ -110,8 +109,6 @@ SaveStateList Sword25MetaEngine::listSaves(const char *target) const { return saveList; } -bool Sword25MetaEngine::simpleSaveNames() const { return false; } - #if PLUGIN_ENABLED_DYNAMIC(SWORD25) REGISTER_PLUGIN_DYNAMIC(SWORD25, PLUGIN_TYPE_ENGINE, Sword25MetaEngine); #else diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp index a8d32e89d4..caa7bdbec9 100644 --- a/engines/teenagent/detection.cpp +++ b/engines/teenagent/detection.cpp @@ -149,8 +149,6 @@ public: return saveList; } - virtual bool simpleSaveNames() const { return false; } - virtual int getMaximumSaveSlot() const { return MAX_SAVES - 1; } diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 7d8b54e5db..d6bcfe5ea0 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -101,7 +101,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -110,7 +109,8 @@ bool TinselMetaEngine::hasFeature(MetaEngineFeature f) const { return (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave); + (f == kSupportsDeleteSave) || + (f == kSimpleSavesNames); } bool Tinsel::TinselEngine::hasFeature(EngineFeature f) const { @@ -165,8 +165,6 @@ SaveStateList TinselMetaEngine::listSaves(const char *target) const { return saveList; } -bool TinselMetaEngine::simpleSaveNames() const { return true; } - bool TinselMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { const Tinsel::TinselGameDescription *gd = (const Tinsel::TinselGameDescription *)desc; if (gd) { diff --git a/engines/toltecs/detection.cpp b/engines/toltecs/detection.cpp index 8da9106931..cc27341e10 100644 --- a/engines/toltecs/detection.cpp +++ b/engines/toltecs/detection.cpp @@ -221,7 +221,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const; SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -235,7 +234,8 @@ bool ToltecsMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); + (f == kSavesSupportPlayTime) || + (f == kSimpleSavesNames); } bool Toltecs::ToltecsEngine::hasFeature(EngineFeature f) const { @@ -289,8 +289,6 @@ SaveStateList ToltecsMetaEngine::listSaves(const char *target) const { return saveList; } -bool ToltecsMetaEngine::simpleSaveNames() const { return true; } - int ToltecsMetaEngine::getMaximumSaveSlot() const { return 999; } diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp index 5dda4c7caf..ec0b3e186b 100644 --- a/engines/tony/detection.cpp +++ b/engines/tony/detection.cpp @@ -82,7 +82,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -142,8 +141,6 @@ SaveStateList TonyMetaEngine::listSaves(const char *target) const { return saveList; } -bool TonyMetaEngine::simpleSaveNames() const { return false; } - int TonyMetaEngine::getMaximumSaveSlot() const { return 99; } diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp index eac91a5595..e93d676d87 100644 --- a/engines/toon/detection.cpp +++ b/engines/toon/detection.cpp @@ -148,7 +148,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -160,7 +159,8 @@ bool ToonMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate); + (f == kSavesSupportCreationDate) || + (f == kSimpleSavesNames); } void ToonMetaEngine::removeSaveState(const char *target, int slot) const { @@ -213,8 +213,6 @@ SaveStateList ToonMetaEngine::listSaves(const char *target) const { return saveList; } -bool ToonMetaEngine::simpleSaveNames() const { return true; } - SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp index e2737d4f2c..dcb58ffae6 100644 --- a/engines/touche/detection.cpp +++ b/engines/touche/detection.cpp @@ -155,7 +155,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -211,8 +210,6 @@ SaveStateList ToucheMetaEngine::listSaves(const char *target) const { return saveList; } -bool ToucheMetaEngine::simpleSaveNames() const { return false; } - int ToucheMetaEngine::getMaximumSaveSlot() const { return Touche::kMaxSaveStates - 1; } diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp index 716ac4af53..e476391f71 100644 --- a/engines/tsage/detection.cpp +++ b/engines/tsage/detection.cpp @@ -95,6 +95,7 @@ public: case kSavesSupportThumbnail: case kSavesSupportCreationDate: case kSavesSupportPlayTime: + case kSimpleSavesNames: return true; default: return false; @@ -145,8 +146,6 @@ public: return saveList; } - virtual bool simpleSaveNames() const { return true; } - virtual int getMaximumSaveSlot() const { return MAX_SAVES - 1; } diff --git a/engines/tucker/detection.cpp b/engines/tucker/detection.cpp index 227924cd28..2447e15d6b 100644 --- a/engines/tucker/detection.cpp +++ b/engines/tucker/detection.cpp @@ -187,8 +187,6 @@ public: return saveList; } - virtual bool simpleSaveNames() const { return false; } - virtual int getMaximumSaveSlot() const { return Tucker::kLastSaveSlot; } diff --git a/engines/voyeur/detection.cpp b/engines/voyeur/detection.cpp index 76668eb370..eefe174e94 100644 --- a/engines/voyeur/detection.cpp +++ b/engines/voyeur/detection.cpp @@ -81,7 +81,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -93,7 +92,8 @@ bool VoyeurMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail); + (f == kSavesSupportThumbnail) || + (f == kSimpleSavesNames); } bool Voyeur::VoyeurEngine::hasFeature(EngineFeature f) const { @@ -144,8 +144,6 @@ SaveStateList VoyeurMetaEngine::listSaves(const char *target) const { return saveList; } -bool VoyeurMetaEngine::simpleSaveNames() const { return true; } - int VoyeurMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES; } diff --git a/engines/wage/detection.cpp b/engines/wage/detection.cpp index 1069d740f6..778cd3c7a7 100644 --- a/engines/wage/detection.cpp +++ b/engines/wage/detection.cpp @@ -70,7 +70,6 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -79,7 +78,8 @@ bool WageMetaEngine::hasFeature(MetaEngineFeature f) const { return (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave); + (f == kSupportsDeleteSave) || + (f == kSimpleSavesNames); } bool Wage::WageEngine::hasFeature(EngineFeature f) const { @@ -137,8 +137,6 @@ SaveStateList WageMetaEngine::listSaves(const char *target) const { return saveList; } -bool WageMetaEngine::simpleSaveNames() const { return true; } - int WageMetaEngine::getMaximumSaveSlot() const { return 999; } void WageMetaEngine::removeSaveState(const char *target, int slot) const { diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp index f225cd3930..4e8eab505f 100644 --- a/engines/wintermute/detection.cpp +++ b/engines/wintermute/detection.cpp @@ -164,8 +164,6 @@ public: return saves; } - virtual bool simpleSaveNames() const { return false; } - int getMaximumSaveSlot() const { return 100; } diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 05dfb8b8d0..5e535a9954 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -75,7 +75,6 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; SaveStateList listSaves(const char *target) const; - virtual bool simpleSaveNames() const; virtual int getMaximumSaveSlot() const; void removeSaveState(const char *target, int slot) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; @@ -88,7 +87,8 @@ bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsDeleteSave) || (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate); + (f == kSavesSupportCreationDate) || + (f == kSimpleSavesNames); //(f == kSavesSupportPlayTime); } @@ -160,8 +160,6 @@ SaveStateList ZVisionMetaEngine::listSaves(const char *target) const { return saveList; } -bool ZVisionMetaEngine::simpleSaveNames() const { return true; } - int ZVisionMetaEngine::getMaximumSaveSlot() const { return 999; } -- cgit v1.2.3 From ea360ef8f20655c0eedbf52a46096f231c459214 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Wed, 3 Aug 2016 18:30:42 +0600 Subject: TITANIC: Fix OutSaveFile usage --- engines/titanic/support/simple_file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index f5d0bc7c1b..01aaa86925 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -278,7 +278,7 @@ public: * Set up a stream for write access */ virtual void open(Common::OutSaveFile *stream) { - SimpleFile::open(Common::wrapCompressedWriteStream(stream)); + SimpleFile::open(new Common::OutSaveFile(Common::wrapCompressedWriteStream(stream))); } }; -- cgit v1.2.3