diff options
author | Paul Gilbert | 2018-11-17 19:04:06 -0800 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | 3b906cb2bb302d9256d07cb462f445af16c7d129 (patch) | |
tree | 0928d07e9f923953401ff82eb488705d59878d9b /engines | |
parent | b05a16a0ad0dcc2881aeda81e0d1a84a752eccab (diff) | |
download | scummvm-rg350-3b906cb2bb302d9256d07cb462f445af16c7d129.tar.gz scummvm-rg350-3b906cb2bb302d9256d07cb462f445af16c7d129.tar.bz2 scummvm-rg350-3b906cb2bb302d9256d07cb462f445af16c7d129.zip |
GLK: Fixes for combined loading/saving code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/glk/detection.cpp | 15 | ||||
-rw-r--r-- | engines/glk/frotz/frotz.h | 5 | ||||
-rw-r--r-- | engines/glk/glk.cpp | 4 | ||||
-rw-r--r-- | engines/glk/glk.h | 3 | ||||
-rw-r--r-- | engines/glk/scott/scott.h | 5 |
5 files changed, 25 insertions, 7 deletions
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp index e6a129f8e2..a91c6033b0 100644 --- a/engines/glk/detection.cpp +++ b/engines/glk/detection.cpp @@ -120,13 +120,22 @@ Common::Error GlkMetaEngine::createInstance(OSystem *syst, Engine **engine) cons return Common::kNoGameDataFoundError; } + // Get the MD5 + Common::File f; + if (!f.open(Common::FSNode(ConfMan.get("path")).getChild(gameDesc._filename))) + return Common::kNoGameDataFoundError; + + gameDesc._md5 = Common::computeStreamMD5AsString(f, 5000); + f.close(); + // Correct the correct engine - if (Glk::Frotz::FrotzMetaEngine::findGame(gameDesc._gameId.c_str()).description) + if (Glk::Frotz::FrotzMetaEngine::findGame(gameDesc._gameId.c_str()).description) { *engine = new Glk::Frotz::Frotz(syst, gameDesc); - else if (Glk::Scott::ScottMetaEngine::findGame(gameDesc._gameId.c_str()).description) + } else if (Glk::Scott::ScottMetaEngine::findGame(gameDesc._gameId.c_str()).description) { *engine = new Glk::Scott::Scott(syst, gameDesc); - else + } else { return Common::kNoGameDataFoundError; + } return Common::kNoError; } diff --git a/engines/glk/frotz/frotz.h b/engines/glk/frotz/frotz.h index 00aeb599fb..0dd8b69e89 100644 --- a/engines/glk/frotz/frotz.h +++ b/engines/glk/frotz/frotz.h @@ -49,6 +49,11 @@ public: void initialize(); /** + * Returns the running interpreter type + */ + virtual InterpreterType getInterpreterType() const override { return INTERPRETER_FROTZ; } + + /** * Execute the game */ virtual void runGame(Common::SeekableReadStream *gameFile) override; diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp index a3cd167ae7..9488c6684a 100644 --- a/engines/glk/glk.cpp +++ b/engines/glk/glk.cpp @@ -149,7 +149,7 @@ Common::Error GlkEngine::loadGameState(int slot) { if (file == nullptr) return Common::kReadingFailed; - Common::Error result = saveGameData(file); + Common::Error result = loadGameData(file); file->close(); return result; @@ -163,7 +163,7 @@ Common::Error GlkEngine::saveGameState(int slot, const Common::String &desc) { if (file == nullptr) return Common::kWritingFailed; - Common::Error result = loadGameData(file); + Common::Error result = saveGameData(file); file->close(); return result; diff --git a/engines/glk/glk.h b/engines/glk/glk.h index f925fd0cc3..63b5727604 100644 --- a/engines/glk/glk.h +++ b/engines/glk/glk.h @@ -76,7 +76,6 @@ struct GlkGameDescription { Common::Language _language; Common::Platform _platform; Common::String _filename; - InterpreterType _interpType; Common::String _md5; }; @@ -162,7 +161,7 @@ public: /** * Returns the running interpreter type */ - InterpreterType getInterpreterType() const { return _gameDescription._interpType; } + virtual InterpreterType getInterpreterType() const = 0; /** * Returns the game's md5 diff --git a/engines/glk/scott/scott.h b/engines/glk/scott/scott.h index a22f88bf94..ad1313d5d4 100644 --- a/engines/glk/scott/scott.h +++ b/engines/glk/scott/scott.h @@ -167,6 +167,11 @@ public: Scott(OSystem *syst, const GlkGameDescription &gameDesc); /** + * Returns the running interpreter type + */ + virtual InterpreterType getInterpreterType() const override { return INTERPRETER_SCOTT; } + + /** * Execute the game */ virtual void runGame(Common::SeekableReadStream *gameFile) override; |