From 38e846738d16095127b83035b60599e1fa9149c8 Mon Sep 17 00:00:00 2001 From: Dankan1890 Date: Mon, 15 May 2017 03:37:55 +0200 Subject: [PATCH] Starting from the Favorites menu now starts the software list submenu (if necessary). (#2308) * Starting a machine containing a list of the software from the Favorites menu, now determines the launch of the appropriate sub-menu with the list of software. --- src/frontend/mame/ui/inifile.cpp | 4 +++- src/frontend/mame/ui/inifile.h | 4 ++-- src/frontend/mame/ui/selgame.cpp | 14 ++++++++++++-- src/frontend/mame/ui/utils.h | 13 +++++-------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/frontend/mame/ui/inifile.cpp b/src/frontend/mame/ui/inifile.cpp index 839ecc2d39b..1dc51a7a793 100644 --- a/src/frontend/mame/ui/inifile.cpp +++ b/src/frontend/mame/ui/inifile.cpp @@ -159,7 +159,9 @@ favorite_manager::favorite_manager(running_machine &machine, ui_options &moption void favorite_manager::add_favorite_game(const game_driver *driver) { - m_list.emplace(driver->type.fullname(), ui_software_info{ driver->name, driver->type.fullname(), "", "", "", 0, "", driver, "", "", "", 1, "", "", "", true }); + m_list.emplace(driver->type.fullname(), + ui_software_info{driver->name, driver->type.fullname(), "", "", "", 0, "", driver, "", "", "", + 1, "", "", "", true}); save_favorite_games(); } diff --git a/src/frontend/mame/ui/inifile.h b/src/frontend/mame/ui/inifile.h index 0ac927f3094..0d203f3b170 100644 --- a/src/frontend/mame/ui/inifile.h +++ b/src/frontend/mame/ui/inifile.h @@ -44,8 +44,8 @@ public: // setters void move_file(int d) { c_file += d; c_cat = 0; } void move_cat(int d) { c_cat += d; } - void set_cat(int i) { c_cat = i; } - void set_file(int i) { c_file = i; } + void set_cat(uint16_t i) { c_cat = i; } + void set_file(uint16_t i) { c_file = i; } private: diff --git a/src/frontend/mame/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp index 08c8bd545d0..90dc3c1551b 100644 --- a/src/frontend/mame/ui/selgame.cpp +++ b/src/frontend/mame/ui/selgame.cpp @@ -872,6 +872,16 @@ void menu_select_game::inkey_select_favorite(const event *menu_event) if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) { + if ((ui_swinfo->driver->flags & MACHINE_TYPE_ARCADE) == 0) + { + for (software_list_device &swlistdev : software_list_device_iterator(enumerator.config()->root_device())) + if (!swlistdev.get_info().empty()) + { + menu::stack_push(ui(), container(), ui_swinfo->driver); + return; + } + } + // if everything looks good, schedule the new driver s_bios biosname; if (!mopt.skip_bios_menu() && has_multiple_bios(ui_swinfo->driver, biosname)) @@ -931,7 +941,7 @@ void menu_select_game::inkey_select_favorite(const event *menu_event) } std::string error_string; - std::string string_list = std::string(ui_swinfo->listname).append(":").append(ui_swinfo->shortname).append(":").append(ui_swinfo->part).append(":").append(ui_swinfo->instance); + std::string string_list = string_format("%s:%s:%s:%s", ui_swinfo->listname, ui_swinfo->shortname, ui_swinfo->part, ui_swinfo->instance); mopt.set_value(OPTION_SOFTWARENAME, string_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); std::string snap_list = std::string(ui_swinfo->listname).append(PATH_SEPARATOR).append(ui_swinfo->shortname); mopt.set_value(OPTION_SNAPNAME, snap_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); @@ -1407,7 +1417,7 @@ bool menu_select_game::load_available_machines() file.gets(rbuf, MAX_CHAR_INFO); file.gets(rbuf, MAX_CHAR_INFO); readbuf = chartrimcarriage(rbuf); - std::string a_rev = std::string(UI_VERSION_TAG).append(bare_build_version); + std::string a_rev = string_format("%s%s", UI_VERSION_TAG, bare_build_version); // version not matching ? exit if (a_rev != readbuf) diff --git a/src/frontend/mame/ui/utils.h b/src/frontend/mame/ui/utils.h index 29ce34abe87..2ea74d6aa4a 100644 --- a/src/frontend/mame/ui/utils.h +++ b/src/frontend/mame/ui/utils.h @@ -156,14 +156,11 @@ struct ui_software_info bool operator==(const ui_software_info& r) { - if (shortname == r.shortname && longname == r.longname && parentname == r.parentname - && year == r.year && publisher == r.publisher && supported == r.supported - && part == r.part && driver == r.driver && listname == r.listname - && interface == r.interface && instance == r.instance && startempty == r.startempty - && parentlongname == r.parentlongname && usage == r.usage && devicetype == r.devicetype) - return true; - - return false; + return shortname == r.shortname && longname == r.longname && parentname == r.parentname + && year == r.year && publisher == r.publisher && supported == r.supported + && part == r.part && driver == r.driver && listname == r.listname + && interface == r.interface && instance == r.instance && startempty == r.startempty + && parentlongname == r.parentlongname && usage == r.usage && devicetype == r.devicetype; } };