aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-09-08 12:52:43 -0700
committerPaul Gilbert2019-09-25 20:13:27 -0700
commit068375e48c2acb9c0e187ff259dde7ad7d1c241f (patch)
tree4aac3b31dabaafaf8b57662b1e50dfb942919c3b
parentc03b7a50eafe3c6a559c55746ec88d5a37885e9a (diff)
downloadscummvm-rg350-068375e48c2acb9c0e187ff259dde7ad7d1c241f.tar.gz
scummvm-rg350-068375e48c2acb9c0e187ff259dde7ad7d1c241f.tar.bz2
scummvm-rg350-068375e48c2acb9c0e187ff259dde7ad7d1c241f.zip
GLK: ADRIFT: Fix exiting game out of debug prompt
-rw-r--r--engines/glk/adrift/os_glk.cpp4
-rw-r--r--engines/glk/adrift/scdebug.cpp5
-rw-r--r--engines/glk/adrift/scinterf.cpp4
-rw-r--r--engines/glk/adrift/scrunner.cpp7
-rw-r--r--engines/glk/adrift/sctaffil.cpp3
5 files changed, 19 insertions, 4 deletions
diff --git a/engines/glk/adrift/os_glk.cpp b/engines/glk/adrift/os_glk.cpp
index 243aca63ae..1244b48e1c 100644
--- a/engines/glk/adrift/os_glk.cpp
+++ b/engines/glk/adrift/os_glk.cpp
@@ -2841,6 +2841,10 @@ gsc_event_wait_2 (glui32 wait_type_1, glui32 wait_type_2, event_t * event)
do
{
g_vm->glk_select (event);
+ if (g_vm->shouldQuit()) {
+ g_vm->glk_cancel_line_event(gsc_main_window, event);
+ return;
+ }
switch (event->type)
{
diff --git a/engines/glk/adrift/scdebug.cpp b/engines/glk/adrift/scdebug.cpp
index e2472cc77c..3852d164e1 100644
--- a/engines/glk/adrift/scdebug.cpp
+++ b/engines/glk/adrift/scdebug.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "glk/adrift/scare.h"
+#include "glk/adrift/adrift.h"
#include "glk/adrift/scprotos.h"
#include "glk/adrift/scgamest.h"
@@ -2429,6 +2429,9 @@ debug_dialog (sc_gameref_t game)
do
{
if_read_debug (buffer, sizeof (buffer));
+
+ if (g_vm->shouldQuit())
+ return;
}
while (sc_strempty (buffer));
diff --git a/engines/glk/adrift/scinterf.cpp b/engines/glk/adrift/scinterf.cpp
index 044c4d8cf8..cc8e1235d7 100644
--- a/engines/glk/adrift/scinterf.cpp
+++ b/engines/glk/adrift/scinterf.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "glk/adrift/scare.h"
+#include "glk/adrift/adrift.h"
#include "glk/adrift/scprotos.h"
#include "glk/adrift/scgamest.h"
#include "common/file.h"
@@ -215,6 +215,8 @@ if_read_line_common (sc_char *buffer, sc_int length,
memset (buffer, NUL, length);
is_line_available = read_line_function (buffer, length);
+ if (g_vm->shouldQuit())
+ return;
}
while (!is_line_available);
diff --git a/engines/glk/adrift/scrunner.cpp b/engines/glk/adrift/scrunner.cpp
index 872a7648b7..ab6bfd8305 100644
--- a/engines/glk/adrift/scrunner.cpp
+++ b/engines/glk/adrift/scrunner.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "glk/adrift/scare.h"
+#include "glk/adrift/adrift.h"
#include "glk/adrift/scprotos.h"
#include "glk/adrift/scgamest.h"
@@ -1377,6 +1377,7 @@ run_main_loop (sc_gameref_t game)
* Game loop, exits either when a command parser handler sets the game
* running flag to FALSE, or by call to run_quit().
*/
+ game->is_running &= !g_vm->shouldQuit();
while (game->is_running)
{
sc_bool status;
@@ -1449,7 +1450,9 @@ run_main_loop (sc_gameref_t game)
debug_turn_update (game);
}
}
- }
+
+ game->is_running &= !g_vm->shouldQuit();
+ }
/*
* Final status update, for games that vary it on completion, then notify
diff --git a/engines/glk/adrift/sctaffil.cpp b/engines/glk/adrift/sctaffil.cpp
index 6868580b5b..c8a25edaeb 100644
--- a/engines/glk/adrift/sctaffil.cpp
+++ b/engines/glk/adrift/sctaffil.cpp
@@ -453,6 +453,7 @@ static sc_bool taf_decompress(sc_tafref_t taf, sc_read_callbackref_t callback,
Common::SeekableReadStream *src = (Common::SeekableReadStream *)opaque;
assert(src);
Common::MemoryWriteStreamDynamic dest(DisposeAfterUse::YES);
+ size_t startingPos = src->pos();
if (!Common::inflateZlibHeaderless(&dest, src))
return false;
@@ -466,6 +467,8 @@ static sc_bool taf_decompress(sc_tafref_t taf, sc_read_callbackref_t callback,
bytesRemaining -= consumed;
}
+ taf->total_in_bytes = src->pos() - startingPos;
+
return true;
#else
return true;