# HG changeset patch # User Michael Pavone # Date 1460433414 25200 # Node ID fec4a59ae5d738cb6d4edbb5f1a89a72a96647cf # Parent 938c72a2f7a94c560f7c2c462a7373bba392c0da# Parent f87522554d7b562fdb4a78ecef93a67a543f05ea Merge diff -r f87522554d7b -r fec4a59ae5d7 blastem.c --- a/blastem.c Sun Apr 10 22:22:36 2016 -0700 +++ b/blastem.c Mon Apr 11 20:56:54 2016 -0700 @@ -1178,6 +1178,9 @@ 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) { @@ -1230,8 +1233,7 @@ 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; diff -r f87522554d7b -r fec4a59ae5d7 blastem.h --- a/blastem.h Sun Apr 10 22:22:36 2016 -0700 +++ b/blastem.h Mon Apr 11 20:56:54 2016 -0700 @@ -43,6 +43,7 @@ uint8_t save_type; io_port ports[3]; uint8_t bus_busy; + uint8_t should_exit; eeprom_state eeprom; } genesis_context; diff -r f87522554d7b -r fec4a59ae5d7 menu.c --- a/menu.c Sun Apr 10 22:22:36 2016 -0700 +++ b/menu.c Mon Apr 11 20:56:54 2016 -0700 @@ -190,6 +190,11 @@ 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); diff -r f87522554d7b -r fec4a59ae5d7 menu.s68 --- a/menu.s68 Sun Apr 10 22:22:36 2016 -0700 +++ b/menu.s68 Mon Apr 11 20:56:54 2016 -0700 @@ -348,7 +348,9 @@ ;regular file lea menu_port+8, a3 move.l a2, (a3) - rts + + addq #6, a7 + bra show_pause_menu .select_menu_button: movea.l menu_functions.w, a2 move.l (0, a2, d0.w), a2 @@ -781,6 +783,17 @@ bsr draw_menu bra gamepad_setup +show_pause_menu: + bsr clear_screen + ;init vertical scroll RAM + vdpaccess $0, VDP_VSRAM_WRITE + move.w #-4, (a0) + move.w #0, (a0) + moveq #8, d6 + move.l #pause_menu_func, menu_functions.w + lea pause_menu(pc), a5 + bsr draw_menu + bra gamepad_setup menu_start: ;init vertical scroll RAM @@ -913,9 +926,21 @@ bra .wait exit: - ;TODO: implement me + move.w #1, menu_port+12 bra exit +resume: + ;TODO: Implement me + bra resume + +save_state: + ;TODO: Implement me + bra save_state + +load_state: + ;TODO: Implement me + bra save_state + about_text: dc.b "BlastEm v0.4.0", 0 dc.b "Copyright 2011-2016 Michael Pavone", 0 @@ -1071,5 +1096,13 @@ dc.b "Load State", 0 dc.b "Exit", 0 dc.b 0 + + align 1 +pause_menu_func + dc.l resume + dc.l menu_start + dc.l save_state + dc.l load_state + dc.l exit rom_end: