diff options
author | Michael Pavone <pavone@retrodev.com> | 2016-03-19 17:53:50 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2016-03-19 17:53:50 -0700 |
commit | bbcb174acd1e9935c06b8d19acbf2fba8f46845f (patch) | |
tree | 886613ff29be47475e3e04b37dedb95335ced7f2 | |
parent | ec7d2e3aa5a16c4d77cb7644ceba48c48fecdb9f (diff) |
Make Exit option in menu work
-rw-r--r-- | blastem.c | 6 | ||||
-rw-r--r-- | blastem.h | 1 | ||||
-rw-r--r-- | menu.c | 5 | ||||
-rw-r--r-- | menu.s68 | 2 |
4 files changed, 11 insertions, 3 deletions
@@ -1170,6 +1170,9 @@ int main(int argc, char ** argv) start_genesis(genesis, menu ? NULL : statefile, menu == debug_target ? debuggerfun : NULL); for(;;) { + if (genesis->should_exit) { + break; + } if (menu && menu_context->next_rom) { if (game_context) { if (game_context->save_type != SAVE_NONE) { @@ -1222,8 +1225,7 @@ int main(int argc, char ** argv) genesis->m68k->options->address_log = address_log; map_all_bindings(genesis->ports); start_genesis(genesis, statefile, menu == debug_target ? debuggerfun : NULL); - } - else if (menu && game_context) { + } else if (menu && game_context) { genesis->arena = set_current_arena(game_context->arena); genesis = game_context; cart = genesis->cart; @@ -43,6 +43,7 @@ typedef struct { uint8_t save_type; io_port ports[3]; uint8_t bus_busy; + uint8_t should_exit; eeprom_state eeprom; } genesis_context; @@ -190,6 +190,11 @@ void * menu_write_w(uint32_t address, void * context, uint16_t value) gen->next_rom = alloc_concat_m(3, pieces); m68k->should_return = 1; break; + case 3: { + m68k->should_return = 1; + gen->should_exit = 1; + break; + } } default: fprintf(stderr, "WARNING: write to undefined menu port %X\n", address); @@ -913,7 +913,7 @@ show_about: bra .wait exit: - ;TODO: implement me + move.w #1, menu_port+12 bra exit about_text: |