diff options
Diffstat (limited to 'engines/sherlock')
-rw-r--r-- | engines/sherlock/detection.cpp | 13 | ||||
-rw-r--r-- | engines/sherlock/journal.cpp | 1 | ||||
-rw-r--r-- | engines/sherlock/saveload.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/saveload.h | 4 | ||||
-rw-r--r-- | engines/sherlock/sherlock.cpp | 18 | ||||
-rw-r--r-- | engines/sherlock/sherlock.h | 1 |
6 files changed, 31 insertions, 10 deletions
diff --git a/engines/sherlock/detection.cpp b/engines/sherlock/detection.cpp index bb66cee7df..5d217bd1c5 100644 --- a/engines/sherlock/detection.cpp +++ b/engines/sherlock/detection.cpp @@ -98,7 +98,12 @@ bool SherlockMetaEngine::createInstance(OSystem *syst, Engine **engine, const AD } bool SherlockMetaEngine::hasFeature(MetaEngineFeature f) const { - return false; + return + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail); } SaveStateList SherlockMetaEngine::listSaves(const char *target) const { @@ -109,13 +114,13 @@ int SherlockMetaEngine::getMaximumSaveSlot() const { return MAX_SAVEGAME_SLOTS; } -void SherlockMetaEngine::removeSaveState(const char *target, int slot) const { - Common::String filename = Common::String::format("%s.%03d", target, slot); +void SherlockMetaEngine::removeSaveState(const char *target, int slot) const { + Common::String filename = Sherlock::SaveManager(nullptr, target).generateSaveName(slot); g_system->getSavefileManager()->removeSavefile(filename); } SaveStateDescriptor SherlockMetaEngine::querySaveMetaInfos(const char *target, int slot) const { - Common::String filename = Common::String::format("%s.%03d", target, slot); + Common::String filename = Sherlock::SaveManager(nullptr, target).generateSaveName(slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename); if (f) { diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp index 15d3a07c75..18edec8c73 100644 --- a/engines/sherlock/journal.cpp +++ b/engines/sherlock/journal.cpp @@ -1194,6 +1194,7 @@ void Journal::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_maxPage); int journalCount = _journal.size(); + s.syncAsUint16LE(journalCount); if (s.isLoading()) _journal.resize(journalCount); diff --git a/engines/sherlock/saveload.cpp b/engines/sherlock/saveload.cpp index cd7627a768..207eff1ab4 100644 --- a/engines/sherlock/saveload.cpp +++ b/engines/sherlock/saveload.cpp @@ -318,8 +318,6 @@ void SaveManager::loadGame(int slot) { if (!saveFile) return; - Common::Serializer s(saveFile, nullptr); - // Load the savaegame header SherlockSavegameHeader header; if (!readSavegameHeader(saveFile, header)) @@ -331,6 +329,7 @@ void SaveManager::loadGame(int slot) { } // Synchronize the savegame data + Common::Serializer s(saveFile, nullptr); synchronize(s); delete saveFile; @@ -347,6 +346,7 @@ void SaveManager::saveGame(int slot, const Common::String &name) { header._saveName = name; writeSavegameHeader(out, header); + // Synchronize the savegame data Common::Serializer s(nullptr, out); synchronize(s); diff --git a/engines/sherlock/saveload.h b/engines/sherlock/saveload.h index 0dad6256ca..0865fd3856 100644 --- a/engines/sherlock/saveload.h +++ b/engines/sherlock/saveload.h @@ -58,8 +58,6 @@ private: void createSavegameList(); - Common::String generateSaveName(int slot); - void synchronize(Common::Serializer &s); public: Common::StringArray _savegames; @@ -76,6 +74,8 @@ public: static SaveStateList getSavegameList(const Common::String &target); + Common::String generateSaveName(int slot); + void writeSavegameHeader(Common::OutSaveFile *out, SherlockSavegameHeader &header); static bool readSavegameHeader(Common::InSaveFile *in, SherlockSavegameHeader &header); diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index bc7b545719..cd5d48033a 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -23,6 +23,7 @@ #include "sherlock/sherlock.h" #include "sherlock/graphics.h" #include "common/scummsys.h" +#include "common/config-manager.h" #include "common/debug-channels.h" #include "engines/util.h" @@ -49,6 +50,7 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam _onChessboard = false; _slowChess = false; _keyPadSpeed = 0; + _loadGameSlot = -1; } SherlockEngine::~SherlockEngine() { @@ -95,8 +97,20 @@ void SherlockEngine::initialize() { Common::Error SherlockEngine::run() { initialize(); - // Temporarily disabled for now -// showOpening(); + // If requested, load a savegame instead of showing the intro + if (ConfMan.hasKey("save_slot")) { + int saveSlot = ConfMan.getInt("save_slot"); + if (saveSlot >= 1 && saveSlot <= MAX_SAVEGAME_SLOTS) + _loadGameSlot = saveSlot; + } + + if (_loadGameSlot != -1) { + _saves->loadGame(_loadGameSlot); + _loadGameSlot = -1; + } else { + // Temporarily disabled for now + // showOpening(); + } while (!shouldQuit()) { // Prepare for scene, and handle any game-specific scenes. This allows diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h index 48850fff06..09e969884c 100644 --- a/engines/sherlock/sherlock.h +++ b/engines/sherlock/sherlock.h @@ -107,6 +107,7 @@ public: bool _onChessboard; bool _slowChess; int _keyPadSpeed; + int _loadGameSlot; public: SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc); virtual ~SherlockEngine(); |