summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend/mame/ui/mainmenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/mame/ui/mainmenu.cpp')
-rw-r--r--src/frontend/mame/ui/mainmenu.cpp49
1 files changed, 34 insertions, 15 deletions
diff --git a/src/frontend/mame/ui/mainmenu.cpp b/src/frontend/mame/ui/mainmenu.cpp
index a50c346a1fe..132902b8f81 100644
--- a/src/frontend/mame/ui/mainmenu.cpp
+++ b/src/frontend/mame/ui/mainmenu.cpp
@@ -84,7 +84,7 @@ enum : unsigned {
***************************************************************************/
/*-------------------------------------------------
- menu_main constructor - populate the main menu
+ menu_main constructor/destructor
-------------------------------------------------*/
menu_main::menu_main(mame_ui_manager &mui, render_container &container) : menu(mui, container)
@@ -92,9 +92,30 @@ menu_main::menu_main(mame_ui_manager &mui, render_container &container) : menu(m
set_needs_prev_menu_item(false);
}
+menu_main::~menu_main()
+{
+}
+
+
+/*-------------------------------------------------
+ menu_activated - handle coming to foreground
+-------------------------------------------------*/
+
+void menu_main::menu_activated()
+{
+ if (machine().phase() != m_phase)
+ reset(reset_options::REMEMBER_REF);
+}
+
+
+/*-------------------------------------------------
+ populate - populate main menu items
+-------------------------------------------------*/
+
void menu_main::populate(float &customtop, float &custombottom)
{
- /* add main menu items */
+ m_phase = machine().phase();
+
item_append(_("Input (general)"), 0, (void *)INPUT_GROUPS);
item_append(_("Input (this Machine)"), 0, (void *)INPUT_SPECIFIC);
@@ -156,7 +177,7 @@ void menu_main::populate(float &customtop, float &custombottom)
if (machine().options().cheat())
item_append(_("Cheat"), 0, (void *)CHEAT);
- if (machine().phase() >= machine_phase::RESET)
+ if (machine_phase::RESET <= m_phase)
{
if (machine().options().plugins() && !mame_machine_manager::instance()->lua()->get_menu().empty())
item_append(_("Plugin Options"), 0, (void *)PLUGINS);
@@ -180,7 +201,7 @@ void menu_main::populate(float &customtop, float &custombottom)
// item_append(_("Quit from Machine"), 0, (void *)QUIT_GAME);
- if (machine().phase() == machine_phase::INIT)
+ if (machine_phase::INIT == m_phase)
{
item_append(_("Start Machine"), 0, (void *)DISMISS);
}
@@ -191,20 +212,18 @@ void menu_main::populate(float &customtop, float &custombottom)
}
}
-menu_main::~menu_main()
-{
-}
/*-------------------------------------------------
- menu_main - handle the main menu
+ handle - handle main menu events
-------------------------------------------------*/
-void menu_main::handle()
+void menu_main::handle(event const *ev)
{
- /* process the menu */
- const event *menu_event = process(0);
- if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT) {
- switch(uintptr_t(menu_event->itemref)) {
+ // process the menu
+ if (ev && (ev->iptkey == IPT_UI_SELECT))
+ {
+ switch (uintptr_t(ev->itemref))
+ {
case INPUT_GROUPS:
menu::stack_push<menu_input_groups>(ui(), container());
break;
@@ -314,12 +333,12 @@ void menu_main::handle()
case ADD_FAVORITE:
mame_machine_manager::instance()->favorite().add_favorite(machine());
- reset(reset_options::REMEMBER_POSITION);
+ reset(reset_options::REMEMBER_REF);
break;
case REMOVE_FAVORITE:
mame_machine_manager::instance()->favorite().remove_favorite(machine());
- reset(reset_options::REMEMBER_POSITION);
+ reset(reset_options::REMEMBER_REF);
break;
case QUIT_GAME: