diff options
Diffstat (limited to 'src/game.c')
| -rw-r--r-- | src/game.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -143,6 +143,11 @@ bool pw_game_iterate(struct pw_game *game) { } if (wasm_rt_trapped(&handler)) { + // In case we trapped for an `_exit` call, treat it as a shutdown + // request instead of a trap. + if (game->env->data.state.shutdown) { + goto shutdown; + } return SDL_SetError("PICO-8 iteration execution trapped: %s", wasm_rt_trap_str(handler.code)); } @@ -152,7 +157,15 @@ bool pw_game_iterate(struct pw_game *game) { wasm_rt_trap_unregister(); + if (game->env->data.state.shutdown) { + goto shutdown; + } + return true; + +shutdown: + // TODO(nlordell): cleanly transition back to cart selection menu. + return false; } bool pw_game_render(struct pw_game *game) { return pw_fb_render(game->fb); } |
