diff options
-rw-r--r-- | engines/tinsel/detection.cpp | 37 | ||||
-rw-r--r-- | engines/tinsel/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/tinsel/savescn.h | 3 | ||||
-rw-r--r-- | engines/tinsel/tinsel.h | 3 |
4 files changed, 43 insertions, 2 deletions
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index e56198c76c..53a7aaea1a 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -27,6 +27,7 @@ #include "common/advancedDetector.h" #include "common/file.h" +#include "common/savefile.h" #include "tinsel/tinsel.h" #include "tinsel/savescn.h" // needed by TinselMetaEngine::listSaves @@ -344,19 +345,31 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; + virtual int getMaximumSaveSlot() const; + virtual void removeSaveState(const char *target, int slot) const; }; bool TinselMetaEngine::hasFeature(MetaEngineFeature f) const { - return (f == kSupportsListSaves); + return + (f == kSupportsListSaves) || + (f == kSupportsDeleteSave); +} + +bool Tinsel::TinselEngine::hasFeature(EngineFeature f) const { + return + (f == kSupportsLoadingDuringRuntime); } namespace Tinsel { extern int getList(Common::SaveFileManager *saveFileMan, const Common::String &target); +extern void setNeedLoad(); +extern bool MoviePlaying(void); } SaveStateList TinselMetaEngine::listSaves(const char *target) const { + Tinsel::setNeedLoad(); int numStates = Tinsel::getList(g_system->getSavefileManager(), target); SaveStateList saveList; @@ -377,8 +390,30 @@ bool TinselMetaEngine::createInstance(OSystem *syst, Engine **engine, const Comm return gd != 0; } +int TinselMetaEngine::getMaximumSaveSlot() const { return 99; } + +void TinselMetaEngine::removeSaveState(const char *target, int slot) const { + Tinsel::setNeedLoad(); + Tinsel::getList(g_system->getSavefileManager(), target); + + g_system->getSavefileManager()->removeSavefile(Tinsel::ListEntry(slot, Tinsel::LE_NAME)); + Tinsel::setNeedLoad(); + Tinsel::getList(g_system->getSavefileManager(), target); +} + #if PLUGIN_ENABLED_DYNAMIC(TINSEL) REGISTER_PLUGIN_DYNAMIC(TINSEL, PLUGIN_TYPE_ENGINE, TinselMetaEngine); #else REGISTER_PLUGIN_STATIC(TINSEL, PLUGIN_TYPE_ENGINE, TinselMetaEngine); #endif + +namespace Tinsel { + +Common::Error TinselEngine::loadGameState(int slot) { + RestoreGame(slot); + return Common::kNoError; // TODO: return success/failure +} + +bool TinselEngine::canLoadGameStateCurrently() { return !MoviePlaying(); } + +} // End of namespace Tinsel diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 3d532300c2..83d5df1262 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -118,6 +118,8 @@ static char *SaveSceneSsData = 0; // points to 'SAVED_DATA ssdata[MAX_NEST]' //------------- SAVE/LOAD SUPPORT METHODS ---------------- +void setNeedLoad() { NeedLoad = true; } + static void syncTime(Serializer &s, struct tm &t) { s.syncAsUint16LE(t.tm_year); s.syncAsByte(t.tm_mon); diff --git a/engines/tinsel/savescn.h b/engines/tinsel/savescn.h index 79bf0ca2b2..e7a4f18adf 100644 --- a/engines/tinsel/savescn.h +++ b/engines/tinsel/savescn.h @@ -42,7 +42,7 @@ namespace Tinsel { enum { SG_DESC_LEN = 40, // Max. saved game description length - MAX_SAVED_FILES = 30, + MAX_SAVED_FILES = 100, // FIXME: Save file names in ScummVM can be longer than 8.3, overflowing the // name field in savedFiles. Raising it to 256 as a preliminary fix. @@ -101,6 +101,7 @@ enum letype{ char *ListEntry(int i, letype which); int getList(void); +void setNeedLoad(void); void RestoreGame(int num); void SaveGame(char *name, char *desc); diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h index 370d500abc..9cb8126567 100644 --- a/engines/tinsel/tinsel.h +++ b/engines/tinsel/tinsel.h @@ -140,6 +140,9 @@ protected: // Engine APIs virtual Common::Error init(); virtual Common::Error go(); + virtual bool hasFeature(EngineFeature f) const; + Common::Error loadGameState(int slot); + bool canLoadGameStateCurrently(); virtual void syncSoundSettings(); public: |