diff options
Diffstat (limited to 'src/frontend/mame/ui/selmenu.cpp')
-rw-r--r-- | src/frontend/mame/ui/selmenu.cpp | 111 |
1 files changed, 69 insertions, 42 deletions
diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index 02deadc09e7..adb1496562a 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -13,6 +13,7 @@ #include "ui/selmenu.h" #include "ui/icorender.h" +#include "ui/info.h" #include "ui/inifile.h" // these hold static bitmap images @@ -123,6 +124,15 @@ template bool menu_select_launch::select_bios(game_driver const &, bool); template bool menu_select_launch::select_bios(ui_software_info const &, bool); +menu_select_launch::system_flags::system_flags(machine_static_info const &info) + : m_machine_flags(info.machine_flags()) + , m_unemulated_features(info.unemulated_features()) + , m_imperfect_features(info.imperfect_features()) + , m_warnings_color(info.warnings_color()) +{ +} + + void menu_select_launch::reselect_last::reset() { s_driver.clear(); @@ -450,10 +460,11 @@ menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container &c , m_info_buffer() , m_cache() , m_is_swlist(is_swlist) - , m_focus(focused_menu::main) + , m_focus(focused_menu::MAIN) , m_pressed(false) , m_repeat(0) , m_right_visible_lines(0) + , m_flags(256) , m_icons(MAX_ICONS_RENDER) { // set up persistent cache for machine run @@ -496,6 +507,24 @@ void menu_select_launch::set_error(reset_options ropt, std::string &&message) //------------------------------------------------- +// get overall emulation status for a system +//------------------------------------------------- + +menu_select_launch::system_flags const &menu_select_launch::get_system_flags(game_driver const &driver) +{ + // try the cache + flags_cache::const_iterator const found(m_flags.find(&driver)); + if (m_flags.end() != found) + return found->second; + + // aggregate flags + emu_options clean_options; + machine_config const mconfig(driver, clean_options); + return m_flags.emplace(&driver, machine_static_info(mconfig)).first->second; +} + + +//------------------------------------------------- // actually start an emulation session //------------------------------------------------- @@ -645,35 +674,33 @@ void menu_select_launch::custom_render(void *selectedref, float top, float botto tempbuf[2] = _("Driver is parent"); // next line is overall driver status - if (driver->flags & machine_flags::NOT_WORKING) + system_flags const &flags(get_system_flags(*driver)); + if (flags.machine_flags() & machine_flags::NOT_WORKING) tempbuf[3] = _("Overall: NOT WORKING"); - else if ((driver->type.unemulated_features() | driver->type.imperfect_features()) & device_t::feature::PROTECTION) + else if ((flags.unemulated_features() | flags.imperfect_features()) & device_t::feature::PROTECTION) tempbuf[3] = _("Overall: Unemulated Protection"); else tempbuf[3] = _("Overall: Working"); // next line is graphics, sound status - if (driver->type.unemulated_features() & device_t::feature::GRAPHICS) + if (flags.unemulated_features() & device_t::feature::GRAPHICS) tempbuf[4] = _("Graphics: Unimplemented, "); - else if ((driver->type.unemulated_features() | driver->type.imperfect_features()) & (device_t::feature::GRAPHICS | device_t::feature::PALETTE)) + else if ((flags.unemulated_features() | flags.imperfect_features()) & (device_t::feature::GRAPHICS | device_t::feature::PALETTE)) tempbuf[4] = _("Graphics: Imperfect, "); else tempbuf[4] = _("Graphics: OK, "); if (driver->flags & machine_flags::NO_SOUND_HW) tempbuf[4].append(_("Sound: None")); - else if (driver->type.unemulated_features() & device_t::feature::SOUND) + else if (flags.unemulated_features() & device_t::feature::SOUND) tempbuf[4].append(_("Sound: Unimplemented")); - else if (driver->type.imperfect_features() & device_t::feature::SOUND) + else if (flags.imperfect_features() & device_t::feature::SOUND) tempbuf[4].append(_("Sound: Imperfect")); else tempbuf[4].append(_("Sound: OK")); - if ((driver->flags & machine_flags::NOT_WORKING) || ((driver->type.unemulated_features() | driver->type.imperfect_features()) & device_t::feature::PROTECTION)) - color = UI_RED_COLOR; - else if (driver->type.unemulated_features() || driver->type.imperfect_features()) - color = UI_YELLOW_COLOR; - else + color = flags.warnings_color(); + if (UI_BACKGROUND_COLOR == color) color = UI_GREEN_COLOR; } else @@ -747,7 +774,7 @@ void menu_select_launch::inkey_navigation() { switch (get_focus()) { - case focused_menu::main: + case focused_menu::MAIN: if (selected <= visible_items) { m_prev_selected = get_selection_ref(); @@ -756,7 +783,7 @@ void menu_select_launch::inkey_navigation() else { if (ui_globals::panels_status != HIDE_LEFT_PANEL) - set_focus(focused_menu::left); + set_focus(focused_menu::LEFT); else if (ui_globals::panels_status == HIDE_BOTH) { @@ -766,29 +793,29 @@ void menu_select_launch::inkey_navigation() } else { - set_focus(focused_menu::righttop); + set_focus(focused_menu::RIGHTTOP); } } break; - case focused_menu::left: + case focused_menu::LEFT: if (ui_globals::panels_status != HIDE_RIGHT_PANEL) { - set_focus(focused_menu::righttop); + set_focus(focused_menu::RIGHTTOP); } else { - set_focus(focused_menu::main); + set_focus(focused_menu::MAIN); select_prev(); } break; - case focused_menu::righttop: - set_focus(focused_menu::rightbottom); + case focused_menu::RIGHTTOP: + set_focus(focused_menu::RIGHTBOTTOM); break; - case focused_menu::rightbottom: - set_focus(focused_menu::main); + case focused_menu::RIGHTBOTTOM: + set_focus(focused_menu::MAIN); select_prev(); break; } @@ -1165,7 +1192,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) // if we hit select, return true or pop the stack, depending on the item if (exclusive_input_pressed(iptkey, IPT_UI_SELECT, 0)) { - if (is_last_selected() && m_focus == focused_menu::main) + if (is_last_selected() && m_focus == focused_menu::MAIN) { iptkey = IPT_UI_CANCEL; stack_pop(); @@ -1194,7 +1221,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) if (!ignoreleft && exclusive_input_pressed(iptkey, IPT_UI_LEFT, (flags & PROCESS_LR_REPEAT) ? 6 : 0)) { // Swap the right panel - if (m_focus == focused_menu::righttop) + if (m_focus == focused_menu::RIGHTTOP) iptkey = IPT_UI_LEFT_PANEL; return; } @@ -1202,7 +1229,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) if (!ignoreright && exclusive_input_pressed(iptkey, IPT_UI_RIGHT, (flags & PROCESS_LR_REPEAT) ? 6 : 0)) { // Swap the right panel - if (m_focus == focused_menu::righttop) + if (m_focus == focused_menu::RIGHTTOP) iptkey = IPT_UI_RIGHT_PANEL; return; } @@ -1211,14 +1238,14 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) if (exclusive_input_pressed(iptkey, IPT_UI_UP, 6)) { // Filter - if (!leftclose && m_focus == focused_menu::left) + if (!leftclose && m_focus == focused_menu::LEFT) { iptkey = IPT_UI_UP_FILTER; return; } // Infos - if (!rightclose && m_focus == focused_menu::rightbottom) + if (!rightclose && m_focus == focused_menu::RIGHTBOTTOM) { iptkey = IPT_UI_UP_PANEL; m_topline_datsview--; @@ -1238,14 +1265,14 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) if (exclusive_input_pressed(iptkey, IPT_UI_DOWN, 6)) { // Filter - if (!leftclose && m_focus == focused_menu::left) + if (!leftclose && m_focus == focused_menu::LEFT) { iptkey = IPT_UI_DOWN_FILTER; return; } // Infos - if (!rightclose && m_focus == focused_menu::rightbottom) + if (!rightclose && m_focus == focused_menu::RIGHTBOTTOM) { iptkey = IPT_UI_DOWN_PANEL; m_topline_datsview++; @@ -1265,7 +1292,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) if (exclusive_input_pressed(iptkey, IPT_UI_PAGE_UP, 6)) { // Infos - if (!rightclose && m_focus == focused_menu::rightbottom) + if (!rightclose && m_focus == focused_menu::RIGHTBOTTOM) { iptkey = IPT_UI_DOWN_PANEL; m_topline_datsview -= m_right_visible_lines - 1; @@ -1287,7 +1314,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) if (exclusive_input_pressed(iptkey, IPT_UI_PAGE_DOWN, 6)) { // Infos - if (!rightclose && m_focus == focused_menu::rightbottom) + if (!rightclose && m_focus == focused_menu::RIGHTBOTTOM) { iptkey = IPT_UI_DOWN_PANEL; m_topline_datsview += m_right_visible_lines - 1; @@ -1309,7 +1336,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) if (exclusive_input_pressed(iptkey, IPT_UI_HOME, 0)) { // Infos - if (!rightclose && m_focus == focused_menu::rightbottom) + if (!rightclose && m_focus == focused_menu::RIGHTBOTTOM) { iptkey = IPT_UI_DOWN_PANEL; m_topline_datsview = 0; @@ -1327,7 +1354,7 @@ void menu_select_launch::handle_keys(uint32_t flags, int &iptkey) if (exclusive_input_pressed(iptkey, IPT_UI_END, 0)) { // Infos - if (!rightclose && m_focus == focused_menu::rightbottom) + if (!rightclose && m_focus == focused_menu::RIGHTBOTTOM) { iptkey = IPT_UI_DOWN_PANEL; m_topline_datsview = m_total_lines; @@ -1410,7 +1437,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev) if (hover >= visible_items - 1 && selected < visible_items) m_prev_selected = get_selection_ref(); selected = hover; - m_focus = focused_menu::main; + m_focus = focused_menu::MAIN; } else if (hover == HOVER_ARROW_UP) { @@ -1555,7 +1582,7 @@ void menu_select_launch::handle_events(uint32_t flags, event &ev) { selected = hover; m_prev_selected = get_selection_ref(); - m_focus = focused_menu::main; + m_focus = focused_menu::MAIN; ev.iptkey = IPT_CUSTOM; ev.mouse.x0 = local_menu_event.mouse_x; ev.mouse.y0 = local_menu_event.mouse_y; @@ -1643,7 +1670,7 @@ void menu_select_launch::draw(uint32_t flags) float effective_width = visible_width - 2.0f * gutter_width; float effective_left = visible_left + gutter_width; - if ((m_focus == focused_menu::main) && (selected < visible_items)) + if ((m_focus == focused_menu::MAIN) && (selected < visible_items)) m_prev_selected = nullptr; int const n_loop = (std::min)(m_visible_lines, visible_items); @@ -1666,7 +1693,7 @@ void menu_select_launch::draw(uint32_t flags) hover = itemnum; // if we're selected, draw with a different background - if (is_selected(itemnum) && m_focus == focused_menu::main) + if (is_selected(itemnum) && m_focus == focused_menu::MAIN) { fgcolor = rgb_t(0xff, 0xff, 0x00); bgcolor = rgb_t(0xff, 0xff, 0xff); @@ -1757,7 +1784,7 @@ void menu_select_launch::draw(uint32_t flags) hover = count; // if we're selected, draw with a different background - if (is_selected(count) && m_focus == focused_menu::main) + if (is_selected(count) && m_focus == focused_menu::MAIN) { fgcolor = rgb_t(0xff, 0xff, 0x00); bgcolor = rgb_t(0xff, 0xff, 0xff); @@ -1907,7 +1934,7 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo fgcolor = UI_CLONE_COLOR; } - if (m_focus == focused_menu::righttop && ui_globals::rpanel == cells) + if (m_focus == focused_menu::RIGHTTOP && ui_globals::rpanel == cells) { fgcolor = rgb_t(0xff, 0xff, 0x00); bgcolor = rgb_t(0xff, 0xff, 0xff); @@ -2116,8 +2143,8 @@ std::string menu_select_launch::arts_render_common(float origx1, float origy1, f title_size = (std::max)(text_length + 0.01f, title_size); } - rgb_t const fgcolor = (m_focus == focused_menu::rightbottom) ? rgb_t(0xff, 0xff, 0x00) : UI_TEXT_COLOR; - rgb_t const bgcolor = (m_focus == focused_menu::rightbottom) ? rgb_t(0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR; + rgb_t const fgcolor = (m_focus == focused_menu::RIGHTBOTTOM) ? rgb_t(0xff, 0xff, 0x00) : UI_TEXT_COLOR; + rgb_t const bgcolor = (m_focus == focused_menu::RIGHTBOTTOM) ? rgb_t(0xff, 0xff, 0xff) : UI_TEXT_BG_COLOR; float const middle = origx2 - origx1; // check size @@ -2421,7 +2448,7 @@ void menu_select_launch::infos_render(float origx1, float origy1, float origx2, rgb_t fgcolor = UI_TEXT_COLOR; rgb_t bgcolor = UI_TEXT_BG_COLOR; - if (get_focus() == focused_menu::rightbottom) + if (get_focus() == focused_menu::RIGHTBOTTOM) { fgcolor = rgb_t(0xff, 0xff, 0xff, 0x00); bgcolor = rgb_t(0xff, 0xff, 0xff, 0xff); |