Factored out quit/confirmquit logic into ui_manager::request_quit()

This commit is contained in:
Nathan Woods 2014-02-23 20:28:32 +00:00
parent 09ee48d11a
commit a2ff7cf249
2 changed files with 16 additions and 4 deletions

View File

@ -1525,10 +1525,8 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co
if (ui_input_pressed(machine, IPT_UI_CANCEL)) if (ui_input_pressed(machine, IPT_UI_CANCEL))
{ {
if (!machine.options().confirm_quit()) machine.ui().request_quit();
machine.schedule_exit(); return 0;
else
return machine.ui().set_handler(handler_confirm_quit, 0);
} }
// turn on menus if requested // turn on menus if requested
@ -1694,6 +1692,19 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container
} }
//-------------------------------------------------
// request_quit
//-------------------------------------------------
void ui_manager::request_quit()
{
if (!machine().options().confirm_quit())
machine().schedule_exit();
else
set_handler(handler_confirm_quit, 0);
}
//------------------------------------------------- //-------------------------------------------------
// handler_confirm_quit - leads the user through // handler_confirm_quit - leads the user through
// confirming quit emulation // confirming quit emulation

View File

@ -157,6 +157,7 @@ public:
void image_handler_ingame(); void image_handler_ingame();
void increase_frameskip(); void increase_frameskip();
void decrease_frameskip(); void decrease_frameskip();
void request_quit();
// print the game info string into a buffer // print the game info string into a buffer
astring &game_info_astring(astring &string); astring &game_info_astring(astring &string);