diff options
Diffstat (limited to 'src/frontend/mame/ui/selsoft.cpp')
-rw-r--r-- | src/frontend/mame/ui/selsoft.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/frontend/mame/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp index cf3e2d9b77c..d29d768ce76 100644 --- a/src/frontend/mame/ui/selsoft.cpp +++ b/src/frontend/mame/ui/selsoft.cpp @@ -125,16 +125,14 @@ bool has_multiple_bios(const game_driver *driver, s_bios &biosname) // ctor //------------------------------------------------- -menu_select_software::menu_select_software(mame_ui_manager &mui, render_container *container, const game_driver *driver) - : menu(mui, container) +menu_select_software::menu_select_software(mame_ui_manager &mui, render_container *container, const game_driver *driver) : menu(mui, container) { if (reselect_last::get()) reselect_last::set(false); sw_filters::actual = 0; highlight = 0; - m_has_empty_start = false; - m_searchlist.fill(nullptr); + m_driver = driver; build_software_list(); load_sw_custom_filters(); @@ -471,17 +469,16 @@ void menu_select_software::populate() } // iterate over entries - int curitem = 0; - for (auto & e : m_displaylist) + for (size_t curitem = 0; curitem < m_displaylist.size(); ++curitem) { if (reselect_last::software == "[Start empty]" && !reselect_last::driver.empty()) old_software = 0; - else if (e->shortname == reselect_last::software && e->listname == reselect_last::swlist) + else if (m_displaylist[curitem]->shortname == reselect_last::software && m_displaylist[curitem]->listname == reselect_last::swlist) old_software = m_has_empty_start ? curitem + 1 : curitem; - item_append(e->longname, e->devicetype, e->parentname.empty() ? flags_ui : (FLAG_INVERT | flags_ui), (void *)e); - curitem++; + item_append(m_displaylist[curitem]->longname, m_displaylist[curitem]->devicetype, + m_displaylist[curitem]->parentname.empty() ? flags_ui : (FLAG_INVERT | flags_ui), (void *)m_displaylist[curitem]); } } @@ -489,7 +486,7 @@ void menu_select_software::populate() { find_matches(m_search, VISIBLE_GAMES_IN_SEARCH); - for (int curitem = 0; m_searchlist[curitem]; ++curitem) + for (int curitem = 0; m_searchlist[curitem] != nullptr; ++curitem) item_append(m_searchlist[curitem]->longname, m_searchlist[curitem]->devicetype, m_searchlist[curitem]->parentname.empty() ? flags_ui : (FLAG_INVERT | flags_ui), (void *)m_searchlist[curitem]); @@ -506,6 +503,7 @@ void menu_select_software::populate() selected = old_software; top_line = selected - (ui_globals::visible_sw_lines / 2); } + reselect_last::reset(); } @@ -587,7 +585,7 @@ void menu_select_software::build_software_list() if (!m_swinfo[y].parentname.empty()) { std::string lparent(m_swinfo[y].parentname); - auto found = false; + bool found = false; // first scan backward for (int x = y; x > 0; --x) @@ -661,13 +659,13 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot const game_driver *driver = nullptr; float width; std::string tempbuf[5], filtered; - auto color = UI_BACKGROUND_COLOR; - auto isstar = false; + rgb_t color = UI_BACKGROUND_COLOR; + bool isstar = false; float tbarspace = ui().get_line_height(); float text_size = 1.0f; // determine the text for the header - auto vis_item = (m_search[0] != 0) ? visible_items : (m_has_empty_start ? visible_items - 1 : visible_items); + int vis_item = (m_search[0] != 0) ? visible_items : (m_has_empty_start ? visible_items - 1 : visible_items); tempbuf[0] = string_format(_("%1$s %2$s ( %3$d / %4$d software packages )"), emulator_info::get_appname(), bare_build_version, vis_item, m_swinfo.size() - 1); tempbuf[1] = string_format(_("Driver: \"%1$s\" software list "), m_driver->description); @@ -883,8 +881,8 @@ void menu_select_software::custom_render(void *selectedref, float top, float bot void menu_select_software::inkey_select(const event *menu_event) { - auto ui_swinfo = (ui_software_info *)menu_event->itemref; - auto mopt = ui().options(); + ui_software_info *ui_swinfo = (ui_software_info *)menu_event->itemref; + ui_options &mopt = ui().options(); if (ui_swinfo->startempty == 1) { @@ -909,10 +907,10 @@ void menu_select_software::inkey_select(const event *menu_event) driver_enumerator drivlist(machine().options(), *ui_swinfo->driver); media_auditor auditor(drivlist); drivlist.next(); - auto swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); - auto swinfo = swlist->find(ui_swinfo->shortname.c_str()); + 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()); - auto summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); + media_auditor::summary summary = auditor.audit_software(swlist->list_name(), swinfo, AUDIT_VALIDATE_FAST); if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) { @@ -1069,7 +1067,7 @@ void menu_select_software::load_sw_custom_filters() // get number of filters file.gets(buffer, MAX_CHAR_INFO); - auto pb = strchr(buffer, '='); + char *pb = strchr(buffer, '='); sw_custfltr::numother = atoi(++pb) - 1; // get main filter @@ -1086,8 +1084,8 @@ void menu_select_software::load_sw_custom_filters() for (int x = 1; x <= sw_custfltr::numother; ++x) { file.gets(buffer, MAX_CHAR_INFO); - auto cb = strchr(buffer, '=') + 2; - for (int y = 0; y < sw_filters::length; ++y) + char *cb = strchr(buffer, '=') + 2; + for (int y = 0; y < sw_filters::length; y++) { if (!strncmp(cb, sw_filters::text[y], strlen(sw_filters::text[y]))) { @@ -1156,11 +1154,11 @@ std::string c_sw_region::getname(std::string &str) { std::string fullname(str); strmakelower(fullname); - auto found = fullname.find("("); + size_t found = fullname.find("("); if (found != std::string::npos) { - auto ends = fullname.find_first_not_of("abcdefghijklmnopqrstuvwxyz", found + 1); + size_t ends = fullname.find_first_not_of("abcdefghijklmnopqrstuvwxyz", found + 1); std::string temp(fullname.substr(found + 1, ends - found - 1)); for (auto & elem : region_lists) @@ -1200,7 +1198,7 @@ void c_sw_year::set(std::string &str) void c_sw_publisher::set(std::string &str) { - auto name = getname(str); + std::string name = getname(str); if (std::find(ui.begin(), ui.end(), name) != ui.end()) return; @@ -1209,7 +1207,7 @@ void c_sw_publisher::set(std::string &str) std::string c_sw_publisher::getname(std::string &str) { - auto found = str.find("("); + size_t found = str.find("("); if (found != std::string::npos) return (str.substr(0, found - 1)); @@ -1270,7 +1268,7 @@ void menu_select_software::build_list(std::vector<ui_software_info *> &s_drivers case UI_SW_REGION: { - auto name = m_filter.region.getname(s_driver->longname); + std::string name = m_filter.region.getname(s_driver->longname); if(!name.empty() && name == filter_text) m_displaylist.push_back(s_driver); @@ -1279,7 +1277,7 @@ void menu_select_software::build_list(std::vector<ui_software_info *> &s_drivers case UI_SW_PUBLISHERS: { - auto name = m_filter.publisher.getname(s_driver->publisher); + std::string name = m_filter.publisher.getname(s_driver->publisher); if(!name.empty() && name == filter_text) m_displaylist.push_back(s_driver); @@ -1400,8 +1398,8 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float float l_height = ui().get_line_height(); float line_height = l_height * text_size; float left_width = 0.0f; - auto text_lenght = sw_filters::length; - auto afilter = sw_filters::actual; + int text_lenght = sw_filters::length; + int afilter = sw_filters::actual; int phover = HOVER_SW_FILTER_FIRST; const char **text = sw_filters::text; float sc = y2 - y1 - (2.0f * UI_BOX_TB_BORDER); @@ -1413,11 +1411,13 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float line_height = l_height * text_size; } - auto text_sign = ui().get_string_width("_# ", text_size); + float text_sign = ui().get_string_width("_# ", text_size); for (int x = 0; x < text_lenght; ++x) { + float total_width; + // compute width of left hand side - auto total_width = ui().get_string_width(text[x], text_size); + total_width = ui().get_string_width(text[x], text_size); total_width += text_sign; // track the maximum @@ -1498,7 +1498,7 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float y2 = origy2; float space = x2 - x1; float lr_arrow_width = 0.4f * space * machine().render().ui_aspect(); - auto fgcolor = UI_TEXT_COLOR; + rgb_t fgcolor = UI_TEXT_COLOR; // set left-right arrows dimension float ar_x0 = 0.5f * (x2 + x1) - 0.5f * lr_arrow_width; @@ -1521,7 +1521,7 @@ float menu_select_software::draw_left_panel(float x1, float y1, float x2, float { float space = x2 - x1; float lr_arrow_width = 0.4f * space * machine().render().ui_aspect(); - auto fgcolor = UI_TEXT_COLOR; + rgb_t fgcolor = UI_TEXT_COLOR; // set left-right arrows dimension float ar_x0 = 0.5f * (x2 + x1) - 0.5f * lr_arrow_width; |