diff options
author | 2016-03-12 12:31:13 +0100 | |
---|---|---|
committer | 2016-03-12 12:31:13 +0100 | |
commit | a026a582f1a0ea8c1ede3acaddacef506ef3f3b0 (patch) | |
tree | e31573822f2359677de519f9f3b600d98e8764cd /src/emu/ui | |
parent | 477d2abd43984f076b7e45f5527591fa8fd0d241 (diff) | |
parent | dcab55bf53b94713a6f72e9633f5101c8dd6c08c (diff) |
Merge pull request #15 from mamedev/master
Sync to base master
Diffstat (limited to 'src/emu/ui')
-rw-r--r-- | src/emu/ui/custui.cpp | 10 | ||||
-rw-r--r-- | src/emu/ui/datfile.h | 5 | ||||
-rw-r--r-- | src/emu/ui/datmenu.cpp | 14 | ||||
-rw-r--r-- | src/emu/ui/dirmenu.cpp | 12 | ||||
-rw-r--r-- | src/emu/ui/filesel.cpp | 4 | ||||
-rw-r--r-- | src/emu/ui/mainmenu.cpp | 2 | ||||
-rw-r--r-- | src/emu/ui/menu.cpp | 25 | ||||
-rw-r--r-- | src/emu/ui/menu.h | 9 | ||||
-rw-r--r-- | src/emu/ui/miscmenu.cpp | 8 | ||||
-rw-r--r-- | src/emu/ui/optsmenu.cpp | 16 | ||||
-rw-r--r-- | src/emu/ui/selector.cpp | 2 | ||||
-rw-r--r-- | src/emu/ui/selgame.cpp | 88 | ||||
-rw-r--r-- | src/emu/ui/selsoft.cpp | 18 | ||||
-rw-r--r-- | src/emu/ui/ui.cpp | 4 |
14 files changed, 145 insertions, 72 deletions
diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index 6aaed9105df..a6279ac5b54 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -588,7 +588,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom // bottom text // get the text for 'UI Select' std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); - topbuf.assign(_("Double click or press ")).append(ui_select_text.c_str()).append(_(" to change the color value")); + topbuf = string_format(_("Double click or press %1$s to change the color value"), ui_select_text); mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); @@ -857,7 +857,7 @@ void ui_menu_rgb_ui::populate() if (m_lock_ref != RGB_ALPHA) { arrow_flags = get_arrow_flags(0, 255, m_color->a()); - item_append(_("Alpha"), string_format("%3d", m_color->a()).c_str(), arrow_flags, (void *)(FPTR)RGB_ALPHA); + item_append(_("Alpha"), string_format("%3u", m_color->a()).c_str(), arrow_flags, (void *)(FPTR)RGB_ALPHA); } else item_append(_("Alpha"), s_text.c_str(), 0, (void *)(FPTR)RGB_ALPHA); @@ -865,7 +865,7 @@ void ui_menu_rgb_ui::populate() if (m_lock_ref != RGB_RED) { arrow_flags = get_arrow_flags(0, 255, m_color->r()); - item_append(_("Red"), string_format("%3d", m_color->r()).c_str(), arrow_flags, (void *)(FPTR)RGB_RED); + item_append(_("Red"), string_format("%3u", m_color->r()).c_str(), arrow_flags, (void *)(FPTR)RGB_RED); } else item_append(_("Red"), s_text.c_str(), 0, (void *)(FPTR)RGB_RED); @@ -873,7 +873,7 @@ void ui_menu_rgb_ui::populate() if (m_lock_ref != RGB_GREEN) { arrow_flags = get_arrow_flags(0, 255, m_color->g()); - item_append(_("Green"), string_format("%3d", m_color->g()).c_str(), arrow_flags, (void *)(FPTR)RGB_GREEN); + item_append(_("Green"), string_format("%3u", m_color->g()).c_str(), arrow_flags, (void *)(FPTR)RGB_GREEN); } else item_append(_("Green"), s_text.c_str(), 0, (void *)(FPTR)RGB_GREEN); @@ -881,7 +881,7 @@ void ui_menu_rgb_ui::populate() if (m_lock_ref != RGB_BLUE) { arrow_flags = get_arrow_flags(0, 255, m_color->b()); - item_append(_("Blue"), string_format("%3d", m_color->b()).c_str(), arrow_flags, (void *)(FPTR)RGB_BLUE); + item_append(_("Blue"), string_format("%3u", m_color->b()).c_str(), arrow_flags, (void *)(FPTR)RGB_BLUE); } else item_append(_("Blue"), s_text.c_str(), 0, (void *)(FPTR)RGB_BLUE); diff --git a/src/emu/ui/datfile.h b/src/emu/ui/datfile.h index 66d76d17501..7b38599ba21 100644 --- a/src/emu/ui/datfile.h +++ b/src/emu/ui/datfile.h @@ -31,7 +31,6 @@ public: void load_software_info(std::string &softlist, std::string &buffer, std::string &softname, std::string &parentname); void command_sub_menu(const game_driver *drv, std::vector<std::string> &menuitems); void reset_run() { first_run = true; } - bool has_software(std::string &softlist, std::string &softname, std::string &parentname); std::string rev_history() const { return m_history_rev; } std::string rev_mameinfo() const { return m_mame_rev; } @@ -45,9 +44,11 @@ public: bool has_command(const game_driver *driver) { return (m_cmdidx.find(driver) != m_cmdidx.end()); } bool has_sysinfo(const game_driver *driver) { return (m_sysidx.find(driver) != m_sysidx.end()); } bool has_story(const game_driver *driver) { return (m_storyidx.find(driver) != m_storyidx.end()); } + bool has_software(std::string &softlist, std::string &softname, std::string &parentname); - bool has_data(const game_driver *d) + bool has_data(const game_driver *a = nullptr) { + const game_driver *d = (a != nullptr) ? a : &machine().system(); return (has_history(d) || has_mameinfo(d) || has_messinfo(d) || has_command(d) || has_sysinfo(d) || has_story(d)); } private: diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp index 6c240311c62..93c776f3e51 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/emu/ui/datmenu.cpp @@ -99,10 +99,7 @@ void ui_menu_dats_view::handle() void ui_menu_dats_view::populate() { machine().pause(); - if (!issoft) - get_data(); - else - get_data_sw(); + (issoft == true) ? get_data_sw() : get_data(); item_append(MENU_SEPARATOR_ITEM, nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), nullptr); customtop = 2.0f * machine().ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER; @@ -119,12 +116,7 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom ui_manager &mui = machine().ui(); float maxwidth = origx2 - origx1; float width; - std::string driver; - - if (issoft) - driver = m_swinfo->longname; - else - driver = m_driver->description; + std::string driver = (issoft == true) ? m_swinfo->longname : m_driver->description; mui.draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); @@ -251,7 +243,6 @@ void ui_menu_dats_view::get_data() { std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x])); item_append(tempbuf.c_str(), nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_DISABLE), (void *)(FPTR)(x + 1)); - } } @@ -276,7 +267,6 @@ void ui_menu_dats_view::get_data_sw() { std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x])); item_append(tempbuf.c_str(), nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_DISABLE), (void *)(FPTR)(x + 1)); - } } diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp index a24a0041653..8ae0372af30 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/emu/ui/dirmenu.cpp @@ -180,7 +180,7 @@ void ui_menu_display_actual::handle() void ui_menu_display_actual::populate() { - m_tempbuf.assign(_("Current ")).append(_(s_folders[m_ref].name)).append(_(" Folders")); + m_tempbuf = string_format(_("Current %1$s Folders"), _(s_folders[m_ref].name)); if (machine().ui().options().exists(s_folders[m_ref].option)) m_searchpath.assign(machine().ui().options().value(s_folders[m_ref].option)); else @@ -494,8 +494,12 @@ void ui_menu_add_change_folder::custom_render(void *selectedref, float top, floa float width, maxwidth = origx2 - origx1; ui_manager &mui = machine().ui(); std::string tempbuf[2]; - tempbuf[0] = (m_change) ? _("Change)") : _("Add"); - tempbuf[0].append(" ").append(_(s_folders[m_ref].name)).append(_(" Folder - Search: ")).append(m_search).append("_"); + tempbuf[0] = string_format( + (m_change) + ? _("Change %1$s Folder - Search: %2$s_") + : _("Add %1$s Folder - Search: %2$s_"), + _(s_folders[m_ref].name), + m_search); tempbuf[1] = m_current_path; // get the size of the text @@ -636,7 +640,7 @@ void ui_menu_remove_folder::custom_render(void *selectedref, float top, float bo { float width; ui_manager &mui = machine().ui(); - std::string tempbuf = std::string(_("Remove ")).append(_(s_folders[m_ref].name)).append(_(" Folder")); + std::string tempbuf = string_format(_("Remove %1$s Folder"), _(s_folders[m_ref].name)); // get the size of the text mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); diff --git a/src/emu/ui/filesel.cpp b/src/emu/ui/filesel.cpp index 18555c4809b..ec8d4c2ea22 100644 --- a/src/emu/ui/filesel.cpp +++ b/src/emu/ui/filesel.cpp @@ -712,7 +712,7 @@ void ui_menu_file_selector::handle() // from current entry to the end for (entry = cur_selected; entry != nullptr; entry = entry->next) { - if (entry->basename != nullptr && m_filename_buffer != nullptr) + if (entry->basename != nullptr && m_filename_buffer[0] != '\0') { int match = 0; for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++) @@ -731,7 +731,7 @@ void ui_menu_file_selector::handle() // and from the first entry to current one for (entry = m_entrylist; entry != cur_selected; entry = entry->next) { - if (entry->basename != nullptr && m_filename_buffer != nullptr) + if (entry->basename != nullptr && m_filename_buffer[0] != '\0') { int match = 0; for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++) diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp index 66381a3df1f..0cf449e8f84 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/emu/ui/mainmenu.cpp @@ -132,7 +132,7 @@ void ui_menu_main::populate() item_append(_("Cheat"), nullptr, 0, (void *)CHEAT); // add dats menu - if (machine().ui().options().enabled_dats() && machine().datfile().has_data(&machine().system())) + if (machine().ui().options().enabled_dats() && machine().datfile().has_data()) item_append(_("External DAT View"), nullptr, 0, (void *)EXTERNAL_DATS); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index f6154c41638..ccc73f55002 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -544,7 +544,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput) machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); // determine the first visible line based on the current selection - if (selected > top_line + visible_lines) + if (selected > top_line + visible_lines || selected < top_line - visible_lines) top_line = selected - (visible_lines / 2); if (top_line < 0 || selected == 0) top_line = 0; @@ -1891,6 +1891,21 @@ void ui_menu::handle_main_events(UINT32 flags) bool stop = false; ui_event local_menu_event; + if (m_pressed) + { + bool pressed = mouse_pressed(); + INT32 m_target_x, m_target_y; + bool m_button; + render_target *mouse_target = machine().ui_input().find_mouse(&m_target_x, &m_target_y, &m_button); + if (mouse_target != nullptr && m_button && (hover == HOVER_ARROW_DOWN || hover == HOVER_ARROW_UP)) + { + if (pressed) + machine().ui_input().push_mouse_down_event(mouse_target, m_target_x, m_target_y); + } + else + reset_pressed(); + } + // loop while we have interesting events while (!stop && machine().ui_input().pop_event(&local_menu_event)) { @@ -1919,6 +1934,7 @@ void ui_menu::handle_main_events(UINT32 flags) if (selected < 0) selected = 0; top_line -= visitems - (top_line + visible_lines == visible_items); + set_pressed(); } else if (hover == HOVER_ARROW_DOWN) { @@ -1926,6 +1942,7 @@ void ui_menu::handle_main_events(UINT32 flags) if (selected >= visible_items) selected = visible_items - 1; top_line += visible_lines - 2; + set_pressed(); } else if (hover == HOVER_UI_RIGHT) menu_event.iptkey = IPT_UI_RIGHT; @@ -2820,3 +2837,9 @@ void ui_menu::draw_dats_menu() // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != visible_items); } + +void ui_menu::set_pressed() +{ + (m_repeat == 0) ? m_repeat = osd_ticks() + osd_ticks_per_second() / 2 : m_repeat = osd_ticks() + osd_ticks_per_second() / 4; + m_pressed = true; +}
\ No newline at end of file diff --git a/src/emu/ui/menu.h b/src/emu/ui/menu.h index 562650d0e51..4a788c612c7 100644 --- a/src/emu/ui/menu.h +++ b/src/emu/ui/menu.h @@ -266,8 +266,15 @@ protected: static std::unique_ptr<bitmap_rgb32> hilight_main_bitmap; static render_texture *hilight_main_texture; private: + + // mouse button held down + bool m_pressed = false; + osd_ticks_t m_repeat = 0; + void reset_pressed() { m_pressed = false; m_repeat = 0; } + bool mouse_pressed() { return (osd_ticks() >= m_repeat); } + void set_pressed(); + static std::unique_ptr<bitmap_argb32> no_avail_bitmap, bgrnd_bitmap, star_bitmap; -// static std::unique_ptr<bitmap_rgb32> hilight_main_bitmap; static render_texture *bgrnd_texture, *star_texture; static bitmap_argb32 *icons_bitmap[]; static render_texture *icons_texture[]; diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp index 89bf4182ffd..2145069bfab 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/emu/ui/miscmenu.cpp @@ -574,7 +574,10 @@ ui_menu_misc_options::misc_option ui_menu_misc_options::m_options[] = { ui_menu_misc_options::ui_menu_misc_options(running_machine &machine, render_container *container) : ui_menu(machine, container) { for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) - m_options[d].status = machine.ui().options().bool_value(m_options[d].option); + if (machine.ui().options().exists(m_options[d].option)) + m_options[d].status = machine.ui().options().bool_value(m_options[d].option); + else + m_options[d].status = machine.options().bool_value(m_options[d].option); } ui_menu_misc_options::~ui_menu_misc_options() @@ -585,7 +588,8 @@ ui_menu_misc_options::~ui_menu_misc_options() { machine().ui().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); } - else { + else + { if (machine().options().bool_value(m_options[d].option) != m_options[d].status) { machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string); diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp index b643fcef883..f93bdbf4652 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/emu/ui/optsmenu.cpp @@ -217,7 +217,7 @@ void ui_menu_game_options::populate() item_append(_("Filter"), main_filters::text[m_main], arrow_flags, (void *)(FPTR)FILTER_MENU); // add category subitem - if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) + if (m_main == FILTER_CATEGORY && !machine().inifile().ini_index.empty()) { inifile_manager &inif = machine().inifile(); int afile = inif.current_file; @@ -233,7 +233,7 @@ void ui_menu_game_options::populate() item_append(fbuff.c_str(), inif.actual_category().c_str(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER); } // add manufacturer subitem - else if (main_filters::actual == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0) + else if (m_main == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0) { arrow_flags = get_arrow_flags(0, c_mnfct::ui.size() - 1, c_mnfct::actual); fbuff = _("^!Manufacturer"); @@ -241,7 +241,7 @@ void ui_menu_game_options::populate() item_append(fbuff.c_str(), c_mnfct::ui[c_mnfct::actual].c_str(), arrow_flags, (void *)(FPTR)MANUFACT_CAT_FILTER); } // add year subitem - else if (main_filters::actual == FILTER_YEAR && c_year::ui.size() > 0) + else if (m_main == FILTER_YEAR && c_year::ui.size() > 0) { arrow_flags = get_arrow_flags(0, c_year::ui.size() - 1, c_year::actual); fbuff.assign(_("^!Year")); @@ -249,7 +249,7 @@ void ui_menu_game_options::populate() item_append(fbuff.c_str(), c_year::ui[c_year::actual].c_str(), arrow_flags, (void *)(FPTR)YEAR_CAT_FILTER); } // add custom subitem - else if (main_filters::actual == FILTER_CUSTOM) + else if (m_main == FILTER_CUSTOM) { fbuff = _("^!Setup custom filter"); convert_command_glyph(fbuff); @@ -322,7 +322,7 @@ void save_ui_options(running_machine &machine) file.close(); } else - machine.popmessage(_("**Error to save ui.ini**")); + machine.popmessage(_("**Error saving ui.ini**")); } //------------------------------------------------- @@ -341,10 +341,10 @@ void save_main_option(running_machine &machine) emu_file file(machine.options().ini_path(), OPEN_FLAG_READ); if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE) { - bool result = options.parse_ini_file((core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); + bool result = options.parse_ini_file((util::core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); if (!result) { - osd_printf_error(_("**Error to load %s.ini**"), emulator_info::get_configname()); + osd_printf_error("**Error loading %s.ini**", emulator_info::get_configname()); return; } } @@ -369,7 +369,7 @@ void save_main_option(running_machine &machine) file.close(); } else { - machine.popmessage(_("**Error to save %s.ini**"), emulator_info::get_configname()); + machine.popmessage(_("**Error saving %s.ini**"), emulator_info::get_configname()); return; } } diff --git a/src/emu/ui/selector.cpp b/src/emu/ui/selector.cpp index ae786dd1834..330694fd497 100644 --- a/src/emu/ui/selector.cpp +++ b/src/emu/ui/selector.cpp @@ -178,7 +178,7 @@ void ui_menu_selector::custom_render(void *selectedref, float top, float bottom, // bottom text // get the text for 'UI Select' std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); - tempbuf.assign(_("Double click or press ")).append(ui_select_text).append(_(" to select")); + tempbuf = string_format(_("Double click or press %1$s to select"), ui_select_text); mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp index 34fdab6d64e..dcc9e1d2d68 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/emu/ui/selgame.cpp @@ -299,10 +299,31 @@ void ui_menu_select_game::handle() } // Infos - else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view > UI_FIRST_LOAD) + else if (ui_globals::rpanel == RP_INFOS) { - ui_globals::curdats_view--; - topline_datsview = 0; + if (!isfavorite()) + { + const game_driver *drv = (const game_driver *)m_event->itemref; + if ((FPTR)drv > skip_main_items && ui_globals::curdats_view > UI_FIRST_LOAD) + { + ui_globals::curdats_view--; + topline_datsview = 0; + } + } + else + { + ui_software_info *drv = (ui_software_info *)m_event->itemref; + if (drv->startempty == 1 && ui_globals::curdats_view > UI_FIRST_LOAD) + { + ui_globals::curdats_view--; + topline_datsview = 0; + } + else if ((FPTR)drv > skip_main_items && ui_globals::cur_sw_dats_view > 0) + { + ui_globals::cur_sw_dats_view--; + topline_datsview = 0; + } + } } } @@ -318,10 +339,31 @@ void ui_menu_select_game::handle() } // Infos - else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view < UI_LAST_LOAD) + else if (ui_globals::rpanel == RP_INFOS) { - ui_globals::curdats_view++; - topline_datsview = 0; + if (!isfavorite()) + { + const game_driver *drv = (const game_driver *)m_event->itemref; + if ((FPTR)drv > skip_main_items && ui_globals::curdats_view < UI_LAST_LOAD) + { + ui_globals::curdats_view++; + topline_datsview = 0; + } + } + else + { + ui_software_info *drv = (ui_software_info *)m_event->itemref; + if (drv->startempty == 1 && ui_globals::curdats_view < UI_LAST_LOAD) + { + ui_globals::curdats_view++; + topline_datsview = 0; + } + else if ((FPTR)drv > skip_main_items && ui_globals::cur_sw_dats_view < 1) + { + ui_globals::cur_sw_dats_view++; + topline_datsview = 0; + } + } } } @@ -358,18 +400,20 @@ void ui_menu_select_game::handle() if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 3 && machine().datfile().has_data(driver)) + if ((FPTR)driver > skip_main_items && machine().datfile().has_data(driver)) ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, driver)); } else { - ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 3 && machine().datfile().has_data(swinfo->driver)) + ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; + datfile_manager &mdat = machine().datfile(); + + if ((FPTR)ui_swinfo > skip_main_items) { - if (swinfo->startempty == 1) - ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, swinfo->driver)); - else - ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, swinfo)); + if (ui_swinfo->startempty == 1 && mdat.has_history(ui_swinfo->driver)) + ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo->driver)); + else if (mdat.has_software(ui_swinfo->listname, ui_swinfo->shortname, ui_swinfo->parentname) || !ui_swinfo->usage.empty()) + ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo)); } } } @@ -380,7 +424,7 @@ void ui_menu_select_game::handle() if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > 3) + if ((FPTR)driver > skip_main_items) { if (!machine().favorite().isgame_favorite(driver)) { @@ -398,7 +442,7 @@ void ui_menu_select_game::handle() else { ui_software_info *swinfo = (ui_software_info *)m_event->itemref; - if ((FPTR)swinfo > 3) + if ((FPTR)swinfo > skip_main_items) { machine().popmessage(_("%s\n removed from favorites list."), swinfo->longname.c_str()); machine().favorite().remove_favorite_game(*swinfo); @@ -534,24 +578,26 @@ void ui_menu_select_game::populate() } // iterate over entries - for (size_t curitem = 0; curitem < m_displaylist.size(); ++curitem) + int curitem = 0; + for (auto & elem : m_displaylist) { UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; - if (old_item_selected == -1 && m_displaylist[curitem]->name == reselect_last::driver) + if (old_item_selected == -1 && elem->name == reselect_last::driver) old_item_selected = curitem; - bool cloneof = strcmp(m_displaylist[curitem]->parent, "0"); + bool cloneof = strcmp(elem->parent, "0"); if (cloneof) { - int cx = driver_list::find(m_displaylist[curitem]->parent); + int cx = driver_list::find(elem->parent); if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0)) cloneof = false; } if (cloneof) flags_ui |= MENU_FLAG_INVERT; - item_append(m_displaylist[curitem]->description, nullptr, flags_ui, (void *)m_displaylist[curitem]); + item_append(elem->description, nullptr, flags_ui, (void *)elem); + curitem++; } } } @@ -1556,7 +1602,7 @@ void ui_menu_select_game::general_info(const game_driver *driver, std::string &b util::stream_format(str, _("Support Cocktail: %1$s\n"), ((driver->flags & MACHINE_NO_COCKTAIL) ? _("Yes") : _("No"))); util::stream_format(str, _("Driver is Bios: %1$s\n"), ((driver->flags & MACHINE_IS_BIOS_ROOT) ? _("Yes") : _("No"))); util::stream_format(str, _("Support Save: %1$s\n"), ((driver->flags & MACHINE_SUPPORTS_SAVE) ? _("Yes") : _("No"))); - util::stream_format(str, _("Screen Orentation: %1$s\n"), ((driver->flags & ORIENTATION_SWAP_XY) ? _("Vertical") : _("Horizontal"))); + util::stream_format(str, _("Screen Orientation: %1$s\n"), ((driver->flags & ORIENTATION_SWAP_XY) ? _("Vertical") : _("Horizontal"))); bool found = false; for (const rom_entry *rom = driver->rom; !ROMENTRY_ISEND(rom); ++rom) if (ROMENTRY_ISREGION(rom) && ROMREGION_ISDISKDATA(rom)) diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp index 2c8fa5135ea..3bf2e237553 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/emu/ui/selsoft.cpp @@ -242,14 +242,12 @@ void ui_menu_select_software::handle() else if (m_event->iptkey == IPT_UI_DATS && machine().ui().options().enabled_dats()) { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; + datfile_manager &mdat = machine().datfile(); - if ((FPTR)ui_swinfo > 1 && machine().datfile().has_data(ui_swinfo->driver)) - { - if (ui_swinfo->startempty == 1) - ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo->driver)); - else - ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo)); - } + if (ui_swinfo->startempty == 1 && mdat.has_history(ui_swinfo->driver)) + ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo->driver)); + else if (mdat.has_software(ui_swinfo->listname, ui_swinfo->shortname, ui_swinfo->parentname) || !ui_swinfo->usage.empty()) + ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo)); } // handle UI_LEFT_PANEL @@ -826,7 +824,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float size_t found = copyright.find("\n"); tempbuf[0].clear(); - tempbuf[1].assign(emulator_info::get_appname()).append(" ").append(build_version); + tempbuf[1] = string_format("%s %s", emulator_info::get_appname(), build_version); tempbuf[2] = copyright.substr(0, found); tempbuf[3] = copyright.substr(found + 1); tempbuf[4].clear(); @@ -2040,7 +2038,7 @@ void ui_bios_selection::handle() { // process the menu const ui_menu_event *event = process(0); - ui_options &moptions = machine().ui().options(); + emu_options &moptions = machine().options(); if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr) for (auto & elem : m_bios) if ((void*)&elem.name == event->itemref) @@ -2073,7 +2071,7 @@ void ui_bios_selection::handle() drivlist.next(); software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); - if (!moptions.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) + if (!machine().ui().options().skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) { std::unordered_map<std::string, std::string> parts; for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next()) diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index 4104ff88308..839e7c2d7a2 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -171,9 +171,9 @@ static void load_ui_options(running_machine &machine) emu_file file(machine.options().ini_path(), OPEN_FLAG_READ); if (file.open("ui.ini") == FILERR_NONE) { - bool result = machine.ui().options().parse_ini_file((core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); + bool result = machine.ui().options().parse_ini_file((util::core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); if (!result) - osd_printf_error("**Error to load ui.ini**"); + osd_printf_error("**Error loading ui.ini**"); } } |