diff options
Diffstat (limited to 'engines/glk')
-rw-r--r-- | engines/glk/adrift/os_glk.cpp | 14 | ||||
-rw-r--r-- | engines/glk/adrift/scare.h | 10 | ||||
-rw-r--r-- | engines/glk/adrift/scdebug.cpp | 34 | ||||
-rw-r--r-- | engines/glk/adrift/scgamest.cpp | 8 | ||||
-rw-r--r-- | engines/glk/adrift/scgamest.h | 3 | ||||
-rw-r--r-- | engines/glk/adrift/scinterf.cpp | 32 | ||||
-rw-r--r-- | engines/glk/adrift/scprops.cpp | 2 | ||||
-rw-r--r-- | engines/glk/adrift/scprotos.h | 26 | ||||
-rw-r--r-- | engines/glk/adrift/screstrs.cpp | 4 | ||||
-rw-r--r-- | engines/glk/adrift/scrunner.cpp | 51 | ||||
-rw-r--r-- | engines/glk/adrift/serialization.cpp | 6 | ||||
-rw-r--r-- | engines/glk/adrift/sxtester.cpp | 7 |
12 files changed, 94 insertions, 103 deletions
diff --git a/engines/glk/adrift/os_glk.cpp b/engines/glk/adrift/os_glk.cpp index c0b35c4e54..b08dfbb93a 100644 --- a/engines/glk/adrift/os_glk.cpp +++ b/engines/glk/adrift/os_glk.cpp @@ -2888,6 +2888,7 @@ static int gsc_startup_code(Common::SeekableReadStream *game_stream, int restore static void gsc_main() { sc_bool is_running; + Context context; /* Ensure SCARE internal types have the right sizes. */ if (!(sizeof(sc_byte) == 1 && sizeof(sc_char) == 1 @@ -2927,7 +2928,12 @@ static void gsc_main() { while (is_running) { /* Run the game until it ends, or the user quits. */ gsc_status_notify(); - sc_interpret_game(gsc_game); + + if (!context._break) + sc_interpret_game(context, gsc_game); + + // End point for any context long jump + context.clear(); /* * If the game did not complete, the user quit explicitly, so leave the @@ -2956,17 +2962,17 @@ static void gsc_main() { switch (gsc_get_ending_option()) { case GAME_RESTART: gsc_short_delay(); - sc_restart_game(gsc_game); + sc_restart_game(context, gsc_game); break; case GAME_UNDO: if (sc_is_game_undo_available(gsc_game)) { - sc_undo_game_turn(gsc_game); + sc_undo_game_turn(context, gsc_game); gsc_normal_string("The previous turn has been undone.\n"); } else { gsc_normal_string("Sorry, no undo is available.\n"); gsc_short_delay(); - sc_restart_game(gsc_game); + sc_restart_game(context, gsc_game); } break; diff --git a/engines/glk/adrift/scare.h b/engines/glk/adrift/scare.h index d4e02314e6..1dc7c6e964 100644 --- a/engines/glk/adrift/scare.h +++ b/engines/glk/adrift/scare.h @@ -25,9 +25,7 @@ #include "common/scummsys.h" #include "common/stream.h" -#undef longjmp -#undef setjmp -#include <setjmp.h> +#include "glk/jumps.h" namespace Glk { namespace Adrift { @@ -111,11 +109,11 @@ extern sc_game sc_game_from_stream(Common::SeekableReadStream *stream); extern sc_game sc_game_from_callback(sc_int(*callback) (void *, sc_byte *, sc_int), void *opaque); -extern void sc_interpret_game(sc_game game); -extern void sc_restart_game(sc_game game); +extern void sc_interpret_game(CONTEXT, sc_game game); +extern void sc_restart_game(CONTEXT, sc_game game); extern sc_bool sc_save_game(sc_game game); extern sc_bool sc_load_game(sc_game game); -extern sc_bool sc_undo_game_turn(sc_game game); +extern sc_bool sc_undo_game_turn(CONTEXT, sc_game game); extern void sc_quit_game(sc_game game); extern sc_bool sc_save_game_to_filename(sc_game game, const sc_char *filename); extern void sc_save_game_to_stream(sc_game game, Common::SeekableReadStream *stream); diff --git a/engines/glk/adrift/scdebug.cpp b/engines/glk/adrift/scdebug.cpp index a752506702..23c8ed2b9a 100644 --- a/engines/glk/adrift/scdebug.cpp +++ b/engines/glk/adrift/scdebug.cpp @@ -1891,6 +1891,7 @@ static sc_bool debug_compare_variable(sc_gameref_t from, sc_gameref_t with, sc_i const sc_char *name; sc_int var_type, var_type2; sc_bool equal = FALSE; + vt_rvalue.voidp = vt_rvalue2.voidp = nullptr; if (from->bundle != with->bundle) sc_fatal("debug_compare_variable: property sharing malfunction\n"); @@ -2203,7 +2204,7 @@ static void debug_dispatch(sc_gameref_t game, sc_command_t command, sc_command_t * * Create a small debugging dialog with the user. */ -static void debug_dialog(sc_gameref_t game) { +static void debug_dialog(CONTEXT, sc_gameref_t game) { const sc_filterref_t filter = gs_get_filter(game); const sc_debuggerref_t debug = debug_get_debugger(game); const sc_var_setref_t vars = gs_get_vars(game); @@ -2264,7 +2265,7 @@ static void debug_dialog(sc_gameref_t game) { /* Drop printfilter contents and quit the game. */ pf_empty(filter); - run_quit(game); + CALL1(run_quit, game); /* Just in case... */ if_print_debug("Unable to quit from the game. Sorry.\n"); @@ -2326,13 +2327,14 @@ sc_bool debug_run_command(sc_gameref_t game, const sc_char *debug_command) { */ sc_bool debug_cmd_debugger(sc_gameref_t game) { const sc_debuggerref_t debug = debug_get_debugger(game); + Context context; /* If debugging disallowed (not initialized), ignore the call. */ - if (debug) - debug_dialog(game); - else + if (debug) { + debug_dialog(context, game); + } else { if_print_string("SCARE's game debugger is not enabled. Sorry.\n"); - + } /* * Set as administrative command, so as not to consume a game turn, and * return successfully. @@ -2354,7 +2356,7 @@ sc_bool debug_cmd_debugger(sc_gameref_t game) { * The second is called on exit from the game, and may make a final sweep for * watchpoints and offer the debug dialog one last time. */ -void debug_game_started(sc_gameref_t game) { +void debug_game_started(CONTEXT, sc_gameref_t game) { const sc_debuggerref_t debug = debug_get_debugger(game); /* If debugging disallowed (not initialized), ignore the call. */ @@ -2368,20 +2370,21 @@ void debug_game_started(sc_gameref_t game) { if_print_debug("\n--- SCARE " SCARE_VERSION SCARE_PATCH_LEVEL " Game Debugger\n" "--- Type 'help' for a list of commands.\n"); - debug_dialog(game); + CALL1(debug_dialog, game); } else { /* * It's a restore or undo through memos, so run the dialog only if * single-stepping; no need to check watchpoints for this case as * none can be set -- no undo. */ - if (debug->single_step) - debug_dialog(game); + if (debug->single_step) { + CALL1(debug_dialog, game); + } } } } -void debug_game_ended(sc_gameref_t game) { +void debug_game_ended(CONTEXT, sc_gameref_t game) { const sc_debuggerref_t debug = debug_get_debugger(game); /* If debugging disallowed (not initialized), ignore the call. */ @@ -2412,7 +2415,7 @@ void debug_game_ended(sc_gameref_t game) { } /* Run a final dialog. */ - debug_dialog(game); + CALL1(debug_dialog, game); } } @@ -2423,7 +2426,7 @@ void debug_game_ended(sc_gameref_t game) { * Called after each turn by the main game loop. Checks for any set * watchpoints, and triggers a debug dialog when any fire. */ -void debug_turn_update(sc_gameref_t game) { +void debug_turn_update(CONTEXT, sc_gameref_t game) { const sc_debuggerref_t debug = debug_get_debugger(game); /* If debugging disallowed (not initialized), ignore the call. */ @@ -2441,8 +2444,9 @@ void debug_turn_update(sc_gameref_t game) { * Run debugger dialog if any watchpoints triggered, or if single * stepping (even if none triggered). */ - if (debug_check_watchpoints(game) || debug->single_step) - debug_dialog(game); + if (debug_check_watchpoints(game) || debug->single_step) { + CALL1(debug_dialog, game); + } } } diff --git a/engines/glk/adrift/scgamest.cpp b/engines/glk/adrift/scgamest.cpp index 84abf6bb9e..ab92b413de 100644 --- a/engines/glk/adrift/scgamest.cpp +++ b/engines/glk/adrift/scgamest.cpp @@ -783,10 +783,7 @@ sc_gameref_t gs_create(sc_var_setref_t vars, sc_prop_setref_t bundle, sc_filterr game->her_npc = -1; game->it_npc = -1; - /* Clear the quit jump buffer for tidiness. */ - memset(&game->quitter, 0, sizeof(game->quitter)); - - /* Return the constructed game state. */ + // Return the constructed game state return game; } @@ -959,9 +956,6 @@ void gs_copy(sc_gameref_t to, sc_gameref_t from) { to->him_npc = from->him_npc; to->her_npc = from->her_npc; to->it_npc = from->it_npc; - - /* Copy over the quit jump buffer. */ - memcpy(&to->quitter, &from->quitter, sizeof(from->quitter)); } diff --git a/engines/glk/adrift/scgamest.h b/engines/glk/adrift/scgamest.h index a246d05164..494f75076a 100644 --- a/engines/glk/adrift/scgamest.h +++ b/engines/glk/adrift/scgamest.h @@ -180,9 +180,6 @@ struct sc_game_s { sc_int him_npc; sc_int her_npc; sc_int it_npc; - - /* Longjump buffer for external requests to quit. */ - jmp_buf quitter; }; typedef sc_game_s sc_game_t; diff --git a/engines/glk/adrift/scinterf.cpp b/engines/glk/adrift/scinterf.cpp index ff7456b120..c01d99a511 100644 --- a/engines/glk/adrift/scinterf.cpp +++ b/engines/glk/adrift/scinterf.cpp @@ -403,22 +403,22 @@ static sc_bool if_game_error(sc_gameref_t game, const sc_char *function_name) { * behaving like sc_restart_game()), but will return if the game could not * be restored. sc_undo_game_turn() behaves like sc_load_game(). */ -void sc_interpret_game(sc_game game) { +void sc_interpret_game(CONTEXT, sc_game game) { const sc_gameref_t game_ = (const sc_gameref_t)game; if (if_game_error(game_, "sc_interpret_game")) return; - run_interpret(game_); + run_interpret(context, game_); } -void sc_restart_game(sc_game game) { +void sc_restart_game(CONTEXT, sc_game game) { const sc_gameref_t game_ = (const sc_gameref_t)game; if (if_game_error(game_, "sc_restart_game")) return; - run_restart(game_); + CALL1(run_restart, game_); } sc_bool sc_save_game(sc_game game) { @@ -430,31 +430,31 @@ sc_bool sc_save_game(sc_game game) { return run_save_prompted(game_); } -sc_bool sc_load_game(sc_game game) { +sc_bool sc_load_game(CONTEXT, sc_game game) { const sc_gameref_t game_ = (const sc_gameref_t)game; if (if_game_error(game_, "sc_load_game")) return FALSE; - return run_restore_prompted(game_); + return run_restore_prompted(context, game_); } -sc_bool sc_undo_game_turn(sc_game game) { +sc_bool sc_undo_game_turn(CONTEXT, sc_game game) { const sc_gameref_t game_ = (const sc_gameref_t)game; if (if_game_error(game_, "sc_undo_game_turn")) return FALSE; - return run_undo(game_); + return run_undo(context, game_); } -void sc_quit_game(sc_game game) { +void sc_quit_game(CONTEXT, sc_game game) { const sc_gameref_t game_ = (const sc_gameref_t)game; if (if_game_error(game_, "sc_quit_game")) return; - run_quit(game_); + run_quit(context, game_); } @@ -526,7 +526,7 @@ void sc_save_game_to_callback(sc_game game, run_save(game_, callback, opaque); } -sc_bool sc_load_game_from_filename(sc_game game, const sc_char *filename) { +sc_bool sc_load_game_from_filename(CONTEXT, sc_game game, const sc_char *filename) { const sc_gameref_t game_ = (const sc_gameref_t)game; Common::InSaveFile *sf; sc_bool status; @@ -545,13 +545,13 @@ sc_bool sc_load_game_from_filename(sc_game game, const sc_char *filename) { return FALSE; } - status = run_restore(game_, if_file_read_callback, sf); + status = run_restore(context, game_, if_file_read_callback, sf); delete sf; return status; } -sc_bool sc_load_game_from_stream(sc_game game, Common::SeekableReadStream *stream) { +sc_bool sc_load_game_from_stream(CONTEXT, sc_game game, Common::SeekableReadStream *stream) { const sc_gameref_t game_ = (const sc_gameref_t)game; if (if_game_error(game_, "sc_load_game_from_stream")) @@ -562,10 +562,10 @@ sc_bool sc_load_game_from_stream(sc_game game, Common::SeekableReadStream *strea return FALSE; } - return run_restore(game_, if_file_read_callback, stream); + return run_restore(context, game_, if_file_read_callback, stream); } -sc_bool sc_load_game_from_callback(sc_game game, +sc_bool sc_load_game_from_callback(CONTEXT, sc_game game, sc_int(*callback)(void *, sc_byte *, sc_int), void *opaque) { const sc_gameref_t game_ = (const sc_gameref_t)game; @@ -577,7 +577,7 @@ sc_bool sc_load_game_from_callback(sc_game game, return FALSE; } - return run_restore(game_, callback, opaque); + return run_restore(context, game_, callback, opaque); } diff --git a/engines/glk/adrift/scprops.cpp b/engines/glk/adrift/scprops.cpp index 0888173ed2..166f506f68 100644 --- a/engines/glk/adrift/scprops.cpp +++ b/engines/glk/adrift/scprops.cpp @@ -256,7 +256,7 @@ static sc_prop_noderef_t prop_find_child(sc_prop_noderef_t parent, sc_int type, /* See if this node has any children. */ if (parent->child_list) { sc_int index_; - sc_prop_noderef_t child; + sc_prop_noderef_t child = nullptr; /* Do the lookup based on name type. */ switch (type) { diff --git a/engines/glk/adrift/scprotos.h b/engines/glk/adrift/scprotos.h index 753359703a..39fba6bbe4 100644 --- a/engines/glk/adrift/scprotos.h +++ b/engines/glk/adrift/scprotos.h @@ -21,6 +21,7 @@ */ #include "glk/adrift/scare.h" +#include "glk/jumps.h" namespace Glk { namespace Adrift { @@ -621,20 +622,17 @@ extern void res_sync_resources(sc_gameref_t game); extern void res_cancel_resources(sc_gameref_t game); /* Game runner functions. */ -extern sc_bool run_game_task_commands(sc_gameref_t game, - const sc_char *string); +extern sc_bool run_game_task_commands(sc_gameref_t game, const sc_char *string); extern sc_gameref_t run_create(sc_read_callbackref_t callback, void *opaque); -extern void run_interpret(sc_gameref_t game); +extern void run_interpret(CONTEXT, sc_gameref_t game); extern void run_destroy(sc_gameref_t game); -extern void run_restart(sc_gameref_t game); -extern void run_save(sc_gameref_t game, - sc_write_callbackref_t callback, void *opaque); +extern void run_restart(CONTEXT, sc_gameref_t game); +extern void run_save(sc_gameref_t game, sc_write_callbackref_t callback, void *opaque); extern sc_bool run_save_prompted(sc_gameref_t game); -extern sc_bool run_restore(sc_gameref_t game, - sc_read_callbackref_t callback, void *opaque); -extern sc_bool run_restore_prompted(sc_gameref_t game); -extern sc_bool run_undo(sc_gameref_t game); -extern void run_quit(sc_gameref_t game); +extern sc_bool run_restore(CONTEXT, sc_gameref_t game, sc_read_callbackref_t callback, void *opaque); +extern sc_bool run_restore_prompted(CONTEXT, sc_gameref_t game); +extern sc_bool run_undo(CONTEXT, sc_gameref_t game); +extern void run_quit(CONTEXT, sc_gameref_t game); extern sc_bool run_is_running(sc_gameref_t game); extern sc_bool run_has_completed(sc_gameref_t game); extern sc_bool run_is_undo_available(sc_gameref_t game); @@ -757,9 +755,9 @@ extern sc_bool debug_run_command(sc_gameref_t game, extern sc_bool debug_cmd_debugger(sc_gameref_t game); extern void debug_set_enabled(sc_gameref_t game, sc_bool enable); extern sc_bool debug_get_enabled(sc_gameref_t game); -extern void debug_game_started(sc_gameref_t game); -extern void debug_game_ended(sc_gameref_t game); -extern void debug_turn_update(sc_gameref_t game); +extern void debug_game_started(CONTEXT, sc_gameref_t game); +extern void debug_game_ended(CONTEXT, sc_gameref_t game); +extern void debug_turn_update(CONTEXT, sc_gameref_t game); /* OS interface functions. */ extern sc_bool if_get_trace_flag(sc_uint bitmask); diff --git a/engines/glk/adrift/screstrs.cpp b/engines/glk/adrift/screstrs.cpp index c808129415..e69ad3e120 100644 --- a/engines/glk/adrift/screstrs.cpp +++ b/engines/glk/adrift/screstrs.cpp @@ -24,6 +24,10 @@ #include "glk/adrift/scprotos.h" #include "glk/adrift/scgamest.h" +#undef longjmp +#undef setjmp +#include <setjmp.h> + namespace Glk { namespace Adrift { diff --git a/engines/glk/adrift/scrunner.cpp b/engines/glk/adrift/scrunner.cpp index 288ca834e2..dbf160f350 100644 --- a/engines/glk/adrift/scrunner.cpp +++ b/engines/glk/adrift/scrunner.cpp @@ -1237,7 +1237,7 @@ static sc_bool run_player_input(sc_gameref_t game) { * * Main interpreter loop. */ -static void run_main_loop(sc_gameref_t game) { +static void run_main_loop(CONTEXT, sc_gameref_t game) { const sc_filterref_t filter = gs_get_filter(game); const sc_var_setref_t vars = gs_get_vars(game); const sc_prop_setref_t bundle = gs_get_bundle(game); @@ -1304,13 +1304,13 @@ static void run_main_loop(sc_gameref_t game) { * the initial room visited as this is how the debugger differentiates * restarts from restore or undo back to game start. */ - debug_game_started(game); + CALL1(debug_game_started, game); /* Note the initial room as visited. */ gs_set_room_seen(game, gs_playerroom(game), TRUE); } else { /* Notify the debugger that the game has restarted. */ - debug_game_started(game); + CALL1(debug_game_started, game); } /* @@ -1381,7 +1381,7 @@ static void run_main_loop(sc_gameref_t game) { gs_set_room_seen(game, gs_playerroom(game), TRUE); /* Give the debugger a chance to catch watchpoints. */ - debug_turn_update(game); + CALL1(debug_turn_update, game); } } @@ -1394,7 +1394,7 @@ static void run_main_loop(sc_gameref_t game) { * scan and offer the dialog if appropriate. */ run_update_status(game); - debug_game_ended(game); + CALL1(debug_game_ended, game); /* * Final resource sync, score change notification and printfilter flush @@ -1575,7 +1575,7 @@ static void run_quit_handler(sc_gameref_t game) { * * Intepret the game in a game context. */ -void run_interpret(sc_gameref_t game) { +void run_interpret(CONTEXT, sc_gameref_t game) { assert(gs_is_game_valid(game)); /* Verify the game is not already running, and is runnable. */ @@ -1597,9 +1597,8 @@ void run_interpret(sc_gameref_t game) { /* Run the main interpreter loop until no more restarts. */ game->is_running = TRUE; do { - /* Run the game until some form of halt is requested. */ - if (setjmp(game->quitter) == 0) - run_main_loop(game); + // Run the game until some form of halt is requested + CALL1(run_main_loop, game); /* * If the halt was a restart or restore, cancel the request, handle @@ -1682,19 +1681,18 @@ void run_destroy(sc_gameref_t game) { * Quits a running game. This function calls a longjump to act as if * run_main_loop() returned, and so never returns to its caller. */ -void run_quit(sc_gameref_t game) { +void run_quit(CONTEXT, sc_gameref_t game) { assert(gs_is_game_valid(game)); - /* Disallow quitting a non-running game. */ + // Disallow quitting a non-running game if (!game->is_running) { sc_error("run_quit: game is not running\n"); return; } - /* Exit the main loop with a longjump. */ + // Exit the main loop game->is_running = FALSE; - longjmp(game->quitter, 1); - sc_fatal("run_quit: unable to quit cleanly\n"); + LONG_JUMP; } @@ -1705,7 +1703,7 @@ void run_quit(sc_gameref_t game) { * function calls a longjump to act as if run_main_loop() returned, and so * never returns to its caller. For stopped games, it returns. */ -void run_restart(sc_gameref_t game) { +void run_restart(CONTEXT, sc_gameref_t game) { assert(gs_is_game_valid(game)); /* @@ -1715,11 +1713,10 @@ void run_restart(sc_gameref_t game) { if (game->is_running) { game->is_running = FALSE; game->do_restart = TRUE; - longjmp(game->quitter, 1); - sc_fatal("run_restart: unable to restart cleanly\n"); + LONG_JUMP; } - /* Restart locally, and ensure that the game remains stopped. */ + // Restart locally, and ensure that the game remains stopped run_restart_handler(game); game->is_running = FALSE; } @@ -1756,7 +1753,7 @@ sc_bool run_save_prompted(sc_gameref_t game) { * restore, and for stopped games, they will return, with TRUE if successful, * FALSE if restore failed. */ -static sc_bool run_restore_common(sc_gameref_t game, sc_read_callbackref_t callback, void *opaque) { +static sc_bool run_restore_common(CONTEXT, sc_gameref_t game, sc_read_callbackref_t callback, void *opaque) { sc_bool is_running, status; /* @@ -1778,8 +1775,7 @@ static sc_bool run_restore_common(sc_gameref_t game, sc_read_callbackref_t callb if (game->is_running) { game->is_running = FALSE; game->do_restore = TRUE; - longjmp(game->quitter, 1); - sc_fatal("run_restore_common: unable to restart cleanly\n"); + LONG_JUMP0; } } @@ -1787,17 +1783,17 @@ static sc_bool run_restore_common(sc_gameref_t game, sc_read_callbackref_t callb return status; } -sc_bool run_restore(sc_gameref_t game, sc_read_callbackref_t callback, void *opaque) { +sc_bool run_restore(CONTEXT, sc_gameref_t game, sc_read_callbackref_t callback, void *opaque) { assert(gs_is_game_valid(game)); assert(callback); - return run_restore_common(game, callback, opaque); + return run_restore_common(context, game, callback, opaque); } -sc_bool run_restore_prompted(sc_gameref_t game) { +sc_bool run_restore_prompted(CONTEXT, sc_gameref_t game) { assert(gs_is_game_valid(game)); - return run_restore_common(game, NULL, NULL); + return run_restore_common(context, game, NULL, NULL); } @@ -1807,7 +1803,7 @@ sc_bool run_restore_prompted(sc_gameref_t game) { * Undo a turn in either a running or a stopped game. Returns TRUE on * successful undo, FALSE if no undo buffer is available. */ -sc_bool run_undo(sc_gameref_t game) { +sc_bool run_undo(CONTEXT, sc_gameref_t game) { const sc_memo_setref_t memento = gs_get_memento(game); sc_bool is_running; assert(gs_is_game_valid(game)); @@ -1845,8 +1841,7 @@ sc_bool run_undo(sc_gameref_t game) { if (game->is_running) { game->is_running = FALSE; game->do_restore = TRUE; - longjmp(game->quitter, 1); - sc_fatal("run_undo: unable to restart cleanly\n"); + LONG_JUMP0; } /* Game undo on non-running game accomplished with memos. */ diff --git a/engines/glk/adrift/serialization.cpp b/engines/glk/adrift/serialization.cpp index c0fa81bf3a..02939ccbc6 100644 --- a/engines/glk/adrift/serialization.cpp +++ b/engines/glk/adrift/serialization.cpp @@ -407,12 +407,6 @@ bool LoadSerializer::load() { new_game->requested_sound = _game->requested_sound; new_game->requested_graphic = _game->requested_graphic; - /* Quitter tweak -- set the quit jump buffer in the new _game to be the - * same as the current one, so that it remains unchanged by gs_copy(). The - * one in the new _game is still the unset one from gs_create(). - */ - memcpy(&new_game->quitter, &_game->quitter, sizeof(_game->quitter)); - /* If we got this far, we successfully restored the _game from the file. * As our final act, copy the new _game onto the old one. */ diff --git a/engines/glk/adrift/sxtester.cpp b/engines/glk/adrift/sxtester.cpp index ae28b3b48b..c0ea3368ae 100644 --- a/engines/glk/adrift/sxtester.cpp +++ b/engines/glk/adrift/sxtester.cpp @@ -32,7 +32,7 @@ namespace Adrift { * Run the game using the given script. Returns the count of errors from * the script's monitoring. */ -static sc_int test_run_game_script(sc_game game, sx_script script) { +static sc_int test_run_game_script(CONTEXT, sc_game game, sx_script script) { sc_int errors; /* Ensure completely repeatable random number sequences. */ @@ -40,7 +40,7 @@ static sc_int test_run_game_script(sc_game game, sx_script script) { /* Start interpreting the script stream. */ scr_start_script(game, script); - sc_interpret_game(game); + R0CALL1(sc_interpret_game, game); /* Wrap up the script interpreter and capture error count. */ errors = scr_finalize_script(); @@ -57,6 +57,7 @@ static sc_int test_run_game_script(sc_game game, sx_script script) { sc_int test_run_game_tests(const sx_test_descriptor_t tests[], sc_int count, sc_bool is_verbose) { const sx_test_descriptor_t *test; sc_int errors; + Context context; assert(tests); errors = 0; @@ -72,7 +73,7 @@ sc_int test_run_game_tests(const sx_test_descriptor_t tests[], sc_int count, sc_ sc_get_game_author(test->game)); } - test_errors = test_run_game_script(test->game, test->script); + test_errors = test_run_game_script(context, test->game, test->script); errors += test_errors; if (is_verbose) { |