aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-09-22 21:15:17 -0700
committerPaul Gilbert2019-09-25 20:13:27 -0700
commitac744241783da16ddf67b1874e93ff949a4c41b3 (patch)
treed88a7393b2f4865a80f44f39103578c160ba59f8 /engines
parentc098422a0d7d60893f4068af329e511699553e50 (diff)
downloadscummvm-rg350-ac744241783da16ddf67b1874e93ff949a4c41b3.tar.gz
scummvm-rg350-ac744241783da16ddf67b1874e93ff949a4c41b3.tar.bz2
scummvm-rg350-ac744241783da16ddf67b1874e93ff949a4c41b3.zip
GLK: ADRIFT: Add loading savegames from launcher
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/adrift/os_glk.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/engines/glk/adrift/os_glk.cpp b/engines/glk/adrift/os_glk.cpp
index c9c9c0c856..c0b35c4e54 100644
--- a/engines/glk/adrift/os_glk.cpp
+++ b/engines/glk/adrift/os_glk.cpp
@@ -26,6 +26,7 @@
#include "glk/glk.h"
#include "glk/streams.h"
#include "glk/windows.h"
+#include "common/config-manager.h"
#include "common/textconsole.h"
#include "common/translation.h"
@@ -2786,7 +2787,7 @@ static enum gsc_end_option gsc_get_ending_option() {
* and generally handle options. The second is called from g_vm->glk_main, and
* does the real work of running the game.
*/
-static int gsc_startup_code(Common::SeekableReadStream *game_stream, strid_t restore_stream,
+static int gsc_startup_code(Common::SeekableReadStream *game_stream, int restore_slot,
sc_uint trace_flags, sc_bool enable_debugger, sc_bool stable_random, const sc_char *locale) {
winid_t window;
assert(game_stream);
@@ -2850,16 +2851,15 @@ static int gsc_startup_code(Common::SeekableReadStream *game_stream, strid_t res
* If the game was created successfully and there is a restore stream, try
* to immediately restore the game from that stream.
*/
- if (gsc_game && restore_stream) {
- if (!sc_load_game_from_callback(gsc_game, gsc_callback, restore_stream)) {
+ if (gsc_game && restore_slot != -1) {
+ if (g_vm->loadGameState(restore_slot).getCode() != Common::kNoError) {
sc_free_game(gsc_game);
gsc_game = nullptr;
gsc_game_message = "Unable to restore this Adrift game from the requested file.";
- } else
+ } else {
gsc_game_message = nullptr;
+ }
}
- if (restore_stream)
- g_vm->glk_stream_close(restore_stream, nullptr);
/* If successful, set game debugging and synchronize to the core's locale. */
if (gsc_game) {
@@ -3078,8 +3078,11 @@ bool adrift_startup_code(Common::SeekableReadStream *gameFile) {
stable_random = gDebugLevel > 0;
locale = nullptr;
+ // Check for savegame to load immediate
+ int saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
+
// Use the generic startup code to complete startup
- return gsc_startup_code(gameFile, nullptr, trace_flags, enable_debugger, stable_random, locale);
+ return gsc_startup_code(gameFile, saveSlot, trace_flags, enable_debugger, stable_random, locale);
}
} // End of namespace Adrift