diff options
author | Paul Gilbert | 2019-06-23 16:15:00 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-06-23 16:19:42 -0700 |
commit | 5eb0390aca85a53a6bc268e082b776119ca9b997 (patch) | |
tree | 33898f1d7487676ce2c24f1b2490e08f4549964a /engines/glk/alan2/alan2.cpp | |
parent | e7fbd9268c9bd4a21a9f4741d4636c722368847c (diff) | |
download | scummvm-rg350-5eb0390aca85a53a6bc268e082b776119ca9b997.tar.gz scummvm-rg350-5eb0390aca85a53a6bc268e082b776119ca9b997.tar.bz2 scummvm-rg350-5eb0390aca85a53a6bc268e082b776119ca9b997.zip |
GLK: ALAN2: Add loading savegames from launcher, deinitialization code
Diffstat (limited to 'engines/glk/alan2/alan2.cpp')
-rw-r--r-- | engines/glk/alan2/alan2.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/engines/glk/alan2/alan2.cpp b/engines/glk/alan2/alan2.cpp index f9077c9f7a..0ad524bd47 100644 --- a/engines/glk/alan2/alan2.cpp +++ b/engines/glk/alan2/alan2.cpp @@ -39,17 +39,18 @@ namespace Alan2 { Alan2 *g_vm = nullptr; Alan2::Alan2(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc), - vm_exited_cleanly(false), _restartFlag(false) { + vm_exited_cleanly(false), _restartFlag(false), _saveSlot(-1), _pendingLook(false) { g_vm = this; + txtfil = nullptr; + logfil = nullptr; + memory = nullptr; } void Alan2::runGame() { - Common::String gameFileName = _gameFile.getName(); + if (initialize()) + Glk::Alan2::run(); - if (!initialize()) - return; - - Glk::Alan2::run(); + deinitialize(); } bool Alan2::initialize() { @@ -91,9 +92,19 @@ bool Alan2::initialize() { return false; } + // Check for a save being loaded directly from the launcher + _saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1; + return true; } +void Alan2::deinitialize() { + free(memory); + + delete txtfil; + delete logfil; +} + Common::Error Alan2::readSaveData(Common::SeekableReadStream *rs) { Common::Serializer s(rs, nullptr); synchronizeSave(s); |