diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2026-10-19 22:47:49 +0200 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2026-10-19 22:47:49 +0200 |
| commit | 312c3c345b5b72a69ba6ee1bf50697eed18c2775 (patch) | |
| tree | bcedd9da193c80c26c1cbb2a1fcf34ab931ef422 /src/game.c | |
| parent | 381e246e73f271be2821dd9208edd2aa09bfc583 (diff) | |
Started Implementing ASM Constants
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); } |
