//using is_transparent = std::true_type; //bool operator()(ui_software_info const &lhs, ui_software_info const &rhs) const; //bool operator()(ui_software_info const &lhs, game_driver const &rhs) const; //bool operator()(game_driver const &lhs, ui_software_info const &rhs) const; public static bool op(game_driver lhs, ui_software_info rhs) { global_object.assert(rhs.driver != null); if (rhs.startempty == 0) { return(true); } else { return(0 > std.strncmp(lhs.name, rhs.driver.name, lhs.name.Length)); } }
//using is_transparent = std::true_type; //bool operator()(ui_software_info const &lhs, ui_software_info const &rhs) const; //bool operator()(ui_software_info const &lhs, game_driver const &rhs) const; //bool operator()(game_driver const &lhs, ui_software_info const &rhs) const; public static bool op(game_driver lhs, ui_software_info rhs) { assert(rhs.driver != null); if (rhs.startempty == 0) { return(true); } else { return(0 > std.strncmp(lhs.name, rhs.driver.name, std.size(lhs.name))); } }
// get selected software and/or driver //------------------------------------------------- // get selected software and/or driver //------------------------------------------------- protected override void get_selection(out ui_software_info software, out ui_system_info system) { if (m_populated_favorites) { software = (ui_software_info)get_selection_ptr(); system = software != null?m_persistent_data.systems()[driver_list.find(software.driver.name)] : null; } else { software = null; system = (ui_system_info)get_selection_ptr(); } }
//ui_system_info const *const m_system; //ui_software_info const *const m_swinfo; //bool const m_issoft; //int m_actual; //std::string m_list, m_short, m_long, m_parent; //std::vector<list_items> m_items_list; menu_dats_view(mame_ui_manager mui, render_container container, ui_software_info swinfo) : base(mui, container) { throw new emu_unimplemented(); }
public bool is_favorite_system_software(ui_software_info swinfo) { throw new emu_unimplemented(); }
// construction/destruction //------------------------------------------------- // ctor //------------------------------------------------- public favorite_manager(ui_options options) { m_options = options; m_favorites = new favorites_set(); m_sorted = new sorted_favorites(); m_need_sort = true; emu_file file = new emu_file(m_options.ui_path(), OPEN_FLAG_READ); if (file.open(FAVORITE_FILENAME) == osd_file.error.NONE) { string readbuf; file.gets(out readbuf, 1024); while (readbuf[0] == '[') { file.gets(out readbuf, 1024); } while (file.gets(out readbuf, 1024) != null) { ui_software_info tmpmatches = new ui_software_info(); tmpmatches.shortname = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.longname = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.parentname = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.year = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.publisher = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.supported = Convert.ToByte(readbuf); file.gets(out readbuf, 1024); tmpmatches.part = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); utils_global.chartrimcarriage(readbuf); var dx = driver_list.find(readbuf); if (0 > dx) { continue; } tmpmatches.driver = driver_list.driver(dx); file.gets(out readbuf, 1024); tmpmatches.listname = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.interface_ = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.instance = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.startempty = Convert.ToByte(readbuf); file.gets(out readbuf, 1024); tmpmatches.parentlongname = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.usage = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.devicetype = utils_global.chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.available = Convert.ToInt32(readbuf) != 0; m_favorites.emplace(tmpmatches); } file.close(); } }
// construction/destruction //------------------------------------------------- // ctor //------------------------------------------------- public favorite_manager(ui_options options) { m_options = options; m_favorites = new favorites_set(); m_sorted = new sorted_favorites(); m_need_sort = true; emu_file file = new emu_file(m_options.ui_path(), OPEN_FLAG_READ); if (!file.open(FAVORITE_FILENAME)) { string readbuf; //char readbuf[1024]; file.gets(out readbuf, 1024); while (readbuf[0] == '[') { file.gets(out readbuf, 1024); } while (file.gets(out readbuf, 1024) != null) { ui_software_info tmpmatches = new ui_software_info(); tmpmatches.shortname = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.longname = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.parentname = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.year = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.publisher = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.supported = (software_support)std.atoi(readbuf); file.gets(out readbuf, 1024); tmpmatches.part = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); chartrimcarriage(readbuf); var dx = driver_list.find(readbuf); if (0 > dx) { continue; } tmpmatches.driver = driver_list.driver((size_t)dx); file.gets(out readbuf, 1024); tmpmatches.listname = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.interface_ = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.instance = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.startempty = (uint8_t)std.atoi(readbuf); file.gets(out readbuf, 1024); tmpmatches.parentlongname = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); //tmpmatches.usage = chartrimcarriage(readbuf); TODO: recover multi-line info file.gets(out readbuf, 1024); tmpmatches.devicetype = chartrimcarriage(readbuf); file.gets(out readbuf, 1024); tmpmatches.available = std.atoi(readbuf) != 0; // need to populate this, it isn't displayed anywhere else tmpmatches.infotext = tmpmatches.infotext.append_(tmpmatches.longname); tmpmatches.infotext = tmpmatches.infotext.append_(1, '\n'); tmpmatches.infotext = tmpmatches.infotext.append_(__("swlist-info", "Software list/item")); tmpmatches.infotext = tmpmatches.infotext.append_(1, '\n'); tmpmatches.infotext = tmpmatches.infotext.append_(tmpmatches.listname); tmpmatches.infotext = tmpmatches.infotext.append_(1, ':'); tmpmatches.infotext = tmpmatches.infotext.append_(tmpmatches.shortname); m_favorites.emplace(tmpmatches); } file.close(); } }
protected override string make_software_description(ui_software_info software, ui_system_info system) { // first line is system return(string_format(__("System: {0}"), system.description)); //return string_format(_("System: %1$-.100s"), system->description); }
//------------------------------------------------- // handle select key event for favorites menu //------------------------------------------------- void inkey_select_favorite(event_ menu_event) { ui_software_info ui_swinfo = (ui_software_info)menu_event.itemref; int ui_swinfoint = (int)menu_event.itemref; if (ui_swinfoint == CONF_OPTS) { throw new emu_unimplemented(); #if false #endif } else if (ui_swinfoint == CONF_MACHINE) { // special case for configure machine if (m_prev_selected != null) { ui_software_info swinfo = (ui_software_info)m_prev_selected; throw new emu_unimplemented(); #if false #endif } return; } else if (ui_swinfo.startempty == 1) { driver_enumerator enumerator = new driver_enumerator(machine().options(), ui_swinfo.driver); enumerator.next(); // if there are software entries, show a software selection menu foreach (software_list_device swlistdev in new software_list_device_enumerator(enumerator.config().root_device())) { if (!swlistdev.get_info().empty()) { throw new emu_unimplemented(); #if false #endif } } // audit the system ROMs first to see if we're going to work media_auditor auditor = new media_auditor(enumerator); media_auditor.summary summary = auditor.audit_media(media_auditor.AUDIT_VALIDATE_FAST); if (audit_passed(summary)) { // if everything looks good, schedule the new driver if (!select_bios(ui_swinfo.driver, false)) { reselect_last.reselect(true); launch_system(ui_swinfo.driver); } } else { // otherwise, display an error set_error(reset_options.REMEMBER_REF, make_system_audit_fail_text(auditor, summary)); } } else { // first audit the system ROMs driver_enumerator drv = new driver_enumerator(machine().options(), ui_swinfo.driver); media_auditor auditor = new media_auditor(drv); drv.next(); media_auditor.summary sysaudit = auditor.audit_media(media_auditor.AUDIT_VALIDATE_FAST); if (!audit_passed(sysaudit)) { set_error(reset_options.REMEMBER_REF, make_system_audit_fail_text(auditor, sysaudit)); } else { // now audit the software software_list_device swlist = software_list_device.find_by_name(drv.config(), ui_swinfo.listname); software_info swinfo = swlist.find(ui_swinfo.shortname); media_auditor.summary swaudit = auditor.audit_software(swlist, swinfo, media_auditor.AUDIT_VALIDATE_FAST); if (audit_passed(swaudit)) { throw new emu_unimplemented(); #if false #endif } else { // otherwise, display an error set_error(reset_options.REMEMBER_REF, make_software_audit_fail_text(auditor, swaudit)); } } } }