diff options
Diffstat (limited to 'engines/tinsel')
-rw-r--r-- | engines/tinsel/detection.cpp | 30 | ||||
-rw-r--r-- | engines/tinsel/saveload.cpp | 22 | ||||
-rw-r--r-- | engines/tinsel/tinsel.cpp | 4 | ||||
-rw-r--r-- | engines/tinsel/tinsel.h | 1 |
4 files changed, 43 insertions, 14 deletions
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index f4fe876290..bf59aae19b 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -29,6 +29,7 @@ #include "common/file.h" #include "tinsel/tinsel.h" +#include "tinsel/savescn.h" // needed by TinselMetaEngine::listSaves namespace Tinsel { @@ -309,13 +310,42 @@ public: } virtual const char *getCopyright() const { + // FIXME: Bad copyright string. + // Should be something like "Tinsel (C) Psygnosis" or so... ??? return "Tinsel Engine"; } virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; + virtual bool hasFeature(MetaEngineFeature f) const; + virtual SaveStateList listSaves(const char *target) const; }; +bool TinselMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsListSaves); +} + +namespace Tinsel { +extern int getList(Common::SaveFileManager *saveFileMan, const Common::String &target); +} + +SaveStateList TinselMetaEngine::listSaves(const char *target) const { + int numStates = Tinsel::getList(g_system->getSavefileManager(), target); + + SaveStateList saveList; + for (int i = 0; i < numStates; i++) { + SaveStateDescriptor sd(i, + Tinsel::ListEntry(i, Tinsel::LE_DESC), + Tinsel::ListEntry(i, Tinsel::LE_NAME)); + // TODO: Also add savedFiles[i].dateTime to the SaveStateDescriptor + saveList.push_back(sd); + } + + return saveList; +} + + bool TinselMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const { const Tinsel::TinselGameDescription *gd = (const Tinsel::TinselGameDescription *)desc; if (gd) { diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 1a6cc1202a..acdaf6c0bb 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -246,16 +246,11 @@ static char *NewName(void) { * Store the file details, ordered by time, in savedFiles[] and return * the number of files found). */ -int getList(void) { - // No change since last call? - // TODO/FIXME: Just always reload this data? Be careful about slow downs!!! - if (!NeedLoad) - return numSfiles; - +int getList(Common::SaveFileManager *saveFileMan, const Common::String &target) { int i; - const Common::String pattern = _vm->getSavegamePattern(); - Common::StringList files = _vm->getSaveFileMan()->listSavefiles(pattern.c_str()); + const Common::String pattern = target + ".???"; + Common::StringList files = saveFileMan->listSavefiles(pattern.c_str()); numSfiles = 0; @@ -264,7 +259,7 @@ int getList(void) { break; const Common::String &fname = *file; - Common::InSaveFile *f = _vm->getSaveFileMan()->openForLoading(fname.c_str()); + Common::InSaveFile *f = saveFileMan->openForLoading(fname.c_str()); if (f == NULL) { continue; } @@ -304,6 +299,15 @@ int getList(void) { return numSfiles; } +int getList(void) { + // No change since last call? + // TODO/FIXME: Just always reload this data? Be careful about slow downs!!! + if (!NeedLoad) + return numSfiles; + + return getList(_vm->getSaveFileMan(), _vm->getTargetName()); +} + char *ListEntry(int i, letype which) { if (i == -1) diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index 70dd0170b4..092fae4be4 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -710,10 +710,6 @@ int TinselEngine::init() { return 0; } -Common::String TinselEngine::getSavegamePattern() const { - return _targetName + ".???"; -} - Common::String TinselEngine::getSavegameFilename(int16 saveNum) const { char filename[256]; snprintf(filename, 256, "%s.%03d", getTargetName().c_str(), saveNum); diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h index 369fd64a9b..9820be7ddd 100644 --- a/engines/tinsel/tinsel.h +++ b/engines/tinsel/tinsel.h @@ -127,7 +127,6 @@ private: public: const Common::String getTargetName() const { return _targetName; } - Common::String getSavegamePattern() const; Common::String getSavegameFilename(int16 saveNum) const; Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; } Graphics::Surface &screen() { return _screenSurface; } |