diff options
author | Filippos Karapetis | 2008-11-12 23:39:38 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-11-12 23:39:38 +0000 |
commit | 0ba17539acad48797323f1481a0533082778b61d (patch) | |
tree | ce2b07baca04dc4de0844c9e44806c633c79e346 | |
parent | 28da377ccb945797aedf76c73eaec4773d03a0ef (diff) | |
download | scummvm-rg350-0ba17539acad48797323f1481a0533082778b61d.tar.gz scummvm-rg350-0ba17539acad48797323f1481a0533082778b61d.tar.bz2 scummvm-rg350-0ba17539acad48797323f1481a0533082778b61d.zip |
Deleting save states via the launcher and the GMM is now supported in the cine engine
svn-id: r35032
-rw-r--r-- | engines/cine/detection.cpp | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index 07195fa7b9..7b4e34c645 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -538,12 +538,14 @@ 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 CineMetaEngine::hasFeature(MetaEngineFeature f) const { return (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup); + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave); } bool Cine::CineEngine::hasFeature(EngineFeature f) const { @@ -607,6 +609,48 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const { int CineMetaEngine::getMaximumSaveSlot() const { return 9; } +void CineMetaEngine::removeSaveState(const char *target, int slot) const { + // Load savegame descriptions from index file + typedef char CommandeType[20]; + CommandeType saveNames[10]; + + Common::InSaveFile *in; + char tmp[80]; + + snprintf(tmp, 80, "%s.dir", target); + in = g_system->getSavefileManager()->openForLoading(tmp); + + if (!in) + return; + + in->read(saveNames, 10 * 20); + delete in; + + // Set description for selected slot + char slotName[20]; + slotName[0] = 0; + strncpy(saveNames[slot], slotName, 20); + + // Update savegame descriptions + char indexFile[80]; + snprintf(indexFile, 80, "%s.dir", target); + + Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving(indexFile); + if (!out) { + warning("Unable to open file %s for saving", indexFile); + return; + } + + out->write(saveNames, 10 * 20); + delete out; + + // Delete save file + char saveFileName[256]; + sprintf(saveFileName, "%s.%1d", target, slot); + + g_system->getSavefileManager()->removeSavefile(saveFileName); +} + #if PLUGIN_ENABLED_DYNAMIC(CINE) REGISTER_PLUGIN_DYNAMIC(CINE, PLUGIN_TYPE_ENGINE, CineMetaEngine); #else |